From 22d83bc9f655d5ae7a1b49709c4c1b663725daf5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 3 Oct 2016 16:33:42 -0300 Subject: Begining of GLES3 renderer: -Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working --- SConstruct | 3 + bin/tests/test_detailer.cpp | 217 -- bin/tests/test_detailer.h | 44 - bin/tests/test_gui.cpp | 4 +- bin/tests/test_main.cpp | 34 +- bin/tests/test_misc.cpp | 499 --- bin/tests/test_misc.h | 40 - bin/tests/test_particles.cpp | 121 - bin/tests/test_particles.h | 43 - bin/tests/test_physics.cpp | 28 +- bin/tests/test_physics_2d.cpp | 10 +- bin/tests/test_python.cpp | 56 - bin/tests/test_python.h | 43 - bin/tests/test_render.cpp | 8 +- bin/tests/test_shader_lang.cpp | 18 +- core/globals.cpp | 47 +- core/image.cpp | 1213 +++--- core/image.h | 200 +- core/image_quantize.cpp | 365 -- core/io/marshalls.cpp | 2 +- core/io/resource_format_binary.cpp | 94 +- core/io/resource_format_xml.cpp | 61 +- core/rid.cpp | 12 +- core/rid.h | 202 +- core/variant_call.cpp | 71 +- core/variant_parser.cpp | 80 +- doc/base/classes.xml | 22 +- drivers/SCsub | 2 +- drivers/dds/texture_loader_dds.cpp | 29 +- drivers/etc1/image_etc.cpp | 16 +- drivers/gles2/rasterizer_gles2.cpp | 60 +- drivers/gles2/rasterizer_gles2.h | 2 +- drivers/gles2/shaders/canvas.glsl | 6 +- drivers/gles3/SCsub | 5 + drivers/gles3/rasterizer_canvas_gles3.cpp | 1461 ++++++++ drivers/gles3/rasterizer_canvas_gles3.h | 102 + drivers/gles3/rasterizer_gles3.cpp | 266 ++ drivers/gles3/rasterizer_gles3.h | 38 + drivers/gles3/rasterizer_storage_gles3.cpp | 2045 ++++++++++ drivers/gles3/rasterizer_storage_gles3.h | 445 +++ drivers/gles3/shader_gles3.cpp | 754 ++++ drivers/gles3/shader_gles3.h | 377 ++ drivers/gles3/shaders/SCsub | 7 + drivers/gles3/shaders/canvas.glsl | 428 +++ drivers/gles3/shaders/canvas_shadow.glsl | 49 + drivers/gles3/shaders/copy.glsl | 52 + drivers/jpegd/image_loader_jpegd.cpp | 4 +- drivers/png/image_loader_png.cpp | 91 +- drivers/png/resource_saver_png.cpp | 16 +- drivers/pvr/texture_loader_pvr.cpp | 38 +- drivers/squish/image_compress_squish.cpp | 18 +- drivers/theora/video_stream_theora.cpp | 10 +- drivers/webp/image_loader_webp.cpp | 10 +- methods.py | 46 +- modules/gridmap/config.py | 2 +- platform/iphone/rasterizer_iphone.cpp | 18 +- platform/iphone/rasterizer_iphone.h | 2 +- platform/osx/export/export.cpp | 2 +- platform/osx/os_osx.mm | 2 +- platform/osx/platform_config.h | 2 + platform/server/os_server.cpp | 10 +- platform/server/os_server.h | 2 +- platform/windows/os_windows.cpp | 4 +- platform/windows/platform_config.h | 1 + platform/x11/context_gl_x11.cpp | 1 + platform/x11/detect.py | 6 +- platform/x11/os_x11.cpp | 19 +- platform/x11/os_x11.h | 4 +- platform/x11/platform_config.h | 1 + scene/2d/canvas_item.cpp | 151 +- scene/2d/canvas_item.h | 38 +- scene/2d/light_2d.cpp | 60 +- scene/2d/light_2d.h | 29 +- scene/2d/sprite.cpp | 3 +- scene/2d/sprite.h | 2 + scene/2d/tile_map.cpp | 15 +- scene/3d/baked_light_instance.cpp | 2 + scene/3d/baked_light_instance.h | 3 +- scene/3d/camera.cpp | 107 +- scene/3d/camera.h | 6 +- scene/3d/light.cpp | 509 +-- scene/3d/light.h | 104 +- scene/3d/particles.cpp | 2 + scene/3d/particles.h | 3 +- scene/3d/portal.cpp | 44 +- scene/3d/portal.h | 2 +- scene/3d/position_3d.cpp | 31 - scene/3d/position_3d.h | 1 - scene/3d/quad.cpp | 2 +- scene/3d/room_instance.cpp | 77 +- scene/3d/room_instance.h | 5 +- scene/3d/skeleton.cpp | 47 +- scene/3d/skeleton.h | 1 - scene/3d/spatial_player.cpp | 140 - scene/3d/spatial_player.h | 2 +- scene/3d/visual_instance.cpp | 108 +- scene/3d/visual_instance.h | 21 +- scene/gui/color_picker.cpp | 76 +- scene/gui/patch_9_frame.cpp | 2 +- scene/main/canvas_layer.cpp | 10 + scene/main/canvas_layer.h | 5 + scene/main/node.cpp | 10 +- scene/main/scene_main_loop.cpp | 35 +- scene/main/viewport.cpp | 260 +- scene/main/viewport.h | 74 +- scene/register_scene_types.cpp | 25 +- scene/resources/baked_light.cpp | 5 +- scene/resources/baked_light.h | 5 +- scene/resources/bit_mask.cpp | 7 +- scene/resources/default_theme/color_picker_hue.png | Bin 0 -> 132 bytes .../resources/default_theme/color_picker_main.png | Bin 0 -> 310 bytes .../default_theme/color_picker_sample.png | Bin 0 -> 194 bytes scene/resources/default_theme/default_theme.cpp | 18 +- scene/resources/default_theme/theme_data.h | 15 + scene/resources/dynamic_font.cpp | 2 +- scene/resources/dynamic_font_stb.cpp | 2 +- scene/resources/environment.cpp | 245 +- scene/resources/environment.h | 97 +- scene/resources/material.cpp | 552 +-- scene/resources/material.h | 188 +- scene/resources/mesh.cpp | 38 +- scene/resources/mesh.h | 5 +- scene/resources/multimesh.cpp | 42 +- scene/resources/multimesh.h | 29 +- scene/resources/room.cpp | 38 +- scene/resources/room.h | 8 +- scene/resources/shader.cpp | 334 +- scene/resources/shader.h | 19 +- scene/resources/shader_graph.cpp | 7 +- scene/resources/shader_graph.h | 4 +- scene/resources/style_box.cpp | 126 +- scene/resources/style_box.h | 30 - scene/resources/texture.cpp | 18 +- scene/resources/texture.h | 2 +- servers/audio/audio_server_sw.h | 4 +- servers/audio/sample_manager_sw.h | 2 +- servers/physics/broad_phase_octree.cpp | 2 +- servers/physics/constraint_sw.h | 2 +- servers/physics/shape_sw.h | 4 +- servers/physics/space_sw.h | 2 +- servers/physics_2d/broad_phase_2d_basic.cpp | 2 +- servers/physics_2d/constraint_2d_sw.h | 2 +- servers/physics_2d/shape_2d_sw.h | 4 +- servers/physics_2d/space_2d_sw.h | 2 +- servers/spatial_sound/spatial_sound_server_sw.h | 8 +- .../spatial_sound_2d/spatial_sound_2d_server_sw.h | 8 +- servers/visual/particle_system_sw.cpp | 412 -- servers/visual/particle_system_sw.h | 131 - servers/visual/rasterizer.cpp | 19 + servers/visual/rasterizer.h | 760 +++- servers/visual/rasterizer_dummy.cpp | 1961 ---------- servers/visual/rasterizer_dummy.h | 791 ---- servers/visual/shader_language.cpp | 3936 +++++++++++--------- servers/visual/shader_language.h | 375 +- servers/visual/visual_server_canvas.cpp | 1268 +++++++ servers/visual/visual_server_canvas.h | 214 ++ servers/visual/visual_server_global.cpp | 10 + servers/visual/visual_server_global.h | 26 + servers/visual/visual_server_raster.cpp | 1329 ++++++- servers/visual/visual_server_raster.h | 592 +-- servers/visual/visual_server_viewport.cpp | 489 +++ servers/visual/visual_server_viewport.h | 118 + servers/visual/visual_server_wrap_mt.cpp | 212 -- servers/visual/visual_server_wrap_mt.h | 739 ---- servers/visual_server.cpp | 439 +-- servers/visual_server.h | 758 +--- tools/editor/code_editor.cpp | 2 +- tools/editor/editor_autoload_settings.cpp | 2 +- tools/editor/editor_help.cpp | 2 +- tools/editor/editor_node.cpp | 35 +- tools/editor/editor_profiler.cpp | 2 +- tools/editor/icons/SCsub | 2 +- .../io_plugins/editor_font_import_plugin.cpp | 10 +- tools/editor/io_plugins/editor_import_collada.cpp | 50 +- .../io_plugins/editor_scene_import_plugin.cpp | 58 +- .../io_plugins/editor_scene_importer_fbxconv.cpp | 3 +- .../io_plugins/editor_scene_importer_fbxconv.h | 2 + .../io_plugins/editor_texture_import_plugin.cpp | 72 +- tools/editor/plugins/baked_light_baker.cpp | 11 +- tools/editor/plugins/baked_light_baker.h | 3 + tools/editor/plugins/baked_light_editor_plugin.cpp | 5 +- tools/editor/plugins/baked_light_editor_plugin.h | 4 +- .../plugins/collision_polygon_editor_plugin.cpp | 3 + .../plugins/collision_polygon_editor_plugin.h | 4 +- .../plugins/cube_grid_theme_editor_plugin.cpp | 3 +- .../editor/plugins/cube_grid_theme_editor_plugin.h | 3 +- tools/editor/plugins/editor_preview_plugins.cpp | 17 +- tools/editor/plugins/editor_preview_plugins.h | 3 +- tools/editor/plugins/material_editor_plugin.cpp | 3 + tools/editor/plugins/material_editor_plugin.h | 3 +- tools/editor/plugins/mesh_editor_plugin.cpp | 2 + tools/editor/plugins/mesh_editor_plugin.h | 3 + .../editor/plugins/particles_2d_editor_plugin.cpp | 4 +- tools/editor/plugins/particles_editor_plugin.cpp | 3 + tools/editor/plugins/particles_editor_plugin.h | 3 +- tools/editor/plugins/path_editor_plugin.cpp | 2 + tools/editor/plugins/path_editor_plugin.h | 3 +- tools/editor/plugins/polygon_2d_editor_plugin.cpp | 2 +- tools/editor/plugins/sample_editor_plugin.cpp | 4 +- .../plugins/sample_library_editor_plugin.cpp | 2 +- tools/editor/plugins/shader_editor_plugin.cpp | 3 +- tools/editor/plugins/shader_editor_plugin.h | 4 +- .../editor/plugins/shader_graph_editor_plugin.cpp | 4 +- tools/editor/plugins/shader_graph_editor_plugin.h | 4 +- tools/editor/plugins/spatial_editor_plugin.cpp | 86 +- tools/editor/plugins/spatial_editor_plugin.h | 2 +- tools/editor/project_manager.cpp | 4 +- tools/editor/pvrtc_compress.cpp | 2 +- tools/editor/scene_tree_editor.cpp | 2 +- tools/editor/spatial_editor_gizmos.cpp | 3 + tools/editor/spatial_editor_gizmos.h | 4 +- 211 files changed, 14950 insertions(+), 13957 deletions(-) delete mode 100644 bin/tests/test_detailer.cpp delete mode 100644 bin/tests/test_detailer.h delete mode 100644 bin/tests/test_misc.cpp delete mode 100644 bin/tests/test_misc.h delete mode 100644 bin/tests/test_particles.cpp delete mode 100644 bin/tests/test_particles.h delete mode 100644 bin/tests/test_python.cpp delete mode 100644 bin/tests/test_python.h create mode 100644 drivers/gles3/SCsub create mode 100644 drivers/gles3/rasterizer_canvas_gles3.cpp create mode 100644 drivers/gles3/rasterizer_canvas_gles3.h create mode 100644 drivers/gles3/rasterizer_gles3.cpp create mode 100644 drivers/gles3/rasterizer_gles3.h create mode 100644 drivers/gles3/rasterizer_storage_gles3.cpp create mode 100644 drivers/gles3/rasterizer_storage_gles3.h create mode 100644 drivers/gles3/shader_gles3.cpp create mode 100644 drivers/gles3/shader_gles3.h create mode 100644 drivers/gles3/shaders/SCsub create mode 100644 drivers/gles3/shaders/canvas.glsl create mode 100644 drivers/gles3/shaders/canvas_shadow.glsl create mode 100644 drivers/gles3/shaders/copy.glsl create mode 100644 scene/resources/default_theme/color_picker_hue.png create mode 100644 scene/resources/default_theme/color_picker_main.png create mode 100644 scene/resources/default_theme/color_picker_sample.png delete mode 100644 servers/visual/particle_system_sw.cpp delete mode 100644 servers/visual/particle_system_sw.h delete mode 100644 servers/visual/rasterizer_dummy.cpp delete mode 100644 servers/visual/rasterizer_dummy.h create mode 100644 servers/visual/visual_server_canvas.cpp create mode 100644 servers/visual/visual_server_canvas.h create mode 100644 servers/visual/visual_server_global.cpp create mode 100644 servers/visual/visual_server_global.h create mode 100644 servers/visual/visual_server_viewport.cpp create mode 100644 servers/visual/visual_server_viewport.h delete mode 100644 servers/visual/visual_server_wrap_mt.cpp delete mode 100644 servers/visual/visual_server_wrap_mt.h diff --git a/SConstruct b/SConstruct index 0652414088..4fd0330b92 100644 --- a/SConstruct +++ b/SConstruct @@ -386,6 +386,9 @@ if selected_platform in platform_list: if (env['etc1']=='yes'): env.Append(CPPFLAGS=['-DETC1_ENABLED']) + if (True): # detect GLES3 + env.Append( BUILDERS = { 'GLES3_GLSL' : env.Builder(action = methods.build_gles3_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + Export('env') #build subdirs, the build order is dependent on link order. diff --git a/bin/tests/test_detailer.cpp b/bin/tests/test_detailer.cpp deleted file mode 100644 index 5dba7c3f72..0000000000 --- a/bin/tests/test_detailer.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/*************************************************************************/ -/* test_detailer.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "test_detailer.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" -#include "geometry.h" -#include "quick_hull.h" -namespace TestMultiMesh { - - -class TestMainLoop : public MainLoop { - - RID instance; - RID camera; - RID viewport; - RID light; - RID mesh; - RID scenario; - -#define MULTIMESH_COUNT 1500 - - float ofs_x,ofs_y; - bool quit; -public: - - - virtual void _update_qh() { - - VisualServer *vs=VisualServer::get_singleton(); - Vector vts; -/* - - static const int s = 20; - for(int i=0;i convex_planes = Geometry::build_cylinder_planes(0.5,0.7,4,Vector3::AXIS_Z); - Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); - vts=convex_data.vertices; - - Geometry::MeshData md; - Error err = QuickHull::build(vts,md); - print_line("ERR: "+itos(err)); - - vs->mesh_remove_surface(mesh,0); - vs->mesh_add_surface_from_mesh_data(mesh,md); - - - - //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME); - - /* - RID sm = vs->shader_create(); - //vs->shader_set_fragment_code(sm,"OUT_ALPHA=mod(TIME,1);"); - //vs->shader_set_vertex_code(sm,"OUT_VERTEX=IN_VERTEX*mod(TIME,1);"); - vs->shader_set_fragment_code(sm,"OUT_DIFFUSE=vec3(1,0,1);OUT_GLOW=abs(sin(TIME));"); - RID tcmat = vs->mesh_surface_get_material(test_cube,0); - vs->material_set_shader(tcmat,sm); - */ - - } - - virtual void input_event(const InputEvent& p_event) { - - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&4) { - - ofs_x+=p_event.mouse_motion.relative_y/200.0; - ofs_y+=p_event.mouse_motion.relative_x/200.0; - } - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==1) { - - QuickHull::debug_stop_after++; - _update_qh(); - } - if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==2) { - - if (QuickHull::debug_stop_after>0) - QuickHull::debug_stop_after--; - _update_qh(); - } - - - } - - virtual void request_quit() { - - quit=true; - } - - - - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - - - mesh = vs->mesh_create(); - - scenario = vs->scenario_create(); - - QuickHull::debug_stop_after=0; - _update_qh(); - - instance = vs->instance_create2(mesh,scenario); - - camera = vs->camera_create(); - - - vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); - viewport = vs->viewport_create(); - vs->viewport_attach_camera( viewport, camera ); - vs->viewport_attach_to_screen(viewport); - vs->viewport_set_scenario( viewport, scenario ); - - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,2 ) ) ); - - RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); - //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.3,0.3,0.3) ); - light = vs->instance_create2( lightaux,scenario ); - vs->instance_set_transform(light,Transform(Matrix3(Vector3(0.1,0.4,0.7).normalized(),0.9))); - - ofs_x=0; - ofs_y=0; - quit=false; - } - - virtual bool idle(float p_time) { - return false; - } - - virtual bool iteration(float p_time) { - - VisualServer *vs=VisualServer::get_singleton(); - - Transform tr_camera; - tr_camera.rotate( Vector3(0,1,0), ofs_y ); - tr_camera.rotate( Vector3(1,0,0),ofs_x ); - tr_camera.translate(0,0,10); - - vs->camera_set_transform( camera, tr_camera ); - - return quit; - } - virtual void finish() { - - } - -}; - -MainLoop* test() { - - return memnew(TestMainLoop); - -} - -} diff --git a/bin/tests/test_detailer.h b/bin/tests/test_detailer.h deleted file mode 100644 index 597e088caf..0000000000 --- a/bin/tests/test_detailer.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************/ -/* test_detailer.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 TEST_MULTIMESH_H -#define TEST_MULTIMESH_H - -/** - @author Juan Linietsky -*/ -#include "os/main_loop.h" - -namespace TestMultiMesh { - -MainLoop* test(); - -} - - -#endif diff --git a/bin/tests/test_gui.cpp b/bin/tests/test_gui.cpp index f4341fd7b3..bfce03d663 100644 --- a/bin/tests/test_gui.cpp +++ b/bin/tests/test_gui.cpp @@ -370,7 +370,7 @@ public: tabc->set_size( Point2( 180,250 ) ); - Ref text = memnew( ImageTexture ); + /*Ref text = memnew( ImageTexture ); text->load("test_data/concave.png"); Sprite* sprite = memnew(Sprite); @@ -383,7 +383,7 @@ public: sprite->set_texture(text); sprite->add_child(sprite2); sprite2->set_pos(Point2(50, 50)); - sprite2->show(); + sprite2->show();*/ } diff --git a/bin/tests/test_main.cpp b/bin/tests/test_main.cpp index 363aede96e..1f7f2d7dda 100644 --- a/bin/tests/test_main.cpp +++ b/bin/tests/test_main.cpp @@ -37,13 +37,10 @@ #include "test_gui.h" #include "test_render.h" #include "test_sound.h" -#include "test_misc.h" #include "test_physics.h" #include "test_physics_2d.h" -#include "test_python.h" + #include "test_io.h" -#include "test_particles.h" -#include "test_detailer.h" #include "test_shader_lang.h" #include "test_gdscript.h" #include "test_image.h" @@ -56,7 +53,6 @@ const char ** tests_get_names() { "containers", "math", "render", - "particles", "multimesh", "gui", "io", @@ -96,11 +92,6 @@ MainLoop* test_main(String p_test,const List& p_args) { return TestPhysics2D::test(); } - if (p_test=="misc") { - - return TestMisc::test(); - } - if (p_test=="render") { return TestRender::test(); @@ -123,16 +114,6 @@ MainLoop* test_main(String p_test,const List& p_args) { return TestIO::test(); } - if (p_test=="particles") { - - return TestParticles::test(); - } - - if (p_test=="multimesh") { - - return TestMultiMesh::test(); - } - if (p_test=="shaderlang") { return TestShaderLang::test(); @@ -163,19 +144,6 @@ MainLoop* test_main(String p_test,const List& p_args) { return TestImage::test(); } - if (p_test=="detailer") { - - return TestMultiMesh::test(); - } - -#ifdef PYTHON_ENABLED - - if (p_test=="python") { - - return TestPython::test(); - } -#endif - return NULL; } diff --git a/bin/tests/test_misc.cpp b/bin/tests/test_misc.cpp deleted file mode 100644 index 9d7adc3573..0000000000 --- a/bin/tests/test_misc.cpp +++ /dev/null @@ -1,499 +0,0 @@ -/*************************************************************************/ -/* test_misc.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "test_misc.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" - - -namespace TestMisc { - -struct ConvexTestResult -{ - - Vector3 edgeA[2]; - Vector3 edgeB[2]; - bool valid; - Vector3 contactA; - Vector3 contactB; - Vector3 contactNormal; - float depth; - - /* - Vector3 contactA; - Vector3 contactB; - Vector3 contactNormal; - Vector3 contactX; - Vector3 contactY; - Vector3 edgeA[2]; - Vector3 edgeB[2]; - float depth; - bool valid; - bool isEdgeEdge; - bool needTransform; - neBool ComputerEdgeContactPoint(ConvexTestResult & res); - neBool ComputerEdgeContactPoint2(float & au, float & bu); - void Reverse() - { - neSwap(contactA, contactB); - contactNormal *= -1.0f; - }*/ - bool ComputerEdgeContactPoint2(float & au, float & bu); -}; - - - -bool ConvexTestResult::ComputerEdgeContactPoint2(float & au, float & bu) -{ - float d1343, d4321, d1321, d4343, d2121; - float numer, denom; - - Vector3 p13; - Vector3 p43; - Vector3 p21; - Vector3 diff; - - p13 = (edgeA[0]) - (edgeB[0]); - p43 = (edgeB[1]) - (edgeB[0]); - - if ( p43.length_squared() < CMP_EPSILON2 ) - { - valid = false; - goto ComputerEdgeContactPoint2_Exit; - } - - p21 = (edgeA[1]) - (edgeA[0]); - - if ( p21.length_squared()= 1.0f) - { - valid = false; - } - else if (bu < 0.0f || bu >= 1.0f) - { - valid = false; - } - else - { - valid = true; - } - { - Vector3 tmpv; - - tmpv = p21 * au; - contactA = (edgeA[0]) + tmpv; - - tmpv = p43 * bu; - contactB = (edgeB[0]) + tmpv; - } - - diff = contactA - contactB; - - depth = Math::sqrt(diff.dot(diff)); - - return true; - -ComputerEdgeContactPoint2_Exit: - - return false; -} - -struct neCollisionResult { - - float depth; - bool penetrate; - Matrix3 collisionFrame; - Vector3 contactA; - Vector3 contactB; -}; - - -struct TConvex { - - float radius; - float half_height; - float CylinderRadius() const { return radius; } - float CylinderHalfHeight() const { return half_height; } -}; - -float GetDistanceFromLine2(Vector3 v, Vector3 & project, const Vector3 & pointA, const Vector3 & pointB) -{ - Vector3 ba = pointB - pointA; - - float len = ba.length(); - - if (lenCMP_EPSILON) - { - float au, bu; - - cr.ComputerEdgeContactPoint2(au, bu); - - if (cr.valid) - { - float depth = cA.CylinderRadius() + cB.CylinderRadius() - cr.depth; - - if (depth <= 0.0f) - return; - - result.depth = depth; - - result.penetrate = true; - - result.collisionFrame.set_axis(2, (cr.contactA - cr.contactB)*(1.0f / cr.depth)); - - result.contactA = cr.contactA - result.collisionFrame.get_axis(2) * cA.CylinderRadius(); - - result.contactB = cr.contactB + result.collisionFrame.get_axis(2) * cB.CylinderRadius(); - - return; - } - } - result.depth = -1.0e6f; - - int i; - - for (i = 0; i < 2; i++) - { - //project onto edge b - - Vector3 diff = cr.edgeA[i] - cr.edgeB[1]; - - float dot = diff.dot(transB.basis.get_axis(1)); - - if (dot < 0.0f) - { - TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[1], cA, cB, transA, transB); - } - else if (dot > (2.0f * cB.CylinderHalfHeight())) - { - TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[0], cA, cB, transA, transB); - } - else - { - TestCylinderVertEdge(result, cr.edgeB[0], cr.edgeB[1], cr.edgeA[i], cB, cA, transB, transA, true); - } - } - for (i = 0; i < 2; i++) - { - //project onto edge b - - Vector3 diff = cr.edgeB[i] - cr.edgeA[1]; - - float dot = diff.dot(transA.basis.get_axis(1)); - - if (dot < 0.0f) - { - TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[1], cA, cB, transA, transB); - } - else if (dot > (2.0f * cB.CylinderHalfHeight())) - { - TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[0], cA, cB, transA, transB); - } - else - { - TestCylinderVertEdge(result, cr.edgeA[0], cr.edgeA[1], cr.edgeB[i], cA, cB, transA, transB, false); - } - } -} - - -class TestMainLoop : public MainLoop { - - RID meshA; - RID meshB; - RID poly; - RID instance; - RID camera; - RID viewport; - RID boxA; - RID boxB; - RID scenario; - - Transform rot_a; - Transform rot_b; - - bool quit; -public: - virtual void input_event(const InputEvent& p_event) { - - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) { - - rot_b.origin.y+=-p_event.mouse_motion.relative_y/100.0; - rot_b.origin.x+=p_event.mouse_motion.relative_x/100.0; - } - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_MIDDLE) { - - //rot_b.origin.x+=-p_event.mouse_motion.relative_y/100.0; - rot_b.origin.z+=p_event.mouse_motion.relative_x/100.0; - } - if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_RIGHT) { - - float rot_x=-p_event.mouse_motion.relative_y/100.0; - float rot_y=p_event.mouse_motion.relative_x/100.0; - rot_b.basis = rot_b.basis * Matrix3(Vector3(1,0,0),rot_x) * Matrix3(Vector3(0,1,0),rot_y); - } - - } - virtual void request_quit() { - - quit=true; - } - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - - camera = vs->camera_create(); - - viewport = vs->viewport_create(); - vs->viewport_attach_to_screen(viewport); - vs->viewport_attach_camera( viewport, camera ); - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,3 ) ) ); - - /* CONVEX SHAPE */ - - DVector cylinder_planes = Geometry::build_cylinder_planes(0.5,2,9,Vector3::AXIS_Y); - RID cylinder_material = vs->fixed_material_create(); - vs->fixed_material_set_param( cylinder_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9)); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_ONTOP,true); - //vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_WIREFRAME,true); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_DOUBLE_SIDED,true); - vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_UNSHADED,true); - - RID cylinder_mesh = vs->mesh_create(); - Geometry::MeshData cylinder_data = Geometry::build_convex_mesh(cylinder_planes); - vs->mesh_add_surface_from_mesh_data(cylinder_mesh,cylinder_data); - vs->mesh_surface_set_material( cylinder_mesh, 0, cylinder_material ); - - meshA=vs->instance_create2(cylinder_mesh,scenario); - meshB=vs->instance_create2(cylinder_mesh,scenario); - boxA=vs->instance_create2(vs->get_test_cube(),scenario); - boxB=vs->instance_create2(vs->get_test_cube(),scenario); - - /* - RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 ); - light = vs->instance_create2( lightaux ); - */ - RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); - //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); - //vs->light_set_shadow( lightaux, true ); - vs->instance_create2( lightaux,scenario ); - - //rot_a=Transform(Matrix3(Vector3(1,0,0),Math_PI/2.0),Vector3()); - rot_b=Transform(Matrix3(),Vector3(2,0,0)); - - //rot_x=0; - //rot_y=0; - quit=false; - } - virtual bool idle(float p_time) { - - VisualServer *vs=VisualServer::get_singleton(); - - vs->instance_set_transform(meshA,rot_a); - vs->instance_set_transform(meshB,rot_b); - - - neCollisionResult res; - TConvex a; - a.radius=0.5; - a.half_height=1; - Cylinder2CylinderTest(res,a,rot_a,a,rot_b); - if (res.penetrate) { - - Matrix3 scale; - scale.scale(Vector3(0.1,0.1,0.1)); - vs->instance_set_transform(boxA,Transform(scale,res.contactA)); - vs->instance_set_transform(boxB,Transform(scale,res.contactB)); - print_line("depth: "+rtos(res.depth)); - } else { - - Matrix3 scale; - scale.scale(Vector3()); - vs->instance_set_transform(boxA,Transform(scale,res.contactA)); - vs->instance_set_transform(boxB,Transform(scale,res.contactB)); - - } - print_line("collided: "+itos(res.penetrate)); - - return false; - } - - - virtual bool iteration(float p_time) { - - - - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} - - - diff --git a/bin/tests/test_misc.h b/bin/tests/test_misc.h deleted file mode 100644 index 55608f6a0e..0000000000 --- a/bin/tests/test_misc.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************/ -/* test_misc.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 TEST_MISC_H -#define TEST_MISC_H - -#include "os/main_loop.h" - -namespace TestMisc { - -MainLoop* test(); - -} - -#endif diff --git a/bin/tests/test_particles.cpp b/bin/tests/test_particles.cpp deleted file mode 100644 index 23a4b9e635..0000000000 --- a/bin/tests/test_particles.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************/ -/* test_particles.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "test_particles.h" -#include "servers/visual_server.h" -#include "os/main_loop.h" -#include "math_funcs.h" -#include "print_string.h" - -namespace TestParticles { - - -class TestMainLoop : public MainLoop { - - RID particles; - RID instance; - RID camera; - RID viewport; - RID light; - RID scenario; - - struct InstanceInfo { - - RID instance; - Transform base; - Vector3 rot_axis; - }; - - List instances; - - float ofs; - bool quit; -public: - virtual void input_event(const InputEvent& p_event) { - - - } - virtual void request_quit() { - - quit=true; - } - virtual void init() { - - VisualServer *vs=VisualServer::get_singleton(); - particles = vs->particles_create(); - vs->particles_set_amount(particles,1000); - - instance = vs->instance_create2(particles,scenario); - - - camera = vs->camera_create(); - -// vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); - viewport = vs->viewport_create(); - vs->viewport_attach_camera( viewport, camera ); - vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,20 ) ) ); - /* - RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 ); - vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 ); - light = vs->instance_create2( lightaux ); - */ - RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); - // vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); - light = vs->instance_create2( lightaux, scenario ); - - ofs=0; - quit=false; - } - virtual bool idle(float p_time) { - return false; - } - - - virtual bool iteration(float p_time) { - -// VisualServer *vs=VisualServer::get_singleton(); - - ofs+=p_time; - return quit; - } - virtual void finish() { - - } - -}; - - -MainLoop* test() { - - return memnew( TestMainLoop ); - -} - -} diff --git a/bin/tests/test_particles.h b/bin/tests/test_particles.h deleted file mode 100644 index e95637a4e6..0000000000 --- a/bin/tests/test_particles.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_particles.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 TEST_PARTICLES_H -#define TEST_PARTICLES_H - -/** - @author Juan Linietsky -*/ -#include "os/main_loop.h" - -namespace TestParticles { - -MainLoop* test(); - -} - -#endif diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index f202d0dda1..3a8ca65734 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -138,10 +138,6 @@ protected: /* SPHERE SHAPE */ RID sphere_mesh = vs->make_sphere_mesh(10,20,0.5); - RID sphere_material = vs->fixed_material_create(); - //vs->material_set_flag( sphere_material, VisualServer::MATERIAL_FLAG_WIREFRAME, true ); - vs->fixed_material_set_param( sphere_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.7,0.8,3.0) ); - vs->mesh_surface_set_material( sphere_mesh, 0, sphere_material ); type_mesh_map[PhysicsServer::SHAPE_SPHERE]=sphere_mesh; RID sphere_shape=ps->shape_create(PhysicsServer::SHAPE_SPHERE); @@ -151,12 +147,9 @@ protected: /* BOX SHAPE */ DVector box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5)); - RID box_material = vs->fixed_material_create(); - vs->fixed_material_set_param( box_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.2,0.2) ); RID box_mesh = vs->mesh_create(); Geometry::MeshData box_data = Geometry::build_convex_mesh(box_planes); vs->mesh_add_surface_from_mesh_data(box_mesh,box_data); - vs->mesh_surface_set_material( box_mesh, 0, box_material ); type_mesh_map[PhysicsServer::SHAPE_BOX]=box_mesh; RID box_shape=ps->shape_create(PhysicsServer::SHAPE_BOX); @@ -167,13 +160,11 @@ protected: /* CAPSULE SHAPE */ DVector capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z); - RID capsule_material = vs->fixed_material_create(); - vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.3,0.4,1.0) ); RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data); - vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material ); + type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh; RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE); @@ -186,14 +177,12 @@ protected: /* CONVEX SHAPE */ DVector convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z); - RID convex_material = vs->fixed_material_create(); - vs->fixed_material_set_param( convex_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9)); RID convex_mesh = vs->mesh_create(); Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); QuickHull::build(convex_data.vertices,convex_data); vs->mesh_add_surface_from_mesh_data(convex_mesh,convex_data); - vs->mesh_surface_set_material( convex_mesh, 0, convex_material ); + type_mesh_map[PhysicsServer::SHAPE_CONVEX_POLYGON]=convex_mesh; RID convex_shape=ps->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON); @@ -223,11 +212,9 @@ protected: d.resize(VS::ARRAY_MAX); d[VS::ARRAY_VERTEX]=p_faces; d[VS::ARRAY_NORMAL]=normals; - vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d ); - RID trimesh_mat = vs->fixed_material_create(); - vs->fixed_material_set_param( trimesh_mat, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.5,0.8)); + vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d ); //vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true); - vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat ); + RID triins = vs->instance_create2(trimesh_mesh,scenario); @@ -464,7 +451,7 @@ public: } virtual bool iteration(float p_time) { - if (mover) { + if (mover.is_valid()) { static float joy_speed = 10; PhysicsServer * ps = PhysicsServer::get_singleton(); Transform t = ps->body_get_state(mover,PhysicsServer::BODY_STATE_TRANSFORM); @@ -548,15 +535,10 @@ public: DVector capsule_planes = Geometry::build_capsule_planes(0.5,1,12,5,Vector3::AXIS_Y); - RID capsule_material = vs->fixed_material_create(); - - vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1,1,1) ); - RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data); - vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material ); type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh; RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE); diff --git a/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index 845e20b6c3..f369c361d3 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -85,7 +85,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,2,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,2,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_SEGMENT].image=vs->texture_create_from_image(image); @@ -113,7 +113,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,32,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,32,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_CIRCLE].image=vs->texture_create_from_image(image); @@ -141,7 +141,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,32,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,32,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_RECTANGLE].image=vs->texture_create_from_image(image); @@ -173,7 +173,7 @@ class TestPhysics2DMainLoop : public MainLoop { } } - Image image(32,64,0,Image::FORMAT_GRAYSCALE_ALPHA,pixels); + Image image(32,64,0,Image::FORMAT_LA8,pixels); body_shape_data[Physics2DServer::SHAPE_CAPSULE].image=vs->texture_create_from_image(image); @@ -381,7 +381,7 @@ public: RID vp = vs->viewport_create(); canvas = vs->canvas_create(); vs->viewport_attach_canvas(vp,canvas); - vs->viewport_attach_to_screen(vp); + vs->viewport_attach_to_screen(vp,Rect2(Vector2(),OS::get_singleton()->get_window_size())); Matrix32 smaller; //smaller.scale(Vector2(0.6,0.6)); //smaller.elements[2]=Vector2(100,0); diff --git a/bin/tests/test_python.cpp b/bin/tests/test_python.cpp deleted file mode 100644 index f4a3d7a3a2..0000000000 --- a/bin/tests/test_python.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* test_python.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "test_python.h" - -#ifdef PYTHON_ENABLED - -#include "Python.h" -#include "print_string.h" - -namespace TestPython { - -void test() { - - print_line("testing python"); - PyRun_SimpleString("import engine\n"); - PyRun_SimpleString("def test(self):\n\tprint(\"noway\")\n"); - PyRun_SimpleString("a=engine.ObjectPtr()\n"); - PyRun_SimpleString("a.noway(22,'hello')\n"); - PyRun_SimpleString("a.normalize()\n"); - PyRun_SimpleString("class Moch(engine.ObjectPtr):\n\tdef mooch(self):\n\t\tprint('muchi')\n"); - PyRun_SimpleString("b=Moch();\n"); - PyRun_SimpleString("b.mooch();\n"); - PyRun_SimpleString("b.meis();\n"); - - -} - -} - -#endif diff --git a/bin/tests/test_python.h b/bin/tests/test_python.h deleted file mode 100644 index 77e9603fe2..0000000000 --- a/bin/tests/test_python.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* test_python.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 TEST_PYTHON_H -#define TEST_PYTHON_H - -#ifdef PYTHON_ENABLED -/** - @author Juan Linietsky -*/ -namespace TestPython { - -void test(); - -} - -#endif -#endif diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index 9c3a287afa..7bf833c8a7 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -173,7 +173,7 @@ public: // vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); viewport = vs->viewport_create(); - vs->viewport_attach_to_screen(viewport); + vs->viewport_attach_to_screen(viewport,Rect2(Vector2(),OS::get_singleton()->get_window_size())); vs->viewport_attach_camera( viewport, camera ); vs->viewport_set_scenario( viewport, scenario ); vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,3,30 ) ) ); @@ -192,7 +192,7 @@ public: //* lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL ); //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) ); - vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,1.0) ); + vs->light_set_color( lightaux, Color(1.0,1.0,1.0) ); //vs->light_set_shadow( lightaux, true ); light = vs->instance_create2( lightaux, scenario ); Transform lla; @@ -205,8 +205,8 @@ public: //* lightaux = vs->light_create( VisualServer::LIGHT_OMNI ); // vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) ); - vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,0.0) ); - vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RADIUS, 4 ); + vs->light_set_color( lightaux, Color(1.0,1.0,0.0) ); + vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RANGE, 4 ); vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_ENERGY, 8 ); //vs->light_set_shadow( lightaux, true ); //light = vs->instance_create( lightaux ); diff --git a/bin/tests/test_shader_lang.cpp b/bin/tests/test_shader_lang.cpp index 9c0075c47d..6c8132122c 100644 --- a/bin/tests/test_shader_lang.cpp +++ b/bin/tests/test_shader_lang.cpp @@ -37,9 +37,9 @@ #include "scene/gui/text_edit.h" #include "print_string.h" #include "servers/visual/shader_language.h" -#include "drivers/gles2/shader_compiler_gles2.h" - +//#include "drivers/gles2/shader_compiler_gles2.h" +#if 0 typedef ShaderLanguage SL; namespace TestShaderLang { @@ -323,7 +323,7 @@ MainLoop* test() { if (!err) { print_line(rcode); } - +#if 0 ShaderCompilerGLES2 comp; String codeline,globalsline; SL::VarInfo vi; @@ -333,6 +333,18 @@ MainLoop* test() { ShaderCompilerGLES2::Flags fl; comp.compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,codeline,globalsline,fl); +#endif + return NULL; +} + +} +#endif + +typedef ShaderLanguage SL; + +namespace TestShaderLang { + +MainLoop* test() { return NULL; } diff --git a/core/globals.cpp b/core/globals.cpp index b822f52f15..6fe53c7412 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -657,37 +657,37 @@ static Variant _decode_variant(const String& p_string) { String format=params[0].strip_edges(); Image::Format imgformat; - +/* if (format=="grayscale") { - imgformat=Image::FORMAT_GRAYSCALE; + imgformat=Image::FORMAT_L8; } else if (format=="intensity") { imgformat=Image::FORMAT_INTENSITY; } else if (format=="grayscale_alpha") { - imgformat=Image::FORMAT_GRAYSCALE_ALPHA; + imgformat=Image::FORMAT_LA8; } else if (format=="rgb") { - imgformat=Image::FORMAT_RGB; + imgformat=Image::FORMAT_RGB8; } else if (format=="rgba") { - imgformat=Image::FORMAT_RGBA; + imgformat=Image::FORMAT_RGBA8; } else if (format=="indexed") { imgformat=Image::FORMAT_INDEXED; } else if (format=="indexed_alpha") { imgformat=Image::FORMAT_INDEXED_ALPHA; } else if (format=="bc1") { - imgformat=Image::FORMAT_BC1; + imgformat=Image::FORMAT_DXT1; } else if (format=="bc2") { - imgformat=Image::FORMAT_BC2; + imgformat=Image::FORMAT_DXT3; } else if (format=="bc3") { - imgformat=Image::FORMAT_BC3; + imgformat=Image::FORMAT_DXT5; } else if (format=="bc4") { - imgformat=Image::FORMAT_BC4; + imgformat=Image::FORMAT_ATI1; } else if (format=="bc5") { - imgformat=Image::FORMAT_BC5; + imgformat=Image::FORMAT_ATI2; } else if (format=="custom") { imgformat=Image::FORMAT_CUSTOM; } else { ERR_FAIL_V( Image() ); - } + }*/ int mipmaps=params[1].to_int(); int w=params[2].to_int(); @@ -974,26 +974,30 @@ static String _encode_variant(const Variant& p_variant) { if (!img.empty()) { String format; + + /* switch(img.get_format()) { - case Image::FORMAT_GRAYSCALE: format="grayscale"; break; + case Image::FORMAT_L8: format="grayscale"; break; case Image::FORMAT_INTENSITY: format="intensity"; break; - case Image::FORMAT_GRAYSCALE_ALPHA: format="grayscale_alpha"; break; - case Image::FORMAT_RGB: format="rgb"; break; - case Image::FORMAT_RGBA: format="rgba"; break; + case Image::FORMAT_LA8: format="grayscale_alpha"; break; + case Image::FORMAT_RGB8: format="rgb"; break; + case Image::FORMAT_RGBA8: format="rgba"; break; case Image::FORMAT_INDEXED : format="indexed"; break; case Image::FORMAT_INDEXED_ALPHA: format="indexed_alpha"; break; - case Image::FORMAT_BC1: format="bc1"; break; - case Image::FORMAT_BC2: format="bc2"; break; - case Image::FORMAT_BC3: format="bc3"; break; - case Image::FORMAT_BC4: format="bc4"; break; - case Image::FORMAT_BC5: format="bc5"; break; + case Image::FORMAT_DXT1: format="bc1"; break; + case Image::FORMAT_DXT3: format="bc2"; break; + case Image::FORMAT_DXT5: format="bc3"; break; + case Image::FORMAT_ATI1: format="bc4"; break; + case Image::FORMAT_ATI2: format="bc5"; break; case Image::FORMAT_CUSTOM: format="custom custom_size="+itos(img.get_data().size())+""; break; default: {} } + */ + str+=format+", "; - str+=itos(img.get_mipmaps())+", "; + str+=itos(img.has_mipmaps())+", "; str+=itos(img.get_width())+", "; str+=itos(img.get_height())+", "; DVector data = img.get_data(); @@ -1399,6 +1403,7 @@ void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& ERR_FAIL_COND(!props.has(p_prop)); custom_prop_info[p_prop]=p_info; + custom_prop_info[p_prop].name=p_prop; } diff --git a/core/image.cpp b/core/image.cpp index 90051d7d0d..73a2ab8013 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -36,86 +36,186 @@ const char* Image::format_names[Image::FORMAT_MAX]={ - "Grayscale", - "Intensity", - "GrayscaleAlpha", - "RGB", - "RGBA", - "Indexed", - "IndexedAlpha", - "YUV422", - "YUV444", - "BC1", - "BC2", - "BC3", - "BC4", - "BC5", - "PVRTC2", - "PVRTC2Alpha", + "Lum8", //luminance + "LumAlpha8", //luminance-alpha + "Red8", + "RedGreen", + "RGB8", + "RGBA8", + "RGB565", //16 bit + "RGBA4444", + "RGBA5551", + "RFloat", //float + "RGFloat", + "RGBFloat", + "RGBAFloat", + "RHalf", //half float + "RGHalf", + "RGBHalf", + "RGBAHalf", + "DXT1", //s3tc + "DXT3", + "DXT5", + "ATI1", + "ATI2", + "BPTC_RGBA", + "BPTC_RGBF", + "BPTC_RGBFU", + "PVRTC2", //pvrtc + "PVRTC2A", "PVRTC4", - "PVRTC4Alpha", - "ETC", - "ATC", - "ATCAlphaExp", - "ATCAlphaInterp", + "PVRTC4A", + "ETC", //etc1 + "ETC2_R11", //etc2 + "ETC2_R11S", //signed", NOT srgb. + "ETC2_RG11", + "ETC2_RG11S", + "ETC2_RGB8", + "ETC2_RGBA8", + "ETC2_RGB8A1", }; SavePNGFunc Image::save_png_func = NULL; -void Image::_put_pixel(int p_x,int p_y, const BColor& p_color, unsigned char *p_data) { - _put_pixelw(p_x,p_y,width,p_color,p_data); +void Image::_put_pixelb(int p_x,int p_y, uint32_t p_pixelsize,uint8_t *p_dst,const uint8_t *p_src) { + + uint32_t ofs=(p_y*width+p_x)*p_pixelsize; + + for(uint32_t i=0;i::Write wp = data.write(); - unsigned char *data_ptr=wp.ptr(); - - _put_pixelw(p_x,p_y,w,BColor(p_color.r*255,p_color.g*255,p_color.b*255,p_color.a*255),&data_ptr[ofs]); +int Image::get_width() const { + return width; } +int Image::get_height() const{ -Image::BColor Image::_get_pixel(int p_x,int p_y,const unsigned char *p_data,int p_data_size) const{ - - return _get_pixelw(p_x,p_y,width,p_data,p_data_size); + return height; } -Image::BColor Image::_get_pixelw(int p_x,int p_y,int p_width,const unsigned char *p_data,int p_data_size) const{ - int ofs=p_y*p_width+p_x; - BColor result(0,0,0,0); - switch(format) { - - case FORMAT_GRAYSCALE: { - - result=BColor(p_data[ofs],p_data[ofs],p_data[ofs],255.0); - } break; - case FORMAT_INTENSITY: { - - result=BColor(255,255,255,p_data[ofs]); - } break; - case FORMAT_GRAYSCALE_ALPHA: { - - result=BColor(p_data[ofs*2],p_data[ofs*2],p_data[ofs*2],p_data[ofs*2+1]); - - } break; - case FORMAT_RGB: { - - result=BColor(p_data[ofs*3],p_data[ofs*3+1],p_data[ofs*3+2]); - - } break; - case FORMAT_RGBA: { - - result=BColor(p_data[ofs*4],p_data[ofs*4+1],p_data[ofs*4+2],p_data[ofs*4+3]); - } break; - case FORMAT_INDEXED_ALPHA: { - - int pitch = 4; - const uint8_t* pal = &p_data[ p_data_size - pitch * 256 ]; - int idx = p_data[ofs]; - result=BColor(pal[idx * pitch + 0] , pal[idx * pitch + 1] , pal[idx * pitch + 2] , pal[idx * pitch + 3] ); - - } break; - case FORMAT_INDEXED: { - - int pitch = 3; - const uint8_t* pal = &p_data[ p_data_size - pitch * 256 ]; - int idx = p_data[ofs]; - result=BColor(pal[idx * pitch + 0] , pal[idx * pitch + 1] , pal[idx * pitch + 2] ,255); - } break; - case FORMAT_YUV_422: { - - int y, u, v; - if (p_x % 2) { - const uint8_t* yp = &p_data[p_width * 2 * p_y + p_x * 2]; - u = *(yp-1); - y = yp[0]; - v = yp[1]; - } else { - - const uint8_t* yp = &p_data[p_width * 2 * p_y + p_x * 2]; - y = yp[0]; - u = yp[1]; - v = yp[3]; - }; - - int32_t r = 1.164 * (y - 16) + 1.596 * (v - 128); - int32_t g = 1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u - 128); - int32_t b = 1.164 * (y - 16) + 2.018 * (u - 128); - result = BColor(CLAMP(r, 0, 255), CLAMP(g, 0, 255), CLAMP(b, 0, 255)); - } break; - case FORMAT_YUV_444: { - - uint8_t y, u, v; - const uint8_t* yp = &p_data[p_width * 3 * p_y + p_x * 3]; - y = yp[0]; - u = yp[1]; - v = yp[2]; - - int32_t r = 1.164 * (y - 16) + 1.596 * (v - 128); - int32_t g = 1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u - 128); - int32_t b = 1.164 * (y - 16) + 2.018 * (u - 128); - result = BColor(CLAMP(r, 0, 255), CLAMP(g, 0, 255), CLAMP(b, 0, 255)); - } break; - default:{} - - } - - return result; +bool Image::has_mipmaps() const { + return mipmaps; } -void Image::put_indexed_pixel(int p_x, int p_y, uint8_t p_idx,int p_mipmap) { - - ERR_FAIL_COND(format != FORMAT_INDEXED && format != FORMAT_INDEXED_ALPHA); - ERR_FAIL_INDEX(p_mipmap,mipmaps+1); - int ofs,w,h; - _get_mipmap_offset_and_size(p_mipmap,ofs,w,h); - ERR_FAIL_INDEX(p_x,w); - ERR_FAIL_INDEX(p_y,h); - - data.set(ofs + p_y * w + p_x, p_idx); -}; - -uint8_t Image::get_indexed_pixel(int p_x, int p_y,int p_mipmap) const { - - ERR_FAIL_COND_V(format != FORMAT_INDEXED && format != FORMAT_INDEXED_ALPHA, 0); - - ERR_FAIL_INDEX_V(p_mipmap,mipmaps+1,0); - int ofs,w,h; - _get_mipmap_offset_and_size(p_mipmap,ofs,w,h); - ERR_FAIL_INDEX_V(p_x,w,0); - ERR_FAIL_INDEX_V(p_y,h,0); - - - return data[ofs + p_y * w + p_x]; -}; - -void Image::set_pallete(const DVector& p_data) { +int Image::get_mipmap_count() const { + if (mipmaps) + return get_image_required_mipmaps(width,height,format); + else + return 0; +} - int len = p_data.size(); - ERR_FAIL_COND(format != FORMAT_INDEXED && format != FORMAT_INDEXED_ALPHA); - ERR_FAIL_COND(format == FORMAT_INDEXED && len!=(256*3)); - ERR_FAIL_COND(format == FORMAT_INDEXED_ALPHA && len!=(256*4)); +//using template generates perfectly optimized code due to constant expression reduction and unused variable removal present in all compilers +template +static void _convert( int p_width,int p_height,const uint8_t* p_src,uint8_t* p_dst ){ - int ofs,w,h; - _get_mipmap_offset_and_size(mipmaps+1,ofs,w,h); - int pal_ofs = ofs; - data.resize(pal_ofs + p_data.size()); - DVector::Write wp = data.write(); - unsigned char *dst=wp.ptr() + pal_ofs; + for(int y=0;y::Read r = p_data.read(); - const unsigned char *src=r.ptr(); + const uint8_t *rofs = &p_src[((y*p_width)+x)*(read_bytes+(read_alpha?1:0))]; + uint8_t *wofs = &p_dst[((y*p_width)+x)*(write_bytes+(write_alpha?1:0))]; - copymem(dst, src, len); -}; + uint8_t rgba[4]; -int Image::get_width() const { - - return width; -} -int Image::get_height() const{ - - return height; -} - -int Image::get_mipmaps() const { + if (read_gray) { + rgba[0]=rofs[0]; + rgba[1]=rofs[0]; + rgba[2]=rofs[0]; + } else { + for(uint32_t i=0;i::Read r = data.read(); - const unsigned char*data_ptr=r.ptr(); - BColor c = _get_pixelw(p_x,p_y,w,&data_ptr[ofs],len); - return Color( c.r/255.0,c.g/255.0,c.b/255.0,c.a/255.0 ); } void Image::convert( Format p_new_format ){ @@ -368,22 +353,17 @@ void Image::convert( Format p_new_format ){ if (p_new_format==format) return; - if (format>=FORMAT_BC1 || p_new_format>=FORMAT_BC1) { - ERR_EXPLAIN("Cannot convert to <-> from compressed/custom image formats (for now)."); - ERR_FAIL(); - } - - if (p_new_format==FORMAT_INDEXED || p_new_format==FORMAT_INDEXED_ALPHA) { + if (format>=FORMAT_RGB565 || p_new_format>=FORMAT_RGB565) { - - return; + ERR_EXPLAIN("Cannot convert to <-> from non byte formats."); + ERR_FAIL(); } Image new_img(width,height,0,p_new_format); - int len=data.size(); +// int len=data.size(); DVector::Read r = data.read(); DVector::Write w = new_img.data.write(); @@ -391,35 +371,56 @@ void Image::convert( Format p_new_format ){ const uint8_t *rptr = r.ptr(); uint8_t *wptr = w.ptr(); - if (p_new_format==FORMAT_RGBA && format==FORMAT_INDEXED_ALPHA) { + int conversion_type = format | p_new_format<<8; + + switch(conversion_type) { + + case FORMAT_L8|(FORMAT_LA8<<8): _convert<1,false,1,true,true,true>( width, height,rptr, wptr ); break; + case FORMAT_L8|(FORMAT_R8<<8): _convert<1,false,1,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_L8|(FORMAT_RG8<<8): _convert<1,false,2,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_L8|(FORMAT_RGB8<<8): _convert<1,false,3,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_L8|(FORMAT_RGBA8<<8): _convert<1,false,3,true,true,false>( width, height,rptr, wptr ); break; + case FORMAT_LA8|(FORMAT_L8<<8): _convert<1,true,1,false,true,true>( width, height,rptr, wptr ); break; + case FORMAT_LA8|(FORMAT_R8<<8): _convert<1,true,1,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_LA8|(FORMAT_RG8<<8): _convert<1,true,2,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_LA8|(FORMAT_RGB8<<8): _convert<1,true,3,false,true,false>( width, height,rptr, wptr ); break; + case FORMAT_LA8|(FORMAT_RGBA8<<8): _convert<1,true,3,true,true,false>( width, height,rptr, wptr ); break; + case FORMAT_R8|(FORMAT_L8<<8): _convert<1,false,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_R8|(FORMAT_LA8<<8): _convert<1,false,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_R8|(FORMAT_RG8<<8): _convert<1,false,2,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_R8|(FORMAT_RGB8<<8): _convert<1,false,3,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_R8|(FORMAT_RGBA8<<8): _convert<1,false,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_L8<<8): _convert<1,false,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_LA8<<8): _convert<1,false,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_R8<<8): _convert<1,false,1,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_RGB8<<8): _convert<1,false,3,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_RGBA8<<8): _convert<1,false,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_L8<<8): _convert<2,false,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_LA8<<8): _convert<2,false,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_R8<<8): _convert<2,false,1,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_RG8<<8): _convert<2,false,2,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_RGBA8<<8): _convert<2,false,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_L8<<8): _convert<3,true,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_LA8<<8): _convert<3,true,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_R8<<8): _convert<3,true,1,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_RG8<<8): _convert<3,true,2,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_RGB8<<8): _convert<3,true,3,true,false,false>( width, height,rptr, wptr ); break; - //optimized unquantized form - int dataend = len-256*4; - const uint32_t *palpos = (const uint32_t*)&rptr[dataend]; - uint32_t *dst32 = (uint32_t *)wptr; - - for(int i=0;i::Read(); w = DVector::Write(); - bool gen_mipmaps=mipmaps>0; + bool gen_mipmaps=mipmaps; + + mipmaps=false; *this=new_img; if (gen_mipmaps) generate_mipmaps(); - } Image::Format Image::get_format() const{ @@ -460,13 +461,13 @@ static void _scale_cubic(const uint8_t* p_src, uint8_t* p_dst, uint32_t p_src_wi int xmax = width - 1; // temporary pointer - for ( int y = 0; y < p_dst_height; y++ ) { + for ( uint32_t y = 0; y < p_dst_height; y++ ) { // Y coordinates oy = (double) y * yfac - 0.5f; oy1 = (int) oy; dy = oy - (double) oy1; - for ( int x = 0; x < p_dst_width; x++ ) { + for ( uint32_t x = 0; x < p_dst_width; x++ ) { // X coordinates ox = (double) x * xfac - 0.5f; ox1 = (int) ox; @@ -650,10 +651,6 @@ void Image::resize( int p_width, int p_height, Interpolation p_interpolation ) { Image dst( p_width, p_height, 0, format ); - if (format==FORMAT_INDEXED) - p_interpolation=INTERPOLATE_NEAREST; - - DVector::Read r = data.read(); const unsigned char*r_ptr=r.ptr(); @@ -722,18 +719,33 @@ void Image::crop( int p_width, int p_height ) { if (p_width==width && p_height==height) return; + uint8_t pdata[16]; //largest is 16 + uint32_t pixel_size = get_format_pixel_size(format); + Image dst( p_width, p_height,0, format ); + { + DVector::Read r = data.read(); + DVector::Write w = dst.data.write(); - for (int y=0;y=width || y>=height)? Color() : get_pixel(x,y); - dst.put_pixel(x,y,col); + if ((x>=width || y>=height)) { + for(uint32_t i=0;i0) dst.generate_mipmaps(); *this=dst; @@ -754,18 +766,28 @@ void Image::flip_y() { + { + DVector::Write w = data.write(); + uint8_t up[16]; + uint8_t down[16]; + uint32_t pixel_size = get_format_pixel_size(format); - for (int y=0;y<(height/2);y++) { + for (int y=0;y::Write w = data.write(); + uint8_t up[16]; + uint8_t down[16]; + uint32_t pixel_size = get_format_pixel_size(format); + + for (int y=0;y @@ -903,16 +914,16 @@ static void _generate_po2_mipmap(const uint8_t* p_src, uint8_t* p_dst, uint32_t void Image::expand_x2_hq2x() { - ERR_FAIL_COND(format>=FORMAT_INDEXED); + ERR_FAIL_COND(!_can_modify(format)); Format current = format; - bool mipmaps=get_mipmaps(); - if (mipmaps) { + bool mm=has_mipmaps(); + if (mm) { clear_mipmaps(); } - if (current!=FORMAT_RGBA) - convert(FORMAT_RGBA); + if (current!=FORMAT_RGBA8) + convert(FORMAT_RGBA8); DVector dest; dest.resize(width*2*height*2*4); @@ -930,7 +941,7 @@ void Image::expand_x2_hq2x() { data=dest; - if (current!=FORMAT_RGBA) + if (current!=FORMAT_RGBA8) convert(current); if (mipmaps) { @@ -941,7 +952,6 @@ void Image::expand_x2_hq2x() { void Image::shrink_x2() { - ERR_FAIL_COND(format==FORMAT_INDEXED || format==FORMAT_INDEXED_ALPHA); ERR_FAIL_COND( data.size()==0 ); @@ -964,7 +974,6 @@ void Image::shrink_x2() { copymem(w.ptr(),&r[ofs],new_size); } - mipmaps--; width/=2; height/=2; data=new_img; @@ -973,7 +982,7 @@ void Image::shrink_x2() { DVector new_img; - ERR_FAIL_COND( format>=FORMAT_INDEXED ); + ERR_FAIL_COND( !_can_modify(format) ); int ps = get_format_pixel_size(format); new_img.resize((width/2)*(height/2)*ps); @@ -983,11 +992,12 @@ void Image::shrink_x2() { switch(format) { - case FORMAT_GRAYSCALE: - case FORMAT_INTENSITY: _generate_po2_mipmap<1>(r.ptr(), w.ptr(), width,height); break; - case FORMAT_GRAYSCALE_ALPHA: _generate_po2_mipmap<2>(r.ptr(), w.ptr(), width,height); break; - case FORMAT_RGB: _generate_po2_mipmap<3>(r.ptr(), w.ptr(), width,height); break; - case FORMAT_RGBA: _generate_po2_mipmap<4>(r.ptr(), w.ptr(), width,height); break; + case FORMAT_L8: + case FORMAT_R8: _generate_po2_mipmap<1>(r.ptr(), w.ptr(), width,height); break; + case FORMAT_LA8: _generate_po2_mipmap<2>(r.ptr(), w.ptr(), width,height); break; + case FORMAT_RG8: _generate_po2_mipmap<2>(r.ptr(), w.ptr(), width,height); break; + case FORMAT_RGB8: _generate_po2_mipmap<3>(r.ptr(), w.ptr(), width,height); break; + case FORMAT_RGBA8: _generate_po2_mipmap<4>(r.ptr(), w.ptr(), width,height); break; default: {} } } @@ -999,7 +1009,7 @@ void Image::shrink_x2() { } } -Error Image::generate_mipmaps(int p_mipmaps,bool p_keep_existing) { +Error Image::generate_mipmaps(bool p_keep_existing) { if (!_can_modify(format)) { ERR_EXPLAIN("Cannot generate mipmaps in indexed, compressed or custom image formats."); @@ -1007,11 +1017,13 @@ Error Image::generate_mipmaps(int p_mipmaps,bool p_keep_existing) { } + int mmcount = get_mipmap_count(); + int from_mm=1; if (p_keep_existing) { - from_mm=mipmaps+1; + from_mm=mmcount+1; } - int size = _get_dst_image_size(width,height,format,mipmaps,p_mipmaps); + int size = _get_dst_image_size(width,height,format,mmcount); data.resize(size); @@ -1023,7 +1035,7 @@ Error Image::generate_mipmaps(int p_mipmaps,bool p_keep_existing) { int prev_h=height; int prev_w=width; - for(int i=1;i(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_GRAYSCALE_ALPHA: _generate_po2_mipmap<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_RGB: _generate_po2_mipmap<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_RGBA: _generate_po2_mipmap<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_L8: + case FORMAT_R8: _generate_po2_mipmap<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_LA8: + case FORMAT_RG8: _generate_po2_mipmap<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_RGB8: _generate_po2_mipmap<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_RGBA8: _generate_po2_mipmap<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; default: {} } } @@ -1056,7 +1069,7 @@ Error Image::generate_mipmaps(int p_mipmaps,bool p_keep_existing) { int prev_h=height; int prev_w=width; - for(int i=1;i(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_GRAYSCALE_ALPHA: _scale_bilinear<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_RGB: _scale_bilinear<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_RGBA: _scale_bilinear<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_L8: + case FORMAT_R8: _scale_bilinear<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_LA8: + case FORMAT_RG8: _scale_bilinear<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_RGB8:_scale_bilinear<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_RGBA8: _scale_bilinear<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; default: {} } } @@ -1083,85 +1097,25 @@ Error Image::generate_mipmaps(int p_mipmaps,bool p_keep_existing) { } - - return OK; } void Image::clear_mipmaps() { - if (mipmaps==0) + if (!mipmaps) return; - if (format==FORMAT_CUSTOM) { - ERR_EXPLAIN("Cannot clear mipmaps in indexed, compressed or custom image formats."); - ERR_FAIL(); - - } - if (empty()) return; int ofs,w,h; _get_mipmap_offset_and_size(1,ofs,w,h); - int palsize = get_format_pallete_size(format); - DVector pallete; - ERR_FAIL_COND(ofs+palsize > data.size()); //bug? - if (palsize) { - - pallete.resize(palsize); - DVector::Read r = data.read(); - DVector::Write w = pallete.write(); - - copymem(&w[0],&r[data.size()-palsize],palsize); - } + data.resize(ofs); - data.resize(ofs+palsize); - - if (palsize) { - - DVector::Read r = pallete.read(); - DVector::Write w = data.write(); - - copymem(&w[ofs],&r[0],palsize); - } - - mipmaps=0; + mipmaps=false; } -void Image::make_normalmap(float p_height_scale) { - - if (!_can_modify(format)) { - ERR_EXPLAIN("Cannot crop in indexed, compressed or custom image formats."); - ERR_FAIL(); - } - - ERR_FAIL_COND( empty() ); - - Image normalmap(width,height,0, FORMAT_RGB); - /* - for (int y=0;y0)?get_pixel(x,y-1).gray()/255.0:center; - float down=(y<(height-1))?get_pixel(x,y+1).gray()/255.0:center; - float left=(x>0)?get_pixel(x-1,y).gray()/255.0:center; - float right=(x<(width-1))?get_pixel(x+1,y).gray()/255.0:center; - - - // uhm, how do i do this? .... - - Color result( (uint8_t)((normal.x+1.0)*127.0), (uint8_t)((normal.y+1.0)*127.0), (uint8_t)((normal.z+1.0)*127.0) ); - - normalmap.put_pixel( x, y, result ); - } - - } - */ - *this=normalmap; -} bool Image::empty() const { @@ -1186,32 +1140,30 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps,Format p_format width=p_width; height=p_height; - mipmaps=mm; + mipmaps=p_use_mipmaps; format=p_format; } -void Image::create(int p_width, int p_height, int p_mipmaps, Format p_format, const DVector& p_data) { +void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const DVector& p_data) { ERR_FAIL_INDEX(p_width-1,MAX_WIDTH); ERR_FAIL_INDEX(p_height-1,MAX_HEIGHT); - if (p_format < FORMAT_CUSTOM) { - int mm; - int size = _get_dst_image_size(p_width,p_height,p_format,mm,p_mipmaps); + int mm; + int size = _get_dst_image_size(p_width,p_height,p_format,mm,p_use_mipmaps); - if (size!=p_data.size()) { - ERR_EXPLAIN("Expected data size of "+itos(size)+" in Image::create()"); - ERR_FAIL_COND(p_data.size()!=size); - } - }; + if (size!=p_data.size()) { + ERR_EXPLAIN("Expected data size of "+itos(size)+" in Image::create()"); + ERR_FAIL_COND(p_data.size()!=size); + } height=p_height; width=p_width; format=p_format; data=p_data; - mipmaps=p_mipmaps; + mipmaps=p_use_mipmaps; } @@ -1220,7 +1172,7 @@ void Image::create( const char ** p_xpm ) { int size_width,size_height; int pixelchars=0; - mipmaps=0; + mipmaps=false; bool has_alpha=false; enum Status { @@ -1235,6 +1187,8 @@ void Image::create( const char ** p_xpm ) { HashMap colormap; int colormap_size; + uint32_t pixel_size; + DVector::Write w; while (status!=DONE) { @@ -1327,7 +1281,9 @@ void Image::create( const char ** p_xpm ) { if (line==colormap_size) { status=READING_PIXELS; - create(size_width,size_height,0,has_alpha?FORMAT_RGBA:FORMAT_RGB); + create(size_width,size_height,0,has_alpha?FORMAT_RGBA8:FORMAT_RGB8); + w=data.write(); + pixel_size=has_alpha?4:3; } } break; case READING_PIXELS: { @@ -1341,7 +1297,11 @@ void Image::create( const char ** p_xpm ) { Color *colorptr = colormap.getptr(pixelstr); ERR_FAIL_COND(!colorptr); - put_pixel(x,y,*colorptr); + uint8_t pixel[4]; + for(uint32_t i=0;i= FORMAT_YUV_422 && format <= FORMAT_YUV_444) - return false; int w,h; _get_mipmap_offset_and_size(1,len,w,h); @@ -1404,13 +1361,8 @@ bool Image::is_invisible() const { bool detected=false; switch(format) { - case FORMAT_INTENSITY: { - for(int i=0;i>1);i++) { @@ -1418,25 +1370,18 @@ bool Image::is_invisible() const { } } break; - case FORMAT_RGBA: { + case FORMAT_RGBA8: { for(int i=0;i<(len>>2);i++) { DETECT_NON_ALPHA(data_ptr[(i<<2)+3]) } } break; - case FORMAT_INDEXED: { - return false; - } break; - case FORMAT_INDEXED_ALPHA: { - - return false; - } break; - case FORMAT_PVRTC2_ALPHA: - case FORMAT_PVRTC4_ALPHA: - case FORMAT_BC2: - case FORMAT_BC3: { + case FORMAT_PVRTC2A: + case FORMAT_PVRTC4A: + case FORMAT_DXT3: + case FORMAT_DXT5: { detected=true; } break; default: {} @@ -1447,19 +1392,12 @@ bool Image::is_invisible() const { Image::AlphaMode Image::detect_alpha() const { - if (format==FORMAT_GRAYSCALE || - format==FORMAT_RGB || - format==FORMAT_INDEXED) - return ALPHA_NONE; int len = data.size(); if (len==0) return ALPHA_NONE; - if (format >= FORMAT_YUV_422 && format <= FORMAT_YUV_444) - return ALPHA_NONE; - int w,h; _get_mipmap_offset_and_size(1,len,w,h); @@ -1470,13 +1408,8 @@ Image::AlphaMode Image::detect_alpha() const { bool detected=false; switch(format) { - case FORMAT_INTENSITY: { - for(int i=0;i>1);i++) { @@ -1484,25 +1417,17 @@ Image::AlphaMode Image::detect_alpha() const { } } break; - case FORMAT_RGBA: { + case FORMAT_RGBA8: { for(int i=0;i<(len>>2);i++) { DETECT_ALPHA(data_ptr[(i<<2)+3]) } - } break; - case FORMAT_INDEXED: { - - return ALPHA_NONE; - } break; - case FORMAT_INDEXED_ALPHA: { - - return ALPHA_BLEND; - } break; - case FORMAT_PVRTC2_ALPHA: - case FORMAT_PVRTC4_ALPHA: - case FORMAT_BC2: - case FORMAT_BC3: { + } break; + case FORMAT_PVRTC2A: + case FORMAT_PVRTC4A: + case FORMAT_DXT3: + case FORMAT_DXT5: { detected=true; } break; default: {} @@ -1528,7 +1453,7 @@ Error Image::save_png(const String& p_path) { return ERR_UNAVAILABLE; return save_png_func(p_path, *this); -}; +} bool Image::operator==(const Image& p_image) const { @@ -1541,84 +1466,7 @@ bool Image::operator==(const Image& p_image) const { } -int Image::get_format_pixel_size(Format p_format) { - - switch(p_format) { - case FORMAT_GRAYSCALE: { - - return 1; - } break; - case FORMAT_INTENSITY: { - - return 1; - } break; - case FORMAT_GRAYSCALE_ALPHA: { - - return 2; - } break; - case FORMAT_RGB: { - - return 3; - } break; - case FORMAT_RGBA: { - - return 4; - } break; - case FORMAT_INDEXED: { - return 1; - } break; - case FORMAT_INDEXED_ALPHA: { - - return 1; - } break; - case FORMAT_BC1: - case FORMAT_BC2: - case FORMAT_BC3: - case FORMAT_BC4: - case FORMAT_BC5: { - - return 1; - } break; - case FORMAT_PVRTC2: - case FORMAT_PVRTC2_ALPHA: { - - return 1; - } break; - case FORMAT_PVRTC4: - case FORMAT_PVRTC4_ALPHA: { - - return 1; - } break; - case FORMAT_ATC: - case FORMAT_ATC_ALPHA_EXPLICIT: - case FORMAT_ATC_ALPHA_INTERPOLATED: { - - return 1; - } break; - case FORMAT_ETC: { - - return 1; - } break; - case FORMAT_YUV_422: { - return 2; - }; - case FORMAT_YUV_444: { - return 3; - } break; - case FORMAT_CUSTOM: { - - ERR_EXPLAIN("pixel size requested for custom image format, and it's unknown obviously"); - ERR_FAIL_V(1); - } break; - default:{ - ERR_EXPLAIN("Cannot obtain pixel size from this format"); - ERR_FAIL_V(1); - - } - } - return 0; -} int Image::get_image_data_size(int p_width, int p_height, Format p_format,int p_mipmaps) { @@ -1635,105 +1483,12 @@ int Image::get_image_required_mipmaps(int p_width, int p_height, Format p_format } -void Image::_get_format_min_data_size(Format p_format,int &r_w, int &r_h) { - - - switch(p_format) { - case FORMAT_BC1: - case FORMAT_BC2: - case FORMAT_BC3: - case FORMAT_BC4: - case FORMAT_BC5: { - r_w=4; - r_h=4; - } break; - case FORMAT_PVRTC2: - case FORMAT_PVRTC2_ALPHA: { - - r_w=16; - r_h=8; - } break; - case FORMAT_PVRTC4_ALPHA: - case FORMAT_PVRTC4: { - - r_w=8; - r_h=8; - } break; - case FORMAT_ATC: - case FORMAT_ATC_ALPHA_EXPLICIT: - case FORMAT_ATC_ALPHA_INTERPOLATED: { - - r_w=8; - r_h=8; - - } break; - - case FORMAT_ETC: { - - r_w=4; - r_h=4; - } break; - default: { - r_w=1; - r_h=1; - } break; - } - -} - - -int Image::get_format_pixel_rshift(Format p_format) { - - if (p_format==FORMAT_BC1 || p_format==FORMAT_BC4 || p_format==FORMAT_ATC || p_format==FORMAT_PVRTC4 || p_format==FORMAT_PVRTC4_ALPHA || p_format==FORMAT_ETC) - return 1; - else if (p_format==FORMAT_PVRTC2 || p_format==FORMAT_PVRTC2_ALPHA) - return 2; - else - return 0; -} - -int Image::get_format_pallete_size(Format p_format) { - - switch(p_format) { - case FORMAT_GRAYSCALE: { - - return 0; - } break; - case FORMAT_INTENSITY: { - - return 0; - } break; - case FORMAT_GRAYSCALE_ALPHA: { - - return 0; - } break; - case FORMAT_RGB: { - - return 0; - } break; - case FORMAT_RGBA: { - - return 0; - } break; - case FORMAT_INDEXED: { - - return 3*256; - } break; - case FORMAT_INDEXED_ALPHA: { - - return 4*256; - } break; - default:{} - } - return 0; -} Error Image::_decompress_bc() { - print_line("decompressing bc"); int wd=width,ht=height; if (wd%4!=0) { @@ -1745,7 +1500,7 @@ Error Image::_decompress_bc() { int mm; - int size = _get_dst_image_size(wd,ht,FORMAT_RGBA,mm,mipmaps); + int size = _get_dst_image_size(wd,ht,FORMAT_RGBA8,mm); DVector newdata; newdata.resize(size); @@ -1762,7 +1517,7 @@ Error Image::_decompress_bc() { switch(format) { - case FORMAT_BC1: { + case FORMAT_DXT1: { int len = (wd*ht)/16; uint8_t* dst=&w[wofs]; @@ -1788,8 +1543,8 @@ Error Image::_decompress_bc() { col_b|=src[2]; uint8_t table[4][4]={ - { (col_a>>11)<<3, ((col_a>>5)&0x3f)<<2, ((col_a)&0x1f)<<3, 255 }, - { (col_b>>11)<<3, ((col_b>>5)&0x3f)<<2, ((col_b)&0x1f)<<3, 255 }, + { uint8_t((col_a>>11)<<3), uint8_t(((col_a>>5)&0x3f)<<2),uint8_t(((col_a)&0x1f)<<3), 255 }, + { uint8_t((col_b>>11)<<3), uint8_t(((col_b>>5)&0x3f)<<2),uint8_t(((col_b)&0x1f)<<3), 255 }, {0,0,0,255}, {0,0,0,255} }; @@ -1841,7 +1596,7 @@ Error Image::_decompress_bc() { ht/=2; } break; - case FORMAT_BC2: { + case FORMAT_DXT3: { int len = (wd*ht)/16; uint8_t* dst=&w[wofs]; @@ -1885,8 +1640,9 @@ Error Image::_decompress_bc() { col_b|=src[8+2]; uint8_t table[4][4]={ - { (col_a>>11)<<3, ((col_a>>5)&0x3f)<<2, ((col_a)&0x1f)<<3, 255 }, - { (col_b>>11)<<3, ((col_b>>5)&0x3f)<<2, ((col_b)&0x1f)<<3, 255 }, + { uint8_t((col_a>>11)<<3), uint8_t(((col_a>>5)&0x3f)<<2),uint8_t(((col_a)&0x1f)<<3), 255 }, + { uint8_t((col_b>>11)<<3), uint8_t(((col_b>>5)&0x3f)<<2),uint8_t(((col_b)&0x1f)<<3), 255 }, + {0,0,0,255}, {0,0,0,255} }; @@ -1933,7 +1689,7 @@ Error Image::_decompress_bc() { ht/=2; } break; - case FORMAT_BC3: { + case FORMAT_DXT5: { int len = (wd*ht)/16; uint8_t* dst=&w[wofs]; @@ -2001,9 +1757,10 @@ Error Image::_decompress_bc() { col_b<<=8; col_b|=src[8+2]; - uint8_t table[4][4]={ - { (col_a>>11)<<3, ((col_a>>5)&0x3f)<<2, ((col_a)&0x1f)<<3, 255 }, - { (col_b>>11)<<3, ((col_b>>5)&0x3f)<<2, ((col_b)&0x1f)<<3, 255 }, + uint8_t table[4][4]={ + { uint8_t((col_a>>11)<<3), uint8_t(((col_a>>5)&0x3f)<<2),uint8_t(((col_a)&0x1f)<<3), 255 }, + { uint8_t((col_b>>11)<<3), uint8_t(((col_b>>5)&0x3f)<<2),uint8_t(((col_b)&0x1f)<<3), 255 }, + {0,0,0,255}, {0,0,0,255} }; @@ -2061,18 +1818,19 @@ Error Image::_decompress_bc() { r=DVector::Read(); data=newdata; - format=FORMAT_RGBA; + format=FORMAT_RGBA8; if (wd!=width || ht!=height) { - //todo, crop - width=wd; - height=ht; + + SWAP(width,wd); + SWAP(height,ht); + crop(wd,ht); } return OK; } bool Image::is_compressed() const { - return format>=FORMAT_BC1; + return format>=FORMAT_RGB565; } @@ -2085,12 +1843,14 @@ Image Image::decompressed() const { Error Image::decompress() { - if (format>=FORMAT_BC1 && format<=FORMAT_BC5 ) + if (format>=FORMAT_DXT1 && format<=FORMAT_ATI2 ) _decompress_bc();//_image_decompress_bc(this); - else if (format>=FORMAT_PVRTC2 && format<=FORMAT_PVRTC4_ALPHA && _image_decompress_pvrtc) + else if (format>=FORMAT_PVRTC2 && format<=FORMAT_PVRTC4A&& _image_decompress_pvrtc) _image_decompress_pvrtc(this); else if (format==FORMAT_ETC && _image_decompress_etc) _image_decompress_etc(this); + else if (format>=FORMAT_ETC2_R11 && format<=FORMAT_ETC2_RGB8A1 && _image_decompress_etc) + _image_decompress_etc2(this); else return ERR_UNAVAILABLE; return OK; @@ -2101,7 +1861,12 @@ Error Image::compress(CompressMode p_mode) { switch(p_mode) { - case COMPRESS_BC: { + case COMPRESS_16BIT: { + + //ERR_FAIL_COND_V(!_image_compress_bc_func, ERR_UNAVAILABLE); + //_image_compress_bc_func(this); + } break; + case COMPRESS_S3TC: { ERR_FAIL_COND_V(!_image_compress_bc_func, ERR_UNAVAILABLE); _image_compress_bc_func(this); @@ -2118,6 +1883,11 @@ Error Image::compress(CompressMode p_mode) { } break; case COMPRESS_ETC: { + ERR_FAIL_COND_V(!_image_compress_etc_func, ERR_UNAVAILABLE); + _image_compress_etc_func(this); + } break; + case COMPRESS_ETC2: { + ERR_FAIL_COND_V(!_image_compress_etc_func, ERR_UNAVAILABLE); _image_compress_etc_func(this); } break; @@ -2133,14 +1903,14 @@ Image Image::compressed(int p_mode) { ret.compress((Image::CompressMode)p_mode); return ret; -}; +} Image::Image(const char **p_xpm) { width=0; height=0; - mipmaps=0; - format=FORMAT_GRAYSCALE; + mipmaps=false; + format=FORMAT_L8; create(p_xpm); } @@ -2150,37 +1920,28 @@ Image::Image(int p_width, int p_height,bool p_use_mipmaps, Format p_format) { width=0; height=0; - mipmaps=0; - format=FORMAT_GRAYSCALE; + mipmaps=p_use_mipmaps; + format=FORMAT_L8; create(p_width,p_height,p_use_mipmaps,p_format); } -Image::Image(int p_width, int p_height, int p_mipmaps, Format p_format, const DVector& p_data) { +Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const DVector& p_data) { width=0; height=0; - mipmaps=0; - format=FORMAT_GRAYSCALE; + mipmaps=p_mipmaps; + format=FORMAT_L8; create(p_width,p_height,p_mipmaps,p_format,p_data); } -Image Image::brushed(const Image& p_src, const Image& p_brush, const Point2& p_dest) const { - - Image img = *this; - img.brush_transfer(p_src,p_brush,p_dest); - return img; -} - Rect2 Image::get_used_rect() const { - if (format==FORMAT_GRAYSCALE || - format==FORMAT_RGB || - format==FORMAT_INDEXED || format>FORMAT_INDEXED_ALPHA) + if (format!=FORMAT_LA8 && format!=FORMAT_RGBA8) return Rect2(Point2(),Size2(width,height)); int len = data.size(); @@ -2188,16 +1949,18 @@ Rect2 Image::get_used_rect() const { if (len==0) return Rect2(); - int data_size = len; + //int data_size = len; DVector::Read r = data.read(); const unsigned char *rptr=r.ptr(); + int ps = format==FORMAT_LA8?2:4; int minx=0xFFFFFF,miny=0xFFFFFFF; int maxx=-1,maxy=-1; - for(int i=0;i2; + bool opaque = rptr[(j*width+i)*ps+(ps-1)]>2; if (!opaque) continue; if (i>maxx) @@ -2225,101 +1988,47 @@ Image Image::get_rect(const Rect2& p_area) const { img.blit_rect(*this, p_area, Point2(0, 0)); return img; -}; - -void Image::brush_transfer(const Image& p_src, const Image& p_brush, const Point2& p_dest) { - - - ERR_FAIL_COND( width != p_src.width || height !=p_src.height); - - int dst_data_size = data.size(); - DVector::Write wp = data.write(); - unsigned char *dst_data_ptr=wp.ptr(); - - - int src_data_size = p_src.data.size(); - DVector::Read rp = p_src.data.read(); - const unsigned char *src_data_ptr=rp.ptr(); - - int brush_data_size = p_brush.data.size(); - DVector::Read bp = p_brush.data.read(); - const unsigned char *src_brush_ptr=bp.ptr(); - - int bw = p_brush.get_width(); - int bh = p_brush.get_height(); - int dx=p_dest.x; - int dy=p_dest.y; - - for(int i=dy;i= height) - continue; - for(int j=dx;j=width) - continue; - - BColor src = p_src._get_pixel(j,i,src_data_ptr,src_data_size); - BColor dst = _get_pixel(j,i,dst_data_ptr,dst_data_size); - BColor brush = p_brush._get_pixel(j-dx,i-dy,src_brush_ptr,brush_data_size); - uint32_t mult = brush.r; - dst.r = dst.r + (((int32_t(src.r)-int32_t(dst.r))*mult)>>8); - dst.g = dst.g + (((int32_t(src.g)-int32_t(dst.g))*mult)>>8); - dst.b = dst.b + (((int32_t(src.b)-int32_t(dst.b))*mult)>>8); - dst.a = dst.a + (((int32_t(src.a)-int32_t(dst.a))*mult)>>8); - _put_pixel(j,i,dst,dst_data_ptr); - } - } } - void Image::blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2& p_dest) { int dsize=data.size(); int srcdsize=p_src.data.size(); ERR_FAIL_COND( dsize==0 ); ERR_FAIL_COND( srcdsize==0 ); + ERR_FAIL_COND( format!=p_src.format ); + Rect2i local_src_rect = Rect2i(0,0,width,height).clip( Rect2i(p_dest+p_src_rect.pos,p_src_rect.size) ); - Rect2 rrect = Rect2(0,0,p_src.width,p_src.height).clip(p_src_rect); + if (local_src_rect.size.x<=0 || local_src_rect.size.y<=0) + return; + Rect2i src_rect( p_src_rect.pos + ( local_src_rect.pos - p_dest), local_src_rect.size ); DVector::Write wp = data.write(); - unsigned char *dst_data_ptr=wp.ptr(); + uint8_t *dst_data_ptr=wp.ptr(); DVector::Read rp = p_src.data.read(); - const unsigned char *src_data_ptr=rp.ptr(); - - if ((format==FORMAT_INDEXED || format == FORMAT_INDEXED_ALPHA) && (p_src.format==FORMAT_INDEXED || p_src.format == FORMAT_INDEXED_ALPHA)) { - - Point2i desti(p_dest.x, p_dest.y); - Point2i srci(rrect.pos.x, rrect.pos.y); + const uint8_t *src_data_ptr=rp.ptr(); - for(int i=0;i= height) - continue; - for(int j=0;j=width) - continue; + for(int i=0;i= height) - continue; - for(int j=0;j=width) - continue; + const uint8_t *src = &src_data_ptr[ (src_y*p_src.width+src_x)*pixel_size]; + uint8_t *dst = &dst_data_ptr[ (dst_y*width+dst_x)*pixel_size]; - _put_pixel(p_dest.x+j,p_dest.y+i,p_src._get_pixel(rrect.pos.x+j,rrect.pos.y+i,src_data_ptr,srcdsize),dst_data_ptr); + for(int k=0;k (*Image::lossy_packer)(const Image& ,float )=NULL; Image (*Image::lossy_unpacker)(const DVector& )=NULL; @@ -2352,7 +2063,7 @@ void Image::set_compress_bc_func(void (*p_compress_func)(Image *)) { void Image::normalmap_to_xy() { - convert(Image::FORMAT_RGBA); + convert(Image::FORMAT_RGBA8); { int len = data.size()/4; @@ -2367,7 +2078,7 @@ void Image::normalmap_to_xy() { } } - convert(Image::FORMAT_GRAYSCALE_ALPHA); + convert(Image::FORMAT_LA8); } void Image::srgb_to_linear() { @@ -2378,9 +2089,9 @@ void Image::srgb_to_linear() { static const uint8_t srgb2lin[256]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54, 55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109, 110, 112, 113, 114, 116, 117, 119, 120, 122, 123, 125, 126, 128, 129, 131, 132, 134, 135, 137, 139, 140, 142, 144, 145, 147, 148, 150, 152, 153, 155, 157, 159, 160, 162, 164, 166, 167, 169, 171, 173, 175, 176, 178, 180, 182, 184, 186, 188, 190, 192, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 218, 220, 222, 224, 226, 228, 230, 232, 235, 237, 239, 241, 243, 245, 248, 250, 252}; - ERR_FAIL_COND( format!=FORMAT_RGB && format!=FORMAT_RGBA ); + ERR_FAIL_COND( format!=FORMAT_RGB8 && format!=FORMAT_RGBA8 ); - if (format==FORMAT_RGBA) { + if (format==FORMAT_RGBA8) { int len = data.size()/4; DVector::Write wp = data.write(); @@ -2393,7 +2104,7 @@ void Image::srgb_to_linear() { data_ptr[(i<<2)+2]=srgb2lin[ data_ptr[(i<<2)+2] ]; } - } else if (format==FORMAT_RGB) { + } else if (format==FORMAT_RGB8) { int len = data.size()/3; DVector::Write wp = data.write(); @@ -2414,7 +2125,7 @@ void Image::premultiply_alpha() { if (data.size()==0) return; - if (format!=FORMAT_RGBA) + if (format!=FORMAT_RGBA8) return; //not needed DVector::Write wp = data.write(); @@ -2424,11 +2135,11 @@ void Image::premultiply_alpha() { for(int i=0;i>8; - bc.g=(int(bc.g)*int(bc.a))>>8; - bc.b=(int(bc.b)*int(bc.a))>>8; - _put_pixel(j,i,bc,data_ptr); + uint8_t *ptr = &data_ptr[(i*width+j)*4]; + + ptr[0]=(uint16_t(ptr[0])*uint16_t(ptr[3]))>>8; + ptr[1]=(uint16_t(ptr[1])*uint16_t(ptr[3]))>>8; + ptr[2]=(uint16_t(ptr[2])*uint16_t(ptr[3]))>>8; } } } @@ -2438,12 +2149,12 @@ void Image::fix_alpha_edges() { if (data.size()==0) return; - if (format!=FORMAT_RGBA) + if (format!=FORMAT_RGBA8) return; //not needed DVector dcopy = data; DVector::Read rp = data.read(); - const uint8_t *rptr=rp.ptr(); + const uint8_t *srcptr=rp.ptr(); DVector::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); @@ -2455,13 +2166,16 @@ void Image::fix_alpha_edges() { for(int i=0;i=alpha_treshold) + const uint8_t *rptr = &srcptr[(i*width+j)*4]; + uint8_t *wptr = &data_ptr[(i*width+j)*4]; + + if (rptr[3]>=alpha_treshold) continue; int closest_dist=max_dist; - BColor closest_color; - closest_color.a=bc.a; + uint8_t closest_color[3]; + + int from_x = MAX(0,j-max_radius); int to_x = MIN(width-1,j+max_radius); int from_y = MAX(0,i-max_radius); @@ -2476,22 +2190,25 @@ void Image::fix_alpha_edges() { if (dist>=closest_dist) continue; - const uint8_t * rp = &rptr[(k*width+l)<<2]; + const uint8_t * rp = &srcptr[(k*width+l)<<2]; if (rp[3]& p_buffer); private: - //internal byte based color - struct BColor { - union { - uint8_t col[4]; - struct { - uint8_t r,g,b,a; - }; - }; - - bool operator==(const BColor& p_color) const { for(int i=0;i<4;i++) {if (col[i]!=p_color.col[i]) return false; } return true; } - _FORCE_INLINE_ uint8_t gray() const { return (uint16_t(col[0])+uint16_t(col[1])+uint16_t(col[2]))/3; } - _FORCE_INLINE_ BColor() {} - BColor(uint8_t p_r,uint8_t p_g,uint8_t p_b,uint8_t p_a=255) { col[0]=p_r; col[1]=p_g; col[2]=p_b; col[3]=p_a; } - }; - - //median cut classes - - struct BColorPos { - - uint32_t index; - BColor color; - struct SortR { - - bool operator()(const BColorPos& ca, const BColorPos& cb) const { return ca.color.r < cb.color.r; } - }; - - struct SortG { - - bool operator()(const BColorPos& ca, const BColorPos& cb) const { return ca.color.g < cb.color.g; } - }; - - struct SortB { - - bool operator()(const BColorPos& ca, const BColorPos& cb) const { return ca.color.b < cb.color.b; } - }; - - struct SortA { - - bool operator()(const BColorPos& ca, const BColorPos& cb) const { return ca.color.a < cb.color.a; } - }; - }; - - struct SPTree { - - bool leaf; - uint8_t split_plane; - uint8_t split_value; - union { - int left; - int color; - }; - int right; - SPTree() { leaf=true; left=-1; right=-1;} - }; - - struct MCBlock { - - BColorPos min_color,max_color; - BColorPos *colors; - int sp_idx; - int color_count; - int get_longest_axis_index() const; - int get_longest_axis_length() const; - bool operator<(const MCBlock& p_block) const; - void shrink(); - MCBlock(); - MCBlock(BColorPos *p_colors,int p_color_count); - }; - Format format; DVector data; - int width,height,mipmaps; - - + int width,height; + bool mipmaps; - _FORCE_INLINE_ BColor _get_pixel(int p_x,int p_y,const unsigned char *p_data,int p_data_size) const; - _FORCE_INLINE_ BColor _get_pixelw(int p_x,int p_y,int p_width,const unsigned char *p_data,int p_data_size) const; - _FORCE_INLINE_ void _put_pixelw(int p_x,int p_y, int p_width, const BColor& p_color, unsigned char *p_data); - _FORCE_INLINE_ void _put_pixel(int p_x,int p_y, const BColor& p_color, unsigned char *p_data); _FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap,int &r_offset, int &r_width, int &r_height) const; //get where the mipmap begins in data - _FORCE_INLINE_ static void _get_format_min_data_size(Format p_format,int &r_w, int &r_h); static int _get_dst_image_size(int p_width, int p_height, Format p_format,int &r_mipmaps,int p_mipmaps=-1); bool _can_modify(Format p_format) const; + _FORCE_INLINE_ void _put_pixelb(int p_x,int p_y, uint32_t p_pixelsize,uint8_t *p_dst,const uint8_t *p_src); + _FORCE_INLINE_ void _get_pixelb(int p_x,int p_y, uint32_t p_pixelsize,const uint8_t *p_src,uint8_t *p_dst); public: @@ -207,20 +149,11 @@ public: int get_width() const; ///< Get image width int get_height() const; ///< Get image height - int get_mipmaps() const; - - /** - * Get a pixel from the image. for grayscale or indexed formats, use Color::gray to obtain the actual - * value. - */ - Color get_pixel(int p_x,int p_y,int p_mipmap=0) const; - /** - * Set a pixel into the image. for grayscale or indexed formats, a suitable Color constructor. - */ - void put_pixel(int p_x,int p_y, const Color& p_color,int p_mipmap=0); /* alpha and index are averaged */ + bool has_mipmaps() const; + int get_mipmap_count() const; /** - * Convert the image to another format, as close as it can be done. + * Convert the image to another format, conversion only to raw byte format */ void convert( Format p_new_format ); @@ -259,25 +192,21 @@ public: void flip_x(); void flip_y(); + /** * Generate a mipmap to an image (creates an image 1/4 the size, with averaging of 4->1) */ - Error generate_mipmaps(int p_amount=-1,bool p_keep_existing=false); + Error generate_mipmaps(bool p_keep_existing=false); void clear_mipmaps(); - /** - * Generate a normal map from a grayscale image - */ - - void make_normalmap(float p_height_scale=1.0); /** * Create a new image of a given size and format. Current image will be lost */ void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format); - void create(int p_width, int p_height, int p_mipmaps, Format p_format, const DVector& p_data); + void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const DVector& p_data); void create( const char ** p_xpm ); /** @@ -301,7 +230,7 @@ public: /** * import an image of a specific size and format from a pointer */ - Image(int p_width, int p_height, int p_mipmaps, Format p_format, const DVector& p_data); + Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const DVector& p_data); enum AlphaMode { ALPHA_NONE, @@ -312,32 +241,27 @@ public: AlphaMode detect_alpha() const; bool is_invisible() const; - void put_indexed_pixel(int p_x, int p_y, uint8_t p_idx,int p_mipmap=0); - uint8_t get_indexed_pixel(int p_x, int p_y,int p_mipmap=0) const; - void set_pallete(const DVector& p_data); - static int get_format_pixel_size(Format p_format); static int get_format_pixel_rshift(Format p_format); - static int get_format_pallete_size(Format p_format); + static void get_format_min_pixel_size(Format p_format,int &r_w, int &r_h); + static int get_image_data_size(int p_width, int p_height, Format p_format,int p_mipmaps=0); static int get_image_required_mipmaps(int p_width, int p_height, Format p_format); - - bool operator==(const Image& p_image) const; - void quantize(); - enum CompressMode { - COMPRESS_BC, + COMPRESS_16BIT, + COMPRESS_S3TC, COMPRESS_PVRTC2, COMPRESS_PVRTC4, - COMPRESS_ETC + COMPRESS_ETC, + COMPRESS_ETC2 }; - Error compress(CompressMode p_mode=COMPRESS_BC); + Error compress(CompressMode p_mode=COMPRESS_S3TC); Image compressed(int p_mode); /* from the Image::CompressMode enum */ Error decompress(); Image decompressed() const; @@ -349,8 +273,6 @@ public: void normalmap_to_xy(); void blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2& p_dest); - void brush_transfer(const Image& p_src, const Image& p_brush, const Point2& p_dest); - Image brushed(const Image& p_src, const Image& p_brush, const Point2& p_dest) const; Rect2 get_used_rect() const; Image get_rect(const Rect2& p_area) const; diff --git a/core/image_quantize.cpp b/core/image_quantize.cpp index f6fe7a88a0..e69de29bb2 100644 --- a/core/image_quantize.cpp +++ b/core/image_quantize.cpp @@ -1,365 +0,0 @@ -/*************************************************************************/ -/* image_quantize.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "image.h" -#include -#include "print_string.h" -#ifdef TOOLS_ENABLED -#include "set.h" -#include "sort.h" -#include "os/os.h" - -//#define QUANTIZE_SPEED_OVER_QUALITY - - -Image::MCBlock::MCBlock() { - - -} - -Image::MCBlock::MCBlock(BColorPos *p_colors,int p_color_count) { - - colors=p_colors; - color_count=p_color_count; - min_color.color=BColor(255,255,255,255); - max_color.color=BColor(0,0,0,0); - shrink(); -} - -int Image::MCBlock::get_longest_axis_index() const { - - int max_dist=-1; - int max_index=0; - - for(int i=0;i<4;i++) { - - int d = max_color.color.col[i]-min_color.color.col[i]; - if (d>max_dist) { - max_index=i; - max_dist=d; - } - } - - return max_index; -} -int Image::MCBlock::get_longest_axis_length() const { - - int max_dist=-1; - - for(int i=0;i<4;i++) { - - int d = max_color.color.col[i]-min_color.color.col[i]; - if (d>max_dist) { - max_dist=d; - } - } - - return max_dist; -} - -bool Image::MCBlock::operator<(const MCBlock& p_block) const { - - int alen = get_longest_axis_length(); - int blen = p_block.get_longest_axis_length(); - if (alen==blen) { - - return colors < p_block.colors; - } else - return alen < blen; - -} - -void Image::MCBlock::shrink() { - - min_color=colors[0]; - max_color=colors[0]; - - for(int i=1;ihas_environment("QUANTIZE_FAST"); - - convert(FORMAT_RGBA); - - ERR_FAIL_COND( format!=FORMAT_RGBA ); - - DVector indexed_data; - - - { - int color_count = data.size()/4; - - ERR_FAIL_COND(color_count==0); - - Set block_queue; - - DVector data_colors; - data_colors.resize(color_count); - - DVector::Write dcw=data_colors.write(); - - DVector::Read dr = data.read(); - const BColor * drptr=(const BColor*)&dr[0]; - BColorPos *bcptr=&dcw[0]; - - - - { - for(int i=0;iget().color_count > 1 ) { - - MCBlock longest = block_queue.back()->get(); - //printf("longest: %i (%i)\n",longest.get_longest_axis_index(),longest.get_longest_axis_length()); - - block_queue.erase(block_queue.back()); - - BColorPos *first = longest.colors; - BColorPos *median = longest.colors + (longest.color_count+1)/2; - BColorPos *end = longest.colors + longest.color_count; - -#if 0 - int lai =longest.get_longest_axis_index(); - switch(lai) { -#if 0 - case 0: { SortArray sort; sort.sort(first,end-first); } break; - case 1: { SortArray sort; sort.sort(first,end-first); } break; - case 2: { SortArray sort; sort.sort(first,end-first); } break; - case 3: { SortArray sort; sort.sort(first,end-first); } break; -#else - case 0: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 1: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 2: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 3: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; -#endif - - } - - //avoid same color from being split in 2 - //search forward and flip - BColorPos *median_end=median; - BColorPos *p=median_end+1; - - while(p!=end) { - if (median_end->color==p->color) { - SWAP(*(median_end+1),*p); - median_end++; - } - p++; - } - - //search backward and flip - BColorPos *median_begin=median; - p=median_begin-1; - - while(p!=(first-1)) { - if (median_begin->color==p->color) { - SWAP(*(median_begin-1),*p); - median_begin--; - } - p--; - } - - - if (first < median_begin) { - median=median_begin; - } else if (median_end < end-1) { - median=median_end+1; - } else { - break; //shouldn't have arrived here, since it means all pixels are equal, but wathever - } - - MCBlock left(first,median-first); - MCBlock right(median,end-median); - - block_queue.insert(left); - block_queue.insert(right); - -#else - switch(longest.get_longest_axis_index()) { - case 0: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 1: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 2: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - case 3: { SortArray sort; sort.nth_element(0,end-first,median-first,first); } break; - - } - - MCBlock left(first,median-first); - MCBlock right(median,end-median); - - block_queue.insert(left); - block_queue.insert(right); - - -#endif - - - } - - while(block_queue.size() > 256) { - - block_queue.erase(block_queue.front());// erase least significant - } - - int res_colors=0; - - int comp_size = (has_alpha?4:3); - indexed_data.resize(color_count + 256*comp_size); - - DVector::Write iw = indexed_data.write(); - uint8_t *iwptr=&iw[0]; - BColor pallete[256]; - - // print_line("applying quantization - res colors "+itos(block_queue.size())); - - while(block_queue.size()) { - - const MCBlock &b = block_queue.back()->get(); - - uint64_t sum[4]={0,0,0,0}; - - for(int i=0;i::Write(); - //dr = DVector::Read(); - //wb = DVector::Write(); - } - - print_line(itos(indexed_data.size())); - data=indexed_data; - format=has_alpha?FORMAT_INDEXED_ALPHA:FORMAT_INDEXED; - - -} //do none - - - -#else - - -void Image::quantize() {} //do none - - -#endif diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index c9bd38c654..13817b762d 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1060,7 +1060,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { if (buf) { encode_uint32(image.get_format(),&buf[0]); - encode_uint32(image.get_mipmaps(),&buf[4]); + encode_uint32(image.has_mipmaps(),&buf[4]); encode_uint32(image.get_width(),&buf[8]); encode_uint32(image.get_height(),&buf[12]); int ds=data.size(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 0544fd6ba8..8db06bf3d9 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -74,29 +74,6 @@ enum { IMAGE_ENCODING_LOSSLESS=2, IMAGE_ENCODING_LOSSY=3, - IMAGE_FORMAT_GRAYSCALE=0, - IMAGE_FORMAT_INTENSITY=1, - IMAGE_FORMAT_GRAYSCALE_ALPHA=2, - IMAGE_FORMAT_RGB=3, - IMAGE_FORMAT_RGBA=4, - IMAGE_FORMAT_INDEXED=5, - IMAGE_FORMAT_INDEXED_ALPHA=6, - IMAGE_FORMAT_BC1=7, - IMAGE_FORMAT_BC2=8, - IMAGE_FORMAT_BC3=9, - IMAGE_FORMAT_BC4=10, - IMAGE_FORMAT_BC5=11, - IMAGE_FORMAT_PVRTC2=12, - IMAGE_FORMAT_PVRTC2_ALPHA=13, - IMAGE_FORMAT_PVRTC4=14, - IMAGE_FORMAT_PVRTC4_ALPHA=15, - IMAGE_FORMAT_ETC=16, - IMAGE_FORMAT_ATC=17, - IMAGE_FORMAT_ATC_ALPHA_EXPLICIT=18, - IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED=19, - IMAGE_FORMAT_CUSTOM=30, - - OBJECT_EMPTY=0, OBJECT_EXTERNAL_RESOURCE=1, OBJECT_INTERNAL_RESOURCE=2, @@ -269,38 +246,22 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t height = f->get_32(); uint32_t mipmaps = f->get_32(); uint32_t format = f->get_32(); - Image::Format fmt; - switch(format) { - - case IMAGE_FORMAT_GRAYSCALE: { fmt=Image::FORMAT_GRAYSCALE; } break; - case IMAGE_FORMAT_INTENSITY: { fmt=Image::FORMAT_INTENSITY; } break; - case IMAGE_FORMAT_GRAYSCALE_ALPHA: { fmt=Image::FORMAT_GRAYSCALE_ALPHA; } break; - case IMAGE_FORMAT_RGB: { fmt=Image::FORMAT_RGB; } break; - case IMAGE_FORMAT_RGBA: { fmt=Image::FORMAT_RGBA; } break; - case IMAGE_FORMAT_INDEXED: { fmt=Image::FORMAT_INDEXED; } break; - case IMAGE_FORMAT_INDEXED_ALPHA: { fmt=Image::FORMAT_INDEXED_ALPHA; } break; - case IMAGE_FORMAT_BC1: { fmt=Image::FORMAT_BC1; } break; - case IMAGE_FORMAT_BC2: { fmt=Image::FORMAT_BC2; } break; - case IMAGE_FORMAT_BC3: { fmt=Image::FORMAT_BC3; } break; - case IMAGE_FORMAT_BC4: { fmt=Image::FORMAT_BC4; } break; - case IMAGE_FORMAT_BC5: { fmt=Image::FORMAT_BC5; } break; - case IMAGE_FORMAT_PVRTC2: { fmt=Image::FORMAT_PVRTC2; } break; - case IMAGE_FORMAT_PVRTC2_ALPHA: { fmt=Image::FORMAT_PVRTC2_ALPHA; } break; - case IMAGE_FORMAT_PVRTC4: { fmt=Image::FORMAT_PVRTC4; } break; - case IMAGE_FORMAT_PVRTC4_ALPHA: { fmt=Image::FORMAT_PVRTC4_ALPHA; } break; - case IMAGE_FORMAT_ETC: { fmt=Image::FORMAT_ETC; } break; - case IMAGE_FORMAT_ATC: { fmt=Image::FORMAT_ATC; } break; - case IMAGE_FORMAT_ATC_ALPHA_EXPLICIT: { fmt=Image::FORMAT_ATC_ALPHA_EXPLICIT; } break; - case IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED: { fmt=Image::FORMAT_ATC_ALPHA_INTERPOLATED; } break; - case IMAGE_FORMAT_CUSTOM: { fmt=Image::FORMAT_CUSTOM; } break; - default: { - - ERR_FAIL_V(ERR_FILE_CORRUPT); - } + const uint32_t format_version_shift=24; + const uint32_t format_version_mask=format_version_shift-1; + + uint32_t format_version = format>>format_version_shift; + + const uint32_t current_version = 0; + if (format_version>current_version) { + ERR_PRINT("Format version for encoded binary image is too new"); + return ERR_PARSE_ERROR; } + Image::Format fmt=Image::Format(format&format_version_mask); //if format changes, we can add a compatibility bit on top + + uint32_t datalen = f->get_32(); DVector imgdata; @@ -1599,7 +1560,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, int encoding=IMAGE_ENCODING_RAW; float quality=0.7; - if (val.get_format() <= Image::FORMAT_INDEXED_ALPHA) { + if (!val.is_compressed()) { //can only compress uncompressed stuff if (p_hint.hint==PROPERTY_HINT_IMAGE_COMPRESS_LOSSY && Image::lossy_packer) { @@ -1621,33 +1582,8 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, f->store_32(val.get_width()); f->store_32(val.get_height()); - f->store_32(val.get_mipmaps()); - switch(val.get_format()) { - - case Image::FORMAT_GRAYSCALE: f->store_32(IMAGE_FORMAT_GRAYSCALE ); break; ///< one byte per pixel: f->store_32(IMAGE_FORMAT_ ); break; 0-255 - case Image::FORMAT_INTENSITY: f->store_32(IMAGE_FORMAT_INTENSITY ); break; ///< one byte per pixel: f->store_32(IMAGE_FORMAT_ ); break; 0-255 - case Image::FORMAT_GRAYSCALE_ALPHA: f->store_32(IMAGE_FORMAT_GRAYSCALE_ALPHA ); break; ///< two bytes per pixel: f->store_32(IMAGE_FORMAT_ ); break; 0-255. alpha 0-255 - case Image::FORMAT_RGB: f->store_32(IMAGE_FORMAT_RGB ); break; ///< one byte R: f->store_32(IMAGE_FORMAT_ ); break; one byte G: f->store_32(IMAGE_FORMAT_ ); break; one byte B - case Image::FORMAT_RGBA: f->store_32(IMAGE_FORMAT_RGBA ); break; ///< one byte R: f->store_32(IMAGE_FORMAT_ ); break; one byte G: f->store_32(IMAGE_FORMAT_ ); break; one byte B: f->store_32(IMAGE_FORMAT_ ); break; one byte A - case Image::FORMAT_INDEXED: f->store_32(IMAGE_FORMAT_INDEXED ); break; ///< index byte 0-256: f->store_32(IMAGE_FORMAT_ ); break; and after image end: f->store_32(IMAGE_FORMAT_ ); break; 256*3 bytes of palette - case Image::FORMAT_INDEXED_ALPHA: f->store_32(IMAGE_FORMAT_INDEXED_ALPHA ); break; ///< index byte 0-256: f->store_32(IMAGE_FORMAT_ ); break; and after image end: f->store_32(IMAGE_FORMAT_ ); break; 256*4 bytes of palette (alpha) - case Image::FORMAT_BC1: f->store_32(IMAGE_FORMAT_BC1 ); break; // DXT1 - case Image::FORMAT_BC2: f->store_32(IMAGE_FORMAT_BC2 ); break; // DXT3 - case Image::FORMAT_BC3: f->store_32(IMAGE_FORMAT_BC3 ); break; // DXT5 - case Image::FORMAT_BC4: f->store_32(IMAGE_FORMAT_BC4 ); break; // ATI1 - case Image::FORMAT_BC5: f->store_32(IMAGE_FORMAT_BC5 ); break; // ATI2 - case Image::FORMAT_PVRTC2: f->store_32(IMAGE_FORMAT_PVRTC2 ); break; - case Image::FORMAT_PVRTC2_ALPHA: f->store_32(IMAGE_FORMAT_PVRTC2_ALPHA ); break; - case Image::FORMAT_PVRTC4: f->store_32(IMAGE_FORMAT_PVRTC4 ); break; - case Image::FORMAT_PVRTC4_ALPHA: f->store_32(IMAGE_FORMAT_PVRTC4_ALPHA ); break; - case Image::FORMAT_ETC: f->store_32(IMAGE_FORMAT_ETC); break; - case Image::FORMAT_ATC: f->store_32(IMAGE_FORMAT_ATC); break; - case Image::FORMAT_ATC_ALPHA_EXPLICIT: f->store_32(IMAGE_FORMAT_ATC_ALPHA_EXPLICIT); break; - case Image::FORMAT_ATC_ALPHA_INTERPOLATED: f->store_32(IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED); break; - case Image::FORMAT_CUSTOM: f->store_32(IMAGE_FORMAT_CUSTOM ); break; - default: {} - - } + f->store_32(val.has_mipmaps()); + f->store_32(val.get_format()); //if format changes we can add a compatibility version bit int dlen = val.get_data().size(); f->store_32(dlen); diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 44fbaf02ac..bbd395f21a 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -553,39 +553,39 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) Image::Format imgformat; - +/* if (format=="grayscale") { - imgformat=Image::FORMAT_GRAYSCALE; + imgformat=Image::FORMAT_L8; } else if (format=="intensity") { imgformat=Image::FORMAT_INTENSITY; } else if (format=="grayscale_alpha") { - imgformat=Image::FORMAT_GRAYSCALE_ALPHA; + imgformat=Image::FORMAT_LA8; } else if (format=="rgb") { - imgformat=Image::FORMAT_RGB; + imgformat=Image::FORMAT_RGB8; } else if (format=="rgba") { - imgformat=Image::FORMAT_RGBA; + imgformat=Image::FORMAT_RGBA8; } else if (format=="indexed") { imgformat=Image::FORMAT_INDEXED; } else if (format=="indexed_alpha") { imgformat=Image::FORMAT_INDEXED_ALPHA; } else if (format=="bc1") { - imgformat=Image::FORMAT_BC1; + imgformat=Image::FORMAT_DXT1; } else if (format=="bc2") { - imgformat=Image::FORMAT_BC2; + imgformat=Image::FORMAT_DXT3; } else if (format=="bc3") { - imgformat=Image::FORMAT_BC3; + imgformat=Image::FORMAT_DXT5; } else if (format=="bc4") { - imgformat=Image::FORMAT_BC4; + imgformat=Image::FORMAT_ATI1; } else if (format=="bc5") { - imgformat=Image::FORMAT_BC5; + imgformat=Image::FORMAT_ATI2; } else if (format=="pvrtc2") { imgformat=Image::FORMAT_PVRTC2; } else if (format=="pvrtc2a") { - imgformat=Image::FORMAT_PVRTC2_ALPHA; + imgformat=Image::FORMAT_PVRTC2A; } else if (format=="pvrtc4") { imgformat=Image::FORMAT_PVRTC4; } else if (format=="pvrtc4a") { - imgformat=Image::FORMAT_PVRTC4_ALPHA; + imgformat=Image::FORMAT_PVRTC4A; } else if (format=="etc") { imgformat=Image::FORMAT_ETC; } else if (format=="atc") { @@ -599,7 +599,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } else { ERR_FAIL_V( ERR_FILE_CORRUPT ); - } + }*/ int datasize; @@ -614,13 +614,6 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) return OK; }; - if (imgformat==Image::FORMAT_CUSTOM) { - - datasize=custom_size; - } else { - - datasize = Image::get_image_data_size(h,w,imgformat,mipmaps); - } if (datasize==0) { //r_v = Image(w, h, imgformat); @@ -2186,33 +2179,33 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V params+="encoding=\"raw\""; params+=" width=\""+itos(img.get_width())+"\""; params+=" height=\""+itos(img.get_height())+"\""; - params+=" mipmaps=\""+itos(img.get_mipmaps())+"\""; - + params+=" mipmaps=\""+itos(img.has_mipmaps())+"\""; +/* switch(img.get_format()) { - case Image::FORMAT_GRAYSCALE: params+=" format=\"grayscale\""; break; + case Image::FORMAT_L8: params+=" format=\"grayscale\""; break; case Image::FORMAT_INTENSITY: params+=" format=\"intensity\""; break; - case Image::FORMAT_GRAYSCALE_ALPHA: params+=" format=\"grayscale_alpha\""; break; - case Image::FORMAT_RGB: params+=" format=\"rgb\""; break; - case Image::FORMAT_RGBA: params+=" format=\"rgba\""; break; + case Image::FORMAT_LA8: params+=" format=\"grayscale_alpha\""; break; + case Image::FORMAT_RGB8: params+=" format=\"rgb\""; break; + case Image::FORMAT_RGBA8: params+=" format=\"rgba\""; break; case Image::FORMAT_INDEXED : params+=" format=\"indexed\""; break; case Image::FORMAT_INDEXED_ALPHA: params+=" format=\"indexed_alpha\""; break; - case Image::FORMAT_BC1: params+=" format=\"bc1\""; break; - case Image::FORMAT_BC2: params+=" format=\"bc2\""; break; - case Image::FORMAT_BC3: params+=" format=\"bc3\""; break; - case Image::FORMAT_BC4: params+=" format=\"bc4\""; break; - case Image::FORMAT_BC5: params+=" format=\"bc5\""; break; + case Image::FORMAT_DXT1: params+=" format=\"bc1\""; break; + case Image::FORMAT_DXT3: params+=" format=\"bc2\""; break; + case Image::FORMAT_DXT5: params+=" format=\"bc3\""; break; + case Image::FORMAT_ATI1: params+=" format=\"bc4\""; break; + case Image::FORMAT_ATI2: params+=" format=\"bc5\""; break; case Image::FORMAT_PVRTC2: params+=" format=\"pvrtc2\""; break; - case Image::FORMAT_PVRTC2_ALPHA: params+=" format=\"pvrtc2a\""; break; + case Image::FORMAT_PVRTC2A: params+=" format=\"pvrtc2a\""; break; case Image::FORMAT_PVRTC4: params+=" format=\"pvrtc4\""; break; - case Image::FORMAT_PVRTC4_ALPHA: params+=" format=\"pvrtc4a\""; break; + case Image::FORMAT_PVRTC4A: params+=" format=\"pvrtc4a\""; break; case Image::FORMAT_ETC: params+=" format=\"etc\""; break; case Image::FORMAT_ATC: params+=" format=\"atc\""; break; case Image::FORMAT_ATC_ALPHA_EXPLICIT: params+=" format=\"atcae\""; break; case Image::FORMAT_ATC_ALPHA_INTERPOLATED: params+=" format=\"atcai\""; break; case Image::FORMAT_CUSTOM: params+=" format=\"custom\" custom_size=\""+itos(img.get_data().size())+"\""; break; default: {} - } + }*/ } break; case Variant::NODE_PATH: type="node_path"; break; case Variant::OBJECT: { diff --git a/core/rid.cpp b/core/rid.cpp index 219c2f0e69..1b7a58313a 100644 --- a/core/rid.cpp +++ b/core/rid.cpp @@ -28,18 +28,16 @@ /*************************************************************************/ #include "rid.h" -static SafeRefCount current_id; -void RID_OwnerBase::init_rid() { +RID_Data::~RID_Data() { - current_id.init(1); } -ID RID_OwnerBase::new_ID() { +SafeRefCount RID_OwnerBase::refcount; - ID id = current_id.refval(); - return id; -} +void RID_OwnerBase::init_rid() { + refcount.init(); +} diff --git a/core/rid.h b/core/rid.h index 2de6956096..85a69ac0ef 100644 --- a/core/rid.h +++ b/core/rid.h @@ -33,183 +33,189 @@ #include "safe_refcount.h" #include "typedefs.h" #include "os/memory.h" -#include "hash_map.h" +#include "set.h" #include "list.h" /** @author Juan Linietsky */ + class RID_OwnerBase; -typedef uint32_t ID; +class RID_Data { + +friend class RID_OwnerBase; + +#ifndef DEBUG_ENABLED + RID_OwnerBase *_owner; +#endif + uint32_t _id; +public: + _FORCE_INLINE_ uint32_t get_id() const { return _id; } + + virtual ~RID_Data(); +}; + class RID { friend class RID_OwnerBase; - ID _id; - RID_OwnerBase *owner; + + mutable RID_Data *_data; + public: - _FORCE_INLINE_ ID get_id() const { return _id; } - bool operator==(const RID& p_rid) const { + _FORCE_INLINE_ RID_Data *get_data() const { return _data; } + + _FORCE_INLINE_ bool operator==(const RID& p_rid) const { - return _id==p_rid._id; + return _data==p_rid._data; } _FORCE_INLINE_ bool operator<(const RID& p_rid) const { - return _id < p_rid._id; + return _data < p_rid._data; } _FORCE_INLINE_ bool operator<=(const RID& p_rid) const { - return _id <= p_rid._id; + return _data <= p_rid._data; } _FORCE_INLINE_ bool operator>(const RID& p_rid) const { - return _id > p_rid._id; + return _data > p_rid._data; } - bool operator!=(const RID& p_rid) const { + _FORCE_INLINE_ bool operator!=(const RID& p_rid) const { - return _id!=p_rid._id; + return _data!=p_rid._data; } - _FORCE_INLINE_ bool is_valid() const { return _id>0; } + _FORCE_INLINE_ bool is_valid() const { return _data!=NULL; } - operator const void*() const { - return is_valid() ? this : 0; - }; + _FORCE_INLINE_ uint32_t get_id() const { return _data?_data->get_id():0; } _FORCE_INLINE_ RID() { - _id = 0; - owner=0; + _data=NULL; } + }; class RID_OwnerBase { protected: -friend class RID; - void set_id(RID& p_rid, ID p_id) const { p_rid._id=p_id; } - void set_ownage(RID& p_rid) const { p_rid.owner=const_cast(this); } - ID new_ID(); + + static SafeRefCount refcount; + _FORCE_INLINE_ void _set_data(RID& p_rid, RID_Data* p_data) { + p_rid._data=p_data; + refcount.ref(); + p_data->_id=refcount.get(); +#ifndef DEBUG_ENABLED + p_data->_owner=this; +#endif + } + +#ifndef DEBUG_ENABLED + + _FORCE_INLINE_ bool _is_owner(RID& p_rid) const { + + return this==p_rid._owner; + + } + + _FORCE_INLINE_ void _remove_owner(RID& p_rid) { + + return p_rid._owner=NULL; + + } +# +#endif + + public: - virtual bool owns(const RID& p_rid) const=0; - virtual void get_owned_list(List *p_owned) const=0; - static void init_rid(); + virtual void get_owned_list(List *p_owned)=0; + static void init_rid(); virtual ~RID_OwnerBase() {} }; -template +template class RID_Owner : public RID_OwnerBase { public: - - typedef void (*ReleaseNotifyFunc)(void*user,T *p_data); -private: - - Mutex *mutex; - mutable HashMap id_map; - +#ifdef DEBUG_ENABLED + mutable Set id_map; +#endif public: - RID make_rid(T * p_data) { + _FORCE_INLINE_ RID make_rid(T * p_data) { - if (thread_safe) { - mutex->lock(); - } - ID id = new_ID(); - id_map[id]=p_data; RID rid; - set_id(rid,id); - set_ownage(rid); + _set_data(rid,p_data); - if (thread_safe) { - mutex->unlock(); - } +#ifdef DEBUG_ENABLED + id_map.insert(p_data) ; +#endif return rid; } _FORCE_INLINE_ T * get(const RID& p_rid) { - if (thread_safe) { - mutex->lock(); - } - - T**elem = id_map.getptr(p_rid.get_id()); +#ifdef DEBUG_ENABLED - if (thread_safe) { - mutex->unlock(); - } - - ERR_FAIL_COND_V(!elem,NULL); - - return *elem; + ERR_FAIL_COND_V(!p_rid.is_valid(),NULL); + ERR_FAIL_COND_V(!id_map.has(p_rid.get_data()),NULL); +#endif + return static_cast(p_rid.get_data()); } - virtual bool owns(const RID& p_rid) const { + _FORCE_INLINE_ T * getornull(const RID& p_rid) { - if (thread_safe) { - mutex->lock(); - } - - T**elem = id_map.getptr(p_rid.get_id()); +#ifdef DEBUG_ENABLED - if (thread_safe) { - mutex->lock(); + if (p_rid.get_data()) { + ERR_FAIL_COND_V(!id_map.has(p_rid.get_data()),NULL); } +#endif + return static_cast(p_rid.get_data()); - return elem!=NULL; } - virtual void free(RID p_rid) { + _FORCE_INLINE_ bool owns(const RID& p_rid) const { - if (thread_safe) { - mutex->lock(); - } - ERR_FAIL_COND(!owns(p_rid)); - id_map.erase(p_rid.get_id()); + if (p_rid.get_data()==NULL) + return false; +#ifdef DEBUG_ENABLED + return id_map.has(p_rid.get_data()); +#else + return _is_owner(p_rid); +#endif } - virtual void get_owned_list(List *p_owned) const { - if (thread_safe) { - mutex->lock(); - } + void free(RID p_rid) { - const ID*id=NULL; - while((id=id_map.next(id))) { +#ifdef DEBUG_ENABLED + id_map.erase(p_rid.get_data()); +#else + _remove_owner(p_rid); +#endif + } - RID rid; - set_id(rid,*id); - set_ownage(rid); - p_owned->push_back(rid); + void get_owned_list(List *p_owned) { - } - if (thread_safe) { - mutex->lock(); - } - } - RID_Owner() { +#ifdef DEBUG_ENABLED - if (thread_safe) { - - mutex = Mutex::create(); + for (typename Set::Element *E=id_map.front();E;E=E->next()) { + RID r; + _set_data(r,static_cast(E->get())); + p_owned->push_back(r); } +#endif } - - ~RID_Owner() { - - if (thread_safe) { - - memdelete(mutex); - } - } }; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 51cd4c2399..bfbb95085e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -617,13 +617,9 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_PTR0R(Image,get_width); VCALL_PTR0R(Image,get_height); VCALL_PTR0R(Image,empty); - VCALL_PTR3R(Image,get_pixel); - VCALL_PTR4(Image, put_pixel); VCALL_PTR0R(Image,get_used_rect); - VCALL_PTR3R(Image,brushed); VCALL_PTR1R(Image,load); VCALL_PTR1R(Image,save_png); - VCALL_PTR3(Image,brush_transfer); VCALL_PTR1R(Image,get_rect); VCALL_PTR1R(Image,compressed); VCALL_PTR0R(Image,decompressed); @@ -1526,12 +1522,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(IMAGE, INT, Image, get_width, varray()); ADDFUNC0(IMAGE, INT, Image, get_height, varray()); ADDFUNC0(IMAGE, BOOL, Image, empty, varray()); - ADDFUNC3(IMAGE, COLOR, Image, get_pixel, INT, "x", INT, "y", INT, "mipmap_level", varray(0)); - ADDFUNC4(IMAGE, NIL, Image, put_pixel, INT, "x", INT, "y", COLOR, "color", INT, "mipmap_level", varray(0)); - ADDFUNC3(IMAGE, IMAGE, Image, brushed, IMAGE, "src", IMAGE, "brush", VECTOR2, "pos", varray(0)); ADDFUNC1(IMAGE, INT, Image, load, STRING, "path", varray(0)); ADDFUNC1(IMAGE, INT, Image, save_png, STRING, "path", varray(0)); - ADDFUNC3(IMAGE, NIL, Image, brush_transfer, IMAGE, "src", IMAGE, "brush", VECTOR2, "pos", varray(0)); ADDFUNC0(IMAGE, RECT2, Image, get_used_rect, varray(0)); ADDFUNC1(IMAGE, IMAGE, Image, get_rect, RECT2, "area", varray(0)); ADDFUNC1(IMAGE, IMAGE, Image, compressed, INT, "format", varray(0)); @@ -1788,34 +1780,53 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl _VariantCall::add_constant(Variant::INPUT_EVENT,"ACTION",InputEvent::ACTION); - _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_BC",Image::COMPRESS_BC); + _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_16BIT",Image::COMPRESS_16BIT); + _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_S3TC",Image::COMPRESS_S3TC); _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_PVRTC2",Image::COMPRESS_PVRTC2); _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_PVRTC4",Image::COMPRESS_PVRTC4); _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_ETC",Image::COMPRESS_ETC); - - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_GRAYSCALE",Image::FORMAT_GRAYSCALE); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_INTENSITY",Image::FORMAT_INTENSITY); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_GRAYSCALE_ALPHA",Image::FORMAT_GRAYSCALE_ALPHA); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGB",Image::FORMAT_RGB); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBA",Image::FORMAT_RGBA); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_INDEXED",Image::FORMAT_INDEXED); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_INDEXED_ALPHA",Image::FORMAT_INDEXED_ALPHA); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_YUV_422",Image::FORMAT_YUV_422); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_YUV_444",Image::FORMAT_YUV_444); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BC1",Image::FORMAT_BC1); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BC2",Image::FORMAT_BC2); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BC3",Image::FORMAT_BC3); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BC4",Image::FORMAT_BC4); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BC5",Image::FORMAT_BC5); + _VariantCall::add_constant(Variant::IMAGE,"COMPRESS_ETC2",Image::COMPRESS_ETC2); + + + + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_L8",Image::FORMAT_L8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_LA8",Image::FORMAT_LA8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_R8",Image::FORMAT_R8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RG8",Image::FORMAT_RG8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGB8",Image::FORMAT_RGB8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBA8",Image::FORMAT_RGBA8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGB565",Image::FORMAT_RGB565); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBA4444",Image::FORMAT_RGBA4444); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBA5551",Image::FORMAT_DXT1); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RF",Image::FORMAT_RF); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGF",Image::FORMAT_RGF); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBF",Image::FORMAT_RGBF); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBAF",Image::FORMAT_RGBAF); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RH",Image::FORMAT_RH); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGH",Image::FORMAT_RGH); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBH",Image::FORMAT_RGBH); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_RGBAH",Image::FORMAT_RGBAH); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_DXT1",Image::FORMAT_DXT1); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_DXT3",Image::FORMAT_DXT3); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_DXT5",Image::FORMAT_DXT5); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ATI1",Image::FORMAT_ATI1); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ATI2",Image::FORMAT_ATI2); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BPTC_RGBA",Image::FORMAT_BPTC_RGBA); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BPTC_RGBF",Image::FORMAT_BPTC_RGBF); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_BPTC_RGBFU",Image::FORMAT_BPTC_RGBFU); _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC2",Image::FORMAT_PVRTC2); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC2_ALPHA",Image::FORMAT_PVRTC2_ALPHA); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC2A",Image::FORMAT_PVRTC2A); _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC4",Image::FORMAT_PVRTC4); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC4_ALPHA",Image::FORMAT_PVRTC4_ALPHA); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_PVRTC4A",Image::FORMAT_PVRTC4A); _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC",Image::FORMAT_ETC); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ATC",Image::FORMAT_ATC); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ATC_ALPHA_EXPLICIT",Image::FORMAT_ATC_ALPHA_EXPLICIT); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ATC_ALPHA_INTERPOLATED",Image::FORMAT_ATC_ALPHA_INTERPOLATED); - _VariantCall::add_constant(Variant::IMAGE,"FORMAT_CUSTOM",Image::FORMAT_CUSTOM); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_R11",Image::FORMAT_ETC2_R11); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_R11S",Image::FORMAT_ETC2_R11S); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_RG11",Image::FORMAT_ETC2_RG11); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_RG11S",Image::FORMAT_ETC2_RG11S); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_RGB8",Image::FORMAT_ETC2_RGB8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_RGBA8",Image::FORMAT_ETC2_RGBA8); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_ETC2_RGB8A1",Image::FORMAT_ETC2_RGB8A1); + _VariantCall::add_constant(Variant::IMAGE,"FORMAT_MAX",Image::FORMAT_MAX); _VariantCall::add_constant(Variant::IMAGE,"INTERPOLATE_NEAREST",Image::INTERPOLATE_NEAREST); _VariantCall::add_constant(Variant::IMAGE,"INTERPOLATE_BILINEAR",Image::INTERPOLATE_BILINEAR); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 6b3828a572..32358e1180 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -755,8 +755,17 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in } get_token(p_stream,token,line,r_err_str); - if (token.type!=TK_NUMBER) { - r_err_str="Expected number (mipmaps)"; + + bool has_mipmaps=false; + + if (token.type==TK_NUMBER) { + has_mipmaps=bool(token.value); + } else if (token.type==TK_IDENTIFIER && String(token.value)=="true") { + has_mipmaps=true; + } else if (token.type==TK_IDENTIFIER && String(token.value)=="false") { + has_mipmaps=false; + } else { + r_err_str="Expected number/true/false (mipmaps)"; return ERR_PARSE_ERROR; } @@ -778,32 +787,18 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in String sformat=token.value; - Image::Format format; - - if (sformat=="GRAYSCALE") format=Image::FORMAT_GRAYSCALE; - else if (sformat=="INTENSITY") format=Image::FORMAT_INTENSITY; - else if (sformat=="GRAYSCALE_ALPHA") format=Image::FORMAT_GRAYSCALE_ALPHA; - else if (sformat=="RGB") format=Image::FORMAT_RGB; - else if (sformat=="RGBA") format=Image::FORMAT_RGBA; - else if (sformat=="INDEXED") format=Image::FORMAT_INDEXED; - else if (sformat=="INDEXED_ALPHA") format=Image::FORMAT_INDEXED_ALPHA; - else if (sformat=="BC1") format=Image::FORMAT_BC1; - else if (sformat=="BC2") format=Image::FORMAT_BC2; - else if (sformat=="BC3") format=Image::FORMAT_BC3; - else if (sformat=="BC4") format=Image::FORMAT_BC4; - else if (sformat=="BC5") format=Image::FORMAT_BC5; - else if (sformat=="PVRTC2") format=Image::FORMAT_PVRTC2; - else if (sformat=="PVRTC2_ALPHA") format=Image::FORMAT_PVRTC2_ALPHA; - else if (sformat=="PVRTC4") format=Image::FORMAT_PVRTC4; - else if (sformat=="PVRTC4_ALPHA") format=Image::FORMAT_PVRTC4_ALPHA; - else if (sformat=="ATC") format=Image::FORMAT_ATC; - else if (sformat=="ATC_ALPHA_EXPLICIT") format=Image::FORMAT_ATC_ALPHA_EXPLICIT; - else if (sformat=="ATC_ALPHA_INTERPOLATED") format=Image::FORMAT_ATC_ALPHA_INTERPOLATED; - else if (sformat=="CUSTOM") format=Image::FORMAT_CUSTOM; - else { - r_err_str="Invalid image format: '"+sformat+"'"; + Image::Format format=Image::FORMAT_MAX; + + for(int i=0;i - + - + - + - + @@ -16342,23 +16342,23 @@ - + - + - + - + - + - + - + diff --git a/drivers/SCsub b/drivers/SCsub index 8243483e17..7420d57604 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -12,7 +12,7 @@ SConscript('unix/SCsub'); SConscript('alsa/SCsub'); SConscript('pulseaudio/SCsub'); SConscript('windows/SCsub'); -SConscript('gles2/SCsub'); +SConscript('gles3/SCsub'); SConscript('gl_context/SCsub'); SConscript('pnm/SCsub'); diff --git a/drivers/dds/texture_loader_dds.cpp b/drivers/dds/texture_loader_dds.cpp index 0cc84f02f7..23fb9f48f7 100644 --- a/drivers/dds/texture_loader_dds.cpp +++ b/drivers/dds/texture_loader_dds.cpp @@ -74,21 +74,20 @@ struct DDSFormatInfo { static const DDSFormatInfo dds_format_info[DDS_MAX]={ - {"DXT1",true,false,4,8,Image::FORMAT_BC1}, - {"DXT3",true,false,4,16,Image::FORMAT_BC2}, - {"DXT5",true,false,4,16,Image::FORMAT_BC3}, - {"ATI1",true,false,4,8,Image::FORMAT_BC4}, - {"ATI2",true,false,4,16,Image::FORMAT_BC5}, - {"BGRA8",false,false,1,4,Image::FORMAT_RGBA}, - {"BGR8",false,false,1,3,Image::FORMAT_RGB}, - {"RGBA8",false,false,1,4,Image::FORMAT_RGBA}, - {"RGB8",false,false,1,3,Image::FORMAT_RGB}, - {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA}, - {"BGR565",false,false,1,2,Image::FORMAT_RGB}, - {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA}, - {"INDEXED",false,true,1,1,Image::FORMAT_INDEXED}, - {"GRAYSCALE",false,false,1,1,Image::FORMAT_GRAYSCALE}, - {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_GRAYSCALE_ALPHA} + {"DXT1",true,false,4,8,Image::FORMAT_DXT1}, + {"DXT3",true,false,4,16,Image::FORMAT_DXT3}, + {"DXT5",true,false,4,16,Image::FORMAT_DXT5}, + {"ATI1",true,false,4,8,Image::FORMAT_ATI1}, + {"ATI2",true,false,4,16,Image::FORMAT_ATI2}, + {"BGRA8",false,false,1,4,Image::FORMAT_RGBA8}, + {"BGR8",false,false,1,3,Image::FORMAT_RGB8}, + {"RGBA8",false,false,1,4,Image::FORMAT_RGBA8}, + {"RGB8",false,false,1,3,Image::FORMAT_RGB8}, + {"BGR5A1",false,false,1,2,Image::FORMAT_RGBA8}, + {"BGR565",false,false,1,2,Image::FORMAT_RGB8}, + {"BGR10A2",false,false,1,4,Image::FORMAT_RGBA8}, + {"GRAYSCALE",false,false,1,1,Image::FORMAT_L8}, + {"GRAYSCALE_ALPHA",false,false,1,2,Image::FORMAT_LA8} }; diff --git a/drivers/etc1/image_etc.cpp b/drivers/etc1/image_etc.cpp index cf2384240b..176abc356c 100644 --- a/drivers/etc1/image_etc.cpp +++ b/drivers/etc1/image_etc.cpp @@ -42,7 +42,7 @@ static void _decompress_etc(Image *p_img) { DVector::Read r = src.read(); - int mmc=p_img->get_mipmaps(); + int mmc=p_img->get_mipmap_count(); for(int i=0;i<=mmc;i++) { @@ -93,9 +93,9 @@ static void _decompress_etc(Image *p_img) { r=DVector::Read(); //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps())); - *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->get_mipmaps(),Image::FORMAT_RGB,dst); - if (p_img->get_mipmaps()) - p_img->generate_mipmaps(-1,true); + *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst); + if (p_img->has_mipmaps()) + p_img->generate_mipmaps(true); } @@ -108,11 +108,11 @@ static void _compress_etc(Image *p_img) { ERR_FAIL_COND( nearest_power_of_2(imgw)!=imgw || nearest_power_of_2(imgh)!=imgh ); - if (img.get_format()!=Image::FORMAT_RGB) - img.convert(Image::FORMAT_RGB); + if (img.get_format()!=Image::FORMAT_RGB8) + img.convert(Image::FORMAT_RGB8); - int mmc=img.get_mipmaps(); + int mmc=img.get_mipmap_count(); if (mmc==0) img.generate_mipmaps(); // force mipmaps, so it works on most hardware @@ -186,7 +186,7 @@ static void _compress_etc(Image *p_img) { } - *p_img=Image(p_img->get_width(),p_img->get_height(),mc-1,Image::FORMAT_ETC,dst_data); + *p_img=Image(p_img->get_width(),p_img->get_height(),(mc-1)?true:false,Image::FORMAT_ETC,dst_data); } diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index a7edc8d935..db874d1287 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -376,7 +376,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For switch(p_format) { - case Image::FORMAT_GRAYSCALE: { + case Image::FORMAT_L8: { r_gl_components=1; r_gl_format=GL_LUMINANCE; r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_NV:GL_LUMINANCE; @@ -385,15 +385,15 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For case Image::FORMAT_INTENSITY: { if (!image.empty()) - image.convert(Image::FORMAT_RGBA); + image.convert(Image::FORMAT_RGBA8); r_gl_components=4; r_gl_format=GL_RGBA; r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_ALPHA_EXT:GL_RGBA; r_has_alpha_cache=true; } break; - case Image::FORMAT_GRAYSCALE_ALPHA: { + case Image::FORMAT_LA8: { - //image.convert(Image::FORMAT_RGBA); + //image.convert(Image::FORMAT_RGBA8); r_gl_components=2; r_gl_format=GL_LUMINANCE_ALPHA; r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_SLUMINANCE_ALPHA_NV:GL_LUMINANCE_ALPHA; @@ -403,7 +403,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For case Image::FORMAT_INDEXED: { if (!image.empty()) - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); r_gl_components=3; r_gl_format=GL_RGB; r_gl_internal_format=(srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_GL_SRGB_EXT:GL_RGB; @@ -413,7 +413,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For case Image::FORMAT_INDEXED_ALPHA: { if (!image.empty()) - image.convert(Image::FORMAT_RGBA); + image.convert(Image::FORMAT_RGBA8); r_gl_components=4; if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { @@ -432,7 +432,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For r_has_alpha_cache=true; } break; - case Image::FORMAT_RGB: { + case Image::FORMAT_RGB8: { r_gl_components=3; @@ -450,7 +450,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For r_gl_internal_format=GL_RGB; } } break; - case Image::FORMAT_RGBA: { + case Image::FORMAT_RGBA8: { r_gl_components=4; if (p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { @@ -470,7 +470,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For r_has_alpha_cache=true; } break; - case Image::FORMAT_BC1: { + case Image::FORMAT_DXT1: { if (!s3tc_supported || (!s3tc_srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { @@ -501,7 +501,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For }; } break; - case Image::FORMAT_BC2: { + case Image::FORMAT_DXT3: { if (!s3tc_supported || (!s3tc_srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { @@ -533,7 +533,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For }; } break; - case Image::FORMAT_BC3: { + case Image::FORMAT_DXT5: { if (!s3tc_supported || (!s3tc_srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { @@ -564,7 +564,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For }; } break; - case Image::FORMAT_BC4: { + case Image::FORMAT_ATI1: { if (!latc_supported) { @@ -595,7 +595,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For }; } break; - case Image::FORMAT_BC5: { + case Image::FORMAT_ATI2: { if (!latc_supported ) { @@ -657,7 +657,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For } } break; - case Image::FORMAT_PVRTC2_ALPHA: { + case Image::FORMAT_PVRTC2A: { if (!pvr_supported || (!pvr_srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { @@ -719,7 +719,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For } } break; - case Image::FORMAT_PVRTC4_ALPHA: { + case Image::FORMAT_PVRTC4A: { if (!pvr_supported || (!pvr_srgb_supported && p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { @@ -841,7 +841,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For case Image::FORMAT_YUV_444: { if (!image.empty()) - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); r_gl_internal_format=GL_RGB; r_gl_components=3; @@ -1145,7 +1145,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid switch(texture->format) { - case Image::FORMAT_GRAYSCALE: { + case Image::FORMAT_L8: { format=GL_LUMINANCE; type=GL_UNSIGNED_BYTE; @@ -1156,19 +1156,19 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid case Image::FORMAT_INTENSITY: { return Image(); } break; - case Image::FORMAT_GRAYSCALE_ALPHA: { + case Image::FORMAT_LA8: { format=GL_LUMINANCE_ALPHA; type=GL_UNSIGNED_BYTE; pixelsize=2; } break; - case Image::FORMAT_RGB: { + case Image::FORMAT_RGB8: { format=GL_RGB; type=GL_UNSIGNED_BYTE; pixelsize=3; } break; - case Image::FORMAT_RGBA: { + case Image::FORMAT_RGBA8: { format=GL_RGBA; type=GL_UNSIGNED_BYTE; @@ -1178,18 +1178,18 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid format=GL_RGB; type=GL_UNSIGNED_BYTE; - fmt=Image::FORMAT_RGB; + fmt=Image::FORMAT_RGB8; pixelsize=3; } break; case Image::FORMAT_INDEXED_ALPHA: { format=GL_RGBA; type=GL_UNSIGNED_BYTE; - fmt=Image::FORMAT_RGBA; + fmt=Image::FORMAT_RGBA8; pixelsize=4; } break; - case Image::FORMAT_BC1: { + case Image::FORMAT_DXT1: { pixelsize=1; //doesn't matter much format=GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; @@ -1198,14 +1198,14 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid minw=minh=4; } break; - case Image::FORMAT_BC2: { + case Image::FORMAT_DXT3: { pixelsize=1; //doesn't matter much format=GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; compressed=true; minw=minh=4; } break; - case Image::FORMAT_BC3: { + case Image::FORMAT_DXT5: { pixelsize=1; //doesn't matter much format=GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; @@ -1213,7 +1213,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid minw=minh=4; } break; - case Image::FORMAT_BC4: { + case Image::FORMAT_ATI1: { format=GL_COMPRESSED_RED_RGTC1; pixelsize=1; //doesn't matter much @@ -1222,7 +1222,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid minw=minh=4; } break; - case Image::FORMAT_BC5: { + case Image::FORMAT_ATI2: { format=GL_COMPRESSED_RG_RGTC2; pixelsize=1; //doesn't matter much @@ -1359,7 +1359,7 @@ Image::Format RasterizerGLES2::texture_get_format(RID p_texture) const { Texture * texture = texture_owner.get(p_texture); - ERR_FAIL_COND_V(!texture,Image::FORMAT_GRAYSCALE); + ERR_FAIL_COND_V(!texture,Image::FORMAT_L8); return texture->format; } @@ -4320,7 +4320,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { w=DVector::Write(); - r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGB,pixels); + r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGB8,pixels); #else @@ -4360,7 +4360,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { } w=DVector::Write(); - r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA,pixels); + r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA8,pixels); //r_capture->flip_y(); diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index b18f89d8e7..23f7cb6a1f 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -154,7 +154,7 @@ class RasterizerGLES2 : public Rasterizer { flags=width=height=0; tex_id=0; data_size=0; - format=Image::FORMAT_GRAYSCALE; + format=Image::FORMAT_L8; gl_components_cache=0; format_has_alpha=false; has_alpha=false; diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 5f4767940d..38c579c15c 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -105,8 +105,8 @@ precision mediump float; precision mediump int; #endif - // texunit:0 -uniform sampler2D texture; + +uniform sampler2D texture; // texunit:0 varying vec2 uv_interp; varying vec4 color_interp; @@ -319,7 +319,7 @@ LIGHT_SHADER_CODE #ifdef USE_DEPTH_SHADOWS -#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).z) +#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).r) #else diff --git a/drivers/gles3/SCsub b/drivers/gles3/SCsub new file mode 100644 index 0000000000..a17335b41b --- /dev/null +++ b/drivers/gles3/SCsub @@ -0,0 +1,5 @@ +Import('env') + +env.add_source_files(env.drivers_sources,"*.cpp") + +SConscript("shaders/SCsub") diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp new file mode 100644 index 0000000000..f24560763f --- /dev/null +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -0,0 +1,1461 @@ +#include "rasterizer_canvas_gles3.h" +#include "os/os.h" + +static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { + + p_array[ 0]=p_mtx.elements[0][0]; + p_array[ 1]=p_mtx.elements[0][1]; + p_array[ 2]=0; + p_array[ 3]=0; + p_array[ 4]=p_mtx.elements[1][0]; + p_array[ 5]=p_mtx.elements[1][1]; + p_array[ 6]=0; + p_array[ 7]=0; + p_array[ 8]=0; + p_array[ 9]=0; + p_array[10]=1; + p_array[11]=0; + p_array[12]=p_mtx.elements[2][0]; + p_array[13]=p_mtx.elements[2][1]; + p_array[14]=0; + p_array[15]=1; +} + + +static _FORCE_INLINE_ void store_transform(const Transform& p_mtx, float* p_array) { + p_array[ 0]=p_mtx.basis.elements[0][0]; + p_array[ 1]=p_mtx.basis.elements[1][0]; + p_array[ 2]=p_mtx.basis.elements[2][0]; + p_array[ 3]=0; + p_array[ 4]=p_mtx.basis.elements[0][1]; + p_array[ 5]=p_mtx.basis.elements[1][1]; + p_array[ 6]=p_mtx.basis.elements[2][1]; + p_array[ 7]=0; + p_array[ 8]=p_mtx.basis.elements[0][2]; + p_array[ 9]=p_mtx.basis.elements[1][2]; + p_array[10]=p_mtx.basis.elements[2][2]; + p_array[11]=0; + p_array[12]=p_mtx.origin.x; + p_array[13]=p_mtx.origin.y; + p_array[14]=p_mtx.origin.z; + p_array[15]=1; +} + +static _FORCE_INLINE_ void store_camera(const CameraMatrix& p_mtx, float* p_array) { + + for (int i=0;i<4;i++) { + for (int j=0;j<4;j++) { + + p_array[i*4+j]=p_mtx.matrix[i][j]; + } + } +} + + +RID RasterizerCanvasGLES3::light_internal_create() { + + LightInternal * li = memnew( LightInternal ); + + glGenBuffers(1, &li->ubo); + glBindBuffer(GL_UNIFORM_BUFFER, li->ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(LightInternal::UBOData), &state.canvas_item_ubo_data, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + return light_internal_owner.make_rid(li); +} + +void RasterizerCanvasGLES3::light_internal_update(RID p_rid, Light* p_light) { + + LightInternal * li = light_internal_owner.getornull(p_rid); + ERR_FAIL_COND(!li); + + store_matrix32(p_light->light_shader_xform,li->ubo_data.light_matrix); + store_matrix32(p_light->xform_cache.affine_inverse(),li->ubo_data.local_matrix); + store_camera(p_light->shadow_matrix_cache,li->ubo_data.shadow_matrix); + + for(int i=0;i<4;i++) { + + li->ubo_data.color[i]=p_light->color[i]*p_light->energy; + li->ubo_data.shadow_color[i]=p_light->shadow_color[i]; + } + + li->ubo_data.light_pos[0]=p_light->light_shader_pos.x; + li->ubo_data.light_pos[1]=p_light->light_shader_pos.y; + li->ubo_data.shadowpixel_size=1.0/p_light->shadow_buffer_size; + li->ubo_data.light_outside_alpha=p_light->mode==VS::CANVAS_LIGHT_MODE_MASK?1.0:0.0; + li->ubo_data.light_height=p_light->height; + if (p_light->radius_cache==0) + li->ubo_data.shadow_gradient=0; + else + li->ubo_data.shadow_gradient=p_light->shadow_gradient_length/(p_light->radius_cache*1.1);; + + li->ubo_data.shadow_distance_mult=(p_light->radius_cache*1.1); + + + glBindBuffer(GL_UNIFORM_BUFFER, li->ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0,sizeof(LightInternal::UBOData), &li->ubo_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + +} + +void RasterizerCanvasGLES3::light_internal_free(RID p_rid) { + + LightInternal * li = light_internal_owner.getornull(p_rid); + ERR_FAIL_COND(!li); + + glDeleteBuffers(1,&li->ubo); + light_internal_owner.free(p_rid); + memdelete(li); + +} + +void RasterizerCanvasGLES3::canvas_begin(){ + + /*canvas_shader.unbind(); + canvas_shader.set_custom_shader(0); + canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,false); + canvas_shader.bind(); + canvas_shader.set_uniform(CanvasShaderGLES2::TEXTURE, 0); + canvas_use_modulate=false;*/ + + reset_canvas(); + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_TEXTURE_RECT,true); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_LIGHTING,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SHADOWS,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_NEAREST,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF5,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF13,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD,false); + + + state.canvas_shader.bind(); + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,Color(1,1,1,1)); + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Matrix32()); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); + + + + +// state.canvas_shader.set_uniform(CanvasShaderGLES3::PROJECTION_MATRIX,state.vp); + //state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Transform()); + //state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Transform()); + + glBindBufferBase(GL_UNIFORM_BUFFER,0,state.canvas_item_ubo); + glBindVertexArray(data.canvas_quad_array); + state.using_texture_rect=true; + + +} + + +void RasterizerCanvasGLES3::canvas_end(){ + + + glBindVertexArray(0); + glBindBufferBase(GL_UNIFORM_BUFFER,0,0); + + state.using_texture_rect=false; + +} + + + +RasterizerStorageGLES3::Texture* RasterizerCanvasGLES3::_bind_canvas_texture(const RID& p_texture) { + + if (p_texture==state.current_tex) { + return state.current_tex_ptr; + } + + if (p_texture.is_valid()) { + + + RasterizerStorageGLES3::Texture*texture=storage->texture_owner.getornull(p_texture); + + if (!texture) { + state.current_tex=RID(); + state.current_tex_ptr=NULL; + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + return NULL; + } + + if (texture->render_target) + texture->render_target->used_in_frame=true; + + glBindTexture(GL_TEXTURE_2D,texture->tex_id); + state.current_tex=p_texture; + state.current_tex_ptr=texture; + + return texture; + + + } else { + + + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + state.current_tex=RID(); + state.current_tex_ptr=NULL; + } + + + return NULL; +} + +void RasterizerCanvasGLES3::_set_texture_rect_mode(bool p_enable) { + + if (state.using_texture_rect==p_enable) + return; + + if (p_enable) { + glBindVertexArray(data.canvas_quad_array); + + + } else { + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); + + + } + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_TEXTURE_RECT,p_enable); + state.canvas_shader.bind(); + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,state.extra_matrix); + + + state.using_texture_rect=p_enable; +} + + +void RasterizerCanvasGLES3::_draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor) { + + bool do_colors=false; + Color m; + if (p_singlecolor) { + m = *p_colors; + glVertexAttrib4f(VS::ARRAY_COLOR,m.r,m.g,m.b,m.a); + } else if (!p_colors) { + + glVertexAttrib4f(VS::ARRAY_COLOR,1,1,1,1); + } else + do_colors=true; + + RasterizerStorageGLES3::Texture *texture = _bind_canvas_texture(p_texture); + +#ifndef GLES_NO_CLIENT_ARRAYS + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(Vector2), p_vertices ); + if (do_colors) { + + glEnableVertexAttribArray(VS::ARRAY_COLOR); + glVertexAttribPointer( VS::ARRAY_COLOR, 4 ,GL_FLOAT, false, sizeof(Color), p_colors ); + } else { + glDisableVertexAttribArray(VS::ARRAY_COLOR); + } + + if (texture && p_uvs) { + + glEnableVertexAttribArray(VS::ARRAY_TEX_UV); + glVertexAttribPointer( VS::ARRAY_TEX_UV, 2 ,GL_FLOAT, false, sizeof(Vector2), p_uvs ); + } else { + glDisableVertexAttribArray(VS::ARRAY_TEX_UV); + } + + if (p_indices) { +#ifdef GLEW_ENABLED + glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices ); +#else + static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!! + ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices); + static uint16_t _draw_poly_indices[_max_draw_poly_indices]; + for (int i=0; i MAX_POLYGON_VERTICES){ + print_line("Too many vertices to render"); + return; + } + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(float)*2, ((float*)0)+ofs ); + for(int i=0;i _max_draw_poly_indices); + static uint16_t _draw_poly_indices[_max_draw_poly_indices]; + for (int i=0; iprint("ind: %d ", p_indices[i]); + }; + + //copy the data to GPU. + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, p_vertex_count * sizeof(uint16_t), &_draw_poly_indices[0]); + + //draw the triangles. + glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_SHORT, 0); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); +#endif + + storage->frame.canvas_draw_commands++; + +} + +void RasterizerCanvasGLES3::_draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color* p_colors, const Vector2 *p_uvs) { + + + + static const GLenum prim[5]={GL_POINTS,GL_POINTS,GL_LINES,GL_TRIANGLES,GL_TRIANGLE_FAN}; + + + //#define GLES_USE_PRIMITIVE_BUFFER + +#ifndef GLES_NO_CLIENT_ARRAYS + + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(Vector2), p_vertices ); + + if (p_colors) { + + glEnableVertexAttribArray(VS::ARRAY_COLOR); + glVertexAttribPointer( VS::ARRAY_COLOR, 4 ,GL_FLOAT, false, sizeof(Color), p_colors ); + } else { + glDisableVertexAttribArray(VS::ARRAY_COLOR); + } + + if (p_uvs) { + + glEnableVertexAttribArray(VS::ARRAY_TEX_UV); + glVertexAttribPointer( VS::ARRAY_TEX_UV, 2 ,GL_FLOAT, false, sizeof(Vector2), p_uvs ); + } else { + glDisableVertexAttribArray(VS::ARRAY_TEX_UV); + } + + glDrawArrays(prim[p_points],0,p_points); + +#else + + glBindBuffer(GL_ARRAY_BUFFER,gui_quad_buffer); + float b[32]; + int ofs=0; + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, sizeof(float)*2, ((float*)0)+ofs ); + for(int i=0;iframe.canvas_draw_commands++; +} + +void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *current_clip,bool &reclip) { + + int cc=p_item->commands.size(); + Item::Command **commands = p_item->commands.ptr(); + + + for(int i=0;itype) { + case Item::Command::TYPE_LINE: { + + + Item::CommandLine* line = static_cast(c); + _set_texture_rect_mode(false); + + + _bind_canvas_texture(RID()); + + glVertexAttrib4f(VS::ARRAY_COLOR,line->color.r,line->color.g,line->color.b,line->color.a); + + Vector2 verts[2]={ + Vector2(line->from.x,line->from.y), + Vector2(line->to.x,line->to.y) + }; + +#ifdef GLEW_ENABLED + if (line->antialiased) + glEnable(GL_LINE_SMOOTH); +#endif + glLineWidth(line->width); + _draw_gui_primitive(2,verts,NULL,NULL); + +#ifdef GLEW_ENABLED + if (line->antialiased) + glDisable(GL_LINE_SMOOTH); +#endif + + + } break; + case Item::Command::TYPE_RECT: { + + Item::CommandRect* rect = static_cast(c); + + _set_texture_rect_mode(true); + + //set color + glVertexAttrib4f(VS::ARRAY_COLOR,rect->modulate.r,rect->modulate.g,rect->modulate.b,rect->modulate.a); + + RasterizerStorageGLES3::Texture* texture = _bind_canvas_texture(rect->texture); + + if ( texture ) { + + bool untile=false; + + if (rect->flags&CANVAS_RECT_TILE && !(texture->flags&VS::TEXTURE_FLAG_REPEAT)) { + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + untile=true; + } + + Size2 texpixel_size( 1.0/texture->width, 1.0/texture->height ); + Rect2 src_rect = (rect->flags&CANVAS_RECT_REGION) ? Rect2( rect->source.pos * texpixel_size, rect->source.size * texpixel_size ) : Rect2(0,0,1,1); + + if (rect->flags&CANVAS_RECT_FLIP_H) { + src_rect.size.x*=-1; + } + + if (rect->flags&CANVAS_RECT_FLIP_V) { + src_rect.size.x*=-1; + } + + if (rect->flags&CANVAS_RECT_TRANSPOSE) { + //err.. + } + + + glVertexAttrib4f(1,rect->rect.pos.x,rect->rect.pos.y,rect->rect.size.x,rect->rect.size.y); + glVertexAttrib4f(2,src_rect.pos.x,src_rect.pos.y,src_rect.size.x,src_rect.size.y); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + + if (untile) { + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + } + + } else { + + + glVertexAttrib4f(1,rect->rect.pos.x,rect->rect.pos.y,rect->rect.size.x,rect->rect.size.y); + glVertexAttrib4f(2,0,0,1,1); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + + } + + storage->frame.canvas_draw_commands++; + + } break; + + case Item::Command::TYPE_NINEPATCH: { + + Item::CommandNinePatch* np = static_cast(c); + + _set_texture_rect_mode(true); + + glVertexAttrib4f(VS::ARRAY_COLOR,np->color.r,np->color.g,np->color.b,np->color.a); + + + RasterizerStorageGLES3::Texture* texture = _bind_canvas_texture(np->texture); + + if ( !texture ) { + + glVertexAttrib4f(1,np->rect.pos.x,np->rect.pos.y,np->rect.size.x,np->rect.size.y); + glVertexAttrib4f(2,0,0,1,1); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + continue; + } + + + Size2 texpixel_size( 1.0/texture->width, 1.0/texture->height ); + +#define DSTRECT(m_x,m_y,m_w,m_h) glVertexAttrib4f(1,m_x,m_y,m_w,m_h) +#define SRCRECT(m_x,m_y,m_w,m_h) glVertexAttrib4f(2,(m_x)*texpixel_size.x,(m_y)*texpixel_size.y,(m_w)*texpixel_size.x,(m_h)*texpixel_size.y) + + //top left + DSTRECT(np->rect.pos.x,np->rect.pos.y,np->margin[MARGIN_LEFT],np->margin[MARGIN_TOP]); + SRCRECT(0,0,np->margin[MARGIN_LEFT],np->margin[MARGIN_TOP]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + //top right + DSTRECT(np->rect.pos.x+np->rect.size.x-np->margin[MARGIN_RIGHT],np->rect.pos.y,np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP]); + SRCRECT(texture->width-np->margin[MARGIN_RIGHT],0,np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + //bottom right + DSTRECT(np->rect.pos.x+np->rect.size.x-np->margin[MARGIN_RIGHT],np->rect.pos.y+np->rect.size.y-np->margin[MARGIN_BOTTOM],np->margin[MARGIN_RIGHT],np->margin[MARGIN_BOTTOM]); + SRCRECT(texture->width-np->margin[MARGIN_RIGHT],texture->height-np->margin[MARGIN_BOTTOM],np->margin[MARGIN_RIGHT],np->margin[MARGIN_BOTTOM]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + //bottom left + DSTRECT(np->rect.pos.x,np->rect.pos.y+np->rect.size.y-np->margin[MARGIN_BOTTOM],np->margin[MARGIN_LEFT],np->margin[MARGIN_BOTTOM]); + SRCRECT(0,texture->height-np->margin[MARGIN_BOTTOM],np->margin[MARGIN_LEFT],np->margin[MARGIN_BOTTOM]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + + //top + DSTRECT(np->rect.pos.x+np->margin[MARGIN_LEFT],np->rect.pos.y,np->rect.size.width-np->margin[MARGIN_LEFT]-np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP]); + SRCRECT(np->margin[MARGIN_LEFT],0,texture->width-np->margin[MARGIN_LEFT]-np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + //bottom + DSTRECT(np->rect.pos.x+np->margin[MARGIN_LEFT],np->rect.pos.y+np->rect.size.y-np->margin[MARGIN_BOTTOM],np->rect.size.width-np->margin[MARGIN_LEFT]-np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP]); + SRCRECT(np->margin[MARGIN_LEFT],texture->height-np->margin[MARGIN_BOTTOM],texture->width-np->margin[MARGIN_LEFT]-np->margin[MARGIN_LEFT],np->margin[MARGIN_TOP]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + + //left + DSTRECT(np->rect.pos.x,np->rect.pos.y+np->margin[MARGIN_TOP],np->margin[MARGIN_LEFT],np->rect.size.height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + SRCRECT(0,np->margin[MARGIN_TOP],np->margin[MARGIN_LEFT],texture->height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + //right + DSTRECT(np->rect.pos.x+np->rect.size.width-np->margin[MARGIN_RIGHT],np->rect.pos.y+np->margin[MARGIN_TOP],np->margin[MARGIN_RIGHT],np->rect.size.height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + SRCRECT(texture->width-np->margin[MARGIN_RIGHT],np->margin[MARGIN_TOP],np->margin[MARGIN_RIGHT],texture->height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + if (np->draw_center) { + + //center + DSTRECT(np->rect.pos.x+np->margin[MARGIN_LEFT],np->rect.pos.y+np->margin[MARGIN_TOP],np->rect.size.x-np->margin[MARGIN_LEFT]-np->margin[MARGIN_RIGHT],np->rect.size.height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + SRCRECT(np->margin[MARGIN_LEFT],np->margin[MARGIN_TOP],texture->width-np->margin[MARGIN_LEFT]-np->margin[MARGIN_RIGHT],texture->height-np->margin[MARGIN_TOP]-np->margin[MARGIN_BOTTOM]); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + } + +#undef SRCRECT +#undef DSTRECT + + storage->frame.canvas_draw_commands++; + } break; + + case Item::Command::TYPE_PRIMITIVE: { + + Item::CommandPrimitive* primitive = static_cast(c); + _set_texture_rect_mode(false); + + ERR_CONTINUE( primitive->points.size()<1); + + _bind_canvas_texture(primitive->texture); + + if (primitive->colors.size()==1 && primitive->points.size()>1) { + + Color c = primitive->colors[0]; + glVertexAttrib4f(VS::ARRAY_COLOR,c.r,c.g,c.b,c.a); + + } else if (primitive->colors.empty()) { + glVertexAttrib4f(VS::ARRAY_COLOR,1,1,1,1); + } + + _draw_gui_primitive(primitive->points.size(),primitive->points.ptr(),primitive->colors.ptr(),primitive->uvs.ptr()); + + } break; + case Item::Command::TYPE_POLYGON: { + + Item::CommandPolygon* polygon = static_cast(c); + _set_texture_rect_mode(false); + _draw_polygon(polygon->count,polygon->indices.ptr(),polygon->points.ptr(),polygon->uvs.ptr(),polygon->colors.ptr(),polygon->texture,polygon->colors.size()==1); + + } break; + case Item::Command::TYPE_CIRCLE: { + + _set_texture_rect_mode(false); + + Item::CommandCircle* circle = static_cast(c); + static const int numpoints=32; + Vector2 points[numpoints+1]; + points[numpoints]=circle->pos; + int indices[numpoints*3]; + + for(int i=0;ipos+Vector2( Math::sin(i*Math_PI*2.0/numpoints),Math::cos(i*Math_PI*2.0/numpoints) )*circle->radius; + indices[i*3+0]=i; + indices[i*3+1]=(i+1)%numpoints; + indices[i*3+2]=numpoints; + } + _draw_polygon(numpoints*3,indices,points,NULL,&circle->color,RID(),true); + //canvas_draw_circle(circle->indices.size(),circle->indices.ptr(),circle->points.ptr(),circle->uvs.ptr(),circle->colors.ptr(),circle->texture,circle->colors.size()==1); + } break; + case Item::Command::TYPE_TRANSFORM: { + + Item::CommandTransform* transform = static_cast(c); + state.extra_matrix=transform->xform; + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,state.extra_matrix); + + } break; + case Item::Command::TYPE_CLIP_IGNORE: { + + Item::CommandClipIgnore* ci = static_cast(c); + if (current_clip) { + + if (ci->ignore!=reclip) { + if (ci->ignore) { + + glDisable(GL_SCISSOR_TEST); + reclip=true; + } else { + + glEnable(GL_SCISSOR_TEST); + //glScissor(viewport.x+current_clip->final_clip_rect.pos.x,viewport.y+ (viewport.height-(current_clip->final_clip_rect.pos.y+current_clip->final_clip_rect.size.height)), + //current_clip->final_clip_rect.size.width,current_clip->final_clip_rect.size.height); + + int x = current_clip->final_clip_rect.pos.x; + int y = storage->frame.current_rt->height - ( current_clip->final_clip_rect.pos.y + current_clip->final_clip_rect.size.y ); + int w = current_clip->final_clip_rect.size.x; + int h = current_clip->final_clip_rect.size.y; + + glScissor(x,y,w,h); + + reclip=false; + } + } + } + + + + } break; + } + } +} + +#if 0 +void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *material,Shader* shader) { + + if (canvas_shader.bind()) + rebind_texpixel_size=true; + + if (material->shader_version!=shader->version) { + //todo optimize uniforms + material->shader_version=shader->version; + } + + if (shader->has_texscreen && framebuffer.active) { + + int x = viewport.x; + int y = window_size.height-(viewport.height+viewport.y); + + canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_MULT,Vector2(float(viewport.width)/framebuffer.width,float(viewport.height)/framebuffer.height)); + canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height)); + canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_TEX,max_texture_units-1); + glActiveTexture(GL_TEXTURE0+max_texture_units-1); + glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); + if (framebuffer.scale==1 && !canvas_texscreen_used) { +#ifdef GLEW_ENABLED + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } +#endif + if (current_rt) { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height); + canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height)); + //window_size.height-(viewport.height+viewport.y) + } else { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); + } +// if (current_clip) { +// // print_line(" a clip "); +// } + + canvas_texscreen_used=true; + } + + glActiveTexture(GL_TEXTURE0); + + } + + if (shader->has_screen_uv) { + canvas_shader.set_uniform(CanvasShaderGLES2::SCREEN_UV_MULT,Vector2(1.0/viewport.width,1.0/viewport.height)); + } + + + uses_texpixel_size=shader->uses_texpixel_size; + +} + +#endif + +void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const Color& p_modulate,Light *p_light) { + + + if (storage->frame.clear_request) { + // a clear request may be pending, so do it + glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); + glClear(GL_COLOR_BUFFER_BIT); + storage->frame.clear_request=false; + + + } + + Item *current_clip=NULL; + RasterizerStorageGLES3::Shader *shader_cache=NULL; + + bool rebind_shader=true; + + Size2 rt_size = Size2(storage->frame.current_rt->width,storage->frame.current_rt->height); + + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD,false); + + glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + state.current_tex=RID(); + state.current_tex_ptr=NULL; + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + + + RID canvas_last_material; + + bool prev_distance_field=false; + + while(p_item_list) { + + Item *ci=p_item_list; + + + if (prev_distance_field!=ci->distance_field) { + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD,ci->distance_field); + prev_distance_field=ci->distance_field; + rebind_shader=true; + } + + + if (current_clip!=ci->final_clip_owner) { + + current_clip=ci->final_clip_owner; + + //setup clip + if (current_clip) { + + glEnable(GL_SCISSOR_TEST); + glScissor(current_clip->final_clip_rect.pos.x,(rt_size.height-(current_clip->final_clip_rect.pos.y+current_clip->final_clip_rect.size.height)),current_clip->final_clip_rect.size.width,current_clip->final_clip_rect.size.height); + + + } else { + + glDisable(GL_SCISSOR_TEST); + } + } +#if 0 + if (ci->copy_back_buffer && framebuffer.active && framebuffer.scale==1) { + + Rect2 rect; + int x,y; + + if (ci->copy_back_buffer->full) { + + x = viewport.x; + y = window_size.height-(viewport.height+viewport.y); + } else { + x = viewport.x+ci->copy_back_buffer->screen_rect.pos.x; + y = window_size.height-(viewport.y+ci->copy_back_buffer->screen_rect.pos.y+ci->copy_back_buffer->screen_rect.size.y); + } + glActiveTexture(GL_TEXTURE0+max_texture_units-1); + glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); + +#ifdef GLEW_ENABLED + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } +#endif + if (current_rt) { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height); + //window_size.height-(viewport.height+viewport.y) + } else { + glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); + } + + canvas_texscreen_used=true; + glActiveTexture(GL_TEXTURE0); + + } + +#endif + + + //begin rect + Item *material_owner = ci->material_owner?ci->material_owner:ci; + + RID material = material_owner->material; + + if (material!=canvas_last_material || rebind_shader) { +#if 0 + Shader *shader = NULL; + if (material && material->shader.is_valid()) { + shader = shader_owner.get(material->shader); + if (shader && !shader->valid) { + shader=NULL; + } + } + + shader_cache=shader; + + if (shader) { + canvas_shader.set_custom_shader(shader->custom_code_id); + _canvas_item_setup_shader_params(material,shader); + } else { + shader_cache=NULL; + canvas_shader.set_custom_shader(0); + canvas_shader.bind(); + uses_texpixel_size=false; + + } + + + canvas_shader.set_uniform(CanvasShaderGLES3::PROJECTION_MATRIX,canvas_transform); + if (canvas_use_modulate) + reset_modulate=true; + canvas_last_material=material; + rebind_shader=false; +#endif + } + + if (material.is_valid() && shader_cache) { +#if 0 + _canvas_item_setup_shader_uniforms(material,shader_cache); +#endif + } + + bool unshaded = false; //(material && material->shading_mode==VS::CANVAS_ITEM_SHADING_UNSHADED) || ci->blend_mode!=VS::MATERIAL_BLEND_MODE_MIX; + bool reclip=false; +#if 0 + if (ci==p_item_list || ci->blend_mode!=canvas_blend_mode) { + + switch(ci->blend_mode) { + + case VS::MATERIAL_BLEND_MODE_MIX: { + glBlendEquation(GL_FUNC_ADD); + if (current_rt && current_rt_transparent) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + } break; + case VS::MATERIAL_BLEND_MODE_ADD: { + + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + + } break; + case VS::MATERIAL_BLEND_MODE_SUB: { + + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + } break; + case VS::MATERIAL_BLEND_MODE_MUL: { + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_DST_COLOR,GL_ZERO); + } break; + case VS::MATERIAL_BLEND_MODE_PREMULT_ALPHA: { + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA); + } break; + + } + + canvas_blend_mode=ci->blend_mode; + } +#endif + +// canvas_shader.set_uniform(CanvasShaderGLES3::CANVAS_MODULATE,unshaded ? Color(1,1,1,1) : p_modulate); + + state.canvas_item_modulate = unshaded ? ci->final_modulate : Color( + ci->final_modulate.r * p_modulate.r, + ci->final_modulate.g * p_modulate.g, + ci->final_modulate.b * p_modulate.b, + ci->final_modulate.a * p_modulate.a ); + + state.final_transform = ci->final_transform; + state.extra_matrix=Matrix32(); + + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,state.extra_matrix); + + + if (unshaded || (state.canvas_item_modulate.a>0.001 && (!material.is_valid() /*|| material->shading_mode!=VS::CANVAS_ITEM_SHADING_ONLY_LIGHT*/) && !ci->light_masked )) + _canvas_item_render_commands(ci,current_clip,reclip); + + if (/*canvas_blend_mode==VS::MATERIAL_BLEND_MODE_MIX &&*/ p_light && !unshaded) { + + Light *light = p_light; + bool light_used=false; + VS::CanvasLightMode mode=VS::CANVAS_LIGHT_MODE_ADD; + state.canvas_item_modulate=ci->final_modulate; // remove the canvas modulate + + + while(light) { + + + if (ci->light_mask&light->item_mask && p_z>=light->z_min && p_z<=light->z_max && ci->global_rect_cache.intersects_transformed(light->xform_cache,light->rect_cache)) { + + //intersects this light + + if (!light_used || mode!=light->mode) { + + mode=light->mode; + + switch(mode) { + + case VS::CANVAS_LIGHT_MODE_ADD: { + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + + } break; + case VS::CANVAS_LIGHT_MODE_SUB: { + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + } break; + case VS::CANVAS_LIGHT_MODE_MIX: + case VS::CANVAS_LIGHT_MODE_MASK: { + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + } break; + } + + } + + if (!light_used) { + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_LIGHTING,true); + light_used=true; + + } + + + bool has_shadow = light->shadow_buffer.is_valid() && ci->light_mask&light->item_shadow_mask; + + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SHADOWS,has_shadow); + if (has_shadow) { + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_USE_GRADIENT,light->shadow_gradient_length>0); + switch(light->shadow_filter) { + + case VS::CANVAS_LIGHT_FILTER_NONE: state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_NEAREST,true); break; + case VS::CANVAS_LIGHT_FILTER_PCF3: state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF3,true); break; + case VS::CANVAS_LIGHT_FILTER_PCF5: state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF5,true); break; + case VS::CANVAS_LIGHT_FILTER_PCF9: state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF9,true); break; + case VS::CANVAS_LIGHT_FILTER_PCF13: state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF13,true); break; + } + + + } + + bool light_rebind = state.canvas_shader.bind(); + + if (light_rebind) { +#if 0 + if (material && shader_cache) { + _canvas_item_setup_shader_params(material,shader_cache); + _canvas_item_setup_shader_uniforms(material,shader_cache); + } +#endif + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); + + } + + glBindBufferBase(GL_UNIFORM_BUFFER,1,static_cast(light->light_internal.get_data())->ubo); + + if (has_shadow) { + + RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(light->shadow_buffer); + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); + glBindTexture(GL_TEXTURE_2D,cls->distance); + + /*canvas_shader.set_uniform(CanvasShaderGLES3::SHADOW_MATRIX,light->shadow_matrix_cache); + canvas_shader.set_uniform(CanvasShaderGLES3::SHADOW_ESM_MULTIPLIER,light->shadow_esm_mult); + canvas_shader.set_uniform(CanvasShaderGLES3::LIGHT_SHADOW_COLOR,light->shadow_color);*/ + + } + + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-1); + RasterizerStorageGLES3::Texture *t = storage->texture_owner.getornull(light->texture); + if (!t) { + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + } else { + + glBindTexture(t->target,t->tex_id); + } + + glActiveTexture(GL_TEXTURE0); + _canvas_item_render_commands(ci,current_clip,reclip); //redraw using light + + } + + light=light->next_ptr; + } + + if (light_used) { + + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_LIGHTING,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SHADOWS,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_NEAREST,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF3,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF5,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF9,false); + state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF13,false); + + + state.canvas_shader.bind(); +#if 0 + if (material && shader_cache) { + _canvas_item_setup_shader_params(material,shader_cache); + _canvas_item_setup_shader_uniforms(material,shader_cache); + } +#endif + + state.canvas_item_modulate = unshaded ? ci->final_modulate : Color( + ci->final_modulate.r * p_modulate.r, + ci->final_modulate.g * p_modulate.g, + ci->final_modulate.b * p_modulate.b, + ci->final_modulate.a * p_modulate.a ); + + + state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); + state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); + + + glBlendEquation(GL_FUNC_ADD); + + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + //@TODO RESET canvas_blend_mode + } + + + } + + if (reclip) { + + glEnable(GL_SCISSOR_TEST); + glScissor(current_clip->final_clip_rect.pos.x,(rt_size.height-(current_clip->final_clip_rect.pos.y+current_clip->final_clip_rect.size.height)),current_clip->final_clip_rect.size.width,current_clip->final_clip_rect.size.height); + + + } + + + + p_item_list=p_item_list->next; + } + + if (current_clip) { + glDisable(GL_SCISSOR_TEST); + } + +} + +void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light* p_lights_with_shadow){ + + Light* light=p_lights_with_shadow; + + canvas_begin(); //reset + glVertexAttrib4f(VS::ARRAY_COLOR,1,1,1,1); + int h = 10; + int w = storage->frame.current_rt->width; + int ofs = h; + glDisable(GL_BLEND); + + //print_line(" debug lights "); + while(light) { + + + // print_line("debug light"); + if (light->shadow_buffer.is_valid()) { + + // print_line("sb is valid"); + RasterizerStorageGLES3::CanvasLightShadow * sb = storage->canvas_light_shadow_owner.get(light->shadow_buffer); + if (sb) { + glBindTexture(GL_TEXTURE_2D,sb->distance); + //glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + draw_generic_textured_rect(Rect2(h,ofs,w-h*2,h),Rect2(0,0,1,1)); + ofs+=h*2; + + } + } + + light=light->shadows_next_ptr; + } +} + + +void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache) { + + RasterizerStorageGLES3::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.get(p_buffer); + ERR_FAIL_COND(!cls); + + + glDisable(GL_BLEND); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_DITHER); + glDisable(GL_CULL_FACE); + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + glDepthMask(true); + + glBindFramebuffer(GL_FRAMEBUFFER, cls->fbo); + + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + state.canvas_shadow_shader.bind(); + + glViewport(0, 0, cls->size,cls->height); + glClearDepth(1.0f); + glClearColor(1,1,1,1); + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + + VS::CanvasOccluderPolygonCullMode cull=VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED; + + + for(int i=0;i<4;i++) { + + //make sure it remains orthogonal, makes easy to read angle later + + Transform light; + light.origin[0]=p_light_xform[2][0]; + light.origin[1]=p_light_xform[2][1]; + light.basis[0][0]=p_light_xform[0][0]; + light.basis[0][1]=p_light_xform[1][0]; + light.basis[1][0]=p_light_xform[0][1]; + light.basis[1][1]=p_light_xform[1][1]; + + //light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1)); + + /// p_near=1; + CameraMatrix projection; + { + real_t fov = 90; + real_t near = p_near; + real_t far = p_far; + real_t aspect = 1.0; + + real_t ymax = near * Math::tan( Math::deg2rad( fov * 0.5 ) ); + real_t ymin = - ymax; + real_t xmin = ymin * aspect; + real_t xmax = ymax * aspect; + + projection.set_frustum( xmin, xmax, ymin, ymax, near, far ); + } + + Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0)); + projection = projection * CameraMatrix(Transform().looking_at(cam_target,Vector3(0,0,-1)).affine_inverse()); + + state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::PROJECTION_MATRIX,projection); + state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::LIGHT_MATRIX,light); + state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::DISTANCE_NORM,1.0/p_far); + + + if (i==0) + *p_xform_cache=projection; + + glViewport(0, (cls->height/4)*i, cls->size,cls->height/4); + + LightOccluderInstance *instance=p_occluders; + + while(instance) { + + RasterizerStorageGLES3::CanvasOccluder *cc = storage->canvas_occluder_owner.get(instance->polygon_buffer); + if (!cc || cc->len==0 || !(p_light_mask&instance->light_mask)) { + + instance=instance->next; + continue; + } + + state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES3::WORLD_MATRIX,instance->xform_cache); + if (cull!=instance->cull_cache) { + + cull=instance->cull_cache; + switch(cull) { + case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: { + + glDisable(GL_CULL_FACE); + + } break; + case VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: { + + glEnable(GL_CULL_FACE); + glCullFace(GL_FRONT); + } break; + case VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: { + + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + + } break; + } + } +/* + if (i==0) { + for(int i=0;ilines.size();i++) { + Vector2 p = instance->xform_cache.xform(cc->lines.get(i)); + Plane pp(Vector3(p.x,p.y,0),1); + pp.normal = light.xform(pp.normal); + pp = projection.xform4(pp); + print_line(itos(i)+": "+pp.normal/pp.d); + //pp=light_mat.xform4(pp); + //print_line(itos(i)+": "+pp.normal/pp.d); + } + } +*/ + glBindBuffer(GL_ARRAY_BUFFER,cc->vertex_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,cc->index_id); + glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0); + glDrawElements(GL_TRIANGLES,cc->len*3,GL_UNSIGNED_SHORT,0); + + + instance=instance->next; + } + + + } + + glDisableVertexAttribArray(VS::ARRAY_VERTEX); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); +} +void RasterizerCanvasGLES3::reset_canvas() { + + + if (storage->frame.current_rt) { + glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->front.fbo); + glColorMask(1,1,1,1); //don't touch alpha + } + + + glBindVertexArray(0); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); +#ifdef GLEW_ENABLED + glDisable(GL_POINT_SPRITE); + glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); +#endif + glEnable(GL_BLEND); + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + //glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glLineWidth(1.0); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); + for(int i=0;iresources.white_tex ); + + + glVertexAttrib4f(VS::ARRAY_COLOR,1,1,1,1); + + Transform canvas_transform; + + if (storage->frame.current_rt) { + + float csy = 1.0; + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { + csy = -1.0; + } + canvas_transform.translate(-(storage->frame.current_rt->width / 2.0f), -(storage->frame.current_rt->height / 2.0f), 0.0f); + canvas_transform.scale( Vector3( 2.0f / storage->frame.current_rt->width, csy * -2.0f / storage->frame.current_rt->height, 1.0f ) ); + } else { + Vector2 ssize = OS::get_singleton()->get_window_size(); + canvas_transform.translate(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f); + canvas_transform.scale( Vector3( 2.0f / ssize.width, -2.0f / ssize.height, 1.0f ) ); + + } + + state.vp=canvas_transform; + + store_transform(canvas_transform,state.canvas_item_ubo_data.projection_matrix); + + glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + + state.canvas_texscreen_used=false; + + +} + + +void RasterizerCanvasGLES3::draw_generic_textured_rect(const Rect2& p_rect, const Rect2& p_src) { + + + glVertexAttrib4f(1,p_rect.pos.x,p_rect.pos.y,p_rect.size.x,p_rect.size.y); + glVertexAttrib4f(2,p_src.pos.x,p_src.pos.y,p_src.size.x,p_src.size.y); + glDrawArrays(GL_TRIANGLE_FAN,0,4); +} + +void RasterizerCanvasGLES3::initialize() { + + + { + //quad buffers + + glGenBuffers(1,&data.canvas_quad_vertices); + glBindBuffer(GL_ARRAY_BUFFER,data.canvas_quad_vertices); + { + const float qv[8]={ + 0,0, + 0,1, + 1,1, + 1,0 + }; + + glBufferData(GL_ARRAY_BUFFER,sizeof(float)*8,qv,GL_STATIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + + glGenVertexArrays(1,&data.canvas_quad_array); + glBindVertexArray(data.canvas_quad_array); + glBindBuffer(GL_ARRAY_BUFFER,data.canvas_quad_vertices); + glVertexAttribPointer(0,2,GL_FLOAT,GL_FALSE,sizeof(float)*2,0); + glEnableVertexAttribArray(0); + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + } + + + store_transform(Transform(),state.canvas_item_ubo_data.projection_matrix); + + + + glGenBuffers(1, &state.canvas_item_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + state.canvas_shader.init(); + state.canvas_shadow_shader.init(); + + state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_RGBA_SHADOWS,storage->config.use_rgba_2d_shadows); + state.canvas_shadow_shader.set_conditional(CanvasShadowShaderGLES3::USE_RGBA_SHADOWS,storage->config.use_rgba_2d_shadows); + + +} + + +void RasterizerCanvasGLES3::finalize() { + + glDeleteBuffers(1,&data.canvas_quad_vertices); + glDeleteVertexArrays(1,&data.canvas_quad_array); +} + +RasterizerCanvasGLES3::RasterizerCanvasGLES3() +{ + +} diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h new file mode 100644 index 0000000000..1f72a8dbcf --- /dev/null +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -0,0 +1,102 @@ +#ifndef RASTERIZERCANVASGLES3_H +#define RASTERIZERCANVASGLES3_H + +#include "servers/visual/rasterizer.h" +#include "rasterizer_storage_gles3.h" +#include "shaders/canvas_shadow.glsl.h" + +class RasterizerCanvasGLES3 : public RasterizerCanvas { +public: + + struct CanvasItemUBO { + + float projection_matrix[16]; + + }; + + struct Data { + + GLuint canvas_quad_vertices; + GLuint canvas_quad_array; + + } data; + + struct State { + CanvasItemUBO canvas_item_ubo_data; + GLuint canvas_item_ubo; + bool canvas_texscreen_used; + CanvasShaderGLES3 canvas_shader; + CanvasShadowShaderGLES3 canvas_shadow_shader; + + bool using_texture_rect; + + + RID current_tex; + RasterizerStorageGLES3::Texture *current_tex_ptr; + + Transform vp; + + Color canvas_item_modulate; + Matrix32 extra_matrix; + Matrix32 final_transform; + + } state; + + RasterizerStorageGLES3 *storage; + + struct LightInternal : public RID_Data { + + struct UBOData { + + float light_matrix[16]; + float local_matrix[16]; + float shadow_matrix[16]; + float color[4]; + float shadow_color[4]; + float light_pos[2]; + float shadowpixel_size; + float shadow_gradient; + float light_height; + float light_outside_alpha; + float shadow_distance_mult; + } ubo_data; + + GLuint ubo; + }; + + RID_Owner light_internal_owner; + + virtual RID light_internal_create(); + virtual void light_internal_update(RID p_rid, Light* p_light); + virtual void light_internal_free(RID p_rid); + + + virtual void canvas_begin(); + virtual void canvas_end(); + + _FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable); + _FORCE_INLINE_ RasterizerStorageGLES3::Texture* _bind_canvas_texture(const RID& p_texture); + + _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color* p_colors, const Vector2 *p_uvs); + _FORCE_INLINE_ void _draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor); + _FORCE_INLINE_ void _canvas_item_render_commands(Item *p_item,Item *current_clip,bool &reclip); + + + virtual void canvas_render_items(Item *p_item_list,int p_z,const Color& p_modulate,Light *p_light); + virtual void canvas_debug_viewport_shadows(Light* p_lights_with_shadow); + + virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, LightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache); + + + virtual void reset_canvas(); + + void draw_generic_textured_rect(const Rect2& p_rect, const Rect2& p_src); + + + void initialize(); + void finalize(); + + RasterizerCanvasGLES3(); +}; + +#endif // RASTERIZERCANVASGLES3_H diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp new file mode 100644 index 0000000000..ba83a572e5 --- /dev/null +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -0,0 +1,266 @@ +#include "rasterizer_gles3.h" +#include "os/os.h" +#include "globals.h" +#include "gl_context/context_gl.h" +#include +RasterizerStorage *RasterizerGLES3::get_storage() { + + return storage; +} + +RasterizerCanvas *RasterizerGLES3::get_canvas() { + + return canvas; +} + +RasterizerScene *RasterizerGLES3::get_scene() { + + return NULL; +} + + +static void _gl_debug_print(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam) +{ + + if (type==GL_DEBUG_TYPE_OTHER_ARB) + return; + + print_line("mesege"); + char debSource[256], debType[256], debSev[256]; + if(source == GL_DEBUG_SOURCE_API_ARB) + strcpy(debSource, "OpenGL"); + else if(source == GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB) + strcpy(debSource, "Windows"); + else if(source == GL_DEBUG_SOURCE_SHADER_COMPILER_ARB) + strcpy(debSource, "Shader Compiler"); + else if(source == GL_DEBUG_SOURCE_THIRD_PARTY_ARB) + strcpy(debSource, "Third Party"); + else if(source == GL_DEBUG_SOURCE_APPLICATION_ARB) + strcpy(debSource, "Application"); + else if(source == GL_DEBUG_SOURCE_OTHER_ARB) + strcpy(debSource, "Other"); + + if(type == GL_DEBUG_TYPE_ERROR_ARB) + strcpy(debType, "Error"); + else if(type == GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB) + strcpy(debType, "Deprecated behavior"); + else if(type == GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB) + strcpy(debType, "Undefined behavior"); + else if(type == GL_DEBUG_TYPE_PORTABILITY_ARB) + strcpy(debType, "Portability"); + else if(type == GL_DEBUG_TYPE_PERFORMANCE_ARB) + strcpy(debType, "Performance"); + else if(type == GL_DEBUG_TYPE_OTHER_ARB) + strcpy(debType, "Other"); + + if(severity == GL_DEBUG_SEVERITY_HIGH_ARB) + strcpy(debSev, "High"); + else if(severity == GL_DEBUG_SEVERITY_MEDIUM_ARB) + strcpy(debSev, "Medium"); + else if(severity == GL_DEBUG_SEVERITY_LOW_ARB) + strcpy(debSev, "Low"); + + String output = String()+ "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message; + + ERR_PRINTS(output); + +} + + +void RasterizerGLES3::initialize() { + + if (OS::get_singleton()->is_stdout_verbose()) { + print_line("Using GLES3 video driver"); + } + +#ifdef GLEW_ENABLED + GLuint res = glewInit(); + ERR_FAIL_COND(res!=GLEW_OK); + if (OS::get_singleton()->is_stdout_verbose()) { + print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION)); + } + + // Check for GL 2.1 compatibility, if not bail out + if (!glewIsSupported("GL_VERSION_3_0")) { + ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n" + "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); + OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n" + "Godot Engine will self-destruct as soon as you acknowledge this error message.", + "Fatal error: Insufficient OpenGL / GLES drivers"); + // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :) + } +#endif + + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); + glDebugMessageCallbackARB(_gl_debug_print, NULL); + glEnable(GL_DEBUG_OUTPUT); + + +/* glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PORTABILITY_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PERFORMANCE_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_OTHER_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + glDebugMessageInsertARB( + + GL_DEBUG_SOURCE_API_ARB, + GL_DEBUG_TYPE_OTHER_ARB, 1, + GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello"); + +*/ + storage->initialize(); + canvas->initialize(); +} + +void RasterizerGLES3::begin_frame(){ + + +} +void RasterizerGLES3::set_current_render_target(RID p_render_target){ + + if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) { + //handle pending clear request, if the framebuffer was not cleared + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glClearColor( + storage->frame.clear_request_color.r, + storage->frame.clear_request_color.g, + storage->frame.clear_request_color.b, + storage->frame.clear_request_color.a ); + + glClear(GL_COLOR_BUFFER_BIT); + + } + + if (p_render_target.is_valid()) { + RasterizerStorageGLES3::RenderTarget * rt = storage->render_target_owner.getornull(p_render_target); + if (!rt) { + storage->frame.current_rt=NULL; + } + ERR_FAIL_COND(!rt); + storage->frame.current_rt=rt; + storage->frame.clear_request=false; + + glViewport(0,0,rt->width,rt->height); + + } else { + storage->frame.current_rt=NULL; + storage->frame.clear_request=false; + glViewport(0,0,OS::get_singleton()->get_window_size().width,OS::get_singleton()->get_window_size().height); + glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo); + } +} + +void RasterizerGLES3::restore_render_target() { + + ERR_FAIL_COND(storage->frame.current_rt==NULL); + RasterizerStorageGLES3::RenderTarget * rt = storage->frame.current_rt; + glViewport(0,0,rt->width,rt->height); + +} + +void RasterizerGLES3::clear_render_target(const Color& p_color) { + + ERR_FAIL_COND(!storage->frame.current_rt); + + storage->frame.clear_request=true; + storage->frame.clear_request_color=p_color; + +} + +void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target,const Rect2& p_screen_rect,int p_screen){ + + ERR_FAIL_COND( storage->frame.current_rt ); + + RasterizerStorageGLES3::RenderTarget *rt = storage->render_target_owner.getornull(p_render_target); + ERR_FAIL_COND(!rt); + + canvas->canvas_begin(); + glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,rt->front.color); + canvas->draw_generic_textured_rect(p_screen_rect,Rect2(0,0,1,-1)); + glBindTexture(GL_TEXTURE_2D,0); + canvas->canvas_end(); +} + +void RasterizerGLES3::end_frame(){ + +#if 0 + canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + glDisable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + + + float vtx[8]={0,0, + 0,1, + 1,1, + 1,0 + }; + + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); + + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, vtx ); + + +// glBindBuffer(GL_ARRAY_BUFFER,canvas->data.canvas_quad_vertices); +// glEnableVertexAttribArray(VS::ARRAY_VERTEX); +// glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, 0 ); + + glBindVertexArray(canvas->data.canvas_quad_array); + + canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1)); +#endif + if (ContextGL::get_singleton()) + ContextGL::get_singleton()->swap_buffers(); +} + +void RasterizerGLES3::finalize(){ + + storage->finalize(); + canvas->finalize(); +} + + +Rasterizer *RasterizerGLES3::_create_current() { + + return memnew( RasterizerGLES3 ); +} + +void RasterizerGLES3::make_current() { + _create_func=_create_current; +} + + +void RasterizerGLES3::register_config() { + + GLOBAL_DEF("rendering/gles3/framebuffer_format",RasterizerStorageGLES3::FBO_FORMAT_FLOAT); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/framebuffer_format",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"16 Bits,32 Bits,Half Float")); + GLOBAL_DEF("rendering/gles3/lighting_technique",1); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/lighting_technique",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"Forward,Deferred")); + GLOBAL_DEF("rendering/gles3/use_nearest_mipmap_filter",false); + GLOBAL_DEF("rendering/gles3/anisotropic_filter_level",4.0); + + +} + +RasterizerGLES3::RasterizerGLES3() +{ + + storage = memnew( RasterizerStorageGLES3 ); + canvas = memnew( RasterizerCanvasGLES3 ); + canvas->storage=storage; + + +} + +RasterizerGLES3::~RasterizerGLES3() { + + memdelete(storage); + memdelete(canvas); +} diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h new file mode 100644 index 0000000000..d461664ea2 --- /dev/null +++ b/drivers/gles3/rasterizer_gles3.h @@ -0,0 +1,38 @@ +#ifndef RASTERIZERGLES3_H +#define RASTERIZERGLES3_H + +#include "servers/visual/rasterizer.h" +#include "rasterizer_storage_gles3.h" +#include "rasterizer_canvas_gles3.h" + + +class RasterizerGLES3 : public Rasterizer { + + static Rasterizer *_create_current(); + + RasterizerStorageGLES3 *storage; + RasterizerCanvasGLES3 *canvas; +public: + + virtual RasterizerStorage *get_storage(); + virtual RasterizerCanvas *get_canvas(); + virtual RasterizerScene *get_scene(); + + virtual void initialize(); + virtual void begin_frame(); + virtual void set_current_render_target(RID p_render_target); + virtual void restore_render_target(); + virtual void clear_render_target(const Color& p_color); + virtual void blit_render_target_to_screen(RID p_render_target,const Rect2& p_screen_rect,int p_screen=0); + virtual void end_frame(); + virtual void finalize(); + + static void make_current(); + + + static void register_config(); + RasterizerGLES3(); + ~RasterizerGLES3(); +}; + +#endif // RASTERIZERGLES3_H diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp new file mode 100644 index 0000000000..b29de876a4 --- /dev/null +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -0,0 +1,2045 @@ +#include "rasterizer_storage_gles3.h" +#include "globals.h" + +/* TEXTURE API */ + +#define _EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define _EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define _EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define _EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + +#define _EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define _EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define _EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 + + +#define _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define _EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +#define _EXT_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define _EXT_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define _EXT_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define _EXT_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 + + +#define _EXT_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define _EXT_COMPRESSED_RED_RGTC1 0x8DBB +#define _EXT_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define _EXT_COMPRESSED_RG_RGTC2 0x8DBD +#define _EXT_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define _EXT_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define _EXT_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define _EXT_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#define _EXT_ETC1_RGB8_OES 0x8D64 + + + +#define _EXT_SLUMINANCE_NV 0x8C46 +#define _EXT_SLUMINANCE_ALPHA_NV 0x8C44 +#define _EXT_SRGB8_NV 0x8C41 +#define _EXT_SLUMINANCE8_NV 0x8C47 +#define _EXT_SLUMINANCE8_ALPHA8_NV 0x8C45 + + +#define _EXT_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define _EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F + + + +#define _EXT_ATC_RGB_AMD 0x8C92 +#define _EXT_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define _EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE + + +#define _TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define _DECODE_EXT 0x8A49 +#define _SKIP_DECODE_EXT 0x8A4A + + +#define _GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define _GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + + + +Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,GLenum &r_gl_type,bool &r_compressed,bool &srgb) { + + + r_compressed=false; + r_gl_format=0; + Image image=p_image; + srgb=false; + + bool need_decompress=false; + + switch(p_format) { + + case Image::FORMAT_L8: { + r_gl_internal_format=GL_LUMINANCE; + r_gl_format=GL_LUMINANCE; + r_gl_type=GL_UNSIGNED_BYTE; + + } break; + case Image::FORMAT_LA8: { + + r_gl_internal_format=GL_LUMINANCE_ALPHA; + r_gl_format=GL_LUMINANCE_ALPHA; + r_gl_type=GL_UNSIGNED_BYTE; + + } break; + case Image::FORMAT_R8: { + + r_gl_internal_format=GL_R8; + r_gl_format=GL_RED; + r_gl_type=GL_UNSIGNED_BYTE; + + } break; + case Image::FORMAT_RG8: { + + r_gl_internal_format=GL_RG8; + r_gl_format=GL_RG; + r_gl_type=GL_UNSIGNED_BYTE; + + } break; + case Image::FORMAT_RGB8: { + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_SRGB8:GL_RGB8; + r_gl_format=GL_RGB; + r_gl_type=GL_UNSIGNED_BYTE; + srgb=true; + + } break; + case Image::FORMAT_RGBA8: { + + r_gl_format=GL_RGBA; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_SRGB8_ALPHA8:GL_RGBA8; + r_gl_type=GL_UNSIGNED_BYTE; + srgb=true; + + } break; + case Image::FORMAT_RGB565: { + + r_gl_internal_format=GL_RGB565; + r_gl_format=GL_RGB; + r_gl_type=GL_UNSIGNED_SHORT_5_6_5; + + } break; + case Image::FORMAT_RGBA4444: { + + r_gl_internal_format=GL_RGBA4; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_SHORT_4_4_4_4; + + } break; + case Image::FORMAT_RGBA5551: { + + r_gl_internal_format=GL_RGB5_A1; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_SHORT_5_5_5_1; + + + } break; + case Image::FORMAT_RF: { + + + r_gl_internal_format=GL_R32F; + r_gl_format=GL_RED; + r_gl_type=GL_FLOAT; + + } break; + case Image::FORMAT_RGF: { + + r_gl_internal_format=GL_RG32F; + r_gl_format=GL_RG; + r_gl_type=GL_FLOAT; + + } break; + case Image::FORMAT_RGBF: { + + r_gl_internal_format=GL_RGB32F; + r_gl_format=GL_RGB; + r_gl_type=GL_FLOAT; + + } break; + case Image::FORMAT_RGBAF: { + + r_gl_internal_format=GL_RGBA32F; + r_gl_format=GL_RGBA; + r_gl_type=GL_FLOAT; + + } break; + case Image::FORMAT_RH: { + r_gl_internal_format=GL_R32F; + r_gl_format=GL_RED; + r_gl_type=GL_HALF_FLOAT; + } break; + case Image::FORMAT_RGH: { + r_gl_internal_format=GL_RG32F; + r_gl_format=GL_RG; + r_gl_type=GL_HALF_FLOAT; + + } break; + case Image::FORMAT_RGBH: { + r_gl_internal_format=GL_RGB32F; + r_gl_format=GL_RGB; + r_gl_type=GL_HALF_FLOAT; + + } break; + case Image::FORMAT_RGBAH: { + r_gl_internal_format=GL_RGBA32F; + r_gl_format=GL_RGBA; + r_gl_type=GL_HALF_FLOAT; + + } break; + case Image::FORMAT_DXT1: { + + if (config.s3tc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + } break; + case Image::FORMAT_DXT3: { + + + if (config.s3tc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT3_EXT; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + } break; + case Image::FORMAT_DXT5: { + + if (config.s3tc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + } break; + case Image::FORMAT_ATI1: { + + if (config.latc_supported) { + + + r_gl_internal_format=_EXT_COMPRESSED_LUMINANCE_LATC1_EXT; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + + } break; + case Image::FORMAT_ATI2: { + + if (config.latc_supported) { + + + r_gl_internal_format=_EXT_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + } else { + + need_decompress=true; + } + + } break; + case Image::FORMAT_BPTC_RGBA: { + + if (config.bptc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:GL_COMPRESSED_RGBA_BPTC_UNORM; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_BPTC_RGBF: { + + if (config.bptc_supported) { + + + r_gl_internal_format=GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT; + r_gl_format=GL_RGB; + r_gl_type=GL_FLOAT; + r_compressed=true; + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_BPTC_RGBFU: { + if (config.bptc_supported) { + + + r_gl_internal_format=GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT; + r_gl_format=GL_RGB; + r_gl_type=GL_FLOAT; + r_compressed=true; + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_PVRTC2: { + + if (config.pvrtc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_PVRTC2A: { + + if (config.pvrtc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + } break; + case Image::FORMAT_PVRTC4: { + + if (config.pvrtc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + } break; + case Image::FORMAT_PVRTC4A: { + + if (config.pvrtc_supported) { + + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT:_EXT_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + } else { + + need_decompress=true; + } + + + } break; + case Image::FORMAT_ETC: { + + if (config.etc_supported) { + + r_gl_internal_format=_EXT_ETC1_RGB8_OES; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + + } else { + + need_decompress=true; + } + + } break; + case Image::FORMAT_ETC2_R11: { + + if (config.etc2_supported) { + + r_gl_internal_format=GL_COMPRESSED_R11_EAC; + r_gl_format=GL_RED; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_R11S: { + + if (config.etc2_supported) { + + r_gl_internal_format=GL_COMPRESSED_SIGNED_R11_EAC; + r_gl_format=GL_RED; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_RG11: { + + if (config.etc2_supported) { + + r_gl_internal_format=GL_COMPRESSED_RG11_EAC; + r_gl_format=GL_RG; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_RG11S: { + if (config.etc2_supported) { + + r_gl_internal_format=GL_COMPRESSED_SIGNED_RG11_EAC; + r_gl_format=GL_RG; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + + } else { + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_RGB8: { + + if (config.etc2_supported) { + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_ETC2:GL_COMPRESSED_RGB8_ETC2; + r_gl_format=GL_RGB; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_RGBA8: { + + if (config.etc2_supported) { + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:GL_COMPRESSED_RGBA8_ETC2_EAC; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + + } else { + + need_decompress=true; + } + } break; + case Image::FORMAT_ETC2_RGB8A1: { + + if (config.etc2_supported) { + + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + r_gl_format=GL_RGBA; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=true; + srgb=true; + + + } else { + + need_decompress=true; + } + } break; + default: { + + ERR_FAIL_V(Image()); + } + } + + if (need_decompress) { + + if (!image.empty()) { + image.decompress(); + ERR_FAIL_COND_V(image.is_compressed(),image); + image.convert(Image::FORMAT_RGBA8); + } + + + r_gl_format=GL_RGBA; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_SRGB8_ALPHA8:GL_RGBA8; + r_gl_type=GL_UNSIGNED_BYTE; + r_compressed=false; + srgb=true; + + return image; + + } + + + return image; +} + +static const GLenum _cube_side_enum[6]={ + + GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + +}; + +RID RasterizerStorageGLES3::texture_create() { + + Texture *texture = memnew(Texture); + ERR_FAIL_COND_V(!texture,RID()); + glGenTextures(1, &texture->tex_id); + texture->active=false; + texture->total_data_size=0; + + return texture_owner.make_rid( texture ); + +} + +void RasterizerStorageGLES3::texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags) { + + int components; + GLenum format; + GLenum internal_format; + GLenum type; + + bool compressed; + bool srgb; + + if (p_flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING) { + p_flags&=~VS::TEXTURE_FLAG_MIPMAPS; // no mipies for video + } + + + Texture *texture = texture_owner.get( p_texture ); + ERR_FAIL_COND(!texture); + texture->width=p_width; + texture->height=p_height; + texture->format=p_format; + texture->flags=p_flags; + texture->target = (p_flags & VS::TEXTURE_FLAG_CUBEMAP) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D; + + _get_gl_image_and_format(Image(),texture->format,texture->flags,format,internal_format,type,compressed,srgb); + + texture->alloc_width = texture->width; + texture->alloc_height = texture->height; + + + texture->gl_format_cache=format; + texture->gl_type_cache=type; + texture->gl_internal_format_cache=internal_format; + texture->compressed=compressed; + texture->srgb=srgb; + texture->data_size=0; + texture->mipmaps=1; + + + glActiveTexture(GL_TEXTURE0); + glBindTexture(texture->target, texture->tex_id); + + + if (p_flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING) { + //prealloc if video + glTexImage2D(texture->target, 0, internal_format, p_width, p_height, 0, format, type,NULL); + } + + texture->active=true; +} + +void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side) { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND(!texture); + ERR_FAIL_COND(!texture->active); + ERR_FAIL_COND(texture->render_target); + ERR_FAIL_COND(texture->format != p_image.get_format() ); + ERR_FAIL_COND( p_image.empty() ); + + GLenum type; + GLenum format; + GLenum internal_format; + bool compressed; + bool srgb; + + + Image img = _get_gl_image_and_format(p_image, p_image.get_format(),texture->flags,format,internal_format,type,compressed,srgb); + + if (config.shrink_textures_x2 && (p_image.has_mipmaps() || !p_image.is_compressed()) && !(texture->flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING)) { + + texture->alloc_height = MAX(1,texture->alloc_height/2); + texture->alloc_width = MAX(1,texture->alloc_width/2); + + if (texture->alloc_width == img.get_width()/2 && texture->alloc_height == img.get_height()/2) { + + img.shrink_x2(); + } else if (img.get_format() <= Image::FORMAT_RGB565) { + + img.resize(texture->alloc_width, texture->alloc_height, Image::INTERPOLATE_BILINEAR); + + } + }; + + + GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D; + + texture->data_size=img.get_data().size(); + DVector::Read read = img.get_data().read(); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(texture->target, texture->tex_id); + + texture->ignore_mipmaps = compressed && !img.has_mipmaps(); + + if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,config.use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR); + else { + if (texture->flags&VS::TEXTURE_FLAG_FILTER) { + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR); + } else { + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + + } + } + + + if (config.srgb_decode_supported && srgb) { + + if (texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { + + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + } else { + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + } + } + + if (texture->flags&VS::TEXTURE_FLAG_FILTER) { + + glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering + + } else { + + glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // raw Filtering + } + + if ((texture->flags&VS::TEXTURE_FLAG_REPEAT || texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) { + + if (texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT){ + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT ); + } + else{ + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + } + } else { + + //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE ); + glTexParameterf( texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameterf( texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + } + + if (config.use_anisotropic_filter) { + + if (texture->flags&VS::TEXTURE_FLAG_ANISOTROPIC_FILTER) { + + glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, config.anisotropic_level); + } else { + glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); + } + } + + int mipmaps= (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && img.has_mipmaps()) ? img.get_mipmap_count() +1: 1; + + + int w=img.get_width(); + int h=img.get_height(); + + int tsize=0; + for(int i=0;icompressed) { + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glCompressedTexImage2D( blit_target, i, format,w,h,0,size,&read[ofs] ); + + } else { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (texture->flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING) { + glTexSubImage2D( blit_target, i, 0,0,w, h,format,type,&read[ofs] ); + } else { + glTexImage2D(blit_target, i, internal_format, w, h, 0, format, type,&read[ofs]); + } + + } + tsize+=size; + + w = MAX(1,w>>1); + h = MAX(1,h>>1); + + } + + info.texture_mem-=texture->total_data_size; + texture->total_data_size=tsize; + info.texture_mem+=texture->total_data_size; + + //printf("texture: %i x %i - size: %i - total: %i\n",texture->width,texture->height,tsize,_rinfo.texture_mem); + + + if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1 && !texture->ignore_mipmaps) { + //generate mipmaps if they were requested and the image does not contain them + glGenerateMipmap(texture->target); + } + + texture->mipmaps=mipmaps; + + //texture_set_flags(p_texture,texture->flags); + + +} + +Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side) const { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND_V(!texture,Image()); + ERR_FAIL_COND_V(!texture->active,Image()); + ERR_FAIL_COND_V(texture->data_size==0,Image()); + ERR_FAIL_COND_V(texture->render_target,Image()); + +#ifdef GLEW_ENABLED + + DVector data; + + int data_size = Image::get_image_data_size(texture->width,texture->height,texture->format,texture->mipmaps>1?-1:0); + + data.resize(data_size); + DVector::Write wb = data.write(); + + glActiveTexture(GL_TEXTURE0); + + glBindTexture(texture->target,texture->tex_id); + + for(int i=0;imipmaps;i++) { + + int ofs=0; + if (i>0) { + ofs=Image::get_image_data_size(texture->alloc_width,texture->alloc_height,texture->format,i-1); + } + + if (texture->compressed) { + + glPixelStorei(GL_PACK_ALIGNMENT, 4); + glGetCompressedTexImage(texture->target,i,&wb[ofs]); + + } else { + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glGetTexImage(texture->target,i,texture->gl_format_cache,texture->gl_type_cache,&wb[ofs]); + } + } + + + wb=DVector::Write(); + + Image img(texture->alloc_width,texture->alloc_height,texture->mipmaps>1?true:false,texture->format,data); + + return img; +#else + + ERR_EXPLAIN("Sorry, It's not posible to obtain images back in OpenGL ES"); +#endif +} + +void RasterizerStorageGLES3::texture_set_flags(RID p_texture,uint32_t p_flags) { + + Texture *texture = texture_owner.get( p_texture ); + ERR_FAIL_COND(!texture); + if (texture->render_target) { + + p_flags&=VS::TEXTURE_FLAG_FILTER;//can change only filter + } + + bool had_mipmaps = texture->flags&VS::TEXTURE_FLAG_MIPMAPS; + + glActiveTexture(GL_TEXTURE0); + glBindTexture(texture->target, texture->tex_id); + uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP; + texture->flags=p_flags|cube; // can't remove a cube from being a cube + + + if ((texture->flags&VS::TEXTURE_FLAG_REPEAT || texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT) && texture->target != GL_TEXTURE_CUBE_MAP) { + + if (texture->flags&VS::TEXTURE_FLAG_MIRRORED_REPEAT){ + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT ); + } + else { + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + } + } else { + //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE ); + glTexParameterf( texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameterf( texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + + } + + + if (config.use_anisotropic_filter) { + + if (texture->flags&VS::TEXTURE_FLAG_ANISOTROPIC_FILTER) { + + glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, config.anisotropic_level); + } else { + glTexParameterf(texture->target, _GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); + } + } + + if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) { + if (!had_mipmaps && texture->mipmaps==1) { + glGenerateMipmap(texture->target); + } + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,config.use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR); + + } else{ + if (texture->flags&VS::TEXTURE_FLAG_FILTER) { + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR); + } else { + glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + + } + } + + + if (config.srgb_decode_supported && texture->srgb) { + + if (texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { + + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + } else { + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + } + } + + if (texture->flags&VS::TEXTURE_FLAG_FILTER) { + + glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering + + } else { + + glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // raw Filtering + } + +} +uint32_t RasterizerStorageGLES3::texture_get_flags(RID p_texture) const { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND_V(!texture,0); + + return texture->flags; + +} +Image::Format RasterizerStorageGLES3::texture_get_format(RID p_texture) const { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND_V(!texture,Image::FORMAT_L8); + + return texture->format; +} +uint32_t RasterizerStorageGLES3::texture_get_width(RID p_texture) const { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND_V(!texture,0); + + return texture->width; +} +uint32_t RasterizerStorageGLES3::texture_get_height(RID p_texture) const { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND_V(!texture,0); + + return texture->height; +} + + +void RasterizerStorageGLES3::texture_set_size_override(RID p_texture,int p_width, int p_height) { + + Texture * texture = texture_owner.get(p_texture); + + ERR_FAIL_COND(!texture); + ERR_FAIL_COND(texture->render_target); + + ERR_FAIL_COND(p_width<=0 || p_width>16384); + ERR_FAIL_COND(p_height<=0 || p_height>16384); + //real texture size is in alloc width and height + texture->width=p_width; + texture->height=p_height; + +} + +void RasterizerStorageGLES3::texture_set_path(RID p_texture,const String& p_path) { + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND(!texture); + + texture->path=p_path; + +} + +String RasterizerStorageGLES3::texture_get_path(RID p_texture) const{ + + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND_V(!texture,String()); + return texture->path; +} +void RasterizerStorageGLES3::texture_debug_usage(List *r_info){ + + List textures; + texture_owner.get_owned_list(&textures); + + for (List::Element *E=textures.front();E;E=E->next()) { + + Texture *t = texture_owner.get(E->get()); + if (!t) + continue; + VS::TextureInfo tinfo; + tinfo.path=t->path; + tinfo.format=t->format; + tinfo.size.x=t->alloc_width; + tinfo.size.y=t->alloc_height; + tinfo.bytes=t->total_data_size; + r_info->push_back(tinfo); + } + +} + +void RasterizerStorageGLES3::texture_set_shrink_all_x2_on_set_data(bool p_enable) { + + config.shrink_textures_x2=p_enable; +} + + + +/* SHADER API */ + + +RID RasterizerStorageGLES3::shader_create(VS::ShaderMode p_mode){ + + return RID(); +} + +void RasterizerStorageGLES3::shader_set_mode(RID p_shader,VS::ShaderMode p_mode){ + + +} +VS::ShaderMode RasterizerStorageGLES3::shader_get_mode(RID p_shader) const { + + return VS::SHADER_SPATIAL; +} +void RasterizerStorageGLES3::shader_set_code(RID p_shader, const String& p_code){ + + +} +String RasterizerStorageGLES3::shader_get_code(RID p_shader) const{ + + return String(); +} +void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List *p_param_list) const{ + + +} + +void RasterizerStorageGLES3::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture){ + + +} +RID RasterizerStorageGLES3::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{ + + return RID(); +} + + +/* COMMON MATERIAL API */ + +RID RasterizerStorageGLES3::material_create(){ + + return RID(); +} + +void RasterizerStorageGLES3::material_set_shader(RID p_shader_material, RID p_shader){ + + +} +RID RasterizerStorageGLES3::material_get_shader(RID p_shader_material) const{ + + return RID(); +} + +void RasterizerStorageGLES3::material_set_param(RID p_material, const StringName& p_param, const Variant& p_value){ + + +} +Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringName& p_param) const{ + + return Variant(); +} + +/* MESH API */ + +RID RasterizerStorageGLES3::mesh_create(){ + + return RID(); +} + +void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes){ + + +} + +void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount){ + + +} +int RasterizerStorageGLES3::mesh_get_morph_target_count(RID p_mesh) const{ + + return 0; +} + + +void RasterizerStorageGLES3::mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode){ + + +} +VS::MorphTargetMode RasterizerStorageGLES3::mesh_get_morph_target_mode(RID p_mesh) const{ + + return VS::MORPH_MODE_NORMALIZED; +} + +void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ + + +} +RID RasterizerStorageGLES3::mesh_surface_get_material(RID p_mesh, int p_surface) const{ + + return RID(); +} + +int RasterizerStorageGLES3::mesh_surface_get_array_len(RID p_mesh, int p_surface) const{ + + return 0; +} +int RasterizerStorageGLES3::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const{ + + + return 0; +} + +DVector RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int p_surface) const{ + + return DVector(); +} +DVector RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_mesh, int p_surface) const{ + + + return DVector(); +} + + +uint32_t RasterizerStorageGLES3::mesh_surface_get_format(RID p_mesh, int p_surface) const{ + + return 0; +} +VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const{ + + return VS::PRIMITIVE_MAX; +} + +void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh,int p_index){ + + +} +int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const{ + + return 0; +} + +void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb){ + + +} +AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const{ + + return AABB(); +} + +AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh) const{ + + return AABB(); +} +void RasterizerStorageGLES3::mesh_clear(RID p_mesh){ + + +} + +/* MULTIMESH API */ + + +RID RasterizerStorageGLES3::multimesh_create(){ + + return RID(); +} + +void RasterizerStorageGLES3::multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb){ + + +} +int RasterizerStorageGLES3::multimesh_get_instance_count(RID p_multimesh) const{ + + return 0; +} + +void RasterizerStorageGLES3::multimesh_set_mesh(RID p_multimesh,RID p_mesh){ + + +} +void RasterizerStorageGLES3::multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb){ + + +} +void RasterizerStorageGLES3::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform){ + + +} +void RasterizerStorageGLES3::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform){ + + +} +void RasterizerStorageGLES3::multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color){ + + +} + +RID RasterizerStorageGLES3::multimesh_get_mesh(RID p_multimesh) const{ + + + return RID(); +} +AABB RasterizerStorageGLES3::multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const{ + + return AABB(); +} + +Transform RasterizerStorageGLES3::multimesh_instance_get_transform(RID p_multimesh,int p_index) const{ + + return Transform(); +} +Matrix32 RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ + + + return Matrix32(); +} +Color RasterizerStorageGLES3::multimesh_instance_get_color(RID p_multimesh,int p_index) const{ + + return Color(); +} + +void RasterizerStorageGLES3::multimesh_set_visible_instances(RID p_multimesh,int p_visible){ + + +} +int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) const{ + + return 0; +} + +AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_mesh) const{ + + return AABB(); +} + +/* IMMEDIATE API */ + +RID RasterizerStorageGLES3::immediate_create(){ + + return RID(); +} +void RasterizerStorageGLES3::immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture){ + + +} +void RasterizerStorageGLES3::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ + + +} +void RasterizerStorageGLES3::immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex){ + + +} +void RasterizerStorageGLES3::immediate_normal(RID p_immediate,const Vector3& p_normal){ + + +} +void RasterizerStorageGLES3::immediate_tangent(RID p_immediate,const Plane& p_tangent){ + + +} +void RasterizerStorageGLES3::immediate_color(RID p_immediate,const Color& p_color){ + + +} +void RasterizerStorageGLES3::immediate_uv(RID p_immediate,const Vector2& tex_uv){ + + +} +void RasterizerStorageGLES3::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ + + +} +void RasterizerStorageGLES3::immediate_end(RID p_immediate){ + + +} +void RasterizerStorageGLES3::immediate_clear(RID p_immediate){ + + +} +void RasterizerStorageGLES3::immediate_set_material(RID p_immediate,RID p_material){ + + +} +RID RasterizerStorageGLES3::immediate_get_material(RID p_immediate) const{ + + return RID(); +} + +/* SKELETON API */ + +RID RasterizerStorageGLES3::skeleton_create(){ + + return RID(); +} +void RasterizerStorageGLES3::skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton){ + + +} +int RasterizerStorageGLES3::skeleton_get_bone_count(RID p_skeleton) const{ + + return 0; +} +void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform){ + + +} +Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int p_bone){ + + return Transform(); +} +void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform){ + + +} +Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone){ + + return Matrix32(); +} + +/* Light API */ + +RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ + + return RID(); +} + +void RasterizerStorageGLES3::light_set_color(RID p_light,const Color& p_color){ + + +} +void RasterizerStorageGLES3::light_set_param(RID p_light,VS::LightParam p_param,float p_value){ + + +} +void RasterizerStorageGLES3::light_set_shadow(RID p_light,bool p_enabled){ + + +} +void RasterizerStorageGLES3::light_set_projector(RID p_light,RID p_texture){ + + +} +void RasterizerStorageGLES3::light_set_attenuation_texure(RID p_light,RID p_texture){ + + +} +void RasterizerStorageGLES3::light_set_negative(RID p_light,bool p_enable){ + + +} +void RasterizerStorageGLES3::light_set_cull_mask(RID p_light,uint32_t p_mask){ + + +} +void RasterizerStorageGLES3::light_set_shader(RID p_light,RID p_shader){ + + +} + + +void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode){ + + +} + +/* PROBE API */ + +RID RasterizerStorageGLES3::reflection_probe_create(){ + + return RID(); +} + +void RasterizerStorageGLES3::reflection_probe_set_intensity(RID p_probe, float p_intensity){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_clip(RID p_probe, float p_near, float p_far){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_min_blend_distance(RID p_probe, float p_distance){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_extents(RID p_probe, const Vector3& p_extents){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_resolution(RID p_probe, int p_resolution){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_hide_skybox(RID p_probe, bool p_hide){ + + +} +void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers){ + + +} + + +/* ROOM API */ + +RID RasterizerStorageGLES3::room_create(){ + + return RID(); +} +void RasterizerStorageGLES3::room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform){ + + +} +void RasterizerStorageGLES3::room_clear_bounds(){ + + +} + +/* PORTAL API */ + +// portals are only (x/y) points, forming a convex shape, which its clockwise +// order points outside. (z is 0); + +RID RasterizerStorageGLES3::portal_create(){ + + return RID(); +} +void RasterizerStorageGLES3::portal_set_shape(RID p_portal, const Vector& p_shape){ + + +} +void RasterizerStorageGLES3::portal_set_enabled(RID p_portal, bool p_enabled){ + + +} +void RasterizerStorageGLES3::portal_set_disable_distance(RID p_portal, float p_distance){ + + +} +void RasterizerStorageGLES3::portal_set_disabled_color(RID p_portal, const Color& p_color){ + + +} + + +/* RENDER TARGET */ + + +void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { + + if (rt->front.fbo) { + glDeleteFramebuffers(1,&rt->front.fbo); + glDeleteTextures(1,&rt->front.color); + rt->front.fbo=0; + } + + if (rt->back.fbo) { + glDeleteFramebuffers(1,&rt->back.fbo); + glDeleteTextures(1,&rt->back.color); + rt->back.fbo=0; + } + + if (rt->deferred.fbo) { + glDeleteFramebuffers(1,&rt->deferred.fbo); + glDeleteFramebuffers(1,&rt->deferred.fbo_color); + glDeleteTextures(1,&rt->deferred.albedo_ao); + glDeleteTextures(1,&rt->deferred.normal_special); + glDeleteTextures(1,&rt->deferred.metal_rough_motion); + rt->deferred.fbo=0; + rt->deferred.fbo_color=0; + } + + if (rt->depth) { + glDeleteRenderbuffers(1,&rt->depth); + rt->depth=0; + } + +} + +void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ + + if (rt->width<=0 || rt->height<=0) + return; + + glGenFramebuffers(1, &rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo); + + + glGenRenderbuffers(1, &rt->depth); + glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); + if (config.fbo_format==FBO_FORMAT_16_BITS) { + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH_COMPONENT16, rt->width, rt->height); + } else { + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8, rt->width, rt->height); + } + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + glBindRenderbuffer(GL_RENDERBUFFER, 0 ); + + + glGenTextures(1, &rt->front.color); + glBindTexture(GL_TEXTURE_2D, rt->front.color); + + + GLuint color_internal_format; + GLuint color_format; + GLuint color_type; + + + if (config.fbo_format==FBO_FORMAT_16_BITS) { + + if (rt->flags[RENDER_TARGET_TRANSPARENT]) { + color_internal_format=GL_RGB5_A1; + color_format=GL_RGBA; + color_type=GL_UNSIGNED_SHORT_5_5_5_1; + } else { + color_internal_format=GL_RGB565; + color_format=GL_RGB; + color_type=GL_UNSIGNED_SHORT_5_6_5; + } + + } else if (config.fbo_format==FBO_FORMAT_32_BITS) { + + if (rt->flags[RENDER_TARGET_TRANSPARENT]) { + color_internal_format=GL_RGBA8; + color_format=GL_RGBA; + color_type=GL_UNSIGNED_BYTE; + } else { + color_internal_format=GL_RGB10_A2; + color_format=GL_RGBA; + color_type=GL_UNSIGNED_INT_2_10_10_10_REV; + } + } else if (config.fbo_format==FBO_FORMAT_FLOAT) { + + color_internal_format=GL_RGBA16F; + color_format=GL_RGBA; + color_type=GL_HALF_FLOAT; + } + + glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->front.color, 0); + + { + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + + + if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) { + + glGenFramebuffers(1, &rt->back.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->back.fbo); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + + glGenTextures(1, &rt->back.color); + glBindTexture(GL_TEXTURE_2D, rt->back.color); + + glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->back.color, 0); + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + } + + + + if (config.fbo_deferred && !rt->flags[RENDER_TARGET_NO_3D]) { + + + //regular fbo + glGenFramebuffers(1, &rt->deferred.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->deferred.fbo); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + + glGenTextures(1, &rt->deferred.albedo_ao); + glBindTexture(GL_TEXTURE_2D, rt->deferred.albedo_ao); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->deferred.albedo_ao, 0); + + glGenTextures(1, &rt->deferred.metal_rough_motion); + glBindTexture(GL_TEXTURE_2D, rt->deferred.metal_rough_motion); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->deferred.metal_rough_motion, 0); + + glGenTextures(1, &rt->deferred.normal_special); + glBindTexture(GL_TEXTURE_2D, rt->deferred.normal_special); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->deferred.normal_special, 0); + + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + + //regular fbo with color attachment (needed for emission or objects rendered as forward) + + glGenFramebuffers(1, &rt->deferred.fbo_color); + glBindFramebuffer(GL_FRAMEBUFFER, rt->deferred.fbo_color); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->deferred.albedo_ao, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->deferred.metal_rough_motion, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->deferred.normal_special, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, rt->front.color, 0); + + + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + } + + +} + + +RID RasterizerStorageGLES3::render_target_create(){ + + RenderTarget *rt = memnew( RenderTarget ); + return render_target_owner.make_rid(rt); +} + +void RasterizerStorageGLES3::render_target_set_size(RID p_render_target,int p_width, int p_height){ + + RenderTarget *rt = render_target_owner.getornull(p_render_target); + ERR_FAIL_COND(!rt); + + if (rt->width==p_width && rt->height==p_height) + return; + + _render_target_clear(rt); + rt->width=p_width; + rt->height=p_height; + _render_target_allocate(rt); + +} + + +RID RasterizerStorageGLES3::render_target_get_texture(RID p_render_target) const{ + + RenderTarget *rt = render_target_owner.getornull(p_render_target); + ERR_FAIL_COND_V(!rt,RID()); + + + return RID(); +} +Image RasterizerStorageGLES3::render_target_get_image(RID p_render_target) const{ + + return Image(); +} +void RasterizerStorageGLES3::render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value) { + + RenderTarget *rt = render_target_owner.getornull(p_render_target); + ERR_FAIL_COND(!rt); + + rt->flags[p_flag]=p_value; + + switch(p_flag) { + case RENDER_TARGET_NO_3D: + case RENDER_TARGET_TRANSPARENT: { + //must reset for these formats + _render_target_clear(rt); + _render_target_allocate(rt); + + } break; + default: {} + } +} + +bool RasterizerStorageGLES3::render_target_renedered_in_frame(RID p_render_target){ + + return false; +} + +/* CANVAS SHADOW */ + + +RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) { + + CanvasLightShadow *cls = memnew( CanvasLightShadow ); + if (p_width>config.max_texture_size) + p_width=config.max_texture_size; + + cls->size=p_width; + cls->height=16; + + glActiveTexture(GL_TEXTURE0); + + glGenFramebuffers(1, &cls->fbo); + glBindFramebuffer(GL_FRAMEBUFFER, cls->fbo); + + glGenRenderbuffers(1, &cls->depth); + glBindRenderbuffer(GL_RENDERBUFFER, cls->depth ); + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH_COMPONENT24, cls->size, cls->height); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, cls->depth); + glBindRenderbuffer(GL_RENDERBUFFER, 0 ); + + glGenTextures(1,&cls->distance); + glBindTexture(GL_TEXTURE_2D, cls->distance); + if (config.use_rgba_2d_shadows) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } else { + glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, GL_RED, GL_FLOAT, NULL); + } + + + + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, cls->distance, 0); + + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + //printf("errnum: %x\n",status); + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + + ERR_FAIL_COND_V( status != GL_FRAMEBUFFER_COMPLETE, RID() ); + + return canvas_light_shadow_owner.make_rid(cls); +} + +/* LIGHT SHADOW MAPPING */ + + +RID RasterizerStorageGLES3::canvas_light_occluder_create() { + + CanvasOccluder *co = memnew( CanvasOccluder ); + co->index_id=0; + co->vertex_id=0; + co->len=0; + + return canvas_occluder_owner.make_rid(co); +} + +void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines) { + + CanvasOccluder *co = canvas_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!co); + + co->lines=p_lines; + + if (p_lines.size()!=co->len) { + + if (co->index_id) + glDeleteBuffers(1,&co->index_id); + if (co->vertex_id) + glDeleteBuffers(1,&co->vertex_id); + + co->index_id=0; + co->vertex_id=0; + co->len=0; + + } + + if (p_lines.size()) { + + + + DVector geometry; + DVector indices; + int lc = p_lines.size(); + + geometry.resize(lc*6); + indices.resize(lc*3); + + DVector::Write vw=geometry.write(); + DVector::Write iw=indices.write(); + + + DVector::Read lr=p_lines.read(); + + const int POLY_HEIGHT = 16384; + + for(int i=0;ivertex_id) { + glGenBuffers(1,&co->vertex_id); + glBindBuffer(GL_ARRAY_BUFFER,co->vertex_id); + glBufferData(GL_ARRAY_BUFFER,lc*6*sizeof(real_t),vw.ptr(),GL_STATIC_DRAW); + } else { + + glBindBuffer(GL_ARRAY_BUFFER,co->vertex_id); + glBufferSubData(GL_ARRAY_BUFFER,0,lc*6*sizeof(real_t),vw.ptr()); + + } + + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + if (!co->index_id) { + + glGenBuffers(1,&co->index_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,co->index_id); + glBufferData(GL_ELEMENT_ARRAY_BUFFER,lc*3*sizeof(uint16_t),iw.ptr(),GL_STATIC_DRAW); + } else { + + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,co->index_id); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER,0,lc*3*sizeof(uint16_t),iw.ptr()); + } + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); //unbind + + co->len=lc; + + } + +} + +bool RasterizerStorageGLES3::free(RID p_rid){ + + if (render_target_owner.owns(p_rid)) { + + RenderTarget *rt = render_target_owner.getornull(p_rid); + _render_target_clear(rt); + render_target_owner.free(p_rid); + memdelete(rt); + + } else if (texture_owner.owns(p_rid)) { + // delete the texture + Texture *texture = texture_owner.get(p_rid); + info.texture_mem-=texture->total_data_size; + texture_owner.free(p_rid); + memdelete(texture); + } else if (canvas_occluder_owner.owns(p_rid)) { + + + CanvasOccluder *co = canvas_occluder_owner.get(p_rid); + if (co->index_id) + glDeleteBuffers(1,&co->index_id); + if (co->vertex_id) + glDeleteBuffers(1,&co->vertex_id); + + canvas_occluder_owner.free(p_rid); + memdelete(co); + + } else if (canvas_light_shadow_owner.owns(p_rid)) { + + CanvasLightShadow *cls = canvas_light_shadow_owner.get(p_rid); + glDeleteFramebuffers(1,&cls->fbo); + glDeleteRenderbuffers(1,&cls->depth); + glDeleteTextures(1,&cls->distance); + canvas_light_shadow_owner.free(p_rid); + memdelete(cls); + } else { + return false; + } + + return true; +} + +//////////////////////////////////////////// + + +void RasterizerStorageGLES3::initialize() { + + config.fbo_format=FBOFormat(int(Globals::get_singleton()->get("rendering/gles3/framebuffer_format"))); + config.fbo_deferred=int(Globals::get_singleton()->get("rendering/gles3/lighting_technique")); + + config.system_fbo=0; + + + //// extensions config + /// + + { + Vector ext= String((const char*)glGetString( GL_EXTENSIONS )).split(" ",false); + for(int i=0;iget("rendering/gles3/use_nearest_mipmap_filter")); + config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic"); + + config.s3tc_supported=config.extensions.has("GL_EXT_texture_compression_dxt1") || config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc"); + config.etc_supported=config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture"); + config.latc_supported=config.extensions.has("GL_EXT_texture_compression_latc"); + config.bptc_supported=config.extensions.has("GL_ARB_texture_compression_bptc"); +#ifdef GLEW_ENABLED + config.etc2_supported=false; +#else + config.etc2_supported=true; +#endif + config.pvrtc_supported=config.extensions.has("GL_IMG_texture_compression_pvrtc"); + config.srgb_decode_supported=config.extensions.has("GL_EXT_texture_sRGB_decode"); + + + + config.anisotropic_level=1.0; + config.use_anisotropic_filter=config.extensions.has("GL_EXT_texture_filter_anisotropic"); + if (config.use_anisotropic_filter) { + glGetFloatv(_GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&config.anisotropic_level); + config.anisotropic_level=MIN(int(Globals::get_singleton()->get("rendering/gles3/anisotropic_filter_level")),config.anisotropic_level); + } + + + frame.clear_request=false; + + shaders.copy.init(); + + { + //default textures + + + glGenTextures(1, &resources.white_tex); + unsigned char whitetexdata[8*8*3]; + for(int i=0;i<8*8*3;i++) { + whitetexdata[i]=255; + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,resources.white_tex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE,whitetexdata); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D,0); + + glGenTextures(1, &resources.black_tex); + unsigned char blacktexdata[8*8*3]; + for(int i=0;i<8*8;i++) { + blacktexdata[i]=0; + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,resources.black_tex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE,blacktexdata); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D,0); + + glGenTextures(1, &resources.normal_tex); + unsigned char normaltexdata[8*8*3]; + for(int i=0;i<8*8*3;i+=3) { + normaltexdata[i+0]=128; + normaltexdata[i+1]=128; + normaltexdata[i+2]=255; + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,resources.normal_tex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE,normaltexdata); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D,0); + + } + + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&config.max_texture_image_units); + glGetIntegerv(GL_MAX_TEXTURE_SIZE,&config.max_texture_size); + +#ifdef GLEW_ENABLED + config.use_rgba_2d_shadows=false; +#else + config.use_rgba_2d_shadows=true; +#endif +} + +void RasterizerStorageGLES3::finalize() { + + glDeleteTextures(1, &resources.white_tex); + glDeleteTextures(1, &resources.black_tex); + glDeleteTextures(1, &resources.normal_tex); + +} + + +RasterizerStorageGLES3::RasterizerStorageGLES3() +{ + +} diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h new file mode 100644 index 0000000000..3b2d7d752c --- /dev/null +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -0,0 +1,445 @@ +#ifndef RASTERIZERSTORAGEGLES3_H +#define RASTERIZERSTORAGEGLES3_H + +#include "servers/visual/rasterizer.h" +#include "shader_gles3.h" +#include "shaders/copy.glsl.h" +#include "shaders/canvas.glsl.h" + + + + +class RasterizerStorageGLES3 : public RasterizerStorage { +public: + + enum FBOFormat { + FBO_FORMAT_16_BITS, + FBO_FORMAT_32_BITS, + FBO_FORMAT_FLOAT, + }; + + struct Config { + + FBOFormat fbo_format; + bool fbo_deferred; + GLuint system_fbo; //on some devices, such as apple, screen is rendered to yet another fbo. + + bool shrink_textures_x2; + bool use_fast_texture_filter; + bool use_anisotropic_filter; + + bool s3tc_supported; + bool latc_supported; + bool bptc_supported; + bool etc_supported; + bool etc2_supported; + bool pvrtc_supported; + + bool srgb_decode_supported; + + bool use_rgba_2d_shadows; + + float anisotropic_level; + + int max_texture_image_units; + int max_texture_size; + + Set extensions; + } config; + + struct Shaders { + + CopyShaderGLES3 copy; + } shaders; + + struct Resources { + + GLuint white_tex; + GLuint black_tex; + GLuint normal_tex; + + } resources; + + struct Info { + + uint64_t texture_mem; + + } info; + + +///////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////DATA/////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + +///////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////API//////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// + + + /* TEXTURE API */ + + struct RenderTarget; + + struct Texture : public RID_Data { + + String path; + uint32_t flags; + int width,height; + int alloc_width, alloc_height; + Image::Format format; + + GLenum target; + GLenum gl_format_cache; + GLenum gl_internal_format_cache; + GLenum gl_type_cache; + int data_size; //original data size, useful for retrieving back + bool compressed; + bool srgb; + int total_data_size; + bool ignore_mipmaps; + + int mipmaps; + + bool active; + GLuint tex_id; + + + RenderTarget *render_target; + + Texture() { + + ignore_mipmaps=false; + render_target=NULL; + flags=width=height=0; + tex_id=0; + data_size=0; + format=Image::FORMAT_L8; + active=false; + compressed=false; + total_data_size=0; + target=GL_TEXTURE_2D; + mipmaps=0; + + } + + ~Texture() { + + if (tex_id!=0) { + + glDeleteTextures(1,&tex_id); + } + } + }; + + mutable RID_Owner texture_owner; + + Image _get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags, GLenum& r_gl_format, GLenum& r_gl_internal_format, GLenum &r_type, bool &r_compressed, bool &srgb); + + virtual RID texture_create(); + virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=VS::TEXTURE_FLAGS_DEFAULT); + virtual void texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT); + virtual Image texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT) const; + virtual void texture_set_flags(RID p_texture,uint32_t p_flags); + virtual uint32_t texture_get_flags(RID p_texture) const; + virtual Image::Format texture_get_format(RID p_texture) const; + virtual uint32_t texture_get_width(RID p_texture) const; + virtual uint32_t texture_get_height(RID p_texture) const; + virtual void texture_set_size_override(RID p_texture,int p_width, int p_height); + + virtual void texture_set_path(RID p_texture,const String& p_path); + virtual String texture_get_path(RID p_texture) const; + + virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable); + + virtual void texture_debug_usage(List *r_info); + + + /* SHADER API */ + + struct Shader : public RID_Data { + + + }; + + + virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_SPATIAL); + + virtual void shader_set_mode(RID p_shader,VS::ShaderMode p_mode); + virtual VS::ShaderMode shader_get_mode(RID p_shader) const; + + virtual void shader_set_code(RID p_shader, const String& p_code); + virtual String shader_get_code(RID p_shader) const; + virtual void shader_get_param_list(RID p_shader, List *p_param_list) const; + + virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); + virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const; + + + /* COMMON MATERIAL API */ + + virtual RID material_create(); + + virtual void material_set_shader(RID p_shader_material, RID p_shader); + virtual RID material_get_shader(RID p_shader_material) const; + + virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); + virtual Variant material_get_param(RID p_material, const StringName& p_param) const; + + /* MESH API */ + + virtual RID mesh_create(); + + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >()); + + virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); + virtual int mesh_get_morph_target_count(RID p_mesh) const; + + + virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode); + virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; + + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); + virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; + + virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; + virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; + + virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const; + virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const; + + + virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; + virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; + + virtual void mesh_remove_surface(RID p_mesh,int p_index); + virtual int mesh_get_surface_count(RID p_mesh) const; + + virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); + virtual AABB mesh_get_custom_aabb(RID p_mesh) const; + + virtual AABB mesh_get_aabb(RID p_mesh) const; + virtual void mesh_clear(RID p_mesh); + + /* MULTIMESH API */ + + + virtual RID multimesh_create(); + + virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb=true); + virtual int multimesh_get_instance_count(RID p_multimesh) const; + + virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); + virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb); + virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform); + virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); + + virtual RID multimesh_get_mesh(RID p_multimesh) const; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const; + + virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; + virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; + virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; + + virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); + virtual int multimesh_get_visible_instances(RID p_multimesh) const; + + virtual AABB multimesh_get_aabb(RID p_mesh) const; + + /* IMMEDIATE API */ + + virtual RID immediate_create(); + virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID()); + virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); + virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex); + virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); + virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); + virtual void immediate_color(RID p_immediate,const Color& p_color); + virtual void immediate_uv(RID p_immediate,const Vector2& tex_uv); + virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv); + virtual void immediate_end(RID p_immediate); + virtual void immediate_clear(RID p_immediate); + virtual void immediate_set_material(RID p_immediate,RID p_material); + virtual RID immediate_get_material(RID p_immediate) const; + + /* SKELETON API */ + + virtual RID skeleton_create(); + virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false); + virtual int skeleton_get_bone_count(RID p_skeleton) const; + virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform); + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone); + + /* Light API */ + + virtual RID light_create(VS::LightType p_type); + + virtual void light_set_color(RID p_light,const Color& p_color); + virtual void light_set_param(RID p_light,VS::LightParam p_param,float p_value); + virtual void light_set_shadow(RID p_light,bool p_enabled); + virtual void light_set_projector(RID p_light,RID p_texture); + virtual void light_set_attenuation_texure(RID p_light,RID p_texture); + virtual void light_set_negative(RID p_light,bool p_enable); + virtual void light_set_cull_mask(RID p_light,uint32_t p_mask); + virtual void light_set_shader(RID p_light,RID p_shader); + + + virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode); + + /* PROBE API */ + + virtual RID reflection_probe_create(); + + virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity); + virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far); + virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance); + virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents); + virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset); + virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable); + virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution); + virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide); + virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); + + + /* ROOM API */ + + virtual RID room_create(); + virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform); + virtual void room_clear_bounds(); + + /* PORTAL API */ + + // portals are only (x/y) points, forming a convex shape, which its clockwise + // order points outside. (z is 0); + + virtual RID portal_create(); + virtual void portal_set_shape(RID p_portal, const Vector& p_shape); + virtual void portal_set_enabled(RID p_portal, bool p_enabled); + virtual void portal_set_disable_distance(RID p_portal, float p_distance); + virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); + + + /* RENDER TARGET */ + + struct RenderTarget : public RID_Data { + + struct Color { + GLuint fbo; + GLuint color; + } front,back; + + GLuint depth; + + struct Deferred { + GLuint fbo; + GLuint fbo_color; + + GLuint albedo_ao; + GLuint metal_rough_motion; + GLuint normal_special; + } deferred; + + int width,height; + + bool flags[RENDER_TARGET_FLAG_MAX]; + + bool used_in_frame; + + RenderTarget() { + + width=0; + height=0; + depth=0; + front.fbo=0; + back.fbo=0; + deferred.fbo=0; + deferred.fbo_color=0; + used_in_frame=false; + + flags[RENDER_TARGET_VFLIP]=false; + flags[RENDER_TARGET_TRANSPARENT]=false; + flags[RENDER_TARGET_NO_3D]=false; + flags[RENDER_TARGET_NO_SAMPLING]=false; + } + }; + + mutable RID_Owner render_target_owner; + + void _render_target_clear(RenderTarget *rt); + void _render_target_allocate(RenderTarget *rt); + + virtual RID render_target_create(); + virtual void render_target_set_size(RID p_render_target,int p_width, int p_height); + virtual RID render_target_get_texture(RID p_render_target) const; + virtual Image render_target_get_image(RID p_render_target) const; + virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value); + virtual bool render_target_renedered_in_frame(RID p_render_target); + + /* CANVAS SHADOW */ + + struct CanvasLightShadow : public RID_Data { + + int size; + int height; + GLuint fbo; + GLuint depth; + GLuint distance; //for older devices + }; + + RID_Owner canvas_light_shadow_owner; + + virtual RID canvas_light_shadow_buffer_create(int p_width); + + /* LIGHT SHADOW MAPPING */ + + struct CanvasOccluder : public RID_Data { + + GLuint vertex_id; // 0 means, unconfigured + GLuint index_id; // 0 means, unconfigured + DVector lines; + int len; + }; + + RID_Owner canvas_occluder_owner; + + virtual RID canvas_light_occluder_create(); + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines); + + virtual bool free(RID p_rid); + + + struct Frame { + + RenderTarget *current_rt; + + bool clear_request; + Color clear_request_color; + int canvas_draw_commands; + } frame; + + void initialize(); + void finalize(); + + + + RasterizerStorageGLES3(); +}; + + +#endif // RASTERIZERSTORAGEGLES3_H diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp new file mode 100644 index 0000000000..f8c0234943 --- /dev/null +++ b/drivers/gles3/shader_gles3.cpp @@ -0,0 +1,754 @@ +/*************************************************************************/ +/* shader_gles2.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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 "shader_gles3.h" + + +#include "print_string.h" + +//#define DEBUG_OPENGL + +#ifdef DEBUG_OPENGL + +#define DEBUG_TEST_ERROR(m_section)\ +{\ + uint32_t err = glGetError();\ + if (err) {\ + print_line("OpenGL Error #"+itos(err)+" at: "+m_section);\ + }\ +} +#else + +#define DEBUG_TEST_ERROR(m_section) + +#endif + +ShaderGLES3 *ShaderGLES3::active=NULL; + + + +//#define DEBUG_SHADER + +#ifdef DEBUG_SHADER + +#define DEBUG_PRINT(m_text) print_line(m_text); + +#else + +#define DEBUG_PRINT(m_text) + +#endif + + +void ShaderGLES3::bind_uniforms() { + + if (!uniforms_dirty) { + return; + }; + + // upload default uniforms + const Map::Element *E =uniform_defaults.front(); + + while(E) { + int idx=E->key(); + int location=version->uniform_location[idx]; + + if (location<0) { + E=E->next(); + continue; + + } + + const Variant &v=E->value(); + _set_uniform_variant(location, v); + //print_line("uniform "+itos(location)+" value "+v+ " type "+Variant::get_type_name(v.get_type())); + E=E->next(); + }; + + const Map::Element* C = uniform_cameras.front(); + while (C) { + + int location = version->uniform_location[C->key()]; + if (location<0) { + C=C->next(); + continue; + } + + glUniformMatrix4fv(location,1,false,&(C->get().matrix[0][0])); + C = C->next(); + }; + + uniforms_dirty = false; +}; + +GLint ShaderGLES3::get_uniform_location(int p_idx) const { + + ERR_FAIL_COND_V(!version, -1); + + return version->uniform_location[p_idx]; +}; + +bool ShaderGLES3::bind() { + + if (active!=this || !version || new_conditional_version.key!=conditional_version.key) { + conditional_version=new_conditional_version; + version = get_current_version(); + } else { + + return false; + } + + ERR_FAIL_COND_V(!version,false); + + glUseProgram( version->id ); + + DEBUG_TEST_ERROR("Use Program"); + + active=this; + uniforms_dirty = true; +/* + * why on earth is this code here? + for (int i=0;i& p_code) { + + + int line=1; + String total_code; + + for(int i=0;i lines = String(total_code).split("\n"); + + for(int j=0;jversion==_v->code_version) + return _v; + } else { + return _v; + } + + } + + + + if (!_v) + version_map[conditional_version]=Version(); + + + Version &v = version_map[conditional_version]; + + if (!_v) { + + v.uniform_location = memnew_arr( GLint, uniform_count ); + + } else { + if (v.ok) { + //bye bye shaders + glDeleteShader( v.vert_id ); + glDeleteShader( v.frag_id ); + glDeleteProgram( v.id ); + v.id=0; + } + + } + + v.ok=false; + /* SETUP CONDITIONALS */ + + Vector strings; +#ifdef GLEW_ENABLED + //strings.push_back("#version 330\n"); + strings.push_back("#version 300 es\n"); +#else + strings.push_back("#version 300 es\n"); //ATI requieres this before anything +#endif + + + int define_line_ofs=1; + + for(int j=0;j0 ) { + //do custom code related stuff + + ERR_FAIL_COND_V( !custom_code_map.has( conditional_version.code_version ), NULL ); + cc=&custom_code_map[conditional_version.code_version]; + v.code_version=cc->version; + define_line_ofs+=2; + } + + + /* CREATE PROGRAM */ + + v.id = glCreateProgram(); + + ERR_FAIL_COND_V(v.id==0, NULL); + + /* VERTEX SHADER */ + + + if (cc) { + for(int i=0;icustom_defines.size();i++) { + + strings.push_back(cc->custom_defines[i]); + DEBUG_PRINT("CD #"+itos(i)+": "+String(cc->custom_defines[i])); + } + } + + int strings_base_size=strings.size(); + + //vertex precision is high + strings.push_back("precision highp float;\n"); + strings.push_back("precision highp int;\n"); + +#if 0 + if (cc) { + + String _code_string = "#define VERTEX_SHADER_CODE "+cc->vertex+"\n"; + String _code_globals = "#define VERTEX_SHADER_GLOBALS "+cc->vertex_globals+"\n"; + + code_string=_code_string.ascii(); + code_globals=_code_globals.ascii(); + DEBUG_PRINT( code_globals.get_data() ); + DEBUG_PRINT( code_string.get_data() ); + strings.push_back(code_globals); + strings.push_back(code_string); + } +#endif + + + strings.push_back(vertex_code0.get_data()); + if (cc) { + code_globals=cc->vertex_globals.ascii(); + strings.push_back(code_globals.get_data()); + } + strings.push_back(vertex_code1.get_data()); + + if (cc) { + code_string=cc->vertex.ascii(); + strings.push_back(code_string.get_data()); + } + + strings.push_back(vertex_code2.get_data()); +#ifdef DEBUG_SHADER + + DEBUG_PRINT("\nVertex Code:\n\n"+String(code_string.get_data())); + for(int i=0;ifragment+"\n"; + String _code_globals = "#define FRAGMENT_SHADER_GLOBALS "+cc->fragment_globals+"\n"; + + code_string=_code_string.ascii(); + code_globals=_code_globals.ascii(); + DEBUG_PRINT( code_globals.get_data() ); + DEBUG_PRINT( code_string.get_data() ); + strings.push_back(code_globals); + strings.push_back(code_string); + } +#endif + + + strings.push_back(fragment_code0.get_data()); + if (cc) { + code_globals=cc->fragment_globals.ascii(); + strings.push_back(code_globals.get_data()); + } + strings.push_back(fragment_code1.get_data()); + + if (cc) { + code_string=cc->fragment.ascii(); + strings.push_back(code_string.get_data()); + } + + strings.push_back(fragment_code2.get_data()); + + if (cc) { + code_string2=cc->light.ascii(); + strings.push_back(code_string2.get_data()); + } + + strings.push_back(fragment_code3.get_data()); + +#ifdef DEBUG_SHADER + DEBUG_PRINT("\nFragment Code:\n\n"+String(code_string.get_data())); + for(int i=0;i=0) { + if (texunit_pairs[i].index<0) { + glUniform1i(loc,max_image_units+texunit_pairs[i].index); //negative, goes down + } else { + + glUniform1i(loc,texunit_pairs[i].index); + } + } + } + + // assign uniform block bind points + for (int i=0;i=0) + glUniformBlockBinding(v.id,loc,ubo_pairs[i].index); + } + + if ( cc ) { + + v.custom_uniform_locations.resize(cc->custom_uniforms.size()); + for(int i=0;icustom_uniforms.size();i++) { + + v.custom_uniform_locations[i]=glGetUniformLocation(v.id,String(cc->custom_uniforms[i]).ascii().get_data()); + } + } + + glUseProgram(0); + + + v.ok=true; + + return &v; +} + +GLint ShaderGLES3::get_uniform_location(const String& p_name) const { + + ERR_FAIL_COND_V(!version,-1); + return glGetUniformLocation(version->id,p_name.ascii().get_data()); +} + + +void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_count,const char** p_uniform_names,int p_uniform_count, const AttributePair* p_attribute_pairs, int p_attribute_count, const TexUnitPair *p_texunit_pairs, int p_texunit_pair_count, const UBOPair *p_ubo_pairs, int p_ubo_pair_count,const char*p_vertex_code, const char *p_fragment_code,int p_vertex_code_start,int p_fragment_code_start) { + + ERR_FAIL_COND(version); + conditional_version.key=0; + new_conditional_version.key=0; + uniform_count=p_uniform_count; + conditional_count=p_conditional_count; + conditional_defines=p_conditional_defines; + uniform_names=p_uniform_names; + vertex_code=p_vertex_code; + fragment_code=p_fragment_code; + texunit_pairs=p_texunit_pairs; + texunit_pair_count=p_texunit_pair_count; + vertex_code_start=p_vertex_code_start; + fragment_code_start=p_fragment_code_start; + attribute_pairs=p_attribute_pairs; + attribute_pair_count=p_attribute_count; + ubo_pairs=p_ubo_pairs; + ubo_count=p_ubo_pair_count; + + //split vertex and shader code (thank you, retarded shader compiler programmers from you know what company). + { + String globals_tag="\nVERTEX_SHADER_GLOBALS"; + String code_tag="\nVERTEX_SHADER_CODE"; + String code = vertex_code; + int cpos = code.find(globals_tag); + if (cpos==-1) { + vertex_code0=code.ascii(); + } else { + vertex_code0=code.substr(0,cpos).ascii(); + code = code.substr(cpos+globals_tag.length(),code.length()); + + cpos = code.find(code_tag); + + if (cpos==-1) { + vertex_code1=code.ascii(); + } else { + + vertex_code1=code.substr(0,cpos).ascii(); + vertex_code2=code.substr(cpos+code_tag.length(),code.length()).ascii(); + } + } + } + + { + String globals_tag="\nFRAGMENT_SHADER_GLOBALS"; + String code_tag="\nFRAGMENT_SHADER_CODE"; + String light_code_tag="\nLIGHT_SHADER_CODE"; + String code = fragment_code; + int cpos = code.find(globals_tag); + if (cpos==-1) { + fragment_code0=code.ascii(); + } else { + fragment_code0=code.substr(0,cpos).ascii(); + code = code.substr(cpos+globals_tag.length(),code.length()); + + cpos = code.find(code_tag); + + if (cpos==-1) { + fragment_code1=code.ascii(); + } else { + + fragment_code1=code.substr(0,cpos).ascii(); + String code2 = code.substr(cpos+code_tag.length(),code.length()); + + cpos = code2.find(light_code_tag); + if (cpos==-1) { + fragment_code2=code2.ascii(); + } else { + + fragment_code2=code2.substr(0,cpos).ascii(); + fragment_code3 = code2.substr(cpos+light_code_tag.length(),code2.length()).ascii(); + } + } + } + } + +} + +void ShaderGLES3::finish() { + + const VersionKey *V=NULL; + while((V=version_map.next(V))) { + + Version &v=version_map[*V]; + glDeleteShader( v.vert_id ); + glDeleteShader( v.frag_id ); + glDeleteProgram( v.id ); + memdelete_arr( v.uniform_location ); + + } + +} + + +void ShaderGLES3::clear_caches() { + + const VersionKey *V=NULL; + while((V=version_map.next(V))) { + + Version &v=version_map[*V]; + glDeleteShader( v.vert_id ); + glDeleteShader( v.frag_id ); + glDeleteProgram( v.id ); + memdelete_arr( v.uniform_location ); + } + + version_map.clear(); + + custom_code_map.clear(); + version=NULL; + last_custom_code=1; + uniforms_dirty = true; + +} + +uint32_t ShaderGLES3::create_custom_shader() { + + custom_code_map[last_custom_code]=CustomCode(); + custom_code_map[last_custom_code].version=1; + return last_custom_code++; +} + +void ShaderGLES3::set_custom_shader_code(uint32_t p_code_id, const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_light, const String& p_fragment_globals,const Vector& p_uniforms,const Vector &p_custom_defines) { + + ERR_FAIL_COND(!custom_code_map.has(p_code_id)); + CustomCode *cc=&custom_code_map[p_code_id]; + + cc->vertex=p_vertex; + cc->vertex_globals=p_vertex_globals; + cc->fragment=p_fragment; + cc->fragment_globals=p_fragment_globals; + cc->light=p_light; + cc->custom_uniforms=p_uniforms; + cc->custom_defines=p_custom_defines; + cc->version++; +} + +void ShaderGLES3::set_custom_shader(uint32_t p_code_id) { + + new_conditional_version.code_version=p_code_id; +} + +void ShaderGLES3::free_custom_shader(uint32_t p_code_id) { + + /* if (! custom_code_map.has( p_code_id )) { + print_line("no code id "+itos(p_code_id)); + } else { + print_line("freed code id "+itos(p_code_id)); + + }*/ + + ERR_FAIL_COND(! custom_code_map.has( p_code_id )); + if (conditional_version.code_version==p_code_id) + conditional_version.code_version=0; //bye + + custom_code_map.erase(p_code_id); + +} + + + +ShaderGLES3::ShaderGLES3() { + version=NULL; + last_custom_code=1; + uniforms_dirty = true; + + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&max_image_units); +} + + +ShaderGLES3::~ShaderGLES3() { + + finish(); +} + + + diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h new file mode 100644 index 0000000000..7aaf65d450 --- /dev/null +++ b/drivers/gles3/shader_gles3.h @@ -0,0 +1,377 @@ +/*************************************************************************/ +/* shader_gles2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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 SHADER_GLES3_H +#define SHADER_GLES3_H + + +#include "platform_config.h" +#ifndef GLES3_INCLUDE_H +#include +#else +#include GLES3_INCLUDE_H +#endif + +#include "hash_map.h" +#include "map.h" +#include "variant.h" +#include "camera_matrix.h" + +/** + @author Juan Linietsky +*/ + + +class ShaderGLES3 { +protected: + + struct Enum { + + uint64_t mask; + uint64_t shift; + const char *defines[16]; + }; + + struct EnumValue { + + uint64_t set_mask; + uint64_t clear_mask; + }; + + struct AttributePair { + + const char *name; + int index; + }; + + struct UniformPair { + const char* name; + Variant::Type type_hint; + }; + + struct TexUnitPair { + + const char *name; + int index; + }; + + struct UBOPair { + + const char *name; + int index; + }; + + bool uniforms_dirty; +private: + + //@TODO Optimize to a fixed set of shader pools and use a LRU + int uniform_count; + int texunit_pair_count; + int conditional_count; + int ubo_count; + int vertex_code_start; + int fragment_code_start; + int attribute_pair_count; + + struct CustomCode { + + String vertex; + String vertex_globals; + String fragment; + String fragment_globals; + String light; + uint32_t version; + Vector custom_uniforms; + Vector custom_defines; + + }; + + + struct Version { + + GLuint id; + GLuint vert_id; + GLuint frag_id; + GLint *uniform_location; + Vector custom_uniform_locations; + uint32_t code_version; + bool ok; + Version() { code_version=0; ok=false; uniform_location=NULL; } + }; + + Version *version; + + union VersionKey { + + struct { + uint32_t version; + uint32_t code_version; + }; + uint64_t key; + bool operator==(const VersionKey& p_key) const { return key==p_key.key; } + bool operator<(const VersionKey& p_key) const { return key version_map; + + HashMap custom_code_map; + uint32_t last_custom_code; + + + VersionKey conditional_version; + VersionKey new_conditional_version; + + virtual String get_shader_name() const=0; + + const char** conditional_defines; + const char** uniform_names; + const AttributePair *attribute_pairs; + const TexUnitPair *texunit_pairs; + const UBOPair *ubo_pairs; + const char* vertex_code; + const char* fragment_code; + CharString fragment_code0; + CharString fragment_code1; + CharString fragment_code2; + CharString fragment_code3; + + CharString vertex_code0; + CharString vertex_code1; + CharString vertex_code2; + + Version * get_current_version(); + + static ShaderGLES3 *active; + + int max_image_units; + + _FORCE_INLINE_ void _set_uniform_variant(GLint p_uniform,const Variant& p_value) { + + if (p_uniform<0) + return; // do none + switch(p_value.get_type()) { + + case Variant::BOOL: + case Variant::INT: { + + int val=p_value; + glUniform1i( p_uniform, val ); + } break; + case Variant::REAL: { + + real_t val=p_value; + glUniform1f( p_uniform, val ); + } break; + case Variant::COLOR: { + + Color val=p_value; + glUniform4f( p_uniform, val.r, val.g,val.b,val.a ); + } break; + case Variant::VECTOR2: { + + Vector2 val=p_value; + glUniform2f( p_uniform, val.x,val.y ); + } break; + case Variant::VECTOR3: { + + Vector3 val=p_value; + glUniform3f( p_uniform, val.x,val.y,val.z ); + } break; + case Variant::PLANE: { + + Plane val=p_value; + glUniform4f( p_uniform, val.normal.x,val.normal.y,val.normal.z,val.d ); + } break; + case Variant::QUAT: { + + Quat val=p_value; + glUniform4f( p_uniform, val.x,val.y,val.z,val.w ); + } break; + + case Variant::MATRIX32: { + + Matrix32 tr=p_value; + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.elements[0][0], + tr.elements[0][1], + 0, + 0, + tr.elements[1][0], + tr.elements[1][1], + 0, + 0, + 0, + 0, + 1, + 0, + tr.elements[2][0], + tr.elements[2][1], + 0, + 1 + }; + + glUniformMatrix4fv(p_uniform,1,false,matrix); + + } break; + case Variant::MATRIX3: + case Variant::TRANSFORM: { + + Transform tr=p_value; + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.basis.elements[0][0], + tr.basis.elements[1][0], + tr.basis.elements[2][0], + 0, + tr.basis.elements[0][1], + tr.basis.elements[1][1], + tr.basis.elements[2][1], + 0, + tr.basis.elements[0][2], + tr.basis.elements[1][2], + tr.basis.elements[2][2], + 0, + tr.origin.x, + tr.origin.y, + tr.origin.z, + 1 + }; + + + glUniformMatrix4fv(p_uniform,1,false,matrix); + } break; + default: { ERR_FAIL(); } // do nothing + + } + } + + Map uniform_defaults; + Map uniform_cameras; + + +protected: + + _FORCE_INLINE_ int _get_uniform(int p_which) const; + _FORCE_INLINE_ void _set_conditional(int p_which, bool p_value); + + void setup(const char** p_conditional_defines, int p_conditional_count,const char** p_uniform_names,int p_uniform_count, const AttributePair* p_attribute_pairs, int p_attribute_count, const TexUnitPair *p_texunit_pairs, int p_texunit_pair_count, const UBOPair *p_ubo_pairs, int p_ubo_pair_count,const char*p_vertex_code, const char *p_fragment_code,int p_vertex_code_start,int p_fragment_code_start); + + ShaderGLES3(); +public: + + enum { + CUSTOM_SHADER_DISABLED=0 + }; + + GLint get_uniform_location(const String& p_name) const; + GLint get_uniform_location(int p_uniform) const; + + static _FORCE_INLINE_ ShaderGLES3 *get_active() { return active; }; + bool bind(); + void unbind(); + void bind_uniforms(); + + + inline GLuint get_program() const { return version?version->id:0; } + + void clear_caches(); + + uint32_t create_custom_shader(); + void set_custom_shader_code(uint32_t p_id,const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_p_light,const String& p_fragment_globals,const Vector& p_uniforms,const Vector &p_custom_defines); + void set_custom_shader(uint32_t p_id); + void free_custom_shader(uint32_t p_id); + + void set_uniform_default(int p_idx, const Variant& p_value) { + + if (p_value.get_type()==Variant::NIL) { + + uniform_defaults.erase(p_idx); + } else { + + uniform_defaults[p_idx]=p_value; + } + uniforms_dirty = true; + } + + uint32_t get_version() const { return new_conditional_version.version; } + + void set_uniform_camera(int p_idx, const CameraMatrix& p_mat) { + + uniform_cameras[p_idx] = p_mat; + uniforms_dirty = true; + }; + + _FORCE_INLINE_ void set_custom_uniform(int p_idx, const Variant& p_value) { + + ERR_FAIL_COND(!version); + ERR_FAIL_INDEX(p_idx,version->custom_uniform_locations.size()); + _set_uniform_variant( version->custom_uniform_locations[p_idx], p_value ); + } + + _FORCE_INLINE_ GLint get_custom_uniform_location(int p_idx) { + + ERR_FAIL_COND_V(!version,-1); + ERR_FAIL_INDEX_V(p_idx,version->custom_uniform_locations.size(),-1); + return version->custom_uniform_locations[p_idx]; + } + + virtual void init()=0; + void finish(); + + virtual ~ShaderGLES3(); + +}; + + +// called a lot, made inline + + +int ShaderGLES3::_get_uniform(int p_which) const { + + ERR_FAIL_INDEX_V( p_which, uniform_count,-1 ); + ERR_FAIL_COND_V( !version, -1 ); + return version->uniform_location[p_which]; +} + +void ShaderGLES3::_set_conditional(int p_which, bool p_value) { + + ERR_FAIL_INDEX(p_which,conditional_count); + if (p_value) + new_conditional_version.version|=(1<135.0*PI/180.0) { + point = -light_vec; + sh = 0.5+(1.0/8.0); + } else if (angle_to_light>0.0) { + + point = vec2(light_vec.y,-light_vec.x); + sh = 0.25+(1.0/8.0); + } else { + + point = vec2(-light_vec.y,light_vec.x); + sh = 0.75+(1.0/8.0); + + } + + + highp vec4 s = shadow_matrix * vec4(point,0.0,1.0); + s.xyz/=s.w; + su=s.x*0.5+0.5; + sz=s.z*0.5+0.5; + //sz=lightlength(light_vec); + + highp float shadow_attenuation=0.0; + +#ifdef USE_RGBA_SHADOWS + +#define SHADOW_DEPTH(m_tex,m_uv) dot(texture2D((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) ) + +#else + +#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).r) + +#endif + + + +#ifdef SHADOW_USE_GRADIENT + +#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=1.0-smoothstep(sd,sd+shadow_gradient,sz); } + +#else + +#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=step(sz,sd); } + +#endif + + +#ifdef SHADOW_FILTER_NEAREST + + SHADOW_TEST(su+shadowpixel_size); + +#endif + + +#ifdef SHADOW_FILTER_PCF3 + + SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su); + SHADOW_TEST(su-shadowpixel_size); + shadow_attenuation/=3.0; + +#endif + + +#ifdef SHADOW_FILTER_PCF5 + + SHADOW_TEST(su+shadowpixel_size*3.0); + SHADOW_TEST(su+shadowpixel_size*2.0); + SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su); + SHADOW_TEST(su-shadowpixel_size); + SHADOW_TEST(su-shadowpixel_size*2.0); + SHADOW_TEST(su-shadowpixel_size*3.0); + shadow_attenuation/=5.0; + +#endif + + +#ifdef SHADOW_FILTER_PCF9 + + SHADOW_TEST(su+shadowpixel_size*4.0); + SHADOW_TEST(su+shadowpixel_size*3.0); + SHADOW_TEST(su+shadowpixel_size*2.0); + SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su); + SHADOW_TEST(su-shadowpixel_size); + SHADOW_TEST(su-shadowpixel_size*2.0); + SHADOW_TEST(su-shadowpixel_size*3.0); + SHADOW_TEST(su-shadowpixel_size*4.0); + shadow_attenuation/=9.0; + +#endif + +#ifdef SHADOW_FILTER_PCF13 + + SHADOW_TEST(su+shadowpixel_size*6.0); + SHADOW_TEST(su+shadowpixel_size*5.0); + SHADOW_TEST(su+shadowpixel_size*4.0); + SHADOW_TEST(su+shadowpixel_size*3.0); + SHADOW_TEST(su+shadowpixel_size*2.0); + SHADOW_TEST(su+shadowpixel_size); + SHADOW_TEST(su); + SHADOW_TEST(su-shadowpixel_size); + SHADOW_TEST(su-shadowpixel_size*2.0); + SHADOW_TEST(su-shadowpixel_size*3.0); + SHADOW_TEST(su-shadowpixel_size*4.0); + SHADOW_TEST(su-shadowpixel_size*5.0); + SHADOW_TEST(su-shadowpixel_size*6.0); + shadow_attenuation/=13.0; + +#endif + + +#if defined(USE_OUTPUT_SHADOW_COLOR) + color=mix(shadow_color,color,shadow_attenuation); +#else + //color*=shadow_attenuation; + color=mix(light_shadow_color,color,shadow_attenuation); +#endif +//use shadows +#endif + } + +//use lighting +#endif +// color.rgb*=color.a; + frag_color = color; + +} + diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl new file mode 100644 index 0000000000..c757990de0 --- /dev/null +++ b/drivers/gles3/shaders/canvas_shadow.glsl @@ -0,0 +1,49 @@ +[vertex] + + + +uniform highp mat4 projection_matrix; +uniform highp mat4 light_matrix; +uniform highp mat4 world_matrix; +uniform highp float distance_norm; + +layout(location=0) in highp vec3 vertex; + +out highp vec4 position_interp; + +void main() { + + gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0))); + position_interp=gl_Position; +} + +[fragment] + +in highp vec4 position_interp; + +#ifdef USE_RGBA_SHADOWS + +layout(location=0) out lowp vec4 distance_buf; + +#else + +layout(location=0) out highp float distance_buf; + +#endif + +void main() { + + highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias; + +#ifdef USE_RGBA_SHADOWS + + highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0)); + comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0); + distance_buf=comp; +#else + + distance_buf=depth; + +#endif +} + diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl new file mode 100644 index 0000000000..aba280186a --- /dev/null +++ b/drivers/gles3/shaders/copy.glsl @@ -0,0 +1,52 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +#ifdef USE_CUBEMAP +layout(location=4) in vec3 cube_in; +#else +layout(location=4) in vec2 uv_in; // attrib:4 +#endif +layout(location=5) in vec2 uv2_in; // attrib:5 + +#ifdef USE_CUBEMAP +out vec3 cube_interp; +#else +out vec2 uv_interp; +#endif + +out vec2 uv2_interp; + +void main() { + +#ifdef USE_CUBEMAP + cube_interp = cube_in; +#else + uv_interp = uv_in; +#endif + uv2_interp = uv2_in; + gl_Position = vertex_attrib; +} + +[fragment] + + +#ifdef USE_CUBEMAP +in vec3 cube_interp; +uniform samplerCube source_cube; +#else +in vec2 uv_interp; +uniform sampler2D source; +#endif + +in vec2 uv2_interp; + +layout(location = 0) vec4 frag_color; //color:0 + +void main() { + + //vec4 color = color_interp; + + frag_color = color; +} + diff --git a/drivers/jpegd/image_loader_jpegd.cpp b/drivers/jpegd/image_loader_jpegd.cpp index 496334605d..2ea9748034 100644 --- a/drivers/jpegd/image_loader_jpegd.cpp +++ b/drivers/jpegd/image_loader_jpegd.cpp @@ -83,9 +83,9 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ Image::Format fmt; if (comps==1) - fmt=Image::FORMAT_GRAYSCALE; + fmt=Image::FORMAT_L8; else - fmt=Image::FORMAT_RGBA; + fmt=Image::FORMAT_RGBA8; dw = DVector::Write(); p_image->create(image_width,image_height,0,fmt,data); diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 4967b0f9df..cd4f2d6529 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -113,25 +113,36 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) printf("Color type:%i\n", color); */ + bool update_info=false; + if (depth<8) { //only bit dept 8 per channel is handled png_set_packing(png); + update_info=true; + }; + if (png_get_color_type(png,info)==PNG_COLOR_TYPE_PALETTE) { + png_set_palette_to_rgb(png); + update_info=true; + } + if (depth > 8) { png_set_strip_16(png); - png_read_update_info(png, info); + update_info=true; } if (png_get_valid(png,info,PNG_INFO_tRNS)) { // png_set_expand_gray_1_2_4_to_8(png); png_set_tRNS_to_alpha(png); + update_info=true; + } + + if (update_info) { png_read_update_info(png, info); png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL); } - int palette_colors = 0; - int palette_components = 0; int components = 0; Image::Format fmt; @@ -140,38 +151,24 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) case PNG_COLOR_TYPE_GRAY: { - fmt=Image::FORMAT_GRAYSCALE; + fmt=Image::FORMAT_L8; components=1; } break; case PNG_COLOR_TYPE_GRAY_ALPHA: { - fmt=Image::FORMAT_GRAYSCALE_ALPHA; + fmt=Image::FORMAT_LA8; components=2; } break; case PNG_COLOR_TYPE_RGB: { - fmt=Image::FORMAT_RGB; + fmt=Image::FORMAT_RGB8; components=3; } break; case PNG_COLOR_TYPE_RGB_ALPHA: { - fmt=Image::FORMAT_RGBA; + fmt=Image::FORMAT_RGBA8; components=4; - } break; - case PNG_COLOR_TYPE_PALETTE: { - - int ntrans = 0; - png_get_tRNS(png, info, NULL, &ntrans, NULL); - //printf("transparent colors %i\n", ntrans); - - fmt = ntrans > 0 ? Image::FORMAT_INDEXED_ALPHA : Image::FORMAT_INDEXED; - palette_components = ntrans > 0 ? 4 : 3; - components = 1; - - png_colorp colors; - png_get_PLTE(png, info, &colors, &palette_colors); - - } break; + } break; default: { ERR_PRINT("INVALID PNG TYPE"); @@ -185,7 +182,7 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) DVector dstbuff; - dstbuff.resize( rowsize * height + palette_components * 256 ); // alloc the entire palette? - yes always + dstbuff.resize( rowsize * height ); DVector::Write dstbuff_write = dstbuff.write(); @@ -199,38 +196,6 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) png_read_image(png, (png_bytep*)row_p); - if (palette_colors) { - - uint8_t *r_pal = &data[components*width*height]; // end of the array - png_colorp colors; - int num; - png_get_PLTE(png, info, &colors, &num); - - int ofs = 0; - for (int i=0; i < palette_colors; i++) { - - r_pal[ofs + 0] = colors[i].red; - r_pal[ofs + 1] = colors[i].green; - r_pal[ofs + 2] = colors[i].blue; - if (palette_components == 4) { - r_pal[ofs + 3] = 255; - }; - ofs += palette_components; - }; - - if (fmt == Image::FORMAT_INDEXED_ALPHA) { - png_color_16p alphas; - png_bytep alpha_idx; - int count; - png_get_tRNS(png, info, &alpha_idx, &count, &alphas); - for (int i=0; i> 8; - r_pal[i*4+3] = alpha_idx[i]; - }; - }; - }; memdelete_arr( row_p ); @@ -324,11 +289,11 @@ static DVector _lossless_pack_png(const Image& p_image) { Image img = p_image; - if (img.get_format() > Image::FORMAT_INDEXED_ALPHA) + if (img.is_compressed()) img.decompress(); - ERR_FAIL_COND_V(img.get_format() > Image::FORMAT_INDEXED_ALPHA, DVector()); + ERR_FAIL_COND_V(img.is_compressed(), DVector()); png_structp png_ptr; png_infop info_ptr; @@ -365,22 +330,22 @@ static DVector _lossless_pack_png(const Image& p_image) { switch(img.get_format()) { - case Image::FORMAT_GRAYSCALE: { + case Image::FORMAT_L8: { pngf=PNG_COLOR_TYPE_GRAY; cs=1; } break; - case Image::FORMAT_GRAYSCALE_ALPHA: { + case Image::FORMAT_LA8: { pngf=PNG_COLOR_TYPE_GRAY_ALPHA; cs=2; } break; - case Image::FORMAT_RGB: { + case Image::FORMAT_RGB8: { pngf=PNG_COLOR_TYPE_RGB; cs=3; } break; - case Image::FORMAT_RGBA: { + case Image::FORMAT_RGBA8: { pngf=PNG_COLOR_TYPE_RGB_ALPHA; cs=4; @@ -389,12 +354,12 @@ static DVector _lossless_pack_png(const Image& p_image) { if (img.detect_alpha()) { - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); pngf=PNG_COLOR_TYPE_RGB_ALPHA; cs=4; } else { - img.convert(Image::FORMAT_RGB); + img.convert(Image::FORMAT_RGB8); pngf=PNG_COLOR_TYPE_RGB; cs=3; } diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 2578fe9eb6..c641f6ee85 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -96,10 +96,10 @@ Error ResourceSaverPNG::save(const String &p_path,const RES& p_resource,uint32_t Error ResourceSaverPNG::save_image(const String &p_path, Image &p_img) { - if (p_img.get_format() > Image::FORMAT_INDEXED_ALPHA) + if (p_img.is_compressed()) p_img.decompress(); - ERR_FAIL_COND_V(p_img.get_format() > Image::FORMAT_INDEXED_ALPHA, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_img.is_compressed(), ERR_INVALID_PARAMETER); png_structp png_ptr; png_infop info_ptr; @@ -138,22 +138,22 @@ Error ResourceSaverPNG::save_image(const String &p_path, Image &p_img) { switch(p_img.get_format()) { - case Image::FORMAT_GRAYSCALE: { + case Image::FORMAT_L8: { pngf=PNG_COLOR_TYPE_GRAY; cs=1; } break; - case Image::FORMAT_GRAYSCALE_ALPHA: { + case Image::FORMAT_LA8: { pngf=PNG_COLOR_TYPE_GRAY_ALPHA; cs=2; } break; - case Image::FORMAT_RGB: { + case Image::FORMAT_RGB8: { pngf=PNG_COLOR_TYPE_RGB; cs=3; } break; - case Image::FORMAT_RGBA: { + case Image::FORMAT_RGBA8: { pngf=PNG_COLOR_TYPE_RGB_ALPHA; cs=4; @@ -162,12 +162,12 @@ Error ResourceSaverPNG::save_image(const String &p_path, Image &p_img) { if (p_img.detect_alpha()) { - p_img.convert(Image::FORMAT_RGBA); + p_img.convert(Image::FORMAT_RGBA8); pngf=PNG_COLOR_TYPE_RGB_ALPHA; cs=4; } else { - p_img.convert(Image::FORMAT_RGB); + p_img.convert(Image::FORMAT_RGB8); pngf=PNG_COLOR_TYPE_RGB; cs=3; } diff --git a/drivers/pvr/texture_loader_pvr.cpp b/drivers/pvr/texture_loader_pvr.cpp index 3ab3240512..b2063292e9 100644 --- a/drivers/pvr/texture_loader_pvr.cpp +++ b/drivers/pvr/texture_loader_pvr.cpp @@ -116,33 +116,33 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E switch(flags&0xFF) { case 0x18: - case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2_ALPHA:Image::FORMAT_PVRTC2; break; + case 0xC: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC2A:Image::FORMAT_PVRTC2; break; case 0x19: - case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4; break; + case 0xD: format=(flags&PVR_HAS_ALPHA)?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4; break; case 0x16: - format=Image::FORMAT_GRAYSCALE; break; + format=Image::FORMAT_L8; break; case 0x17: - format=Image::FORMAT_GRAYSCALE_ALPHA; break; + format=Image::FORMAT_LA8; break; case 0x20: case 0x80: case 0x81: - format=Image::FORMAT_BC1; break; + format=Image::FORMAT_DXT1; break; case 0x21: case 0x22: case 0x82: case 0x83: - format=Image::FORMAT_BC2; break; + format=Image::FORMAT_DXT3; break; case 0x23: case 0x24: case 0x84: case 0x85: - format=Image::FORMAT_BC3; break; + format=Image::FORMAT_DXT5; break; case 0x4: case 0x15: - format=Image::FORMAT_RGB; break; + format=Image::FORMAT_RGB8; break; case 0x5: case 0x12: - format=Image::FORMAT_RGBA; break; + format=Image::FORMAT_RGBA8; break; case 0x36: format=Image::FORMAT_ETC; break; default: @@ -198,24 +198,24 @@ static void _compress_pvrtc4(Image * p_img) { bool make_mipmaps=false; if (img.get_width()%8 || img.get_height()%8) { - make_mipmaps=img.get_mipmaps()>0; + make_mipmaps=img.has_mipmaps(); img.resize(img.get_width()+(8-(img.get_width()%8)),img.get_height()+(8-(img.get_height()%8))); } - img.convert(Image::FORMAT_RGBA); - if (img.get_mipmaps()==0 && make_mipmaps) + img.convert(Image::FORMAT_RGBA8); + if (!img.has_mipmaps() && make_mipmaps) img.generate_mipmaps(); bool use_alpha=img.detect_alpha(); Image new_img; - new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4_ALPHA:Image::FORMAT_PVRTC4); + new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4); DVector data=new_img.get_data(); { DVector::Write wr=data.write(); DVector::Read r=img.get_data().read(); - for(int i=0;i<=new_img.get_mipmaps();i++) { + for(int i=0;i<=new_img.get_mipmap_count();i++) { int ofs,size,w,h; img.get_mipmap_offset_size_and_dimensions(i,ofs,size,w,h); @@ -234,7 +234,7 @@ static void _compress_pvrtc4(Image * p_img) { } - *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.get_mipmaps(),new_img.get_format(),data); + *p_img = Image(new_img.get_width(),new_img.get_height(),new_img.has_mipmaps(),new_img.get_format(),data); } @@ -673,9 +673,9 @@ static void _pvrtc_decompress(Image* p_img) { // decompress_pvrtc((PVRTCBlock*)p_comp_img,p_2bit,p_width,p_height,1,p_dst); // } - ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2_ALPHA && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4_ALPHA); + ERR_FAIL_COND( p_img->get_format()!=Image::FORMAT_PVRTC2 && p_img->get_format()!=Image::FORMAT_PVRTC2A && p_img->get_format()!=Image::FORMAT_PVRTC4 && p_img->get_format()!=Image::FORMAT_PVRTC4A); - bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2_ALPHA ); + bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A ); DVector data = p_img->get_data(); DVector::Read r = data.read(); @@ -694,8 +694,8 @@ static void _pvrtc_decompress(Image* p_img) { w=DVector::Write(); r=DVector::Read(); - bool make_mipmaps=p_img->get_mipmaps()>0; - Image newimg(p_img->get_width(),p_img->get_height(),0,Image::FORMAT_RGBA,newdata); + bool make_mipmaps=p_img->has_mipmaps(); + Image newimg(p_img->get_width(),p_img->get_height(),false,Image::FORMAT_RGBA8,newdata); if (make_mipmaps) newimg.generate_mipmaps(); *p_img=newimg; diff --git a/drivers/squish/image_compress_squish.cpp b/drivers/squish/image_compress_squish.cpp index 95de83d5a5..2cab6e6059 100644 --- a/drivers/squish/image_compress_squish.cpp +++ b/drivers/squish/image_compress_squish.cpp @@ -35,7 +35,7 @@ void image_compress_squish(Image *p_image) { int w=p_image->get_width(); int h=p_image->get_height(); - if (p_image->get_mipmaps() == 0) { + if (!p_image->has_mipmaps() ) { ERR_FAIL_COND( !w || w % 4 != 0); ERR_FAIL_COND( !h || h % 4 != 0); } else { @@ -43,26 +43,26 @@ void image_compress_squish(Image *p_image) { ERR_FAIL_COND( !h || h !=nearest_power_of_2(h) ); }; - if (p_image->get_format()>=Image::FORMAT_BC1) + if (p_image->get_format()>=Image::FORMAT_DXT1) return; //do not compress, already compressed int shift=0; int squish_comp=squish::kColourRangeFit; Image::Format target_format; - if (p_image->get_format()==Image::FORMAT_GRAYSCALE_ALPHA) { + if (p_image->get_format()==Image::FORMAT_LA8) { //compressed normalmap - target_format = Image::FORMAT_BC3; squish_comp|=squish::kDxt5;; + target_format = Image::FORMAT_DXT5; squish_comp|=squish::kDxt5;; } else if (p_image->detect_alpha()!=Image::ALPHA_NONE) { - target_format = Image::FORMAT_BC2; squish_comp|=squish::kDxt3;; + target_format = Image::FORMAT_DXT3; squish_comp|=squish::kDxt3;; } else { - target_format = Image::FORMAT_BC1; shift=1; squish_comp|=squish::kDxt1;; + target_format = Image::FORMAT_DXT1; shift=1; squish_comp|=squish::kDxt1;; } - p_image->convert(Image::FORMAT_RGBA); //always expects rgba + p_image->convert(Image::FORMAT_RGBA8); //always expects rgba - int mm_count = p_image->get_mipmaps(); + int mm_count = p_image->get_mipmap_count(); DVector data; int target_size = Image::get_image_data_size(w,h,target_format,mm_count); @@ -85,7 +85,7 @@ void image_compress_squish(Image *p_image) { rb = DVector::Read(); wb = DVector::Write(); - p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data); + p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data); } diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp index 1f3832ec16..7f7449de94 100644 --- a/drivers/theora/video_stream_theora.cpp +++ b/drivers/theora/video_stream_theora.cpp @@ -105,7 +105,7 @@ void VideoStreamPlaybackTheora::video_write(void){ dst[p++] = 255; }; } - format = Image::FORMAT_RGBA; + format = Image::FORMAT_RGBA8; } // */ @@ -132,10 +132,10 @@ void VideoStreamPlaybackTheora::video_write(void){ yuv420_2_rgb8888((uint8_t*)dst, (uint8_t*)yuv[0].data, (uint8_t*)yuv[2].data, (uint8_t*)yuv[1].data, size.x, size.y, yuv[0].stride, yuv[1].stride, size.x<<2, 0); }; - format = Image::FORMAT_RGBA; + format = Image::FORMAT_RGBA8; } - Image img(size.x,size.y,0,Image::FORMAT_RGBA,frame_data); //zero copy image creation + Image img(size.x,size.y,0,Image::FORMAT_RGBA8,frame_data); //zero copy image creation texture->set_data(img); //zero copy send to visual server @@ -204,7 +204,7 @@ void VideoStreamPlaybackTheora::video_write(void){ } } - format = Image::FORMAT_RGBA; + format = Image::FORMAT_RGBA8; } else { @@ -472,7 +472,7 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) { size.x = w; size.y = h; - texture->create(w,h,Image::FORMAT_RGBA,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE); + texture->create(w,h,Image::FORMAT_RGBA8,Texture::FLAG_FILTER|Texture::FLAG_VIDEO_SURFACE); }else{ /* tear down the partial theora setup */ diff --git a/drivers/webp/image_loader_webp.cpp b/drivers/webp/image_loader_webp.cpp index 68bb857293..d0b9285153 100644 --- a/drivers/webp/image_loader_webp.cpp +++ b/drivers/webp/image_loader_webp.cpp @@ -41,9 +41,9 @@ static DVector _webp_lossy_pack(const Image& p_image,float p_quality) { Image img=p_image; if (img.detect_alpha()) - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); else - img.convert(Image::FORMAT_RGB); + img.convert(Image::FORMAT_RGB8); Size2 s(img.get_width(),img.get_height()); DVector data = img.get_data(); @@ -51,7 +51,7 @@ static DVector _webp_lossy_pack(const Image& p_image,float p_quality) { uint8_t *dst_buff=NULL; size_t dst_size=0; - if (img.get_format()==Image::FORMAT_RGB) { + if (img.get_format()==Image::FORMAT_RGB8) { dst_size = WebPEncodeRGB(r.ptr(),s.width,s.height,3*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff); } else { @@ -108,7 +108,7 @@ static Image _webp_lossy_unpack(const DVector& p_buffer) { dst_w = DVector::Write(); - return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image); + return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); } @@ -160,7 +160,7 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { src_r = DVector::Read(); dst_w = DVector::Write(); - *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image); + *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); return OK; diff --git a/methods.py b/methods.py index c4951c69bd..7ad42a559a 100755 --- a/methods.py +++ b/methods.py @@ -123,7 +123,7 @@ def build_glsl_header( filename ): uline=line[:line.lower().find("//")] uline = uline[uline.find("uniform")+len("uniform"):]; uline = uline.replace(";",""); - uline = uline.replace("{",""); + uline = uline.replace("{","").strip(); lines = uline.split(",") for x in lines: @@ -767,9 +767,31 @@ def include_file_in_legacygl_header( filename, header_data, depth ): header_data.texunits+=[(x,texunit)] header_data.texunit_names+=[x] + elif (line.find("uniform")!=-1 and line.lower().find("ubo:")!=-1): + #uniform buffer object + ubostr = line[line.find(":")+1:].strip() + ubo = str(int(ubostr )) + uline=line[:line.lower().find("//")] + uline = uline[uline.find("uniform")+len("uniform"):]; + uline = uline.replace("highp",""); + uline = uline.replace(";",""); + uline = uline.replace("{","").strip(); + lines = uline.split(",") + for x in lines: + + x = x.strip() + x = x[ x.rfind(" ")+1: ] + if (x.find("[")!=-1): + #unfiorm array + x = x[ :x.find("[") ] + + if (not x in header_data.ubo_names): + header_data.ubos+=[(x,ubo)] + header_data.ubo_names+=[x] - elif (line.find("uniform")!=-1): + + elif (line.find("uniform")!=-1 and line.find("{")==-1 and line.find(";")!=-1): uline = line.replace("uniform",""); uline = uline.replace(";",""); lines = uline.split(",") @@ -785,7 +807,7 @@ def include_file_in_legacygl_header( filename, header_data, depth ): header_data.uniforms+=[x] - if ((line.strip().find("in ")==0 or line.strip().find("attribute ")==0) and line.find("attrib:")!=-1): + if ( line.strip().find("attribute ")==0 and line.find("attrib:")!=-1): uline = line.replace("in ",""); uline = uline.replace("attribute ",""); uline = uline.replace("highp ",""); @@ -1036,6 +1058,7 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): else: fd.write("\t\tstatic const char **_uniform_strings=NULL;\n") + if output_attribs: if (len(header_data.attributes)): @@ -1055,6 +1078,14 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): else: fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n") + if (len(header_data.ubos)): + fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n") + for x in header_data.ubos: + fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n"); + fd.write("\t\t};\n\n"); + else: + fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n") + fd.write("\t\tstatic const char _vertex_code[]={\n") for x in header_data.vertex_lines: for i in range(len(x)): @@ -1077,9 +1108,9 @@ def build_legacygl_header( filename, include, class_suffix, output_attribs ): fd.write("\t\tstatic const int _fragment_code_start="+str(header_data.fragment_offset)+";\n") if output_attribs: - fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_attribute_pairs,"+str(len(header_data.attributes))+", _texunit_pairs,"+str(len(header_data.texunits))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_attribute_pairs,"+str(len(header_data.attributes))+", _texunit_pairs,"+str(len(header_data.texunits))+",_ubo_pairs,"+str(len(header_data.ubos))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") else: - fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_texunit_pairs,"+str(len(header_data.texunits))+",_enums,"+str(len(header_data.enums))+",_enum_values,"+str(enum_value_count)+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") + fd.write("\t\tsetup(_conditional_strings,"+str(len(header_data.conditionals))+",_uniform_strings,"+str(len(header_data.uniforms))+",_texunit_pairs,"+str(len(header_data.texunits))+",_enums,"+str(len(header_data.enums))+",_enum_values,"+str(enum_value_count)+",_ubo_pairs,"+str(len(header_data.ubos))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") fd.write("\t};\n\n") @@ -1111,6 +1142,11 @@ def build_gles2_headers( target, source, env ): for x in source: build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix = "GLES2", output_attribs = True) + +def build_gles3_headers( target, source, env ): + + for x in source: + build_legacygl_header(str(x), include="drivers/gles3/shader_gles3.h", class_suffix = "GLES3", output_attribs = True) def update_version(): diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index ea7e83378a..9826689218 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -1,7 +1,7 @@ def can_build(platform): - return True + return False def configure(env): diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp index 99e83343d0..5478569a42 100644 --- a/platform/iphone/rasterizer_iphone.cpp +++ b/platform/iphone/rasterizer_iphone.cpp @@ -134,21 +134,21 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form switch(p_format) { - case Image::FORMAT_GRAYSCALE: { + case Image::FORMAT_L8: { r_gl_components=1; r_gl_format=GL_LUMINANCE; } break; case Image::FORMAT_INTENSITY: { - image.convert(Image::FORMAT_RGBA); + image.convert(Image::FORMAT_RGBA8); r_gl_components=4; r_gl_format=GL_RGBA; r_has_alpha_cache=true; } break; - case Image::FORMAT_GRAYSCALE_ALPHA: { + case Image::FORMAT_LA8: { - image.convert(Image::FORMAT_RGBA); + image.convert(Image::FORMAT_RGBA8); r_gl_components=4; r_gl_format=GL_RGBA; r_has_alpha_cache=true; @@ -156,7 +156,7 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form case Image::FORMAT_INDEXED: { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); r_gl_components=3; r_gl_format=GL_RGB; @@ -164,17 +164,17 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form case Image::FORMAT_INDEXED_ALPHA: { - image.convert(Image::FORMAT_RGBA); + image.convert(Image::FORMAT_RGBA8); r_gl_components=4; r_gl_format=GL_RGB; r_has_alpha_cache=true; } break; - case Image::FORMAT_RGB: { + case Image::FORMAT_RGB8: { r_gl_components=3; r_gl_format=GL_RGB; } break; - case Image::FORMAT_RGBA: { + case Image::FORMAT_RGBA8: { r_gl_components=4; r_gl_format=GL_RGBA; @@ -344,7 +344,7 @@ Image::Format RasterizerIPhone::texture_get_format(RID p_texture) const { Texture * texture = texture_owner.get(p_texture); - ERR_FAIL_COND_V(!texture,Image::FORMAT_GRAYSCALE); + ERR_FAIL_COND_V(!texture,Image::FORMAT_L8); return texture->format; } diff --git a/platform/iphone/rasterizer_iphone.h b/platform/iphone/rasterizer_iphone.h index add656b190..fcbb339ab3 100644 --- a/platform/iphone/rasterizer_iphone.h +++ b/platform/iphone/rasterizer_iphone.h @@ -74,7 +74,7 @@ class RasterizerIPhone : public Rasterizer { flags=width=height=0; tex_id=0; - format=Image::FORMAT_GRAYSCALE; + format=Image::FORMAT_L8; gl_components_cache=0; format_has_alpha=false; has_alpha=false; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 30f4c58150..c55bf0eadb 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -207,7 +207,7 @@ void EditorExportPlatformOSX::_make_icon(const Image& p_icon,Vector& ic while(size>=16) { Image copy = p_icon; - copy.convert(Image::FORMAT_RGBA); + copy.convert(Image::FORMAT_RGBA8); copy.resize(size,size); it->create_from_image(copy); String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/icon.png"; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index cc893cc7a0..5a5ddccd60 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1313,7 +1313,7 @@ void OS_OSX::set_window_title(const String& p_title) { void OS_OSX::set_icon(const Image& p_icon) { Image img=p_icon; - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); NSBitmapImageRep *imgrep= [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL pixelsWide: p_icon.get_width() pixelsHigh: p_icon.get_height() diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h index 86505206ae..dc04e9b4f1 100644 --- a/platform/osx/platform_config.h +++ b/platform/osx/platform_config.h @@ -27,5 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include + #define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/GL/glew.h" #define PTHREAD_RENAME_SELF diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index 5404980ff3..cb00fdaac8 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -26,8 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "servers/visual/visual_server_raster.h" -#include "servers/visual/rasterizer_dummy.h" +//#include "servers/visual/visual_server_raster.h" +//#include "servers/visual/rasterizer_dummy.h" #include "os_server.h" #include #include @@ -57,9 +57,9 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a current_videomode=p_desired; main_loop=NULL; - rasterizer = memnew( RasterizerDummy ); + //rasterizer = memnew( RasterizerDummy ); - visual_server = memnew( VisualServerRaster(rasterizer) ); + //visual_server = memnew( VisualServerRaster(rasterizer) ); AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton(); @@ -114,7 +114,7 @@ void OS_Server::finalize() { visual_server->finish(); memdelete(visual_server); - memdelete(rasterizer); + //memdelete(rasterizer); physics_server->finish(); memdelete(physics_server); diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 2081d5f2f4..ed5111d831 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -51,7 +51,7 @@ class OS_Server : public OS_Unix { - Rasterizer *rasterizer; +// Rasterizer *rasterizer; VisualServer *visual_server; VideoMode current_videomode; List args; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 35d90a8308..1af7cb2a49 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2081,8 +2081,8 @@ void OS_Windows::set_icon(const Image& p_icon) { Image icon=p_icon; - if (icon.get_format()!=Image::FORMAT_RGBA) - icon.convert(Image::FORMAT_RGBA); + if (icon.get_format()!=Image::FORMAT_RGBA8) + icon.convert(Image::FORMAT_RGBA8); int w = icon.get_width(); int h = icon.get_height(); diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 9e20750816..296a778ac8 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -31,5 +31,6 @@ //#include //#endif #define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/GL/glew.h" diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index cd325dfc99..ccf7a801ef 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -140,6 +140,7 @@ Error ContextGL_X11::initialize() { static int context_attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 0, + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, None }; diff --git a/platform/x11/detect.py b/platform/x11/detect.py index ba232f6d4e..6e3a8af676 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -198,9 +198,9 @@ def configure(env): import methods - env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + #env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + #env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) + #env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) if (env["use_static_cpp"]=="yes"): diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 5f1ab5b4aa..d2d6e88c4b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "servers/visual/visual_server_raster.h" -#include "drivers/gles2/rasterizer_gles2.h" +#include "drivers/gles3/rasterizer_gles3.h" #include "os_x11.h" #include "key_mapping_x11.h" #include @@ -74,7 +74,7 @@ int OS_X11::get_video_driver_count() const { } const char * OS_X11::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } OS::VideoMode OS_X11::get_default_video_mode() const { @@ -203,19 +203,22 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi //print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height)); #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) + context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) ); context_gl->initialize(); - rasterizer = memnew( RasterizerGLES2 ); + RasterizerGLES3::register_config(); -#endif - visual_server = memnew( VisualServerRaster(rasterizer) ); + RasterizerGLES3::make_current(); +#endif + visual_server = memnew( VisualServerRaster ); +#if 0 if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); } - +#endif // borderless fullscreen window mode if (current_videomode.fullscreen) { // needed for lxde/openbox, possibly others @@ -487,7 +490,7 @@ void OS_X11::finalize() { visual_server->finish(); memdelete(visual_server); - memdelete(rasterizer); + //memdelete(rasterizer); physics_server->finish(); memdelete(physics_server); @@ -1878,7 +1881,7 @@ void OS_X11::set_icon(const Image& p_icon) { if (!p_icon.empty()) { Image img=p_icon; - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); int w = img.get_width(); int h = img.get_height(); diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index b27f71406a..b351309d80 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -34,7 +34,7 @@ #include "drivers/unix/os_unix.h" #include "context_gl_x11.h" #include "servers/visual_server.h" -#include "servers/visual/visual_server_wrap_mt.h" +//#include "servers/visual/visual_server_wrap_mt.h" #include "servers/visual/rasterizer.h" #include "servers/physics_server.h" #include "servers/audio/audio_server_sw.h" @@ -99,7 +99,7 @@ class OS_X11 : public OS_Unix { #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) ContextGL_X11 *context_gl; #endif - Rasterizer *rasterizer; + //Rasterizer *rasterizer; VisualServer *visual_server; VideoMode current_videomode; List args; diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h index 3b47b2c92d..1873e712ec 100644 --- a/platform/x11/platform_config.h +++ b/platform/x11/platform_config.h @@ -35,5 +35,6 @@ #endif #define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/GL/glew.h" diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index ed1d606ba8..07ee1ff753 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -42,9 +42,6 @@ bool CanvasItemMaterial::_set(const StringName& p_name, const Variant& p_value) if (p_name==SceneStringNames::get_singleton()->shader_shader) { set_shader(p_value); return true; - } else if (p_name==SceneStringNames::get_singleton()->shading_mode) { - set_shading_mode(ShadingMode(p_value.operator int())); - return true; } else { if (shader.is_valid()) { @@ -58,7 +55,7 @@ bool CanvasItemMaterial::_set(const StringName& p_name, const Variant& p_value) } } if (pr) { - VisualServer::get_singleton()->canvas_item_material_set_shader_param(material,pr,p_value); + VisualServer::get_singleton()->material_set_param(material,pr,p_value); return true; } } @@ -74,18 +71,14 @@ bool CanvasItemMaterial::_get(const StringName& p_name,Variant &r_ret) const { r_ret=get_shader(); return true; - } else if (p_name==SceneStringNames::get_singleton()->shading_mode) { - - r_ret=shading_mode; - return true; } else { if (shader.is_valid()) { StringName pr = shader->remap_param(p_name); if (pr) { - r_ret=VisualServer::get_singleton()->canvas_item_material_get_shader_param(material,pr); + r_ret=VisualServer::get_singleton()->material_get_param(material,pr); return true; } } @@ -100,7 +93,6 @@ bool CanvasItemMaterial::_get(const StringName& p_name,Variant &r_ret) const { void CanvasItemMaterial::_get_property_list( List *p_list) const { p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"CanvasItemShader,CanvasItemShaderGraph" ) ); - p_list->push_back( PropertyInfo( Variant::INT, "shader/shading_mode",PROPERTY_HINT_ENUM,"Normal,Unshaded,Light Only") ); if (!shader.is_null()) { @@ -119,7 +111,7 @@ void CanvasItemMaterial::set_shader(const Ref& p_shader) { if (shader.is_valid()) rid=shader->get_rid(); - VS::get_singleton()->canvas_item_material_set_shader(material,rid); + VS::get_singleton()->material_set_shader(material,rid); _change_notify(); //properties for shader exposed emit_changed(); } @@ -131,12 +123,12 @@ Ref CanvasItemMaterial::get_shader() const{ void CanvasItemMaterial::set_shader_param(const StringName& p_param,const Variant& p_value){ - VS::get_singleton()->canvas_item_material_set_shader_param(material,p_param,p_value); + VS::get_singleton()->material_set_param(material,p_param,p_value); } Variant CanvasItemMaterial::get_shader_param(const StringName& p_param) const{ - return VS::get_singleton()->canvas_item_material_get_shader_param(material,p_param); + return VS::get_singleton()->material_get_param(material,p_param); } RID CanvasItemMaterial::get_rid() const { @@ -144,16 +136,6 @@ RID CanvasItemMaterial::get_rid() const { return material; } -void CanvasItemMaterial::set_shading_mode(ShadingMode p_mode) { - - shading_mode=p_mode; - VS::get_singleton()->canvas_item_material_set_shading_mode(material,VS::CanvasItemShadingMode(p_mode)); -} - -CanvasItemMaterial::ShadingMode CanvasItemMaterial::get_shading_mode() const { - return shading_mode; -} - void CanvasItemMaterial::_bind_methods() { @@ -161,12 +143,7 @@ void CanvasItemMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_shader:Shader"),&CanvasItemMaterial::get_shader); ObjectTypeDB::bind_method(_MD("set_shader_param","param","value"),&CanvasItemMaterial::set_shader_param); ObjectTypeDB::bind_method(_MD("get_shader_param","param"),&CanvasItemMaterial::get_shader_param); - ObjectTypeDB::bind_method(_MD("set_shading_mode","mode"),&CanvasItemMaterial::set_shading_mode); - ObjectTypeDB::bind_method(_MD("get_shading_mode"),&CanvasItemMaterial::get_shading_mode); - BIND_CONSTANT( SHADING_NORMAL ); - BIND_CONSTANT( SHADING_UNSHADED ); - BIND_CONSTANT( SHADING_ONLY_LIGHT ); } @@ -189,13 +166,13 @@ void CanvasItemMaterial::get_argument_options(const StringName& p_function,int p CanvasItemMaterial::CanvasItemMaterial() { - material=VS::get_singleton()->canvas_item_material_create(); - shading_mode=SHADING_NORMAL; + + } CanvasItemMaterial::~CanvasItemMaterial(){ - VS::get_singleton()->free(material); + } @@ -374,6 +351,8 @@ Matrix32 CanvasItem::get_global_transform_with_canvas() const { return last_valid->canvas_layer->get_transform() * xform; else if (is_inside_tree()) return get_viewport()->get_canvas_transform() * xform; + + return xform; } Matrix32 CanvasItem::get_global_transform() const { @@ -394,42 +373,17 @@ Matrix32 CanvasItem::get_global_transform() const { } - -void CanvasItem::_queue_sort_children() { - - if (pending_children_sort) - return; - - pending_children_sort=true; - MessageQueue::get_singleton()->push_call(this,"_sort_children"); -} - -void CanvasItem::_sort_children() { - - pending_children_sort=false; +void CanvasItem::_toplevel_raise_self() { if (!is_inside_tree()) return; - for(int i=0;icast_to(); - - if (ci) { - if (ci->toplevel || ci->group!="") - continue; - VisualServer::get_singleton()->canvas_item_raise(n->cast_to()->canvas_item); - } - } -} - -void CanvasItem::_raise_self() { + if (canvas_layer) + VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item,canvas_layer->get_sort_index()); + else + VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item,get_viewport()->gui_get_canvas_sort_index()); - if (!is_inside_tree()) - return; - VisualServer::get_singleton()->canvas_item_raise(canvas_item); } @@ -461,14 +415,19 @@ void CanvasItem::_enter_canvas() { group = "root_canvas"+itos(canvas.get_id()); add_to_group(group); - get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self"); + if (canvas_layer) + canvas_layer->reset_sort_index(); + else + get_viewport()->gui_reset_canvas_sort_index(); + + get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); } else { CanvasItem *parent = get_parent_item(); canvas_layer=parent->canvas_layer; VisualServer::get_singleton()->canvas_item_set_parent(canvas_item,parent->get_canvas_item()); - parent->_queue_sort_children(); + VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item,get_index()); } pending_update=false; @@ -495,7 +454,6 @@ void CanvasItem::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { first_draw=true; - pending_children_sort=false; if (get_parent()) { CanvasItem *ci = get_parent()->cast_to(); if (ci) @@ -508,13 +466,15 @@ void CanvasItem::_notification(int p_what) { } break; case NOTIFICATION_MOVED_IN_PARENT: { + if (!is_inside_tree()) + break; if (group!="") { - get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_raise_self"); + get_tree()->call_group(SceneTree::GROUP_CALL_UNIQUE,group,"_toplevel_raise_self"); } else { CanvasItem *p = get_parent_item(); ERR_FAIL_COND(!p); - p->_queue_sort_children(); + VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item,get_index()); } @@ -569,15 +529,15 @@ void CanvasItem::update() { MessageQueue::get_singleton()->push_call(this,"_update_callback"); } -void CanvasItem::set_opacity(float p_opacity) { +void CanvasItem::set_modulate(const Color& p_modulate) { - opacity=p_opacity; - VisualServer::get_singleton()->canvas_item_set_opacity(canvas_item,opacity); + modulate=p_modulate; + VisualServer::get_singleton()->canvas_item_set_modulate(canvas_item,modulate); } -float CanvasItem::get_opacity() const { +Color CanvasItem::get_modulate() const { - return opacity; + return modulate; } @@ -614,29 +574,17 @@ CanvasItem *CanvasItem::get_parent_item() const { } -void CanvasItem::set_self_opacity(float p_self_opacity) { +void CanvasItem::set_self_modulate(const Color& p_self_modulate) { - self_opacity=p_self_opacity; - VisualServer::get_singleton()->canvas_item_set_self_opacity(canvas_item,self_opacity); - -} -float CanvasItem::get_self_opacity() const { + self_modulate=p_self_modulate; + VisualServer::get_singleton()->canvas_item_set_self_modulate(canvas_item,self_modulate); - return self_opacity; } +Color CanvasItem::get_self_modulate() const { -void CanvasItem::set_blend_mode(BlendMode p_blend_mode) { - - ERR_FAIL_INDEX(p_blend_mode,5); - blend_mode=p_blend_mode; - VisualServer::get_singleton()->canvas_item_set_blend_mode(canvas_item,VS::MaterialBlendMode(blend_mode)); - + return self_modulate; } -CanvasItem::BlendMode CanvasItem::get_blend_mode() const { - - return blend_mode; -} void CanvasItem::set_light_mask(int p_light_mask) { @@ -913,7 +861,7 @@ void CanvasItem::set_draw_behind_parent(bool p_enable) { if (behind==p_enable) return; behind=p_enable; - VisualServer::get_singleton()->canvas_item_set_on_top(canvas_item,!behind); + VisualServer::get_singleton()->canvas_item_set_draw_behind_parent(canvas_item,behind); } @@ -983,8 +931,7 @@ Vector2 CanvasItem::get_local_mouse_pos() const{ void CanvasItem::_bind_methods() { - ObjectTypeDB::bind_method(_MD("_sort_children"),&CanvasItem::_sort_children); - ObjectTypeDB::bind_method(_MD("_raise_self"),&CanvasItem::_raise_self); + ObjectTypeDB::bind_method(_MD("_toplevel_raise_self"),&CanvasItem::_toplevel_raise_self); ObjectTypeDB::bind_method(_MD("_update_callback"),&CanvasItem::_update_callback); ObjectTypeDB::bind_method(_MD("_set_visible_"),&CanvasItem::_set_visible_); ObjectTypeDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_); @@ -1011,16 +958,13 @@ void CanvasItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_as_toplevel","enable"),&CanvasItem::set_as_toplevel); ObjectTypeDB::bind_method(_MD("is_set_as_toplevel"),&CanvasItem::is_set_as_toplevel); - ObjectTypeDB::bind_method(_MD("set_blend_mode","blend_mode"),&CanvasItem::set_blend_mode); - ObjectTypeDB::bind_method(_MD("get_blend_mode"),&CanvasItem::get_blend_mode); - ObjectTypeDB::bind_method(_MD("set_light_mask","light_mask"),&CanvasItem::set_light_mask); ObjectTypeDB::bind_method(_MD("get_light_mask"),&CanvasItem::get_light_mask); - ObjectTypeDB::bind_method(_MD("set_opacity","opacity"),&CanvasItem::set_opacity); - ObjectTypeDB::bind_method(_MD("get_opacity"),&CanvasItem::get_opacity); - ObjectTypeDB::bind_method(_MD("set_self_opacity","self_opacity"),&CanvasItem::set_self_opacity); - ObjectTypeDB::bind_method(_MD("get_self_opacity"),&CanvasItem::get_self_opacity); + ObjectTypeDB::bind_method(_MD("set_modulate","modulate"),&CanvasItem::set_modulate); + ObjectTypeDB::bind_method(_MD("get_modulate"),&CanvasItem::get_modulate); + ObjectTypeDB::bind_method(_MD("set_self_modulate","self_modulate"),&CanvasItem::set_self_modulate); + ObjectTypeDB::bind_method(_MD("get_self_modulate"),&CanvasItem::get_self_modulate); ObjectTypeDB::bind_method(_MD("set_draw_behind_parent","enable"),&CanvasItem::set_draw_behind_parent); ObjectTypeDB::bind_method(_MD("is_draw_behind_parent_enabled"),&CanvasItem::is_draw_behind_parent_enabled); @@ -1069,12 +1013,11 @@ void CanvasItem::_bind_methods() { BIND_VMETHOD(MethodInfo("_draw")); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); - ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_opacity"),_SCS("get_opacity") ); - ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/self_opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_opacity"),_SCS("get_self_opacity") ); + ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/modulate",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_modulate"),_SCS("get_modulate") ); + ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/self_modulate",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_modulate"),_SCS("get_self_modulate") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"visibility/behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/on_top",PROPERTY_HINT_NONE,"",0), _SCS("_set_on_top"),_SCS("_is_on_top") ); //compatibility - ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"visibility/blend_mode",PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul,PMAlpha"), _SCS("set_blend_mode"),_SCS("get_blend_mode") ); ADD_PROPERTYNO( PropertyInfo(Variant::INT,"visibility/light_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_light_mask"),_SCS("get_light_mask") ); ADD_PROPERTYNZ( PropertyInfo(Variant::OBJECT,"material/material",PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"), _SCS("set_material"),_SCS("get_material") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"material/use_parent"), _SCS("set_use_parent_material"),_SCS("get_use_parent_material") ); @@ -1176,12 +1119,10 @@ CanvasItem::CanvasItem() : xform_change(this) { canvas_item=VisualServer::get_singleton()->canvas_item_create(); hidden=false; pending_update=false; - opacity=1; - self_opacity=1; + modulate=Color(1,1,1,1); + self_modulate=Color(1,1,1,1); toplevel=false; - pending_children_sort=false; first_draw=false; - blend_mode=BLEND_MODE_MIX; drawing=false; behind=false; block_transform_notify=false; diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 7849a66185..b65c1a60b4 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -33,6 +33,7 @@ #include "scene/resources/texture.h" #include "scene/main/scene_main_loop.h" #include "scene/resources/shader.h" +#include "scene/resources/material.h" class CanvasLayer; class Viewport; @@ -40,22 +41,19 @@ class Font; class StyleBox; -class CanvasItemMaterial : public Resource{ +class CanvasItemMaterial : public Material{ - OBJ_TYPE(CanvasItemMaterial,Resource); + OBJ_TYPE(CanvasItemMaterial,Material); RID material; Ref shader; public: - enum ShadingMode { + /*enum ShadingMode { SHADING_NORMAL, SHADING_UNSHADED, SHADING_ONLY_LIGHT, - }; + };*/ protected: - - ShadingMode shading_mode; - bool _set(const StringName& p_name, const Variant& p_value); bool _get(const StringName& p_name,Variant &r_ret) const; void _get_property_list( List *p_list) const; @@ -72,15 +70,12 @@ public: void set_shader_param(const StringName& p_param,const Variant& p_value); Variant get_shader_param(const StringName& p_param) const; - void set_shading_mode(ShadingMode p_mode); - ShadingMode get_shading_mode() const; - virtual RID get_rid() const; CanvasItemMaterial(); ~CanvasItemMaterial(); }; -VARIANT_ENUM_CAST( CanvasItemMaterial::ShadingMode ); + class CanvasItem : public Node { @@ -107,8 +102,8 @@ private: CanvasLayer *canvas_layer; - float opacity; - float self_opacity; + Color modulate; + Color self_modulate; List children_items; List::Element *C; @@ -120,7 +115,6 @@ private: bool hidden; bool pending_update; bool toplevel; - bool pending_children_sort; bool drawing; bool block_transform_notify; bool behind; @@ -133,7 +127,7 @@ private: mutable bool global_invalid; - void _raise_self(); + void _toplevel_raise_self(); void _propagate_visibility_changed(bool p_visible); @@ -145,9 +139,6 @@ private: void _enter_canvas(); void _exit_canvas(); - void _queue_sort_children(); - void _sort_children(); - void _notify_transform(CanvasItem *p_node); void _set_on_top(bool p_on_top) { set_draw_behind_parent(!p_on_top); } @@ -193,17 +184,14 @@ public: void update(); - void set_blend_mode(BlendMode p_blend_mode); - BlendMode get_blend_mode() const; - virtual void set_light_mask(int p_light_mask); int get_light_mask() const; - void set_opacity(float p_opacity); - float get_opacity() const; + void set_modulate(const Color& p_modulate); + Color get_modulate() const; - void set_self_opacity(float p_self_opacity); - float get_self_opacity() const; + void set_self_modulate(const Color& p_self_modulate); + Color get_self_modulate() const; /* DRAWING API */ diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index f37cef673d..8e5b8ba0a4 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -208,26 +208,26 @@ int Light2D::get_layer_range_max() const { return layer_max; } -void Light2D::set_item_mask( int p_mask) { +void Light2D::set_item_cull_mask( int p_mask) { item_mask=p_mask; - VS::get_singleton()->canvas_light_set_item_mask(canvas_light,item_mask); + VS::get_singleton()->canvas_light_set_item_cull_mask(canvas_light,item_mask); } -int Light2D::get_item_mask() const { +int Light2D::get_item_cull_mask() const { return item_mask; } -void Light2D::set_item_shadow_mask( int p_mask) { +void Light2D::set_item_shadow_cull_mask( int p_mask) { item_shadow_mask=p_mask; - VS::get_singleton()->canvas_light_set_item_shadow_mask(canvas_light,item_shadow_mask); + VS::get_singleton()->canvas_light_set_item_shadow_cull_mask(canvas_light,item_shadow_mask); } -int Light2D::get_item_shadow_mask() const { +int Light2D::get_item_shadow_cull_mask() const { return item_shadow_mask; } @@ -265,17 +265,30 @@ int Light2D::get_shadow_buffer_size() const { return shadow_buffer_size; } -void Light2D::set_shadow_esm_multiplier( float p_multiplier) { +void Light2D::set_shadow_gradient_length( float p_multiplier) { - shadow_esm_multiplier=p_multiplier; - VS::get_singleton()->canvas_light_set_shadow_esm_multiplier(canvas_light,p_multiplier); + shadow_gradient_length=p_multiplier; + VS::get_singleton()->canvas_light_set_shadow_gradient_length(canvas_light,p_multiplier); } -float Light2D::get_shadow_esm_multiplier() const{ +float Light2D::get_shadow_gradient_length() const{ - return shadow_esm_multiplier; + return shadow_gradient_length; } + +void Light2D::set_shadow_filter( ShadowFilter p_filter) { + shadow_filter=p_filter; + VS::get_singleton()->canvas_light_set_shadow_filter(canvas_light,VS::CanvasLightShadowFilter(p_filter )); +} + +Light2D::ShadowFilter Light2D::get_shadow_filter() const { + + return shadow_filter; +} + + + void Light2D::set_shadow_color( const Color& p_shadow_color) { shadow_color=p_shadow_color; VS::get_singleton()->canvas_light_set_shadow_color(canvas_light,shadow_color); @@ -360,11 +373,11 @@ void Light2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_layer_range_max"),&Light2D::get_layer_range_max); - ObjectTypeDB::bind_method(_MD("set_item_mask","item_mask"),&Light2D::set_item_mask); - ObjectTypeDB::bind_method(_MD("get_item_mask"),&Light2D::get_item_mask); + ObjectTypeDB::bind_method(_MD("set_item_cull_mask","item_cull_mask"),&Light2D::set_item_cull_mask); + ObjectTypeDB::bind_method(_MD("get_item_cull_mask"),&Light2D::get_item_cull_mask); - ObjectTypeDB::bind_method(_MD("set_item_shadow_mask","item_shadow_mask"),&Light2D::set_item_shadow_mask); - ObjectTypeDB::bind_method(_MD("get_item_shadow_mask"),&Light2D::get_item_shadow_mask); + ObjectTypeDB::bind_method(_MD("set_item_shadow_cull_mask","item_shadow_cull_mask"),&Light2D::set_item_shadow_cull_mask); + ObjectTypeDB::bind_method(_MD("get_item_shadow_cull_mask"),&Light2D::get_item_shadow_cull_mask); ObjectTypeDB::bind_method(_MD("set_mode","mode"),&Light2D::set_mode); ObjectTypeDB::bind_method(_MD("get_mode"),&Light2D::get_mode); @@ -375,8 +388,11 @@ void Light2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_shadow_buffer_size","size"),&Light2D::set_shadow_buffer_size); ObjectTypeDB::bind_method(_MD("get_shadow_buffer_size"),&Light2D::get_shadow_buffer_size); - ObjectTypeDB::bind_method(_MD("set_shadow_esm_multiplier","multiplier"),&Light2D::set_shadow_esm_multiplier); - ObjectTypeDB::bind_method(_MD("get_shadow_esm_multiplier"),&Light2D::get_shadow_esm_multiplier); + ObjectTypeDB::bind_method(_MD("set_shadow_gradient_length","multiplier"),&Light2D::set_shadow_gradient_length); + ObjectTypeDB::bind_method(_MD("get_shadow_gradient_length"),&Light2D::get_shadow_gradient_length); + + ObjectTypeDB::bind_method(_MD("set_shadow_filter","filter"),&Light2D::set_shadow_filter); + ObjectTypeDB::bind_method(_MD("get_shadow_filter"),&Light2D::get_shadow_filter); ObjectTypeDB::bind_method(_MD("set_shadow_color","shadow_color"),&Light2D::set_shadow_color); ObjectTypeDB::bind_method(_MD("get_shadow_color"),&Light2D::get_shadow_color); @@ -394,12 +410,13 @@ void Light2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"range/z_max",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z_range_max"),_SCS("get_z_range_max")); ADD_PROPERTY( PropertyInfo(Variant::INT,"range/layer_min",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_min"),_SCS("get_layer_range_min")); ADD_PROPERTY( PropertyInfo(Variant::INT,"range/layer_max",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_max"),_SCS("get_layer_range_max")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"range/item_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_mask"),_SCS("get_item_mask")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"range/item_cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_cull_mask"),_SCS("get_item_cull_mask")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shadow/enabled"),_SCS("set_shadow_enabled"),_SCS("is_shadow_enabled")); ADD_PROPERTY( PropertyInfo(Variant::COLOR,"shadow/color"),_SCS("set_shadow_color"),_SCS("get_shadow_color")); ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/buffer_size",PROPERTY_HINT_RANGE,"32,16384,1"),_SCS("set_shadow_buffer_size"),_SCS("get_shadow_buffer_size")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/esm_multiplier",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_esm_multiplier"),_SCS("get_shadow_esm_multiplier")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/item_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_shadow_mask"),_SCS("get_item_shadow_mask")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/gradient_length",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_gradient_length"),_SCS("get_shadow_gradient_length")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/filter",PROPERTY_HINT_ENUM,"None,PCF3,PCF5,PCF9,PCF13"),_SCS("set_shadow_filter"),_SCS("get_shadow_filter")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/item_cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_shadow_cull_mask"),_SCS("get_item_shadow_cull_mask")); BIND_CONSTANT( MODE_ADD ); BIND_CONSTANT( MODE_SUB ); @@ -425,9 +442,10 @@ Light2D::Light2D() { item_shadow_mask=1; mode=MODE_ADD; shadow_buffer_size=2048; - shadow_esm_multiplier=80; + shadow_gradient_length=0; energy=1.0; shadow_color=Color(0,0,0,0); + shadow_filter=SHADOW_FILTER_NONE; } diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index c03ef96eff..75dcf67936 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -42,6 +42,14 @@ public: MODE_MASK, }; + enum ShadowFilter { + SHADOW_FILTER_NONE, + SHADOW_FILTER_PCF3, + SHADOW_FILTER_PCF5, + SHADOW_FILTER_PCF9, + SHADOW_FILTER_PCF13, + }; + private: RID canvas_light; bool enabled; @@ -58,10 +66,12 @@ private: int item_mask; int item_shadow_mask; int shadow_buffer_size; - float shadow_esm_multiplier; + float shadow_gradient_length; Mode mode; Ref texture; Vector2 texture_offset; + ShadowFilter shadow_filter; + void _update_light_visibility(); protected: @@ -108,11 +118,11 @@ public: void set_layer_range_max( int p_max_layer); int get_layer_range_max() const; - void set_item_mask( int p_mask); - int get_item_mask() const; + void set_item_cull_mask( int p_mask); + int get_item_cull_mask() const; - void set_item_shadow_mask( int p_mask); - int get_item_shadow_mask() const; + void set_item_shadow_cull_mask( int p_mask); + int get_item_shadow_cull_mask() const; void set_mode( Mode p_mode ); Mode get_mode() const; @@ -123,8 +133,11 @@ public: void set_shadow_buffer_size( int p_size ); int get_shadow_buffer_size() const; - void set_shadow_esm_multiplier( float p_multiplier); - float get_shadow_esm_multiplier() const; + void set_shadow_gradient_length( float p_multiplier); + float get_shadow_gradient_length() const; + + void set_shadow_filter( ShadowFilter p_filter); + ShadowFilter get_shadow_filter() const; void set_shadow_color( const Color& p_shadow_color); Color get_shadow_color() const; @@ -139,5 +152,7 @@ public: }; VARIANT_ENUM_CAST(Light2D::Mode); +VARIANT_ENUM_CAST(Light2D::ShadowFilter); + #endif // LIGHT_2D_H diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index c5b338bf59..00ce59a6f6 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -376,7 +376,7 @@ Sprite::Sprite() { /// /// - +#if 0 void ViewportSprite::edit_set_pivot(const Point2& p_pivot) { set_offset(p_pivot); @@ -588,3 +588,4 @@ ViewportSprite::ViewportSprite() { centered=true; modulate=Color(1,1,1,1); } +#endif diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h index 32d3f476d1..2e7b753a04 100644 --- a/scene/2d/sprite.h +++ b/scene/2d/sprite.h @@ -107,6 +107,7 @@ public: Sprite(); }; +#if 0 class ViewportSprite : public Node2D { OBJ_TYPE( ViewportSprite, Node2D ); @@ -149,4 +150,5 @@ public: ViewportSprite(); }; +#endif #endif // SPRITE_H diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 1a4f88c30e..972ce8378a 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -477,7 +477,7 @@ void TileMap::_update_dirty_quadrants() { _fix_cell_transform(xform,c,shape_ofs+center_ofs,s); - if (debug_canvas_item) { + if (debug_canvas_item.is_valid()) { vs->canvas_item_add_set_transform(debug_canvas_item,xform); shape->draw(debug_canvas_item,debug_collision_color); @@ -488,7 +488,7 @@ void TileMap::_update_dirty_quadrants() { } } - if (debug_canvas_item) { + if (debug_canvas_item.is_valid()) { vs->canvas_item_add_set_transform(debug_canvas_item,Matrix32()); } @@ -541,26 +541,19 @@ void TileMap::_update_dirty_quadrants() { if (quadrant_order_dirty) { + int index=-0x80000000; //always must be drawn below children for (Map::Element *E=quadrant_map.front();E;E=E->next()) { Quadrant &q=E->get(); for (List::Element *E=q.canvas_items.front();E;E=E->next()) { - VS::get_singleton()->canvas_item_raise(E->get()); + VS::get_singleton()->canvas_item_set_draw_index(E->get(),index++); } } quadrant_order_dirty=false; } - for(int i=0;icast_to(); - - if (c) - VS::get_singleton()->canvas_item_raise(c->get_canvas_item()); - } - _recompute_rect_cache(); } diff --git a/scene/3d/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index ca3a309568..07f0e4ee57 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -29,6 +29,7 @@ #include "baked_light_instance.h" #include "scene/scene_string_names.h" +#if 0 RID BakedLightInstance::get_baked_light_instance() const { @@ -179,3 +180,4 @@ BakedLightSampler::~BakedLightSampler(){ VS::get_singleton()->free(base); } +#endif diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h index 002e55df1d..15f04fea31 100644 --- a/scene/3d/baked_light_instance.h +++ b/scene/3d/baked_light_instance.h @@ -32,6 +32,7 @@ #include "scene/3d/visual_instance.h" #include "scene/resources/baked_light.h" +#if 0 class BakedLightBaker; @@ -101,5 +102,5 @@ public: VARIANT_ENUM_CAST( BakedLightSampler::Param ); - +#endif #endif // BAKED_LIGHT_H diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index e76c0938fb..1ce07b0264 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -96,8 +96,8 @@ bool Camera::_set(const StringName& p_name, const Variant& p_value) { } else { clear_current(); } - } else if (p_name=="visible_layers") { - set_visible_layers(p_value); + } else if (p_name=="cull_mask") { + set_cull_mask(p_value); } else if (p_name=="environment") { set_environment(p_value); } else @@ -130,8 +130,8 @@ bool Camera::_get(const StringName& p_name,Variant &r_ret) const { } else { r_ret=is_current(); } - } else if (p_name=="visible_layers") { - r_ret=get_visible_layers(); + } else if (p_name=="cull_mask") { + r_ret=get_cull_mask(); } else if (p_name=="h_offset") { r_ret=get_h_offset(); } else if (p_name=="v_offset") { @@ -176,7 +176,7 @@ void Camera::_get_property_list( List *p_list) const { p_list->push_back( PropertyInfo( Variant::REAL, "far" , PROPERTY_HINT_EXP_RANGE, "0.01,4096.0,0.01") ); p_list->push_back( PropertyInfo( Variant::INT, "keep_aspect",PROPERTY_HINT_ENUM,"Keep Width,Keep Height") ); p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) ); - p_list->push_back( PropertyInfo( Variant::INT, "visible_layers",PROPERTY_HINT_ALL_FLAGS ) ); + p_list->push_back( PropertyInfo( Variant::INT, "cull_mask",PROPERTY_HINT_ALL_FLAGS ) ); p_list->push_back( PropertyInfo( Variant::OBJECT, "environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "h_offset" ) ); p_list->push_back( PropertyInfo( Variant::REAL, "v_offset" ) ); @@ -342,91 +342,6 @@ bool Camera::_can_gizmo_scale() const { } -RES Camera::_get_gizmo_geometry() const { - - - Ref surface_tool( memnew( SurfaceTool )); - - Ref mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(1.0,0.5,1.0,0.5) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); - //mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - switch(mode) { - - case PROJECTION_PERSPECTIVE: { - - - - Vector3 side=Vector3( Math::sin(Math::deg2rad(fov)), 0, -Math::cos(Math::deg2rad(fov)) ); - Vector3 nside=side; - nside.x=-nside.x; - Vector3 up=Vector3(0,side.x,0); - - -#define ADD_TRIANGLE( m_a, m_b, m_c)\ -{\ - surface_tool->add_vertex(m_a);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_a);\ -} - - ADD_TRIANGLE( Vector3(), side+up, side-up ); - ADD_TRIANGLE( Vector3(), nside+up, nside-up ); - ADD_TRIANGLE( Vector3(), side+up, nside+up ); - ADD_TRIANGLE( Vector3(), side-up, nside-up ); - - side.x*=0.25; - nside.x*=0.25; - Vector3 tup( 0, up.y*3/2,side.z); - ADD_TRIANGLE( tup, side+up, nside+up ); - - } break; - case PROJECTION_ORTHOGONAL: { - -#define ADD_QUAD( m_a, m_b, m_c, m_d)\ -{\ - surface_tool->add_vertex(m_a);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_b);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_c);\ - surface_tool->add_vertex(m_d);\ - surface_tool->add_vertex(m_d);\ - surface_tool->add_vertex(m_a);\ -} - - float hsize=size*0.5; - Vector3 right(hsize,0,0); - Vector3 up(0,hsize,0); - Vector3 back(0,0,-1.0); - Vector3 front(0,0,0); - - ADD_QUAD( -up-right,-up+right,up+right,up-right); - ADD_QUAD( -up-right+back,-up+right+back,up+right+back,up-right+back); - ADD_QUAD( up+right,up+right+back,up-right+back,up-right); - ADD_QUAD( -up+right,-up+right+back,-up-right+back,-up-right); - - right.x*=0.25; - Vector3 tup( 0, up.y*3/2,back.z ); - ADD_TRIANGLE( tup, right+up+back, -right+up+back ); - - } break; - - } - - return surface_tool->commit(); - -} Vector3 Camera::project_ray_normal(const Point2& p_pos) const { @@ -648,8 +563,8 @@ void Camera::_bind_methods() { ObjectTypeDB::bind_method( _MD("get_zfar"),&Camera::get_zfar ); ObjectTypeDB::bind_method( _MD("get_znear"),&Camera::get_znear ); ObjectTypeDB::bind_method( _MD("get_projection"),&Camera::get_projection ); - ObjectTypeDB::bind_method( _MD("set_visible_layers","mask"),&Camera::set_visible_layers ); - ObjectTypeDB::bind_method( _MD("get_visible_layers"),&Camera::get_visible_layers ); + ObjectTypeDB::bind_method( _MD("set_cull_mask","mask"),&Camera::set_cull_mask ); + ObjectTypeDB::bind_method( _MD("get_cull_mask"),&Camera::get_cull_mask ); ObjectTypeDB::bind_method(_MD("set_environment","env:Environment"),&Camera::set_environment); ObjectTypeDB::bind_method(_MD("get_environment:Environment"),&Camera::get_environment); ObjectTypeDB::bind_method(_MD("set_keep_aspect_mode","mode"),&Camera::set_keep_aspect_mode); @@ -690,13 +605,13 @@ Camera::Projection Camera::get_projection() const { return mode; } -void Camera::set_visible_layers(uint32_t p_layers) { +void Camera::set_cull_mask(uint32_t p_layers) { layers=p_layers; - VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); + VisualServer::get_singleton()->camera_set_cull_mask(camera,layers); } -uint32_t Camera::get_visible_layers() const{ +uint32_t Camera::get_cull_mask() const{ return layers; } @@ -757,7 +672,7 @@ Camera::Camera() { layers=0xfffff; v_offset=0; h_offset=0; - VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); + VisualServer::get_singleton()->camera_set_cull_mask(camera,layers); //active=false; } diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 30c6928245..3ea0bd711c 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -75,7 +75,7 @@ private: Ref environment; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; + //void _camera_make_current(Node *p_camera); @@ -126,8 +126,8 @@ public: bool is_position_behind(const Vector3& p_pos) const; Vector3 project_position(const Point2& p_point) const; - void set_visible_layers(uint32_t p_layers); - uint32_t get_visible_layers() const; + void set_cull_mask(uint32_t p_layers); + uint32_t get_cull_mask() const; Vector get_frustum() const; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 227bb3a59d..d98f100020 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -32,75 +32,6 @@ #include "scene/resources/surface_tool.h" -static const char* _light_param_names[VS::LIGHT_PARAM_MAX]={ - "params/spot_attenuation", - "params/spot_angle", - "params/radius", - "params/energy", - "params/attenuation", - "shadow/darkening", - "shadow/z_offset", - "shadow/z_slope_scale", - "shadow/esm_multiplier", - "shadow/blur_passes" -}; - -void Light::set_parameter(Parameter p_param, float p_value) { - - ERR_FAIL_INDEX(p_param, PARAM_MAX); - vars[p_param]=p_value; - VisualServer::get_singleton()->light_set_param(light,(VisualServer::LightParam)p_param,p_value); - if (p_param==PARAM_RADIUS || p_param==PARAM_SPOT_ANGLE) - update_gizmo(); - _change_notify(_light_param_names[p_param]); -// _change_notify(_param_names[p_param]); -} - -float Light::get_parameter(Parameter p_param) const { - - ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0); - return vars[p_param]; - -} - -void Light::set_color(LightColor p_color, const Color& p_value) { - - ERR_FAIL_INDEX(p_color, 3); - colors[p_color]=p_value; - VisualServer::get_singleton()->light_set_color(light,(VisualServer::LightColor)p_color,p_value); - //_change_notify(_color_names[p_color]); - -} -Color Light::get_color(LightColor p_color) const { - - ERR_FAIL_INDEX_V(p_color, 3, Color()); - return colors[p_color]; - -} - - -void Light::set_project_shadows(bool p_enabled) { - - shadows=p_enabled; - VisualServer::get_singleton()->light_set_shadow(light, p_enabled); - _change_notify("shadow"); -} -bool Light::has_project_shadows() const { - - return shadows; -} - -void Light::set_projector(const Ref& p_projector) { - - projector=p_projector; - VisualServer::get_singleton()->light_set_projector(light, projector.is_null()?RID():projector->get_rid()); -} - -Ref Light::get_projector() const { - - return projector; -} - bool Light::_can_gizmo_scale() const { @@ -108,220 +39,9 @@ bool Light::_can_gizmo_scale() const { } -static void _make_sphere(int p_lats, int p_lons, float p_radius, Ref p_tool) { - - - p_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - - for(int i = 1; i <= p_lats; i++) { - double lat0 = Math_PI * (-0.5 + (double) (i - 1) / p_lats); - double z0 = Math::sin(lat0); - double zr0 = Math::cos(lat0); - - double lat1 = Math_PI * (-0.5 + (double) i / p_lats); - double z1 = Math::sin(lat1); - double zr1 = Math::cos(lat1); - - for(int j = p_lons; j >= 1; j--) { - - double lng0 = 2 * Math_PI * (double) (j - 1) / p_lons; - double x0 = Math::cos(lng0); - double y0 = Math::sin(lng0); - - double lng1 = 2 * Math_PI * (double) (j) / p_lons; - double x1 = Math::cos(lng1); - double y1 = Math::sin(lng1); - - - Vector3 v[4]={ - Vector3(x1 * zr0, z0, y1 *zr0), - Vector3(x1 * zr1, z1, y1 *zr1), - Vector3(x0 * zr1, z1, y0 *zr1), - Vector3(x0 * zr0, z0, y0 *zr0) - }; - -#define ADD_POINT(m_idx) \ - p_tool->add_normal(v[m_idx]);\ - p_tool->add_vertex(v[m_idx]*p_radius); - - ADD_POINT(0); - ADD_POINT(1); - ADD_POINT(2); - - ADD_POINT(2); - ADD_POINT(3); - ADD_POINT(0); - } - } - -} - -RES Light::_get_gizmo_geometry() const { - - - Ref mat_area( memnew( FixedMaterial )); - - mat_area->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.7,0.6,0.0,0.05) ); - mat_area->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.7,0.7,0.7) ); - mat_area->set_blend_mode( Material::BLEND_MODE_ADD ); - mat_area->set_flag(Material::FLAG_DOUBLE_SIDED,true); -// mat_area->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - Ref mat_light( memnew( FixedMaterial )); - - mat_light->set_parameter( FixedMaterial::PARAM_DIFFUSE, Color(1.0,1.0,0.8,0.9) ); - mat_light->set_flag(Material::FLAG_UNSHADED,true); - - Ref< Mesh > mesh; - - Ref surftool( memnew( SurfaceTool )); - - switch(type) { - - case VisualServer::LIGHT_DIRECTIONAL: { - - - mat_area->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.9,0.8,0.1,0.8) ); - mat_area->set_blend_mode( Material::BLEND_MODE_MIX); - mat_area->set_flag(Material::FLAG_DOUBLE_SIDED,false); - mat_area->set_flag(Material::FLAG_UNSHADED,true); - - _make_sphere( 5,5,0.6, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - - // float radius=1; - - surftool->begin(Mesh::PRIMITIVE_TRIANGLES); - - const int arrow_points=5; - Vector3 arrow[arrow_points]={ - Vector3(0,0,2), - Vector3(1,1,2), - Vector3(1,1,-1), - Vector3(2,2,-1), - Vector3(0,0,-3) - }; - - int arrow_sides=4; - - - for(int i = 0; i < arrow_sides ; i++) { - - - Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/arrow_sides); - Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/arrow_sides); - - - for(int j=0;jadd_normal(n); - surftool->add_vertex(points[0]); - surftool->add_normal(n); - surftool->add_vertex(points[1]); - surftool->add_normal(n); - surftool->add_vertex(points[2]); - - surftool->add_normal(n); - surftool->add_vertex(points[0]); - surftool->add_normal(n); - surftool->add_vertex(points[2]); - surftool->add_normal(n); - surftool->add_vertex(points[3]); - - - } - - - } - - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - - - - } break; - case VisualServer::LIGHT_OMNI: { - - - _make_sphere( 20,20,vars[PARAM_RADIUS], surftool ); - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - _make_sphere(5,5, 0.1, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - } break; - - case VisualServer::LIGHT_SPOT: { - - _make_sphere( 5,5,0.1, surftool ); - surftool->set_material(mat_light); - mesh=surftool->commit(mesh); - - // make cone - int points=24; - float len=vars[PARAM_RADIUS]; - float size=Math::tan(Math::deg2rad(vars[PARAM_SPOT_ANGLE]))*len; - - surftool->begin(Mesh::PRIMITIVE_TRIANGLES); - - for(int i = 0; i < points; i++) { - - float x0=Math::sin(i * Math_PI * 2 / points); - float y0=Math::cos(i * Math_PI * 2 / points); - float x1=Math::sin((i+1) * Math_PI * 2 / points); - float y1=Math::cos((i+1) * Math_PI * 2 / points); - - Vector3 v1=Vector3(x0*size,y0*size,-len).normalized()*len; - Vector3 v2=Vector3(x1*size,y1*size,-len).normalized()*len; - - Vector3 v3=Vector3(0,0,0); - Vector3 v4=Vector3(0,0,v1.z); - - Vector3 n = Plane(v1,v2,v3).normal; - - - surftool->add_normal(n); - surftool->add_vertex(v1); - surftool->add_normal(n); - surftool->add_vertex(v2); - surftool->add_normal(n); - surftool->add_vertex(v3); - - n=Vector3(0,0,-1); - - surftool->add_normal(n); - surftool->add_vertex(v1); - surftool->add_normal(n); - surftool->add_vertex(v2); - surftool->add_normal(n); - surftool->add_vertex(v4); - - - } - - surftool->set_material(mat_area); - mesh=surftool->commit(mesh); - - - } break; - } - - return mesh; -} - - AABB Light::get_aabb() const { +#if 0 if (type==VisualServer::LIGHT_DIRECTIONAL) { return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); @@ -336,7 +56,7 @@ AABB Light::get_aabb() const { float size=Math::tan(Math::deg2rad(vars[PARAM_SPOT_ANGLE]))*len; return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); } - +#endif return AABB(); } @@ -346,89 +66,6 @@ DVector Light::get_faces(uint32_t p_usage_flags) const { } -void Light::set_operator(Operator p_op) { - ERR_FAIL_INDEX(p_op,2); - op=p_op; - VisualServer::get_singleton()->light_set_operator(light,VS::LightOp(op)); - -} - -void Light::set_bake_mode(BakeMode p_bake_mode) { - - bake_mode=p_bake_mode; -} - -Light::BakeMode Light::get_bake_mode() const { - - return bake_mode; -} - - -Light::Operator Light::get_operator() const { - - return op; -} - -void Light::approximate_opengl_attenuation(float p_constant, float p_linear, float p_quadratic,float p_radius_treshold) { - - //this is horrible and must never be used - - float a = p_quadratic * p_radius_treshold; - float b = p_linear * p_radius_treshold; - float c = p_constant * p_radius_treshold -1; - - float radius=10000; - - if(a == 0) { // solve linear - float d = Math::abs(-c/b); - if(d=0) { - - root = sqrt(root); - - float solution1 = fabs( (-b + root) / denominator); - float solution2 = fabs( (-b - root) / denominator); - - if(solution1 > radius) - solution1 = radius; - - if(solution2 > radius) - solution2 = radius; - - radius = (solution1 > solution2 ? solution1 : solution2); - } - } - } - - float energy=1.0; - - /*if (p_constant>0) - energy=1.0/p_constant; //energy is this - else - energy=8.0; // some high number.. -*/ - - if (radius==10000) - radius=100; //bug? - - set_parameter(PARAM_RADIUS,radius); - set_parameter(PARAM_ENERGY,energy); - -} - void Light::_update_visibility() { @@ -436,7 +73,7 @@ void Light::_update_visibility() { return; -bool editor_ok=true; + bool editor_ok=true; #ifdef TOOLS_ENABLED if (editor_only) { @@ -448,7 +85,7 @@ bool editor_ok=true; } #endif - VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && enabled && editor_ok); + //VS::get_singleton()->instance_light_set_enabled(get_instance(),is_visible() && editor_ok); _change_notify("geometry/visible"); } @@ -461,16 +98,6 @@ void Light::_notification(int p_what) { } } -void Light::set_enabled(bool p_enabled) { - - enabled=p_enabled; - _update_visibility(); -} - -bool Light::is_enabled() const{ - - return enabled; -} void Light::set_editor_only(bool p_editor_only) { @@ -486,68 +113,15 @@ bool Light::is_editor_only() const{ void Light::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_parameter","variable","value"), &Light::set_parameter ); - ObjectTypeDB::bind_method(_MD("get_parameter","variable"), &Light::get_parameter ); - ObjectTypeDB::bind_method(_MD("set_color","color","value"), &Light::set_color ); - ObjectTypeDB::bind_method(_MD("get_color","color"), &Light::get_color ); - ObjectTypeDB::bind_method(_MD("set_project_shadows","enable"), &Light::set_project_shadows ); - ObjectTypeDB::bind_method(_MD("has_project_shadows"), &Light::has_project_shadows ); - ObjectTypeDB::bind_method(_MD("set_projector","projector:Texture"), &Light::set_projector ); - ObjectTypeDB::bind_method(_MD("get_projector:Texture"), &Light::get_projector ); - ObjectTypeDB::bind_method(_MD("set_operator","operator"), &Light::set_operator ); - ObjectTypeDB::bind_method(_MD("get_operator"), &Light::get_operator ); - ObjectTypeDB::bind_method(_MD("set_bake_mode","bake_mode"), &Light::set_bake_mode ); - ObjectTypeDB::bind_method(_MD("get_bake_mode"), &Light::get_bake_mode ); - ObjectTypeDB::bind_method(_MD("set_enabled","enabled"), &Light::set_enabled ); - ObjectTypeDB::bind_method(_MD("is_enabled"), &Light::is_enabled ); + ObjectTypeDB::bind_method(_MD("set_editor_only","editor_only"), &Light::set_editor_only ); ObjectTypeDB::bind_method(_MD("is_editor_only"), &Light::is_editor_only ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/enabled"), _SCS("set_enabled"), _SCS("is_enabled")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "params/bake_mode",PROPERTY_HINT_ENUM,"Disabled,Indirect,Indirect+Shadows,Full"), _SCS("set_bake_mode"), _SCS("get_bake_mode")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/energy", PROPERTY_HINT_EXP_RANGE, "0,64,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ENERGY ); - /* - if (type == VisualServer::LIGHT_OMNI || type == VisualServer::LIGHT_SPOT) { - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_RANGE, "0,8,0.01")); - } - if (type == VisualServer::LIGHT_SPOT) { - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/spot_angle", PROPERTY_HINT_RANGE, "0.01,90.0,0.01")); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_RANGE, "0,8,0.01")); - }*/ - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "colors/diffuse"), _SCS("set_color"), _SCS("get_color"),COLOR_DIFFUSE); - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "colors/specular"), _SCS("set_color"), _SCS("get_color"),COLOR_SPECULAR); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow/shadow"), _SCS("set_project_shadows"), _SCS("has_project_shadows")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/darkening", PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_DARKENING ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/z_offset", PROPERTY_HINT_RANGE, "0,128,0.001"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_Z_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/z_slope_scale", PROPERTY_HINT_RANGE, "0,128,0.001"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_Z_SLOPE_SCALE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/esm_multiplier", PROPERTY_HINT_RANGE, "1.0,512.0,0.1"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_ESM_MULTIPLIER); - ADD_PROPERTYI( PropertyInfo( Variant::INT, "shadow/blur_passes", PROPERTY_HINT_RANGE, "0,4,1"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADOW_BLUR_PASSES); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "projector",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_projector"), _SCS("get_projector")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "operator",PROPERTY_HINT_ENUM,"Add,Sub"), _SCS("set_operator"), _SCS("get_operator")); - - - BIND_CONSTANT( PARAM_RADIUS ); - BIND_CONSTANT( PARAM_ENERGY ); - BIND_CONSTANT( PARAM_ATTENUATION ); - BIND_CONSTANT( PARAM_SPOT_ANGLE ); - BIND_CONSTANT( PARAM_SPOT_ATTENUATION ); - BIND_CONSTANT( PARAM_SHADOW_DARKENING ); - BIND_CONSTANT( PARAM_SHADOW_Z_OFFSET ); - - - BIND_CONSTANT( COLOR_DIFFUSE ); - BIND_CONSTANT( COLOR_SPECULAR ); - - BIND_CONSTANT( BAKE_MODE_DISABLED ); - BIND_CONSTANT( BAKE_MODE_INDIRECT ); - BIND_CONSTANT( BAKE_MODE_INDIRECT_AND_SHADOWS ); - BIND_CONSTANT( BAKE_MODE_FULL ); } @@ -558,27 +132,8 @@ Light::Light(VisualServer::LightType p_type) { type=p_type; light=VisualServer::get_singleton()->light_create(p_type); - set_parameter(PARAM_SPOT_ATTENUATION,1.0); - set_parameter(PARAM_SPOT_ANGLE,30.0); - set_parameter(PARAM_RADIUS,2.0); - set_parameter(PARAM_ENERGY,1.0); - set_parameter(PARAM_ATTENUATION,1.0); - set_parameter(PARAM_SHADOW_DARKENING,0.0); - set_parameter(PARAM_SHADOW_Z_OFFSET,0.05); - set_parameter(PARAM_SHADOW_Z_SLOPE_SCALE,0); - set_parameter(PARAM_SHADOW_ESM_MULTIPLIER,60); - set_parameter(PARAM_SHADOW_BLUR_PASSES,1); - - - set_color( COLOR_DIFFUSE, Color(1,1,1)); - set_color( COLOR_SPECULAR, Color(1,1,1)); - - op=OPERATOR_ADD; - set_project_shadows( false ); - set_base(light); - enabled=true; + editor_only=false; - bake_mode=BAKE_MODE_DISABLED; } @@ -598,59 +153,15 @@ Light::~Light() { ///////////////////////////////////////// -void DirectionalLight::set_shadow_mode(ShadowMode p_mode) { - - shadow_mode=p_mode; - VS::get_singleton()->light_directional_set_shadow_mode(light,(VS::LightDirectionalShadowMode)p_mode); - -} - -DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const{ - - return shadow_mode; -} - -void DirectionalLight::set_shadow_param(ShadowParam p_param, float p_value) { - - ERR_FAIL_INDEX(p_param,3); - shadow_param[p_param]=p_value; - VS::get_singleton()->light_directional_set_shadow_param(light,VS::LightDirectionalShadowParam(p_param),p_value); -} - -float DirectionalLight::get_shadow_param(ShadowParam p_param) const { - ERR_FAIL_INDEX_V(p_param,3,0); - return shadow_param[p_param]; -} - void DirectionalLight::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_shadow_mode","mode"),&DirectionalLight::set_shadow_mode); - ObjectTypeDB::bind_method(_MD("get_shadow_mode"),&DirectionalLight::get_shadow_mode); - ObjectTypeDB::bind_method(_MD("set_shadow_param","param","value"),&DirectionalLight::set_shadow_param); - ObjectTypeDB::bind_method(_MD("get_shadow_param","param"),&DirectionalLight::get_shadow_param); - - ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/mode",PROPERTY_HINT_ENUM,"Orthogonal,Perspective,PSSM 2 Splits,PSSM 4 Splits"),_SCS("set_shadow_mode"),_SCS("get_shadow_mode")); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/max_distance",PROPERTY_HINT_EXP_RANGE,"0.00,99999,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_MAX_DISTANCE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/split_weight",PROPERTY_HINT_RANGE,"0.01,1.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_SPLIT_WEIGHT); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/zoffset_scale",PROPERTY_HINT_RANGE,"0.01,1024.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_ZOFFSET_SCALE); - BIND_CONSTANT( SHADOW_ORTHOGONAL ); - BIND_CONSTANT( SHADOW_PERSPECTIVE ); - BIND_CONSTANT( SHADOW_PARALLEL_2_SPLITS ); - BIND_CONSTANT( SHADOW_PARALLEL_4_SPLITS ); - BIND_CONSTANT( SHADOW_PARAM_MAX_DISTANCE ); - BIND_CONSTANT( SHADOW_PARAM_PSSM_SPLIT_WEIGHT ); - BIND_CONSTANT( SHADOW_PARAM_PSSM_ZOFFSET_SCALE ); } DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) { - shadow_mode=SHADOW_ORTHOGONAL; - shadow_param[SHADOW_PARAM_MAX_DISTANCE]=0; - shadow_param[SHADOW_PARAM_PSSM_SPLIT_WEIGHT]=0.5; - shadow_param[SHADOW_PARAM_PSSM_ZOFFSET_SCALE]=2.0; } @@ -658,19 +169,11 @@ DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) void OmniLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_EXP_RANGE, "0.2,4096,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_RADIUS ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ATTENUATION ); } void SpotLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/radius", PROPERTY_HINT_EXP_RANGE, "0.2,4096,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_RADIUS ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_ATTENUATION ); - - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_angle", PROPERTY_HINT_RANGE, "0.01,89.9,0.01"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ANGLE ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/spot_attenuation", PROPERTY_HINT_EXP_EASING, "spot_attenuation"), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPOT_ATTENUATION ); - } diff --git a/scene/3d/light.h b/scene/3d/light.h index b25c6a44b5..3c31d90d4c 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -44,57 +44,12 @@ class Light : public VisualInstance { public: - enum Parameter { - PARAM_RADIUS=VisualServer::LIGHT_PARAM_RADIUS, - PARAM_ENERGY=VisualServer::LIGHT_PARAM_ENERGY, - PARAM_ATTENUATION=VisualServer::LIGHT_PARAM_ATTENUATION, - PARAM_SPOT_ANGLE=VisualServer::LIGHT_PARAM_SPOT_ANGLE, - PARAM_SPOT_ATTENUATION=VisualServer::LIGHT_PARAM_SPOT_ATTENUATION, - PARAM_SHADOW_DARKENING=VisualServer::LIGHT_PARAM_SHADOW_DARKENING, - PARAM_SHADOW_Z_OFFSET=VisualServer::LIGHT_PARAM_SHADOW_Z_OFFSET, - PARAM_SHADOW_Z_SLOPE_SCALE=VisualServer::LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE, - PARAM_SHADOW_ESM_MULTIPLIER=VisualServer::LIGHT_PARAM_SHADOW_ESM_MULTIPLIER, - PARAM_SHADOW_BLUR_PASSES=VisualServer::LIGHT_PARAM_SHADOW_BLUR_PASSES, - PARAM_MAX=VisualServer::LIGHT_PARAM_MAX - }; - enum LightColor { - - COLOR_DIFFUSE=VisualServer::LIGHT_COLOR_DIFFUSE, - COLOR_SPECULAR=VisualServer::LIGHT_COLOR_SPECULAR - }; - - enum BakeMode { - - BAKE_MODE_DISABLED, - BAKE_MODE_INDIRECT, - BAKE_MODE_INDIRECT_AND_SHADOWS, - BAKE_MODE_FULL - - }; - - - enum Operator { - - OPERATOR_ADD, - OPERATOR_SUB - }; private: - - Ref projector; - float vars[PARAM_MAX]; - Color colors[3]; - - - BakeMode bake_mode; - VisualServer::LightType type; - bool shadows; - bool enabled; + VS::LightType type; bool editor_only; - Operator op; - void _update_visibility(); // bind helpers @@ -103,8 +58,7 @@ protected: RID light; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; - + static void _bind_methods(); void _notification(int p_what); @@ -114,44 +68,17 @@ public: VS::LightType get_light_type() const { return type; } - void set_parameter(Parameter p_var, float p_value); - float get_parameter(Parameter p_var) const; - - void set_color(LightColor p_color,const Color& p_value); - Color get_color(LightColor p_color) const; - - void set_project_shadows(bool p_enabled); - bool has_project_shadows() const; - - void set_projector(const Ref& p_projector); - Ref get_projector() const; - - void set_operator(Operator p_op); - Operator get_operator() const; - - void set_bake_mode(BakeMode p_bake_mode); - BakeMode get_bake_mode() const; - - void set_enabled(bool p_enabled); - bool is_enabled() const; - void set_editor_only(bool p_editor_only); bool is_editor_only() const; virtual AABB get_aabb() const; virtual DVector get_faces(uint32_t p_usage_flags) const; - void approximate_opengl_attenuation(float p_constant, float p_linear, float p_quadratic, float p_radius_treshold=0.5); - Light(); ~Light(); }; -VARIANT_ENUM_CAST( Light::Parameter ); -VARIANT_ENUM_CAST( Light::LightColor ); -VARIANT_ENUM_CAST( Light::Operator ); -VARIANT_ENUM_CAST( Light::BakeMode); class DirectionalLight : public Light { @@ -160,39 +87,18 @@ class DirectionalLight : public Light { public: - enum ShadowMode { - SHADOW_ORTHOGONAL, - SHADOW_PERSPECTIVE, - SHADOW_PARALLEL_2_SPLITS, - SHADOW_PARALLEL_4_SPLITS - }; - enum ShadowParam { - SHADOW_PARAM_MAX_DISTANCE, - SHADOW_PARAM_PSSM_SPLIT_WEIGHT, - SHADOW_PARAM_PSSM_ZOFFSET_SCALE - }; private: - ShadowMode shadow_mode; - float shadow_param[3]; + + protected: static void _bind_methods(); public: - void set_shadow_mode(ShadowMode p_mode); - ShadowMode get_shadow_mode() const; - - void set_shadow_max_distance(float p_distance); - float get_shadow_max_distance() const; - void set_shadow_param(ShadowParam p_param, float p_value); - float get_shadow_param(ShadowParam p_param) const; DirectionalLight(); }; -VARIANT_ENUM_CAST( DirectionalLight::ShadowMode ); -VARIANT_ENUM_CAST( DirectionalLight::ShadowParam ); - class OmniLight : public Light { @@ -203,7 +109,7 @@ protected: public: - OmniLight() : Light( VisualServer::LIGHT_OMNI ) { set_parameter(PARAM_SHADOW_Z_OFFSET,0.001);} + OmniLight() : Light( VisualServer::LIGHT_OMNI ) { } }; class SpotLight : public Light { diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 3ac5d8ed7b..994e329853 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -30,6 +30,7 @@ #include "servers/visual_server.h" #include "scene/resources/surface_tool.h" +#if 0 /* static const char* _var_names[Particles::VAR_MAX]={ "vars/lifetime", @@ -557,3 +558,4 @@ Particles::~Particles() { VisualServer::get_singleton()->free(particles); } +#endif diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 42d27c41d7..fb3bb258ef 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -37,7 +37,7 @@ /** @author Juan Linietsky */ - +#if 0 class Particles : public GeometryInstance { public: @@ -163,3 +163,4 @@ public: VARIANT_ENUM_CAST( Particles::Variable ); #endif +#endif diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 23bc64615d..131bbd7000 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -96,45 +96,6 @@ void Portal::_get_property_list( List *p_list) const { } -RES Portal::_get_gizmo_geometry() const { - - Ref surface_tool( memnew( SurfaceTool )); - - Ref mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(1.0,0.8,0.8,0.7) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); -// mat->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - Vector shape = get_shape(); - - Vector2 center; - for (int i=0;i points; - surface_tool->add_vertex( Vector3( shape[i].x, shape[i].y,0 )); - surface_tool->add_vertex( Vector3( shape[n].x, shape[n].y,0 )); - center+=shape[i]; - - } - - if (shape.size()>0) { - - center/=shape.size(); - Vector points; - surface_tool->add_vertex( Vector3( center.x, center.y,0 )); - surface_tool->add_vertex( Vector3( center.x, center.y,1.0 )); - } - - return surface_tool->commit(); -} - AABB Portal::get_aabb() const { @@ -178,18 +139,19 @@ void Portal::set_shape(const Vector& p_shape) { VisualServer::get_singleton()->portal_set_shape(portal, p_shape); + shape=p_shape; update_gizmo(); } Vector Portal::get_shape() const { - return VisualServer::get_singleton()->portal_get_shape(portal); + return shape; } void Portal::set_connect_range(float p_range) { connect_range=p_range; - VisualServer::get_singleton()->portal_set_connect_range(portal,p_range); + //VisualServer::get_singleton()->portal_set_connect_range(portal,p_range); } float Portal::get_connect_range() const { diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 149a56900f..8bcfa1ea4b 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -47,6 +47,7 @@ class Portal : public VisualInstance { OBJ_TYPE(Portal, VisualInstance); RID portal; + Vector shape; bool enabled; float disable_distance; @@ -55,7 +56,6 @@ class Portal : public VisualInstance { AABB aabb; - virtual RES _get_gizmo_geometry() const; protected: diff --git a/scene/3d/position_3d.cpp b/scene/3d/position_3d.cpp index 27130cbe6a..de1a0b73f4 100644 --- a/scene/3d/position_3d.cpp +++ b/scene/3d/position_3d.cpp @@ -29,37 +29,6 @@ #include "position_3d.h" #include "scene/resources/mesh.h" -RES Position3D::_get_gizmo_geometry() const { - - - Ref mesh = memnew( Mesh ); - - DVector cursor_points; - DVector cursor_colors; - float cs = 0.25; - cursor_points.push_back(Vector3(+cs,0,0)); - cursor_points.push_back(Vector3(-cs,0,0)); - cursor_points.push_back(Vector3(0,+cs,0)); - cursor_points.push_back(Vector3(0,-cs,0)); - cursor_points.push_back(Vector3(0,0,+cs)); - cursor_points.push_back(Vector3(0,0,-cs)); - cursor_colors.push_back(Color(1,0.5,0.5,1)); - cursor_colors.push_back(Color(1,0.5,0.5,1)); - cursor_colors.push_back(Color(0.5,1,0.5,1)); - cursor_colors.push_back(Color(0.5,1,0.5,1)); - cursor_colors.push_back(Color(0.5,0.5,1,1)); - cursor_colors.push_back(Color(0.5,0.5,1,1)); - - Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_line_width(3); - Array d; - d[Mesh::ARRAY_VERTEX]=cursor_points; - d[Mesh::ARRAY_COLOR]=cursor_colors; - mesh->add_surface(Mesh::PRIMITIVE_LINES,d); - mesh->surface_set_material(0,mat); - return mesh; -} Position3D::Position3D() { diff --git a/scene/3d/position_3d.h b/scene/3d/position_3d.h index 6bac540fcb..676f46c2ee 100644 --- a/scene/3d/position_3d.h +++ b/scene/3d/position_3d.h @@ -35,7 +35,6 @@ class Position3D : public Spatial { OBJ_TYPE(Position3D,Spatial); - virtual RES _get_gizmo_geometry() const; public: diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp index 1a7eeef180..f31d248ba7 100644 --- a/scene/3d/quad.cpp +++ b/scene/3d/quad.cpp @@ -120,7 +120,7 @@ void Quad::_update() { } else { configured=true; } - VS::get_singleton()->mesh_add_surface(mesh,VS::PRIMITIVE_TRIANGLES,arr); + VS::get_singleton()->mesh_add_surface_from_arrays(mesh,VS::PRIMITIVE_TRIANGLES,arr); pending_update=false; } diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 9e6867d2a2..080fa880ba 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -75,50 +75,6 @@ void Room::_notification(int p_what) { } -RES Room::_get_gizmo_geometry() const { - - DVector faces; - if (!room.is_null()) - faces=room->get_geometry_hint(); - - int count=faces.size(); - if (count==0) - return RES(); - - DVector::Read facesr=faces.read(); - - const Face3* facesptr=facesr.ptr(); - - DVector points; - - Ref surface_tool( memnew( SurfaceTool )); - - Ref mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.2,0.8,0.9,0.3) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - for (int i=0;iadd_vertex(facesptr[i].vertex[0]); - surface_tool->add_vertex(facesptr[i].vertex[1]); - - surface_tool->add_vertex(facesptr[i].vertex[1]); - surface_tool->add_vertex(facesptr[i].vertex[2]); - - surface_tool->add_vertex(facesptr[i].vertex[2]); - surface_tool->add_vertex(facesptr[i].vertex[0]); - - } - - return surface_tool->commit(); -} @@ -127,8 +83,9 @@ AABB Room::get_aabb() const { if (room.is_null()) return AABB(); - return room->get_bounds().get_aabb(); + return AABB(); } + DVector Room::get_faces(uint32_t p_usage_flags) const { return DVector(); @@ -154,9 +111,6 @@ void Room::set_room( const Ref& p_room ) { propagate_notification(NOTIFICATION_AREA_CHANGED); update_gizmo(); - if (room.is_valid()) - SpatialSoundServer::get_singleton()->room_set_bounds(sound_room,room->get_bounds()); - } @@ -202,32 +156,6 @@ void Room::_parse_node_faces(DVector &all_faces,const Node *p_node) const } -void Room::compute_room_from_subtree() { - - - DVector all_faces; - _parse_node_faces(all_faces,this); - - - if (all_faces.size()==0) - return; - float error; - DVector wrapped_faces = Geometry::wrap_geometry(all_faces,&error); - - - if (wrapped_faces.size()==0) - return; - - BSP_Tree tree(wrapped_faces,error); - - Ref room( memnew( RoomBounds ) ); - room->set_bounds(tree); - room->set_geometry_hint(wrapped_faces); - - set_room(room); - -} - void Room::set_simulate_acoustics(bool p_enable) { @@ -268,7 +196,6 @@ void Room::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_room","room:Room"),&Room::set_room ); ObjectTypeDB::bind_method(_MD("get_room:Room"),&Room::get_room ); - ObjectTypeDB::bind_method(_MD("compute_room_from_subtree"),&Room::compute_room_from_subtree); diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index c7df4ceadd..346e687d9e 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -45,6 +45,8 @@ */ + + class Room : public VisualInstance { OBJ_TYPE( Room, VisualInstance ); @@ -65,7 +67,7 @@ private: void _bounds_changed(); - virtual RES _get_gizmo_geometry() const; + protected: @@ -89,7 +91,6 @@ public: void set_simulate_acoustics(bool p_enable); bool is_simulating_acoustics() const; - void compute_room_from_subtree(); RID get_sound_room() const; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index c996a8123c..96233c5ed7 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -163,7 +163,7 @@ void Skeleton::_notification(int p_what) { Bone *bonesptr=&bones[0]; int len=bones.size(); - vs->skeleton_resize( skeleton, len ); // if same size, nothin really happens + vs->skeleton_allocate( skeleton, len ); // if same size, nothin really happens // pose changed, rebuild cache of inverses if (rest_global_inverse_dirty) { @@ -513,51 +513,6 @@ void Skeleton::_make_dirty() { } -RES Skeleton::_get_gizmo_geometry() const { - - if (!GLOBAL_DEF("debug/draw_skeleton", true)) - return RES(); - - if (bones.size()==0) - return RES(); - - Ref surface_tool( memnew( SurfaceTool )); - - Ref mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.6,1.0,0.3,0.1) ); - mat->set_line_width(4); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_flag(Material::FLAG_ONTOP,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - surface_tool->begin(Mesh::PRIMITIVE_LINES); - surface_tool->set_material(mat); - - - const Bone *bonesptr=&bones[0]; - int len=bones.size(); - - for (int i=0;iadd_vertex(v1); - surface_tool->add_vertex(v2); - - } - - return surface_tool->commit(); - -} void Skeleton::localize_rests() { diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index bfdb1d1499..1b8136b06c 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -84,7 +84,6 @@ class Skeleton : public Spatial { return bound; } - virtual RES _get_gizmo_geometry() const; protected: diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp index c7cf03e284..70370c51e7 100644 --- a/scene/3d/spatial_player.cpp +++ b/scene/3d/spatial_player.cpp @@ -88,146 +88,6 @@ bool SpatialPlayer::_can_gizmo_scale() const { return false; } -RES SpatialPlayer::_get_gizmo_geometry() const { - - Ref surface_tool( memnew( SurfaceTool )); - - Ref mat( memnew( FixedMaterial )); - - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.05) ); - mat->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) ); - mat->set_blend_mode( Material::BLEND_MODE_ADD ); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); -// mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - - - surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - surface_tool->set_material(mat); - - int sides=16; - int sections=24; - -// float len=1; - float deg=Math::deg2rad(params[PARAM_EMISSION_CONE_DEGREES]); - if (deg==180) - deg=179.5; - - Vector3 to=Vector3(0,0,-1); - - for(int j=0;jadd_normal(p1r.normalized()); - surface_tool->add_vertex(p1r); - surface_tool->add_normal(p1s.normalized()); - surface_tool->add_vertex(p1s); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - - surface_tool->add_normal(p1r.normalized()); - surface_tool->add_vertex(p1r); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - surface_tool->add_normal(p2r.normalized()); - surface_tool->add_vertex(p2r); - - if (j==sections-1) { - - surface_tool->add_normal(p2r.normalized()); - surface_tool->add_vertex(p2r); - surface_tool->add_normal(p2s.normalized()); - surface_tool->add_vertex(p2s); - surface_tool->add_normal(Vector3(0,0,1)); - surface_tool->add_vertex(Vector3()); - } - } - } - - - Ref mesh = surface_tool->commit(); - - Ref mat_speaker( memnew( FixedMaterial )); - - mat_speaker->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.3,0.3,0.6) ); - mat_speaker->set_parameter( FixedMaterial::PARAM_SPECULAR,Color(0.5,0.5,0.6) ); - //mat_speaker->set_blend_mode( Material::BLEND_MODE_MIX); - //mat_speaker->set_flag(Material::FLAG_DOUBLE_SIDED,false); - //mat_speaker->set_flag(Material::FLAG_UNSHADED,true); - - surface_tool->begin(Mesh::PRIMITIVE_TRIANGLES); - surface_tool->set_material(mat_speaker); - -// float radius=1; - - - const int speaker_points=8; - Vector3 speaker[speaker_points]={ - Vector3(0,0,1)*0.15, - Vector3(1,1,1)*0.15, - Vector3(1,1,0)*0.15, - Vector3(2,2,-1)*0.15, - Vector3(1,1,-1)*0.15, - Vector3(0.8,0.8,-1.2)*0.15, - Vector3(0.5,0.5,-1.4)*0.15, - Vector3(0.0,0.0,-1.6)*0.15 - }; - - int speaker_sides=10; - - - for(int i = 0; i < speaker_sides ; i++) { - - - Matrix3 ma(Vector3(0,0,1),Math_PI*2*float(i)/speaker_sides); - Matrix3 mb(Vector3(0,0,1),Math_PI*2*float(i+1)/speaker_sides); - - - for(int j=0;jadd_normal(n); - surface_tool->add_vertex(points[0]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[2]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[1]); - - surface_tool->add_normal(n); - surface_tool->add_vertex(points[0]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[3]); - surface_tool->add_normal(n); - surface_tool->add_vertex(points[2]); - - - } - - - } - - - return surface_tool->commit(mesh); - -} - - void SpatialPlayer::_bind_methods() { diff --git a/scene/3d/spatial_player.h b/scene/3d/spatial_player.h index 5a8687b854..594fc8f850 100644 --- a/scene/3d/spatial_player.h +++ b/scene/3d/spatial_player.h @@ -60,7 +60,7 @@ private: RID source_rid; virtual bool _can_gizmo_scale() const; - virtual RES _get_gizmo_geometry() const; + protected: diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index b4f7a4e5b4..5bc332f8fb 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -52,7 +52,7 @@ void VisualInstance::_notification(int p_what) { Room *room=NULL; bool is_geom = cast_to(); - while(parent) { + /* while(parent) { room = parent->cast_to(); if (room) @@ -64,7 +64,7 @@ void VisualInstance::_notification(int p_what) { } parent=parent->get_parent_spatial(); - } + }*/ @@ -92,7 +92,7 @@ void VisualInstance::_notification(int p_what) { VisualServer::get_singleton()->instance_set_scenario( instance, RID() ); VisualServer::get_singleton()->instance_set_room(instance,RID()); VisualServer::get_singleton()->instance_attach_skeleton( instance, RID() ); - VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); + // VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() ); } break; @@ -172,30 +172,55 @@ Ref GeometryInstance::get_material_override() const{ -void GeometryInstance::set_draw_range_begin(float p_dist){ +void GeometryInstance::set_lod_min_distance(float p_dist){ + + lod_min_distance=p_dist; + VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis); +} + +float GeometryInstance::get_lod_min_distance() const{ + + return lod_min_distance; +} + + +void GeometryInstance::set_lod_max_distance(float p_dist) { + + lod_max_distance=p_dist; + VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis); - draw_begin=p_dist; - VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),draw_begin,draw_end); } -float GeometryInstance::get_draw_range_begin() const{ +float GeometryInstance::get_lod_max_distance() const { - return draw_begin; + return lod_max_distance; } +void GeometryInstance::set_lod_min_hysteresis(float p_dist){ -void GeometryInstance::set_draw_range_end(float p_dist) { + lod_min_hysteresis=p_dist; + VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis); +} - draw_end=p_dist; - VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),draw_begin,draw_end); +float GeometryInstance::get_lod_min_hysteresis() const{ + return lod_min_hysteresis; } -float GeometryInstance::get_draw_range_end() const { - return draw_end; +void GeometryInstance::set_lod_max_hysteresis(float p_dist) { + + lod_max_hysteresis=p_dist; + VS::get_singleton()->instance_geometry_set_draw_range(get_instance(),lod_min_distance,lod_max_distance,lod_min_hysteresis,lod_max_hysteresis); + } +float GeometryInstance::get_lod_max_hysteresis() const { + + return lod_max_hysteresis; +} + + void GeometryInstance::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_WORLD) { @@ -212,8 +237,8 @@ void GeometryInstance::_notification(int p_what) { if (flags[FLAG_USE_BAKED_LIGHT]) { if (baked_light_instance) { - baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); - baked_light_instance=NULL; + // baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); + // baked_light_instance=NULL; } _baked_light_changed(); @@ -229,15 +254,15 @@ void GeometryInstance::_notification(int p_what) { void GeometryInstance::_baked_light_changed() { - if (!baked_light_instance) - VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); - else - VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); + //if (!baked_light_instance) + // VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); +// else +// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); } void GeometryInstance::_find_baked_light() { - +/* Node *n=get_parent(); while(n) { @@ -255,6 +280,7 @@ void GeometryInstance::_find_baked_light() { } _baked_light_changed(); + */ } void GeometryInstance::_update_visibility() { @@ -288,7 +314,7 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) { } if (p_flag==FLAG_USE_BAKED_LIGHT) { - if (is_inside_world()) { + /* if (is_inside_world()) { if (!p_value) { if (baked_light_instance) { baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); @@ -298,7 +324,7 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) { } else { _find_baked_light(); } - } + }*/ } } @@ -333,8 +359,8 @@ GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_settin void GeometryInstance::set_baked_light_texture_id(int p_id) { - baked_light_texture_id=p_id; - VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),baked_light_texture_id); +// baked_light_texture_id=p_id; +// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),baked_light_texture_id); } @@ -366,11 +392,18 @@ void GeometryInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_cast_shadows_setting", "shadow_casting_setting"), &GeometryInstance::set_cast_shadows_setting); ObjectTypeDB::bind_method(_MD("get_cast_shadows_setting"), &GeometryInstance::get_cast_shadows_setting); - ObjectTypeDB::bind_method(_MD("set_draw_range_begin","mode"), &GeometryInstance::set_draw_range_begin); - ObjectTypeDB::bind_method(_MD("get_draw_range_begin"), &GeometryInstance::get_draw_range_begin); + ObjectTypeDB::bind_method(_MD("set_lod_max_hysteresis","mode"), &GeometryInstance::set_lod_max_hysteresis); + ObjectTypeDB::bind_method(_MD("get_lod_max_hysteresis"), &GeometryInstance::get_lod_max_hysteresis); + + ObjectTypeDB::bind_method(_MD("set_lod_max_distance","mode"), &GeometryInstance::set_lod_max_distance); + ObjectTypeDB::bind_method(_MD("get_lod_max_distance"), &GeometryInstance::get_lod_max_distance); + + ObjectTypeDB::bind_method(_MD("set_lod_min_hysteresis","mode"), &GeometryInstance::set_lod_min_hysteresis); + ObjectTypeDB::bind_method(_MD("get_lod_min_hysteresis"), &GeometryInstance::get_lod_min_hysteresis); + + ObjectTypeDB::bind_method(_MD("set_lod_min_distance","mode"), &GeometryInstance::set_lod_min_distance); + ObjectTypeDB::bind_method(_MD("get_lod_min_distance"), &GeometryInstance::get_lod_min_distance); - ObjectTypeDB::bind_method(_MD("set_draw_range_end","mode"), &GeometryInstance::set_draw_range_end); - ObjectTypeDB::bind_method(_MD("get_draw_range_end"), &GeometryInstance::get_draw_range_end); ObjectTypeDB::bind_method(_MD("set_baked_light_texture_id","id"), &GeometryInstance::set_baked_light_texture_id); ObjectTypeDB::bind_method(_MD("get_baked_light_texture_id"), &GeometryInstance::get_baked_light_texture_id); @@ -385,9 +418,6 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "geometry/material_override",PROPERTY_HINT_RESOURCE_TYPE,"Material"), _SCS("set_material_override"), _SCS("get_material_override")); ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry/cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), _SCS("set_cast_shadows_setting"), _SCS("get_cast_shadows_setting")); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/receive_shadows"), _SCS("set_flag"), _SCS("get_flag"),FLAG_RECEIVE_SHADOWS); - ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_begin",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_begin"), _SCS("get_draw_range_begin")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/range_end",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_draw_range_end"), _SCS("get_draw_range_end")); ADD_PROPERTY( PropertyInfo( Variant::REAL, "geometry/extra_cull_margin",PROPERTY_HINT_RANGE,"0,16384,0"), _SCS("set_extra_cull_margin"), _SCS("get_extra_cull_margin")); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/billboard_y"), _SCS("set_flag"), _SCS("get_flag"),FLAG_BILLBOARD_FIX_Y); @@ -395,12 +425,15 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible_in_all_rooms"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE_IN_ALL_ROOMS); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/use_baked_light"), _SCS("set_flag"), _SCS("get_flag"),FLAG_USE_BAKED_LIGHT); ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/baked_light_tex_id"), _SCS("set_baked_light_texture_id"), _SCS("get_baked_light_texture_id")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_distance"), _SCS("get_lod_min_distance")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_hysteresis"), _SCS("get_lod_min_hysteresis")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/max_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_distance"), _SCS("get_lod_max_distance")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/max_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_hysteresis"), _SCS("get_lod_max_hysteresis")); // ADD_SIGNAL( MethodInfo("visibility_changed")); BIND_CONSTANT(FLAG_VISIBLE ); BIND_CONSTANT(FLAG_CAST_SHADOW ); - BIND_CONSTANT(FLAG_RECEIVE_SHADOWS ); BIND_CONSTANT(FLAG_BILLBOARD ); BIND_CONSTANT(FLAG_BILLBOARD_FIX_Y ); BIND_CONSTANT(FLAG_DEPH_SCALE ); @@ -415,20 +448,23 @@ void GeometryInstance::_bind_methods() { } GeometryInstance::GeometryInstance() { - draw_begin=0; - draw_end=0; + lod_min_distance=0; + lod_max_distance=0; + lod_min_hysteresis=0; + lod_max_hysteresis=0; + for(int i=0;iinstance_geometry_set_baked_light_texture_index(get_instance(),0); +// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); } diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index e286d5fa88..eb0587815f 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -89,7 +89,6 @@ public: enum Flags { FLAG_VISIBLE=VS::INSTANCE_FLAG_VISIBLE, FLAG_CAST_SHADOW=VS::INSTANCE_FLAG_CAST_SHADOW, - FLAG_RECEIVE_SHADOWS=VS::INSTANCE_FLAG_RECEIVE_SHADOWS, FLAG_BILLBOARD=VS::INSTANCE_FLAG_BILLBOARD, FLAG_BILLBOARD_FIX_Y=VS::INSTANCE_FLAG_BILLBOARD_FIX_Y, FLAG_DEPH_SCALE=VS::INSTANCE_FLAG_DEPH_SCALE, @@ -110,8 +109,10 @@ private: bool flags[FLAG_MAX]; ShadowCastingSetting shadow_casting_setting; Ref material_override; - float draw_begin; - float draw_end; + float lod_min_distance; + float lod_max_distance; + float lod_min_hysteresis; + float lod_max_hysteresis; void _find_baked_light(); BakedLightInstance *baked_light_instance; int baked_light_texture_id; @@ -131,11 +132,17 @@ public: void set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting); ShadowCastingSetting get_cast_shadows_setting() const; - void set_draw_range_begin(float p_dist); - float get_draw_range_begin() const; + void set_lod_min_distance(float p_dist); + float get_lod_min_distance() const; - void set_draw_range_end(float p_dist); - float get_draw_range_end() const; + void set_lod_max_distance(float p_dist); + float get_lod_max_distance() const; + + void set_lod_min_hysteresis(float p_dist); + float get_lod_min_hysteresis() const; + + void set_lod_max_hysteresis(float p_dist); + float get_lod_max_hysteresis() const; void set_material_override(const Ref& p_material); Ref get_material_override() const; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 5e66544153..27bdb581e1 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -59,6 +59,10 @@ void ColorPicker::_notification(int p_what) { w_material->set_shader(get_shader("w_editor")); update_material(uv_material,color,h,s,v); update_material(w_material,color,h,s,v); + uv_edit->set_texture(get_icon("color_main")); + w_edit->set_texture(get_icon("color_hue")); + sample->set_texture(get_icon("color_sample")); + _update_controls(); } break; @@ -192,10 +196,24 @@ void ColorPicker::_update_presets() { Size2 size=bt_add_preset->get_size(); preset->set_custom_minimum_size(Size2(size.width*presets.size(),size.height)); - Image i(size.x*presets.size(),size.y, false, Image::FORMAT_RGB); - for (int y=0;y img; + img.resize(size.x*presets.size()*size.y*3); + + { + DVector::Write w=img.write(); + for (int y=0;y t; t.instance(); t->create_from_image(i); @@ -394,15 +412,23 @@ void ColorPicker::_screen_input(const InputEvent &ev) } else if (ev.type==InputEvent::MOUSE_MOTION) { const InputEventMouse &mev = ev.mouse_motion; Viewport *r=get_tree()->get_root(); - if (!r->get_rect().has_point(Point2(mev.global_x,mev.global_y))) + if (!r->get_visible_rect().has_point(Point2(mev.global_x,mev.global_y))) return; Image img =r->get_screen_capture(); if (!img.empty()) { last_capture=img; r->queue_screen_capture(); } - if (!last_capture.empty()) - set_color(last_capture.get_pixel(mev.global_x,mev.global_y)); + if (!last_capture.empty()) { + int pw = last_capture.get_format()==Image::FORMAT_RGBA8?4:3; + int ofs = (mev.global_y*last_capture.get_width()+mev.global_x)*pw; + + DVector::Read r = last_capture.get_data().read(); + + Color c( r[ofs+0]/255.0, r[ofs+1]/255.0, r[ofs+2]/255.0 ); + + set_color(c); + } } } @@ -474,16 +500,10 @@ ColorPicker::ColorPicker() : HBoxContainer *hb_edit = memnew( HBoxContainer ); uv_edit= memnew ( TextureFrame ); - Image i(256, 256, false, Image::FORMAT_RGB); - for (int y=0;y<256;y++) - for (int x=0;x<256;x++) - i.put_pixel(x,y,Color()); - Ref t; - t.instance(); - t->create_from_image(i); - uv_edit->set_texture(t); + + + uv_edit->set_ignore_mouse(false); - uv_edit->set_custom_minimum_size(Size2(256,256)); uv_edit->connect("input_event", this, "_uv_input"); Control *c= memnew( Control ); uv_edit->add_child(c); @@ -497,16 +517,9 @@ ColorPicker::ColorPicker() : add_child(hb_edit); w_edit= memnew( TextureFrame ); - i = Image(15, 256, false, Image::FORMAT_RGB); - for (int y=0;y<256;y++) - for (int x=0;x<15;x++) - i.put_pixel(x,y,Color()); - Ref tw; - tw.instance(); - tw->create_from_image(i); - w_edit->set_texture(tw); - w_edit->set_ignore_mouse(false); - w_edit->set_custom_minimum_size(Size2(15,256)); + + + w_edit->set_ignore_mouse(false); w_edit->connect("input_event", this, "_w_input"); c= memnew( Control ); w_edit->add_child(c); @@ -594,17 +607,6 @@ ColorPicker::ColorPicker() : set_color(Color(1,1,1)); - i.create(256,20,false,Image::FORMAT_RGB); - for (int y=0;y<20;y++) - for(int x=0;x<256;x++) - if ((x/4+y/4)%2) - i.put_pixel(x,y,Color(1,1,1)); - else - i.put_pixel(x,y,Color(0.6,0.6,0.6)); - Ref t_smpl; - t_smpl.instance(); - t_smpl->create_from_image(i); - sample->set_texture(t_smpl); HBoxContainer *bbc = memnew( HBoxContainer ); add_child(bbc); diff --git a/scene/gui/patch_9_frame.cpp b/scene/gui/patch_9_frame.cpp index 9ad6398359..ed1abbadee 100644 --- a/scene/gui/patch_9_frame.cpp +++ b/scene/gui/patch_9_frame.cpp @@ -39,7 +39,7 @@ void Patch9Frame::_notification(int p_what) { Size2 s=get_size(); RID ci = get_canvas_item(); - VS::get_singleton()->canvas_item_add_style_box(ci,Rect2(Point2(),s),region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),draw_center,modulate); + VS::get_singleton()->canvas_item_add_nine_patch(ci,Rect2(Point2(),s),region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),VS::NINE_PATCH_STRETCH,VS::NINE_PATCH_STRETCH,draw_center,modulate); // draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); /* diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 8e238c7d77..9ee0cf9349 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -246,6 +246,15 @@ Node* CanvasLayer::get_custom_viewport() const { return custom_viewport; } +void CanvasLayer::reset_sort_index() { + sort_index=0; +} + +int CanvasLayer::get_sort_index() { + + return sort_index++; +} + void CanvasLayer::_bind_methods() { @@ -296,4 +305,5 @@ CanvasLayer::CanvasLayer() { canvas = Ref( memnew(World2D) ); custom_viewport=NULL; custom_viewport_id=0; + sort_index=0; } diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index a1311390be..bb63c96cdf 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -52,6 +52,8 @@ class CanvasLayer : public Node { RID viewport; Viewport *vp; + int sort_index; + // Deprecated, should be removed in a future version. void _set_rotationd(real_t p_rotation); real_t _get_rotationd() const; @@ -93,6 +95,9 @@ public: void set_custom_viewport(Node *p_viewport); Node* get_custom_viewport() const; + void reset_sort_index(); + int get_sort_index(); + CanvasLayer(); }; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 1892240426..5d4e46f9ac 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -315,6 +315,12 @@ void Node::move_child(Node *p_child,int p_pos) { } + if (p_child->data.pos==p_pos) + return; //do nothing + + int motion_from = MIN(p_pos,p_child->data.pos); + int motion_to = MAX(p_pos,p_child->data.pos); + data.children.remove( p_child->data.pos ); data.children.insert( p_pos, p_child ); @@ -324,13 +330,13 @@ void Node::move_child(Node *p_child,int p_pos) { data.blocked++; //new pos first - for (int i=0;idata.pos=i; } // notification second move_child_notify(p_child); - for (int i=0;inotification( NOTIFICATION_MOVED_IN_PARENT ); } diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index e3472c074a..c1552a4167 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -746,11 +746,11 @@ Ref SceneTree::get_debug_navigation_material() { return navigation_material; Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); +/* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ navigation_material=line_material; @@ -764,11 +764,11 @@ Ref SceneTree::get_debug_navigation_disabled_material(){ return navigation_disabled_material; Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); +/* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ navigation_disabled_material=line_material; @@ -782,11 +782,11 @@ Ref SceneTree::get_debug_collision_material() { Ref line_material = Ref( memnew( FixedMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); + /*line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color()); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ collision_material=line_material; @@ -801,10 +801,10 @@ Ref SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref( memnew( Mesh ) ); Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); + /*mat->set_flag(Material::FLAG_UNSHADED,true); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color()); + mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ Vector3 diamond[6]={ Vector3(-1, 0, 0), @@ -1098,7 +1098,11 @@ void SceneTree::_update_root_rect() { if (stretch_mode==STRETCH_MODE_DISABLED) { - root->set_rect(Rect2(Point2(),last_screen_size)); + + root->set_size(last_screen_size); + root->set_attach_to_screen_rect(Rect2(Point2(),last_screen_size)); + root->set_size_override_stretch(false); + root->set_size_override(false,Size2()); return; //user will take care } @@ -1174,21 +1178,18 @@ void SceneTree::_update_root_rect() { switch (stretch_mode) { case STRETCH_MODE_2D: { -// root->set_rect(Rect2(Point2(),video_mode)); - root->set_as_render_target(false); - root->set_rect(Rect2(margin,screen_size)); + root->set_size(screen_size); + root->set_attach_to_screen_rect(Rect2(margin,screen_size)); root->set_size_override_stretch(true); root->set_size_override(true,viewport_size); } break; case STRETCH_MODE_VIEWPORT: { - root->set_rect(Rect2(Point2(),viewport_size)); + root->set_size(viewport_size); + root->set_attach_to_screen_rect(Rect2(margin,screen_size)); root->set_size_override_stretch(false); root->set_size_override(false,Size2()); - root->set_as_render_target(true); - root->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS); - root->set_render_target_to_screen_rect(Rect2(margin,screen_size)); } break; @@ -2300,7 +2301,7 @@ SceneTree::SceneTree() { stretch_aspect=STRETCH_ASPECT_IGNORE; last_screen_size=Size2( OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height ); - root->set_rect(Rect2(Point2(),last_screen_size)); + root->set_size(last_screen_size); if (ScriptDebugger::get_singleton()) { ScriptDebugger::get_singleton()->set_request_scene_tree_message_func(_debugger_request_tree,this); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b22d1fcdf4..44a3f41a4a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -54,22 +54,22 @@ int RenderTargetTexture::get_width() const { ERR_FAIL_COND_V(!vp,0); - return vp->rect.size.width; + return vp->size.width; } int RenderTargetTexture::get_height() const{ ERR_FAIL_COND_V(!vp,0); - return vp->rect.size.height; + return vp->size.height; } Size2 RenderTargetTexture::get_size() const{ ERR_FAIL_COND_V(!vp,Size2()); - return vp->rect.size; + return vp->size; } RID RenderTargetTexture::get_rid() const{ ERR_FAIL_COND_V(!vp,RID()); - return vp->render_target_texture_rid; + return vp->texture_rid; } bool RenderTargetTexture::has_alpha() const{ @@ -85,7 +85,7 @@ void RenderTargetTexture::set_flags(uint32_t p_flags){ else flags=0; - VS::get_singleton()->texture_set_flags(vp->render_target_texture_rid,flags); + VS::get_singleton()->texture_set_flags(vp->texture_rid,flags); } @@ -141,9 +141,9 @@ void Viewport::_update_stretch_transform() { if (size_override_stretch && size_override) { //print_line("sive override size "+size_override_size); - //print_line("rect size "+rect.size); + //print_line("rect size "+size); stretch_transform=Matrix32(); - Size2 scale = rect.size/(size_override_size+size_override_margin*2); + Size2 scale = size/(size_override_size+size_override_margin*2); stretch_transform.scale(scale); stretch_transform.elements[2]=size_override_margin*scale; @@ -164,14 +164,14 @@ void Viewport::_update_rect() { return; - if (!render_target && parent_control) { + /*if (!render_target && parent_control) { Control *c = parent_control; rect.pos=Point2(); rect.size=c->get_size(); - } - + }*/ +/* VisualServer::ViewportRect vr; vr.x=rect.pos.x; vr.y=rect.pos.y; @@ -191,8 +191,8 @@ void Viewport::_update_rect() { } emit_signal("size_changed"); - render_target_texture->emit_changed(); - + texture->emit_changed(); +*/ } @@ -232,12 +232,12 @@ void Viewport::_vp_enter_tree() { VisualServer::get_singleton()->canvas_item_set_parent(canvas_item,parent_ci); VisualServer::get_singleton()->canvas_item_set_visible(canvas_item,false); - VisualServer::get_singleton()->canvas_item_attach_viewport(canvas_item,viewport); +// VisualServer::get_singleton()->canvas_item_attach_viewport(canvas_item,viewport); parent_control->connect("resized",this,"_parent_resized"); parent_control->connect("visibility_changed",this,"_parent_visibility_changed"); } else if (!parent){ - VisualServer::get_singleton()->viewport_attach_to_screen(viewport,0); +// VisualServer::get_singleton()->viewport_attach_to_screen(viewport,0); } @@ -246,6 +246,7 @@ void Viewport::_vp_enter_tree() { void Viewport::_vp_exit_tree() { + /* if (parent_control) { parent_control->disconnect("resized",this,"_parent_resized"); @@ -268,7 +269,7 @@ void Viewport::_vp_exit_tree() { VisualServer::get_singleton()->viewport_detach(viewport); } - +*/ } @@ -346,11 +347,6 @@ void Viewport::_notification(int p_what) { parent_node=parent_node->get_parent(); } - - if (!render_target) - _vp_enter_tree(); - - current_canvas=find_world_2d()->get_canvas(); VisualServer::get_singleton()->viewport_set_scenario(viewport,find_world()->get_scenario()); VisualServer::get_singleton()->viewport_attach_canvas(viewport,current_canvas); @@ -370,7 +366,7 @@ void Viewport::_notification(int p_what) { //3D PhysicsServer::get_singleton()->space_set_debug_contacts(find_world()->get_space(),get_tree()->get_collision_debug_contact_count()); contact_3d_debug_multimesh=VisualServer::get_singleton()->multimesh_create(); - VisualServer::get_singleton()->multimesh_set_instance_count(contact_3d_debug_multimesh,get_tree()->get_collision_debug_contact_count()); + VisualServer::get_singleton()->multimesh_allocate(contact_3d_debug_multimesh,get_tree()->get_collision_debug_contact_count(),VS::MULTIMESH_TRANSFORM_3D,VS::MULTIMESH_COLOR_8BIT); VisualServer::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh,0); VisualServer::get_singleton()->multimesh_set_mesh(contact_3d_debug_multimesh,get_tree()->get_debug_contact_mesh()->get_rid()); contact_3d_debug_instance=VisualServer::get_singleton()->instance_create(); @@ -380,6 +376,7 @@ void Viewport::_notification(int p_what) { } + VS::get_singleton()->viewport_set_active(viewport,true); } break; case NOTIFICATION_READY: { #ifndef _3D_DISABLED @@ -418,8 +415,8 @@ void Viewport::_notification(int p_what) { if (world_2d.is_valid()) world_2d->_remove_viewport(this); - if (!render_target) - _vp_exit_tree(); + //if (!render_target) + // _vp_exit_tree(); VisualServer::get_singleton()->viewport_set_scenario(viewport,RID()); SpatialSoundServer::get_singleton()->listener_set_space(internal_listener, RID()); @@ -439,6 +436,9 @@ void Viewport::_notification(int p_what) { remove_from_group("_viewports"); parent_control=NULL; + VS::get_singleton()->viewport_set_active(viewport,false); + + } break; case NOTIFICATION_FIXED_PROCESS: { @@ -452,7 +452,7 @@ void Viewport::_notification(int p_what) { if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) { VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug); - VisualServer::get_singleton()->canvas_item_raise(contact_2d_debug); + VisualServer::get_singleton()->canvas_item_set_draw_index(contact_2d_debug,0xFFFFF); //very high index Vector points = Physics2DServer::get_singleton()->space_get_contacts(find_world_2d()->get_space()); int point_count = Physics2DServer::get_singleton()->space_get_contact_count(find_world_2d()->get_space()); @@ -488,13 +488,13 @@ void Viewport::_notification(int p_what) { VisualServer::get_singleton()->multimesh_instance_set_transform(contact_3d_debug_multimesh,i,t); } aabb.grow(aabb.get_longest_axis_size()*0.01); - VisualServer::get_singleton()->multimesh_set_aabb(contact_3d_debug_multimesh,aabb); + VisualServer::get_singleton()->multimesh_set_custom_aabb(contact_3d_debug_multimesh,aabb); } } - if (physics_object_picking && (render_target || Input::get_singleton()->get_mouse_mode()!=Input::MOUSE_MODE_CAPTURED)) { + if (physics_object_picking && (to_screen_rect==Rect2() || Input::get_singleton()->get_mouse_mode()!=Input::MOUSE_MODE_CAPTURED)) { Vector2 last_pos(1e20,1e20); CollisionObject *last_object; @@ -708,15 +708,18 @@ RID Viewport::get_viewport() const { return viewport; } -void Viewport::set_rect(const Rect2& p_rect) { +void Viewport::set_size(const Size2 &p_size) { - if (rect==p_rect) + if (size==p_size.floor()) return; - rect=p_rect; + size=p_size.floor(); + VS::get_singleton()->viewport_set_size(viewport,size.width,size.height); _update_rect(); _update_stretch_transform(); + emit_signal("size_changed"); + } Rect2 Viewport::get_visible_rect() const { @@ -724,12 +727,12 @@ Rect2 Viewport::get_visible_rect() const { Rect2 r; - if (rect.pos==Vector2() && rect.size==Size2()) { + if (size==Size2()) { r=Rect2( Point2(), Size2( OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height ) ); } else { - r=Rect2( rect.pos , rect.size ); + r=Rect2( Point2() , size ); } if (size_override) { @@ -740,9 +743,9 @@ Rect2 Viewport::get_visible_rect() const { return r; } -Rect2 Viewport::get_rect() const { +Size2 Viewport::get_size() const { - return rect; + return size; } @@ -1219,10 +1222,10 @@ bool Viewport::is_size_override_stretch_enabled() const { return size_override_stretch; } - +#if 0 void Viewport::set_as_render_target(bool p_enable){ - if (render_target==p_enable) +/* if (render_target==p_enable) return; render_target=p_enable; @@ -1238,117 +1241,114 @@ void Viewport::set_as_render_target(bool p_enable){ if (p_enable) { - render_target_texture_rid = VS::get_singleton()->viewport_get_render_target_texture(viewport); + texture_rid = VS::get_singleton()->viewport_get_texture(viewport); } else { - render_target_texture_rid=RID(); + texture_rid=RID(); } - render_target_texture->set_flags(render_target_texture->flags); - render_target_texture->emit_changed(); + texture->set_flags(texture->flags); + texture->emit_changed(); update_configuration_warning(); + */ } bool Viewport::is_set_as_render_target() const{ return render_target; + } -void Viewport::set_render_target_update_mode(RenderTargetUpdateMode p_mode){ +#endif +void Viewport::set_update_mode(UpdateMode p_mode){ - render_target_update_mode=p_mode; - VS::get_singleton()->viewport_set_render_target_update_mode(viewport,VS::RenderTargetUpdateMode(p_mode)); + update_mode=p_mode; +// VS::get_singleton()->viewport_set_update_mode(viewport,VS::RenderTargetUpdateMode(p_mode)); } -Viewport::RenderTargetUpdateMode Viewport::get_render_target_update_mode() const{ +Viewport::UpdateMode Viewport::get_update_mode() const{ - return render_target_update_mode; + return update_mode; } -//RID get_render_target_texture() const; +//RID get_texture() const; void Viewport::queue_screen_capture(){ - VS::get_singleton()->viewport_queue_screen_capture(viewport); + //VS::get_singleton()->viewport_queue_screen_capture(viewport); } Image Viewport::get_screen_capture() const { - return VS::get_singleton()->viewport_get_screen_capture(viewport); +// return VS::get_singleton()->viewport_get_screen_capture(viewport); + return Image(); } -Ref Viewport::get_render_target_texture() const { +Ref Viewport::get_texture() const { - return render_target_texture; + return texture; } -void Viewport::set_render_target_vflip(bool p_enable) { +void Viewport::set_vflip(bool p_enable) { - render_target_vflip=p_enable; - VisualServer::get_singleton()->viewport_set_render_target_vflip(viewport,p_enable); + vflip=p_enable; +// VisualServer::get_singleton()->viewport_set_vflip(viewport,p_enable); } -bool Viewport::get_render_target_vflip() const{ +bool Viewport::get_vflip() const{ - return render_target_vflip; + return vflip; } -void Viewport::set_render_target_clear_on_new_frame(bool p_enable) { +void Viewport::set_clear_on_new_frame(bool p_enable) { - render_target_clear_on_new_frame=p_enable; - VisualServer::get_singleton()->viewport_set_render_target_clear_on_new_frame(viewport,p_enable); + clear_on_new_frame=p_enable; + //VisualServer::get_singleton()->viewport_set_clear_on_new_frame(viewport,p_enable); } -bool Viewport::get_render_target_clear_on_new_frame() const{ +bool Viewport::get_clear_on_new_frame() const{ - return render_target_clear_on_new_frame; + return clear_on_new_frame; } -void Viewport::render_target_clear() { +void Viewport::clear() { - //render_target_clear=true; - VisualServer::get_singleton()->viewport_render_target_clear(viewport); + //clear=true; +// VisualServer::get_singleton()->viewport_clear(viewport); } -void Viewport::set_render_target_filter(bool p_enable) { - - if(!render_target) - return; +void Viewport::set_filter(bool p_enable) { - render_target_texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); + texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); } -bool Viewport::get_render_target_filter() const{ +bool Viewport::get_filter() const{ - return (render_target_texture->get_flags()&Texture::FLAG_FILTER)!=0; + return (texture->get_flags()&Texture::FLAG_FILTER)!=0; } -void Viewport::set_render_target_gen_mipmaps(bool p_enable) { +void Viewport::set_gen_mipmaps(bool p_enable) { - //render_target_texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); - render_target_gen_mipmaps=p_enable; + //texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); + gen_mipmaps=p_enable; } -bool Viewport::get_render_target_gen_mipmaps() const{ +bool Viewport::get_gen_mipmaps() const{ - //return (render_target_texture->get_flags()&Texture::FLAG_FILTER)!=0; - return render_target_gen_mipmaps; + //return (texture->get_flags()&Texture::FLAG_FILTER)!=0; + return gen_mipmaps; } Matrix32 Viewport::_get_input_pre_xform() const { Matrix32 pre_xf; - if (render_target) { - if (to_screen_rect!=Rect2()) { - pre_xf.elements[2]=-to_screen_rect.pos; - pre_xf.scale(rect.size/to_screen_rect.size); - } - } else { + if (to_screen_rect!=Rect2()) { - pre_xf.elements[2]=-rect.pos; + pre_xf.elements[2]=-to_screen_rect.pos; + pre_xf.scale(size/to_screen_rect.size); } return pre_xf; @@ -1457,7 +1457,7 @@ void Viewport::_vp_input(const InputEvent& p_ev) { if (parent_control && !parent_control->is_visible()) return; - if (render_target && to_screen_rect==Rect2()) + if (to_screen_rect==Rect2()) return; //if render target, can't get input events //this one handles system input, p_ev are in system coordinates @@ -1483,7 +1483,7 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { if (parent_control && !parent_control->is_visible()) return; - if (render_target && to_screen_rect==Rect2()) + if (to_screen_rect==Rect2()) return; //if render target, can't get input events //this one handles system input, p_ev are in system coordinates @@ -2518,17 +2518,18 @@ bool Viewport::is_using_own_world() const { return own_world.is_valid(); } -void Viewport::set_render_target_to_screen_rect(const Rect2& p_rect) { +void Viewport::set_attach_to_screen_rect(const Rect2& p_rect) { + VS::get_singleton()->viewport_attach_to_screen(viewport,p_rect); to_screen_rect=p_rect; - VisualServer::get_singleton()->viewport_set_render_target_to_screen_rect(viewport,to_screen_rect); } -Rect2 Viewport::get_render_target_to_screen_rect() const{ +Rect2 Viewport::get_attach_to_screen_rect() const{ return to_screen_rect; } + void Viewport::set_physics_object_picking(bool p_enable) { physics_object_picking=p_enable; @@ -2584,19 +2585,28 @@ Control *Viewport::get_modal_stack_top() const { String Viewport::get_configuration_warning() const { - if (get_parent() && !get_parent()->cast_to() && !render_target) { + /*if (get_parent() && !get_parent()->cast_to() && !render_target) { return TTR("This viewport is not set as render target. If you intend for it to display its contents directly to the screen, make it a child of a Control so it can obtain a size. Otherwise, make it a RenderTarget and assign its internal texture to some node for display."); - } + }*/ return String(); } +void Viewport::gui_reset_canvas_sort_index() { + gui.canvas_sort_index=0; +} +int Viewport::gui_get_canvas_sort_index() { + + return gui.canvas_sort_index++; +} + + void Viewport::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_rect","rect"), &Viewport::set_rect); - ObjectTypeDB::bind_method(_MD("get_rect"), &Viewport::get_rect); + ObjectTypeDB::bind_method(_MD("set_size","size"), &Viewport::set_size); + ObjectTypeDB::bind_method(_MD("get_size"), &Viewport::get_size); ObjectTypeDB::bind_method(_MD("set_world_2d","world_2d:World2D"), &Viewport::set_world_2d); ObjectTypeDB::bind_method(_MD("get_world_2d:World2D"), &Viewport::get_world_2d); ObjectTypeDB::bind_method(_MD("find_world_2d:World2D"), &Viewport::find_world_2d); @@ -2630,27 +2640,25 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("queue_screen_capture"), &Viewport::queue_screen_capture); ObjectTypeDB::bind_method(_MD("get_screen_capture"), &Viewport::get_screen_capture); - ObjectTypeDB::bind_method(_MD("set_as_render_target","enable"), &Viewport::set_as_render_target); - ObjectTypeDB::bind_method(_MD("is_set_as_render_target"), &Viewport::is_set_as_render_target); - ObjectTypeDB::bind_method(_MD("set_render_target_vflip","enable"), &Viewport::set_render_target_vflip); - ObjectTypeDB::bind_method(_MD("get_render_target_vflip"), &Viewport::get_render_target_vflip); + ObjectTypeDB::bind_method(_MD("set_vflip","enable"), &Viewport::set_vflip); + ObjectTypeDB::bind_method(_MD("get_vflip"), &Viewport::get_vflip); - ObjectTypeDB::bind_method(_MD("set_render_target_clear_on_new_frame","enable"), &Viewport::set_render_target_clear_on_new_frame); - ObjectTypeDB::bind_method(_MD("get_render_target_clear_on_new_frame"), &Viewport::get_render_target_clear_on_new_frame); + ObjectTypeDB::bind_method(_MD("set_clear_on_new_frame","enable"), &Viewport::set_clear_on_new_frame); + ObjectTypeDB::bind_method(_MD("get_clear_on_new_frame"), &Viewport::get_clear_on_new_frame); - ObjectTypeDB::bind_method(_MD("render_target_clear"), &Viewport::render_target_clear); + ObjectTypeDB::bind_method(_MD("clear"), &Viewport::clear); - ObjectTypeDB::bind_method(_MD("set_render_target_filter","enable"), &Viewport::set_render_target_filter); - ObjectTypeDB::bind_method(_MD("get_render_target_filter"), &Viewport::get_render_target_filter); + ObjectTypeDB::bind_method(_MD("set_filter","enable"), &Viewport::set_filter); + ObjectTypeDB::bind_method(_MD("get_filter"), &Viewport::get_filter); - ObjectTypeDB::bind_method(_MD("set_render_target_gen_mipmaps","enable"), &Viewport::set_render_target_gen_mipmaps); - ObjectTypeDB::bind_method(_MD("get_render_target_gen_mipmaps"), &Viewport::get_render_target_gen_mipmaps); + ObjectTypeDB::bind_method(_MD("set_gen_mipmaps","enable"), &Viewport::set_gen_mipmaps); + ObjectTypeDB::bind_method(_MD("get_gen_mipmaps"), &Viewport::get_gen_mipmaps); - ObjectTypeDB::bind_method(_MD("set_render_target_update_mode","mode"), &Viewport::set_render_target_update_mode); - ObjectTypeDB::bind_method(_MD("get_render_target_update_mode"), &Viewport::get_render_target_update_mode); + ObjectTypeDB::bind_method(_MD("set_update_mode","mode"), &Viewport::set_update_mode); + ObjectTypeDB::bind_method(_MD("get_update_mode"), &Viewport::get_update_mode); - ObjectTypeDB::bind_method(_MD("get_render_target_texture:RenderTargetTexture"), &Viewport::get_render_target_texture); + ObjectTypeDB::bind_method(_MD("get_texture:RenderTargetTexture"), &Viewport::get_texture); ObjectTypeDB::bind_method(_MD("set_physics_object_picking","enable"), &Viewport::set_physics_object_picking); ObjectTypeDB::bind_method(_MD("get_physics_object_picking"), &Viewport::get_physics_object_picking); @@ -2671,7 +2679,7 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_as_audio_listener_2d","enable"), &Viewport::set_as_audio_listener_2d); ObjectTypeDB::bind_method(_MD("is_audio_listener_2d","enable"), &Viewport::is_audio_listener_2d); - ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect","rect"), &Viewport::set_render_target_to_screen_rect); + ObjectTypeDB::bind_method(_MD("set_attach_to_screen_rect","rect"), &Viewport::set_attach_to_screen_rect); ObjectTypeDB::bind_method(_MD("get_mouse_pos"), &Viewport::get_mouse_pos); ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"), &Viewport::warp_mouse); @@ -2685,17 +2693,16 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip); ObjectTypeDB::bind_method(_MD("_gui_remove_focus"), &Viewport::_gui_remove_focus); - ADD_PROPERTY( PropertyInfo(Variant::RECT2,"rect"), _SCS("set_rect"), _SCS("get_rect") ); + ADD_PROPERTY( PropertyInfo(Variant::RECT2,"size"), _SCS("set_size"), _SCS("get_size") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"own_world"), _SCS("set_use_own_world"), _SCS("is_using_own_world") ); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") ); // ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/enabled"), _SCS("set_as_render_target"), _SCS("is_set_as_render_target") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/v_flip"), _SCS("set_render_target_vflip"), _SCS("get_render_target_vflip") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/clear_on_new_frame"), _SCS("set_render_target_clear_on_new_frame"), _SCS("get_render_target_clear_on_new_frame") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/filter"), _SCS("set_render_target_filter"), _SCS("get_render_target_filter") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/gen_mipmaps"), _SCS("set_render_target_gen_mipmaps"), _SCS("get_render_target_gen_mipmaps") ); - ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_render_target_update_mode"), _SCS("get_render_target_update_mode") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/v_flip"), _SCS("set_vflip"), _SCS("get_vflip") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/clear_on_new_frame"), _SCS("set_clear_on_new_frame"), _SCS("get_clear_on_new_frame") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/filter"), _SCS("set_filter"), _SCS("get_filter") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/gen_mipmaps"), _SCS("set_gen_mipmaps"), _SCS("get_gen_mipmaps") ); + ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_update_mode"), _SCS("get_update_mode") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_2d"), _SCS("set_as_audio_listener_2d"), _SCS("is_audio_listener_2d") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_3d"), _SCS("set_as_audio_listener"), _SCS("is_audio_listener") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"physics/object_picking"), _SCS("set_physics_object_picking"), _SCS("get_physics_object_picking") ); @@ -2703,10 +2710,10 @@ void Viewport::_bind_methods() { ADD_SIGNAL(MethodInfo("size_changed")); - BIND_CONSTANT( RENDER_TARGET_UPDATE_DISABLED ); - BIND_CONSTANT( RENDER_TARGET_UPDATE_ONCE ); - BIND_CONSTANT( RENDER_TARGET_UPDATE_WHEN_VISIBLE ); - BIND_CONSTANT( RENDER_TARGET_UPDATE_ALWAYS ); + BIND_CONSTANT( UPDATE_DISABLED ); + BIND_CONSTANT( UPDATE_ONCE ); + BIND_CONSTANT( UPDATE_WHEN_VISIBLE ); + BIND_CONSTANT( UPDATE_ALWAYS ); } @@ -2731,13 +2738,13 @@ Viewport::Viewport() { size_override=false; size_override_stretch=false; size_override_size=Size2(1,1); - render_target_gen_mipmaps=false; - render_target=false; - render_target_vflip=false; - render_target_clear_on_new_frame=true; - //render_target_clear=true; - render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; - render_target_texture = Ref( memnew( RenderTargetTexture(this) ) ); + gen_mipmaps=false; + + vflip=false; + clear_on_new_frame=true; + //clear=true; + update_mode=UPDATE_WHEN_VISIBLE; + texture = Ref( memnew( RenderTargetTexture(this) ) ); physics_object_picking=false; physics_object_capture=0; @@ -2763,6 +2770,7 @@ Viewport::Viewport() { gui.tooltip_label=NULL; gui.drag_preview=NULL; gui.drag_attempted=false; + gui.canvas_sort_index=0; parent_control=NULL; @@ -2776,8 +2784,8 @@ Viewport::~Viewport() { VisualServer::get_singleton()->free( viewport ); SpatialSoundServer::get_singleton()->free(internal_listener); SpatialSound2DServer::get_singleton()->free(internal_listener_2d); - if (render_target_texture.is_valid()) - render_target_texture->vp=NULL; //so if used, will crash + if (texture.is_valid()) + texture->vp=NULL; //so if used, will crash } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index f657f0507d..d610237bec 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -79,11 +79,11 @@ class Viewport : public Node { OBJ_TYPE( Viewport, Node ); public: - enum RenderTargetUpdateMode { - RENDER_TARGET_UPDATE_DISABLED, - RENDER_TARGET_UPDATE_ONCE, //then goes to disabled - RENDER_TARGET_UPDATE_WHEN_VISIBLE, // default - RENDER_TARGET_UPDATE_ALWAYS + enum UpdateMode { + UPDATE_DISABLED, + UPDATE_ONCE, //then goes to disabled + UPDATE_WHEN_VISIBLE, // default + UPDATE_ALWAYS }; private: @@ -114,7 +114,7 @@ friend class RenderTargetTexture; Matrix32 global_canvas_transform; Matrix32 stretch_transform; - Rect2 rect; + Size2 size; Rect2 to_screen_rect; RID contact_2d_debug; @@ -131,10 +131,10 @@ friend class RenderTargetTexture; Rect2 last_vp_rect; bool transparent_bg; - bool render_target_vflip; - bool render_target_clear_on_new_frame; - bool render_target_filter; - bool render_target_gen_mipmaps; + bool vflip; + bool clear_on_new_frame; + bool filter; + bool gen_mipmaps; bool physics_object_picking; List physics_picking_events; @@ -170,10 +170,10 @@ friend class RenderTargetTexture; void _update_stretch_transform(); void _update_global_transform(); - bool render_target; - RenderTargetUpdateMode render_target_update_mode; - RID render_target_texture_rid; - Ref render_target_texture; + + UpdateMode update_mode; + RID texture_rid; + Ref texture; struct GUI { @@ -202,6 +202,7 @@ friend class RenderTargetTexture; List subwindows; bool roots_order_dirty; List roots; + int canvas_sort_index; //for sorting items with canvas as root GUI(); @@ -299,8 +300,10 @@ public: void set_as_audio_listener_2d(bool p_enable); bool is_audio_listener_2d() const; - void set_rect(const Rect2& p_rect); - Rect2 get_rect() const; + void set_size(const Size2& p_size); + + + Size2 get_size() const; Rect2 get_visible_rect() const; RID get_viewport() const; @@ -327,29 +330,27 @@ public: void set_size_override(bool p_enable,const Size2& p_size=Size2(-1,-1),const Vector2& p_margin=Vector2()); Size2 get_size_override() const; + bool is_size_override_enabled() const; void set_size_override_stretch(bool p_enable); bool is_size_override_stretch_enabled() const; - void set_as_render_target(bool p_enable); - bool is_set_as_render_target() const; + void set_vflip(bool p_enable); + bool get_vflip() const; - void set_render_target_vflip(bool p_enable); - bool get_render_target_vflip() const; + void set_clear_on_new_frame(bool p_enable); + bool get_clear_on_new_frame() const; + void clear(); - void set_render_target_clear_on_new_frame(bool p_enable); - bool get_render_target_clear_on_new_frame() const; - void render_target_clear(); + void set_filter(bool p_enable); + bool get_filter() const; - void set_render_target_filter(bool p_enable); - bool get_render_target_filter() const; + void set_gen_mipmaps(bool p_enable); + bool get_gen_mipmaps() const; - void set_render_target_gen_mipmaps(bool p_enable); - bool get_render_target_gen_mipmaps() const; - - void set_render_target_update_mode(RenderTargetUpdateMode p_mode); - RenderTargetUpdateMode get_render_target_update_mode() const; - Ref get_render_target_texture() const; + void set_update_mode(UpdateMode p_mode); + UpdateMode get_update_mode() const; + Ref get_texture() const; Vector2 get_camera_coords(const Vector2& p_viewport_coords) const; @@ -367,8 +368,8 @@ public: void set_disable_input(bool p_disable); bool is_input_disabled() const; - void set_render_target_to_screen_rect(const Rect2& p_rect); - Rect2 get_render_target_to_screen_rect() const; + void set_attach_to_screen_rect(const Rect2& p_rect); + Rect2 get_attach_to_screen_rect() const; Vector2 get_mouse_pos() const; void warp_mouse(const Vector2& p_pos); @@ -381,12 +382,17 @@ public: Variant gui_get_drag_data() const; Control *get_modal_stack_top() const; + void gui_reset_canvas_sort_index(); + int gui_get_canvas_sort_index(); + virtual String get_configuration_warning() const; + + Viewport(); ~Viewport(); }; -VARIANT_ENUM_CAST(Viewport::RenderTargetUpdateMode); +VARIANT_ENUM_CAST(Viewport::UpdateMode); #endif diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 104aeb2b5e..dcb2edf872 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -235,7 +235,6 @@ static ResourceFormatLoaderWAV *resource_loader_wav=NULL; #endif static ResourceFormatLoaderTheme *resource_loader_theme=NULL; -static ResourceFormatLoaderShader *resource_loader_shader=NULL; static ResourceFormatSaverText *resource_saver_text=NULL; static ResourceFormatLoaderText *resource_loader_text=NULL; @@ -269,8 +268,6 @@ void register_scene_types() { resource_loader_theme = memnew( ResourceFormatLoaderTheme ); ResourceLoader::add_resource_format_loader( resource_loader_theme ); - resource_loader_shader = memnew( ResourceFormatLoaderShader ); - ResourceLoader::add_resource_format_loader( resource_loader_shader ); bool default_theme_hidpi=GLOBAL_DEF("display/use_hidpi_theme",false); Globals::get_singleton()->set_custom_property_info("display/use_hidpi_theme",PropertyInfo(Variant::BOOL,"display/use_hidpi_theme",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED)); @@ -424,7 +421,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); + //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -453,8 +450,8 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); + //ObjectTypeDB::register_type(); + //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -489,7 +486,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -538,17 +535,17 @@ void register_scene_types() { /* REGISTER RESOURCES */ ObjectTypeDB::register_virtual_type(); - ObjectTypeDB::register_virtual_type(); +// ObjectTypeDB::register_virtual_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); #ifndef _3D_DISABLED ObjectTypeDB::register_type(); ObjectTypeDB::register_virtual_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::add_compatibility_type("Shader","MaterialShader"); ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedMaterial"); @@ -568,7 +565,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); + //ObjectTypeDB::register_type(); OS::get_singleton()->yield(); //may take time to init @@ -590,8 +587,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::add_compatibility_type("Font","BitmapFont"); @@ -664,7 +660,6 @@ void unregister_scene_types() { memdelete( resource_loader_theme ); - memdelete( resource_loader_shader ); if (resource_saver_text) { memdelete(resource_saver_text); diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp index e4510be874..38ed661cdd 100644 --- a/scene/resources/baked_light.cpp +++ b/scene/resources/baked_light.cpp @@ -29,6 +29,8 @@ #include "baked_light.h" #include "servers/visual_server.h" +#if 0 + void BakedLight::set_mode(Mode p_mode) { mode=p_mode; @@ -582,7 +584,7 @@ BakedLight::BakedLight() { tint=0.0; ao_radius=2.5; ao_strength=0.7; - format=FORMAT_RGB; + format=FORMAT_RGB8; transfer_only_uv2=false; @@ -600,3 +602,4 @@ BakedLight::~BakedLight() { VS::get_singleton()->free(baked_light); } +#endif diff --git a/scene/resources/baked_light.h b/scene/resources/baked_light.h index 16806d29e3..0eaa3df276 100644 --- a/scene/resources/baked_light.h +++ b/scene/resources/baked_light.h @@ -32,6 +32,7 @@ #include "resource.h" #include "scene/resources/texture.h" +#if 0 class BakedLight : public Resource { OBJ_TYPE( BakedLight, Resource); @@ -44,7 +45,7 @@ public: enum Format { - FORMAT_RGB, + FORMAT_RGB8, FORMAT_HDR8, FORMAT_HDR16 }; @@ -195,5 +196,5 @@ public: VARIANT_ENUM_CAST(BakedLight::Format); VARIANT_ENUM_CAST(BakedLight::Mode); VARIANT_ENUM_CAST(BakedLight::BakeFlags); - +#endif #endif // BAKED_LIGHT_H diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index f5bfce3ef8..57dc39138a 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -45,8 +45,8 @@ void BitMap::create_from_image_alpha(const Image& p_image){ ERR_FAIL_COND(p_image.empty()); Image img=p_image; - img.convert(Image::FORMAT_INTENSITY); - ERR_FAIL_COND(img.get_format()!=Image::FORMAT_INTENSITY); + img.convert(Image::FORMAT_LA8); + ERR_FAIL_COND(img.get_format()!=Image::FORMAT_LA8); create(Size2(img.get_width(),img.get_height())); @@ -58,7 +58,7 @@ void BitMap::create_from_image_alpha(const Image& p_image){ int bbyte = i/8; int bbit = i % 8; - if (r[i]) + if (r[i*2]) w[bbyte]|=(1< make_stylebox(T p_src,float p_left, float p_top, flo if (scale>1) { Size2 orig_size = Size2(img.get_width(),img.get_height()); - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); img.expand_x2_hq2x(); if (scale!=2.0) { img.resize(orig_size.x*scale,orig_size.y*scale); } } else if (scale<1) { Size2 orig_size = Size2(img.get_width(),img.get_height()); - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); img.resize(orig_size.x*scale,orig_size.y*scale); } @@ -108,14 +108,14 @@ static Ref make_icon(T p_src) { if (scale>1) { Size2 orig_size = Size2(img.get_width(),img.get_height()); - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); img.expand_x2_hq2x(); if (scale!=2.0) { img.resize(orig_size.x*scale,orig_size.y*scale); } } else if (scale<1) { Size2 orig_size = Size2(img.get_width(),img.get_height()); - img.convert(Image::FORMAT_RGBA); + img.convert(Image::FORMAT_RGBA8); img.resize(orig_size.x*scale,orig_size.y*scale); } texture->create_from_image( img,ImageTexture::FLAG_FILTER ); @@ -125,7 +125,7 @@ static Ref make_icon(T p_src) { static Ref make_shader(const char*vertex_code,const char*fragment_code,const char*lighting_code) { Ref shader = (memnew( Shader(Shader::MODE_CANVAS_ITEM) )); - shader->set_code(vertex_code, fragment_code, lighting_code); +// shader->set_code(vertex_code, fragment_code, lighting_code); return shader; } @@ -214,6 +214,8 @@ static Ref make_empty_stylebox(float p_margin_left=-1, float p_margin_ return style; } + + void fill_default_theme(Ref& t, const Ref & default_font, const Ref & large_font, Ref& default_icon, Ref& default_style, float p_scale) { scale=p_scale; @@ -832,10 +834,15 @@ void fill_default_theme(Ref& t, const Ref & default_font, const Ref t->set_icon("screen_picker","ColorPicker", make_icon( icon_color_pick_png ) ); t->set_icon("add_preset","ColorPicker", make_icon( icon_add_png ) ); + t->set_icon("color_area", "ColorPicker", make_icon( color_picker_main_png)); + t->set_icon("color_hue", "ColorPicker", make_icon( color_picker_hue_png)); + t->set_icon("color_sample", "ColorPicker", make_icon( color_picker_sample_png)); t->set_shader("uv_editor", "ColorPicker", make_shader("", uv_editor_shader_code, "")); t->set_shader("w_editor", "ColorPicker", make_shader("", w_editor_shader_code, "")); + + // TooltipPanel Ref style_tt = make_stylebox( tooltip_bg_png,4,4,4,4); @@ -962,7 +969,6 @@ void fill_default_theme(Ref& t, const Ref & default_font, const Ref t->set_icon( "logo","Icons", make_icon(logo_png) ); - // Theme default_icon= make_icon(error_icon_png) ; diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index 73c801483f..913ea9b5e9 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -69,6 +69,21 @@ static const unsigned char close_hl_png[]={ }; +static const unsigned char color_picker_hue_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x1,0x0,0x8,0x2,0x0,0x0,0x0,0x35,0x30,0x61,0x19,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x9,0x18,0xc,0x24,0x18,0xa9,0xb3,0x2c,0xb7,0x0,0x0,0x0,0x23,0x49,0x44,0x41,0x54,0x68,0xde,0xed,0xc1,0x31,0x1,0x0,0x0,0x0,0xc2,0xa0,0xf5,0x4f,0x6d,0xd,0xf,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xbe,0xd,0x31,0x0,0x0,0x1,0x35,0x84,0x14,0xe2,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + +static const unsigned char color_picker_main_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x0,0x8,0x2,0x0,0x0,0x0,0xd3,0x10,0x3f,0x31,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x9,0x18,0xc,0x23,0x22,0x20,0xfe,0x63,0xc2,0x0,0x0,0x0,0xd5,0x49,0x44,0x41,0x54,0x78,0xda,0xed,0xc1,0x31,0x1,0x0,0x0,0x0,0xc2,0xa0,0xf5,0x4f,0xed,0x65,0xb,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x1b,0x1,0x2d,0x0,0x1,0x9e,0xcb,0xc2,0xed,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + +static const unsigned char color_picker_sample_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x14,0x8,0x2,0x0,0x0,0x0,0xed,0x20,0x74,0x8,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x9,0x18,0xc,0x27,0x37,0x29,0x4f,0x42,0x2d,0x0,0x0,0x0,0x61,0x49,0x44,0x41,0x54,0x68,0xde,0xed,0xd9,0xb1,0xd,0x0,0x21,0xc,0x3,0x40,0x40,0xbf,0x5f,0x66,0xcd,0x84,0xf9,0x96,0x19,0xf0,0x5d,0x87,0x5c,0x5b,0x9,0xca,0x9e,0x99,0x75,0xe9,0xee,0xfb,0x59,0x55,0x52,0xe9,0xc3,0xe9,0x59,0x10,0x4c,0x1,0x50,0x0,0x50,0x0,0x8,0xf4,0xf9,0x15,0x49,0x93,0x53,0x13,0x0,0x2b,0x10,0x28,0x0,0x28,0x0,0x64,0xd9,0x2e,0xc1,0xd2,0xe4,0xd4,0x4,0xc0,0xa,0x4,0xa,0x0,0xa,0x0,0x59,0x5c,0x82,0xa5,0xd1,0xa9,0x9,0x80,0x15,0x8,0x14,0x0,0x14,0x0,0xb2,0xfc,0x5b,0xb2,0x3c,0x5a,0x4,0xa1,0xf3,0x57,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + static const unsigned char dosfont_png[]={ 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x80,0x1,0x0,0x0,0x0,0x0,0xeb,0x45,0x5c,0x66,0x0,0x0,0x0,0x4,0x67,0x41,0x4d,0x41,0x0,0x0,0xb1,0x8f,0xb,0xfc,0x61,0x5,0x0,0x0,0x0,0x20,0x63,0x48,0x52,0x4d,0x0,0x0,0x7a,0x26,0x0,0x0,0x80,0x84,0x0,0x0,0xfa,0x0,0x0,0x0,0x80,0xe8,0x0,0x0,0x75,0x30,0x0,0x0,0xea,0x60,0x0,0x0,0x3a,0x98,0x0,0x0,0x17,0x70,0x9c,0xba,0x51,0x3c,0x0,0x0,0x0,0x2,0x74,0x52,0x4e,0x53,0x0,0x0,0x76,0x93,0xcd,0x38,0x0,0x0,0x0,0x2,0x62,0x4b,0x47,0x44,0x0,0x1,0xdd,0x8a,0x13,0xa4,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x89,0x0,0x0,0xb,0x89,0x1,0x37,0xc9,0xcb,0xad,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xe0,0x6,0x16,0x12,0x2b,0x5,0x39,0x1a,0x32,0x39,0x0,0x0,0x2,0x83,0x49,0x44,0x41,0x54,0x48,0xc7,0xed,0xd4,0xb1,0x6e,0xdb,0x30,0x10,0x0,0x50,0x22,0x3,0x27,0x22,0xc8,0x78,0x83,0x91,0xa9,0x1f,0xc0,0xa9,0x10,0xa,0x7e,0xc,0x11,0x14,0x87,0xc,0x1c,0x32,0x9,0x1a,0xe,0x46,0xa6,0xfc,0x43,0xff,0x86,0xb5,0x80,0x9b,0x88,0x8e,0x5d,0x64,0x18,0x9e,0xdc,0xd5,0x53,0x91,0xc1,0xa0,0x7a,0xa4,0xe4,0xd4,0x31,0xd2,0x25,0x70,0x97,0xa2,0x37,0x48,0xe6,0x33,0x45,0xdd,0x51,0x24,0x95,0x7a,0x23,0xe0,0x75,0x13,0xb,0xd8,0x93,0xbf,0x51,0x51,0xa3,0xac,0x99,0xc9,0x29,0x87,0x81,0x83,0xb2,0x0,0xc7,0xfe,0xee,0x43,0x58,0x85,0x95,0xb7,0xa6,0xb6,0xaf,0x7a,0xe9,0x93,0x63,0xc3,0xf2,0xc,0x96,0x3e,0xba,0x97,0x11,0x3,0xb5,0x46,0xc0,0x15,0x30,0x43,0x1,0xbd,0x6,0x81,0x71,0xa9,0xb2,0x82,0x9,0x92,0x3d,0xf6,0xb0,0xbd,0x5c,0xf2,0x53,0xf2,0x75,0xc,0x11,0x5f,0xc7,0xe0,0xc4,0xaa,0xb4,0x40,0x41,0xc4,0x69,0xd0,0x27,0x55,0x12,0x13,0x78,0x74,0xa7,0xb5,0xd8,0x3f,0x14,0x77,0x81,0x0,0x22,0x93,0x9b,0x4c,0x54,0x5b,0x72,0x6d,0x98,0x17,0xd1,0x33,0xb3,0x94,0xaa,0x3c,0x93,0xea,0xb4,0x76,0x31,0x6a,0x66,0x0,0xa9,0x59,0x1c,0x8c,0xe,0x33,0xc0,0x12,0x4c,0x29,0xc2,0xa5,0xc3,0xc1,0xd0,0xb2,0x64,0x6a,0x60,0xa3,0xc0,0xea,0xac,0x19,0x58,0x4b,0xa9,0x4a,0x17,0xf0,0xda,0x68,0xb6,0x5,0xec,0xb2,0xf6,0x88,0x33,0xc8,0x18,0x52,0xd5,0x5a,0x1,0xb3,0x61,0x1,0x53,0xdf,0x2,0x51,0x2d,0x33,0xdd,0x12,0x59,0xea,0x94,0x95,0x3c,0x80,0x2e,0x5e,0xf9,0xdb,0x71,0x73,0x70,0xcf,0x39,0x3b,0x76,0xb7,0xbb,0x7d,0xcf,0x74,0x50,0xd,0x62,0x40,0x44,0x6,0x83,0xfe,0xc7,0x8e,0x51,0x5,0x5c,0xe1,0xdd,0xdd,0xaa,0xc2,0xf8,0x53,0x80,0x31,0xe2,0xfd,0x7d,0x14,0x8,0x7e,0xcc,0x5,0x28,0x62,0xd7,0xc5,0xc,0xa6,0xf3,0xc3,0x46,0xa6,0x30,0xd7,0x1e,0x1b,0x2e,0xd0,0x7f,0x63,0x5f,0x1f,0xf1,0x32,0xc9,0x90,0x82,0xef,0xb9,0x82,0xc,0x5a,0x1,0xef,0x66,0x90,0xd7,0x7a,0x2c,0x80,0x13,0x94,0xc4,0xf6,0x9f,0xd8,0x75,0xbb,0x2c,0x89,0xed,0xff,0x42,0xe9,0xa7,0xfb,0xa4,0x84,0xec,0x13,0x45,0x7,0x1a,0xb9,0x97,0x18,0x65,0xab,0x4,0xf9,0x54,0x8c,0x3c,0x54,0xe8,0xed,0xa3,0x7c,0x7b,0x55,0xe0,0x8b,0x0,0xf6,0x4f,0x36,0xd6,0x3d,0xc3,0xe8,0x41,0xc0,0xa1,0xb1,0xdb,0x9,0xa8,0x29,0x0,0xe,0xec,0xc3,0x4,0xc1,0x8,0xc,0x0,0xd6,0x36,0xf3,0x23,0xba,0x80,0x3,0x6f,0x17,0x15,0xbe,0x4b,0xe5,0x8c,0x23,0xc2,0x57,0x7b,0x5d,0x61,0x53,0xc0,0x61,0xf,0xbd,0xd5,0x15,0x68,0x47,0x8e,0x0,0x7b,0x37,0xba,0xab,0xba,0x59,0xcc,0x79,0x3d,0xd7,0xaf,0x5a,0xe3,0x85,0x66,0x69,0xab,0x16,0x32,0x31,0x5b,0xd0,0xdb,0x66,0x2,0x2f,0x6f,0xe,0xb2,0x42,0xb5,0x87,0xdf,0xf0,0x59,0xae,0x6a,0x86,0xae,0x93,0x4c,0x7d,0x1b,0x9a,0x6b,0x84,0xdd,0x9a,0xd6,0xca,0xc8,0x89,0xc3,0xfb,0xd4,0x82,0xe,0x30,0xa2,0x2c,0x18,0xc2,0x98,0xb2,0x4f,0x8,0xba,0x83,0xa1,0x40,0x12,0x88,0x6f,0x43,0x38,0x82,0x1c,0x1f,0x15,0x70,0x82,0x96,0xa8,0xa5,0x3d,0xed,0x9c,0xde,0xb9,0x1,0xe9,0xb8,0x5f,0x4c,0x39,0xd2,0xa6,0xac,0xa6,0x48,0xe7,0xd0,0x95,0x53,0xb0,0xc4,0x7b,0x97,0xd4,0xcd,0x3c,0xdd,0xf0,0xd0,0x4e,0xbf,0xe6,0x65,0x24,0x5b,0x7b,0x7d,0xe,0xe5,0xd6,0xae,0xe9,0x90,0x64,0xfd,0x70,0x9e,0x21,0xb5,0x6c,0x5,0xa4,0xa2,0x87,0xe9,0xa3,0x25,0xf4,0x5,0x5c,0x39,0x61,0xa6,0x1e,0xbe,0x11,0x18,0x80,0xed,0xb,0x18,0x9b,0x70,0x70,0xec,0x5f,0x80,0x3f,0x26,0x27,0xb3,0xc9,0x33,0xc8,0x5c,0x2c,0x5a,0x59,0x1f,0xcb,0x2c,0x89,0x9d,0xae,0xf,0x7d,0xcc,0xdb,0x9c,0xdd,0xd5,0xed,0x7c,0x7f,0xbe,0xd0,0x52,0xf9,0x1f,0xff,0x76,0xfc,0x2,0x24,0x3a,0x65,0x42,0xf6,0x41,0x91,0x95,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x0,0x25,0x74,0x45,0x58,0x74,0x64,0x61,0x74,0x65,0x3a,0x63,0x72,0x65,0x61,0x74,0x65,0x0,0x32,0x30,0x31,0x36,0x2d,0x30,0x36,0x2d,0x32,0x32,0x54,0x32,0x30,0x3a,0x33,0x39,0x3a,0x32,0x36,0x2b,0x30,0x32,0x3a,0x30,0x30,0xc9,0xad,0xc8,0x52,0x0,0x0,0x0,0x25,0x74,0x45,0x58,0x74,0x64,0x61,0x74,0x65,0x3a,0x6d,0x6f,0x64,0x69,0x66,0x79,0x0,0x32,0x30,0x31,0x36,0x2d,0x30,0x36,0x2d,0x32,0x32,0x54,0x32,0x30,0x3a,0x33,0x39,0x3a,0x32,0x36,0x2b,0x30,0x32,0x3a,0x30,0x30,0xb8,0xf0,0x70,0xee,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 }; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 679c8a000c..83518e1f3e 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -573,7 +573,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { //blit to image and texture { - Image img(tex.texture_size,tex.texture_size,0,Image::FORMAT_GRAYSCALE_ALPHA,tex.imgdata); + Image img(tex.texture_size,tex.texture_size,0,Image::FORMAT_LA8,tex.imgdata); if (tex.texture.is_null()) { tex.texture.instance(); diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 456e6a5ee7..d1efc0f705 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -321,7 +321,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { //blit to image and texture { - Image img(tex.texture_size,tex.texture_size,0,Image::FORMAT_GRAYSCALE_ALPHA,tex.imgdata); + Image img(tex.texture_size,tex.texture_size,0,Image::FORMAT_LA8,tex.imgdata); if (tex.texture.is_null()) { tex.texture.instance(); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 4551aff0ef..6fecdef59d 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -28,59 +28,7 @@ /*************************************************************************/ #include "environment.h" #include "texture.h" -void Environment::set_background(BG p_bg) { - ERR_FAIL_INDEX(p_bg,BG_MAX); - bg_mode=p_bg; - VS::get_singleton()->environment_set_background(environment,VS::EnvironmentBG(p_bg)); -} - -Environment::BG Environment::get_background() const{ - - return bg_mode; -} - -void Environment::set_background_param(BGParam p_param, const Variant& p_value){ - - ERR_FAIL_INDEX(p_param,BG_PARAM_MAX); - bg_param[p_param]=p_value; - VS::get_singleton()->environment_set_background_param(environment,VS::EnvironmentBGParam(p_param),p_value); - -} -Variant Environment::get_background_param(BGParam p_param) const{ - - ERR_FAIL_INDEX_V(p_param,BG_PARAM_MAX,Variant()); - return bg_param[p_param]; - -} - -void Environment::set_enable_fx(Fx p_effect,bool p_enabled){ - - ERR_FAIL_INDEX(p_effect,FX_MAX); - fx_enabled[p_effect]=p_enabled; - VS::get_singleton()->environment_set_enable_fx(environment,VS::EnvironmentFx(p_effect),p_enabled); - -} -bool Environment::is_fx_enabled(Fx p_effect) const{ - - ERR_FAIL_INDEX_V(p_effect,FX_MAX,false); - return fx_enabled[p_effect]; - -} - -void Environment::fx_set_param(FxParam p_param,const Variant& p_value){ - - ERR_FAIL_INDEX(p_param,FX_PARAM_MAX); - fx_param[p_param]=p_value; - VS::get_singleton()->environment_fx_set_param(environment,VS::EnvironmentFxParam(p_param),p_value); - -} -Variant Environment::fx_get_param(FxParam p_param) const{ - - ERR_FAIL_INDEX_V(p_param,FX_PARAM_MAX,Variant()); - return fx_param[p_param]; - -} RID Environment::get_rid() const { @@ -89,160 +37,6 @@ RID Environment::get_rid() const { void Environment::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_background","bgmode"),&Environment::set_background); - ObjectTypeDB::bind_method(_MD("get_background"),&Environment::get_background); - - ObjectTypeDB::bind_method(_MD("set_background_param","param","value"),&Environment::set_background_param); - ObjectTypeDB::bind_method(_MD("get_background_param","param"),&Environment::get_background_param); - - ObjectTypeDB::bind_method(_MD("set_enable_fx","effect","enabled"),&Environment::set_enable_fx); - ObjectTypeDB::bind_method(_MD("is_fx_enabled","effect"),&Environment::is_fx_enabled); - - ObjectTypeDB::bind_method(_MD("fx_set_param","param","value"),&Environment::fx_set_param); - ObjectTypeDB::bind_method(_MD("fx_get_param","param"),&Environment::fx_get_param); - - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"ambient_light/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_AMBIENT_LIGHT); - ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"ambient_light/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_AMBIENT_LIGHT_COLOR); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,64,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_AMBIENT_LIGHT_ENERGY); - - - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fxaa/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_FXAA); - - ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Canvas"),_SCS("set_background"),_SCS("get_background")); - ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_COLOR); - ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_TEXTURE); - ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/cubemap",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CUBEMAP); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,128,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_ENERGY); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/scale",PROPERTY_HINT_RANGE,"0.001,16,0.001"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_SCALE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/glow",PROPERTY_HINT_RANGE,"0.00,8,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_GLOW); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"background/canvas_max_layer"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CANVAS_MAX_LAYER); - - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_GLOW); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"glow/blur_passes",PROPERTY_HINT_RANGE,"1,4,1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_PASSES); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"glow/blur_scale",PROPERTY_HINT_RANGE,"0.01,4,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_SCALE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"glow/blur_strength",PROPERTY_HINT_RANGE,"0.01,4,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_STRENGTH); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"glow/blur_blend_mode",PROPERTY_HINT_ENUM,"Additive,Screen,SoftLight"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_BLEND_MODE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"glow/bloom",PROPERTY_HINT_RANGE,"0,8,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLOOM); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"glow/bloom_treshold",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLOOM_TRESHOLD); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"dof_blur/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_DOF_BLUR); - ADD_PROPERTYI( PropertyInfo(Variant::INT,"dof_blur/blur_passes",PROPERTY_HINT_RANGE,"1,4,1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_DOF_BLUR_PASSES); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"dof_blur/begin",PROPERTY_HINT_RANGE,"0,4096,0.1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_DOF_BLUR_BEGIN); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"dof_blur/range",PROPERTY_HINT_RANGE,"0,4096,0.1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_DOF_BLUR_RANGE); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"hdr/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_HDR); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/tonemapper",PROPERTY_HINT_ENUM,"Linear,Log,Reinhardt,ReinhardtAutoWhite"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_TONEMAPPER); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/exposure",PROPERTY_HINT_RANGE,"0.01,16,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_EXPOSURE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/white",PROPERTY_HINT_RANGE,"0.01,16,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_WHITE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/glow_treshold",PROPERTY_HINT_RANGE,"0.00,8,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_GLOW_TRESHOLD); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/glow_scale",PROPERTY_HINT_RANGE,"0.00,16,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_GLOW_SCALE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/min_luminance",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_MIN_LUMINANCE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/max_luminance",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_MAX_LUMINANCE); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"hdr/exposure_adj_speed",PROPERTY_HINT_RANGE,"0.001,64,0.001"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fog/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_FOG); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"fog/begin",PROPERTY_HINT_RANGE,"0.01,4096,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_FOG_BEGIN); - ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"fog/begin_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_FOG_BEGIN_COLOR); - ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"fog/end_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_FOG_END_COLOR); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"fog/attenuation",PROPERTY_HINT_EXP_EASING),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_FOG_ATTENUATION); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fog/bg"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_FOG_BG); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"bcs/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_BCS); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"bcs/brightness",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_BCS_BRIGHTNESS); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"bcs/contrast",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_BCS_CONTRAST); - ADD_PROPERTYI( PropertyInfo(Variant::REAL,"bcs/saturation",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_BCS_SATURATION); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"srgb/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_SRGB); - - - - - -/* - FX_PARAM_BLOOM_GLOW_BLUR_PASSES=VS::ENV_FX_PARAM_BLOOM_GLOW_BLUR_PASSES, - FX_PARAM_BLOOM_AMOUNT=VS::ENV_FX_PARAM_BLOOM_AMOUNT, - FX_PARAM_DOF_BLUR_PASSES=VS::ENV_FX_PARAM_DOF_BLUR_PASSES, - FX_PARAM_DOF_BLUR_BEGIN=VS::ENV_FX_PARAM_DOF_BLUR_BEGIN, - FX_PARAM_DOF_BLUR_END=VS::ENV_FX_PARAM_DOF_BLUR_END, - FX_PARAM_HDR_EXPOSURE=VS::ENV_FX_PARAM_HDR_EXPOSURE, - FX_PARAM_HDR_WHITE=VS::ENV_FX_PARAM_HDR_WHITE, - FX_PARAM_HDR_GLOW_TRESHOLD=VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD, - FX_PARAM_HDR_GLOW_SCALE=VS::ENV_FX_PARAM_HDR_GLOW_SCALE, - FX_PARAM_HDR_MIN_LUMINANCE=VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE, - FX_PARAM_HDR_MAX_LUMINANCE=VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE, - FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED=VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED, - FX_PARAM_FOG_BEGIN=VS::ENV_FX_PARAM_FOG_BEGIN, - FX_PARAM_FOG_ATTENUATION=VS::ENV_FX_PARAM_FOG_ATTENUATION, - FX_PARAM_FOG_BEGIN_COLOR=VS::ENV_FX_PARAM_FOG_BEGIN_COLOR, - FX_PARAM_FOG_END_COLOR=VS::ENV_FX_PARAM_FOG_END_COLOR, - FX_PARAM_FOG_BG=VS::ENV_FX_PARAM_FOG_BG, - FX_PARAM_GAMMA_VALUE=VS::ENV_FX_PARAM_GAMMA_VALUE, - FX_PARAM_BRIGHTNESS_VALUE=VS::ENV_FX_PARAM_BRIGHTNESS_VALUE, - FX_PARAM_CONTRAST_VALUE=VS::ENV_FX_PARAM_CONTRAST_VALUE, - FX_PARAM_SATURATION_VALUE=VS::ENV_FX_PARAM_SATURATION_VALUE, - FX_PARAM_MAX=VS::ENV_FX_PARAM_MAX -*/ - - BIND_CONSTANT( BG_KEEP ); - BIND_CONSTANT( BG_DEFAULT_COLOR ); - BIND_CONSTANT( BG_COLOR ); - BIND_CONSTANT( BG_TEXTURE ); - BIND_CONSTANT( BG_CUBEMAP ); - BIND_CONSTANT( BG_CANVAS ); - BIND_CONSTANT( BG_MAX ); - - BIND_CONSTANT( BG_PARAM_CANVAS_MAX_LAYER ); - BIND_CONSTANT( BG_PARAM_COLOR ); - BIND_CONSTANT( BG_PARAM_TEXTURE ); - BIND_CONSTANT( BG_PARAM_CUBEMAP ); - BIND_CONSTANT( BG_PARAM_ENERGY ); - BIND_CONSTANT( BG_PARAM_GLOW ); - BIND_CONSTANT( BG_PARAM_MAX ); - - - BIND_CONSTANT( FX_AMBIENT_LIGHT ); - BIND_CONSTANT( FX_FXAA ); - BIND_CONSTANT( FX_GLOW ); - BIND_CONSTANT( FX_DOF_BLUR ); - BIND_CONSTANT( FX_HDR ); - BIND_CONSTANT( FX_FOG ); - BIND_CONSTANT( FX_BCS); - BIND_CONSTANT( FX_SRGB ); - BIND_CONSTANT( FX_MAX ); - - - BIND_CONSTANT( FX_BLUR_BLEND_MODE_ADDITIVE ); - BIND_CONSTANT( FX_BLUR_BLEND_MODE_SCREEN ); - BIND_CONSTANT( FX_BLUR_BLEND_MODE_SOFTLIGHT ); - - BIND_CONSTANT( FX_HDR_TONE_MAPPER_LINEAR ); - BIND_CONSTANT( FX_HDR_TONE_MAPPER_LOG ); - BIND_CONSTANT( FX_HDR_TONE_MAPPER_REINHARDT ); - BIND_CONSTANT( FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE ); - - BIND_CONSTANT( FX_PARAM_AMBIENT_LIGHT_COLOR ); - BIND_CONSTANT( FX_PARAM_AMBIENT_LIGHT_ENERGY ); - BIND_CONSTANT( FX_PARAM_GLOW_BLUR_PASSES ); - BIND_CONSTANT( FX_PARAM_GLOW_BLUR_SCALE ); - BIND_CONSTANT( FX_PARAM_GLOW_BLUR_STRENGTH ); - BIND_CONSTANT( FX_PARAM_GLOW_BLUR_BLEND_MODE ); - BIND_CONSTANT( FX_PARAM_GLOW_BLOOM); - BIND_CONSTANT( FX_PARAM_GLOW_BLOOM_TRESHOLD); - BIND_CONSTANT( FX_PARAM_DOF_BLUR_PASSES ); - BIND_CONSTANT( FX_PARAM_DOF_BLUR_BEGIN ); - BIND_CONSTANT( FX_PARAM_DOF_BLUR_RANGE ); - BIND_CONSTANT( FX_PARAM_HDR_TONEMAPPER); - BIND_CONSTANT( FX_PARAM_HDR_EXPOSURE ); - BIND_CONSTANT( FX_PARAM_HDR_WHITE ); - BIND_CONSTANT( FX_PARAM_HDR_GLOW_TRESHOLD ); - BIND_CONSTANT( FX_PARAM_HDR_GLOW_SCALE ); - BIND_CONSTANT( FX_PARAM_HDR_MIN_LUMINANCE ); - BIND_CONSTANT( FX_PARAM_HDR_MAX_LUMINANCE ); - BIND_CONSTANT( FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED ); - BIND_CONSTANT( FX_PARAM_FOG_BEGIN ); - BIND_CONSTANT( FX_PARAM_FOG_ATTENUATION ); - BIND_CONSTANT( FX_PARAM_FOG_BEGIN_COLOR ); - BIND_CONSTANT( FX_PARAM_FOG_END_COLOR ); - BIND_CONSTANT( FX_PARAM_FOG_BG ); - BIND_CONSTANT( FX_PARAM_BCS_BRIGHTNESS ); - BIND_CONSTANT( FX_PARAM_BCS_CONTRAST ); - BIND_CONSTANT( FX_PARAM_BCS_SATURATION ); - BIND_CONSTANT( FX_PARAM_MAX ); } @@ -250,45 +44,8 @@ Environment::Environment() { environment = VS::get_singleton()->environment_create(); - set_background(BG_DEFAULT_COLOR); - set_background_param(BG_PARAM_COLOR,Color(0,0,0)); - set_background_param(BG_PARAM_TEXTURE,Ref()); - set_background_param(BG_PARAM_CUBEMAP,Ref()); - set_background_param(BG_PARAM_ENERGY,1.0); - set_background_param(BG_PARAM_SCALE,1.0); - set_background_param(BG_PARAM_GLOW,0.0); - - for(int i=0;ifree(environment); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index a72cc6a47f..f8ea0cb36f 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -37,107 +37,16 @@ class Environment : public Resource { OBJ_TYPE(Environment,Resource); public: - enum BG { - BG_KEEP=VS::ENV_BG_KEEP, - BG_DEFAULT_COLOR=VS::ENV_BG_DEFAULT_COLOR, - BG_COLOR=VS::ENV_BG_COLOR, - BG_TEXTURE=VS::ENV_BG_TEXTURE, - BG_CUBEMAP=VS::ENV_BG_CUBEMAP, - BG_CANVAS=VS::ENV_BG_CANVAS, - BG_MAX=VS::ENV_BG_MAX - }; - - enum BGParam { - - BG_PARAM_CANVAS_MAX_LAYER=VS::ENV_BG_PARAM_CANVAS_MAX_LAYER, - BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR, - BG_PARAM_TEXTURE=VS::ENV_BG_PARAM_TEXTURE, - BG_PARAM_CUBEMAP=VS::ENV_BG_PARAM_CUBEMAP, - BG_PARAM_ENERGY=VS::ENV_BG_PARAM_ENERGY, - BG_PARAM_SCALE=VS::ENV_BG_PARAM_SCALE, - BG_PARAM_GLOW=VS::ENV_BG_PARAM_GLOW, - BG_PARAM_MAX=VS::ENV_BG_PARAM_MAX - }; - - enum Fx { - FX_AMBIENT_LIGHT=VS::ENV_FX_AMBIENT_LIGHT, - FX_FXAA=VS::ENV_FX_FXAA, - FX_GLOW=VS::ENV_FX_GLOW, - FX_DOF_BLUR=VS::ENV_FX_DOF_BLUR, - FX_HDR=VS::ENV_FX_HDR, - FX_FOG=VS::ENV_FX_FOG, - FX_BCS=VS::ENV_FX_BCS, - FX_SRGB=VS::ENV_FX_SRGB, - FX_MAX=VS::ENV_FX_MAX, - }; - - enum FxBlurBlendMode { - FX_BLUR_BLEND_MODE_ADDITIVE, - FX_BLUR_BLEND_MODE_SCREEN, - FX_BLUR_BLEND_MODE_SOFTLIGHT, - }; - - enum FxHDRToneMapper { - FX_HDR_TONE_MAPPER_LINEAR, - FX_HDR_TONE_MAPPER_LOG, - FX_HDR_TONE_MAPPER_REINHARDT, - FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE, - }; - - enum FxParam { - FX_PARAM_AMBIENT_LIGHT_COLOR=VS::ENV_FX_PARAM_AMBIENT_LIGHT_COLOR, - FX_PARAM_AMBIENT_LIGHT_ENERGY=VS::ENV_FX_PARAM_AMBIENT_LIGHT_ENERGY, - FX_PARAM_GLOW_BLUR_PASSES=VS::ENV_FX_PARAM_GLOW_BLUR_PASSES, - FX_PARAM_GLOW_BLUR_SCALE=VS::ENV_FX_PARAM_GLOW_BLUR_SCALE, - FX_PARAM_GLOW_BLUR_STRENGTH=VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH, - FX_PARAM_GLOW_BLUR_BLEND_MODE=VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE, - FX_PARAM_GLOW_BLOOM=VS::ENV_FX_PARAM_GLOW_BLOOM, - FX_PARAM_GLOW_BLOOM_TRESHOLD=VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD, - FX_PARAM_DOF_BLUR_PASSES=VS::ENV_FX_PARAM_DOF_BLUR_PASSES, - FX_PARAM_DOF_BLUR_BEGIN=VS::ENV_FX_PARAM_DOF_BLUR_BEGIN, - FX_PARAM_DOF_BLUR_RANGE=VS::ENV_FX_PARAM_DOF_BLUR_RANGE, - FX_PARAM_HDR_EXPOSURE=VS::ENV_FX_PARAM_HDR_EXPOSURE, - FX_PARAM_HDR_TONEMAPPER=VS::ENV_FX_PARAM_HDR_TONEMAPPER, - FX_PARAM_HDR_WHITE=VS::ENV_FX_PARAM_HDR_WHITE, - FX_PARAM_HDR_GLOW_TRESHOLD=VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD, - FX_PARAM_HDR_GLOW_SCALE=VS::ENV_FX_PARAM_HDR_GLOW_SCALE, - FX_PARAM_HDR_MIN_LUMINANCE=VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE, - FX_PARAM_HDR_MAX_LUMINANCE=VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE, - FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED=VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED, - FX_PARAM_FOG_BEGIN=VS::ENV_FX_PARAM_FOG_BEGIN, - FX_PARAM_FOG_BEGIN_COLOR=VS::ENV_FX_PARAM_FOG_BEGIN_COLOR, - FX_PARAM_FOG_END_COLOR=VS::ENV_FX_PARAM_FOG_END_COLOR, - FX_PARAM_FOG_ATTENUATION=VS::ENV_FX_PARAM_FOG_ATTENUATION, - FX_PARAM_FOG_BG=VS::ENV_FX_PARAM_FOG_BG, - FX_PARAM_BCS_BRIGHTNESS=VS::ENV_FX_PARAM_BCS_BRIGHTNESS, - FX_PARAM_BCS_CONTRAST=VS::ENV_FX_PARAM_BCS_CONTRAST, - FX_PARAM_BCS_SATURATION=VS::ENV_FX_PARAM_BCS_SATURATION, - FX_PARAM_MAX=VS::ENV_FX_PARAM_MAX - }; private: - BG bg_mode; - Variant bg_param[BG_PARAM_MAX]; - bool fx_enabled[FX_MAX]; - Variant fx_param[FX_PARAM_MAX]; + RID environment; protected: static void _bind_methods(); public: - void set_background(BG p_bg); - BG get_background() const; - - void set_background_param(BGParam p_param, const Variant& p_value); - Variant get_background_param(BGParam p_param) const; - - void set_enable_fx(Fx p_effect,bool p_enabled); - bool is_fx_enabled(Fx p_effect) const; - - void fx_set_param(FxParam p_param,const Variant& p_value); - Variant fx_get_param(FxParam p_param) const; virtual RID get_rid() const; @@ -145,9 +54,5 @@ public: ~Environment(); }; -VARIANT_ENUM_CAST( Environment::BG ); -VARIANT_ENUM_CAST( Environment::BGParam ); -VARIANT_ENUM_CAST( Environment::Fx ); -VARIANT_ENUM_CAST( Environment::FxParam ); #endif // ENVIRONMENT_H diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 9dc54ef0e4..3ebe5b7800 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -29,144 +29,14 @@ #include "material.h" #include "scene/scene_string_names.h" - -static const char*_flag_names[Material::FLAG_MAX]={ - "visible", - "double_sided", - "invert_faces", - "unshaded", - "on_top", - "lightmap_on_uv2", - "colarray_is_srgb" -}; - - -static const Material::Flag _flag_indices[Material::FLAG_MAX]={ - Material::FLAG_VISIBLE, - Material::FLAG_DOUBLE_SIDED, - Material::FLAG_INVERT_FACES, - Material::FLAG_UNSHADED, - Material::FLAG_ONTOP, - Material::FLAG_LIGHTMAP_ON_UV2, - Material::FLAG_COLOR_ARRAY_SRGB, -}; - - RID Material::get_rid() const { return material; } -void Material::set_flag(Flag p_flag,bool p_enabled) { - - ERR_FAIL_INDEX(p_flag,FLAG_MAX); - flags[p_flag]=p_enabled; - VisualServer::get_singleton()->material_set_flag(material,(VS::MaterialFlag)p_flag,p_enabled); - _change_notify(); -} - - -void Material::set_blend_mode(BlendMode p_blend_mode) { - - ERR_FAIL_INDEX(p_blend_mode,4); - blend_mode=p_blend_mode; - VisualServer::get_singleton()->material_set_blend_mode(material,(VS::MaterialBlendMode)p_blend_mode); - _change_notify(); -} - -Material::BlendMode Material::get_blend_mode() const { - - return blend_mode; -} - - -void Material::set_depth_draw_mode(DepthDrawMode p_depth_draw_mode) { - - depth_draw_mode=p_depth_draw_mode; - VisualServer::get_singleton()->material_set_depth_draw_mode(material,(VS::MaterialDepthDrawMode)p_depth_draw_mode); -} - -Material::DepthDrawMode Material::get_depth_draw_mode() const { - - return depth_draw_mode; -} - -bool Material::get_flag(Flag p_flag) const { - - ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false); - return flags[p_flag]; -} - -void Material::set_line_width(float p_width) { - - line_width=p_width; - VisualServer::get_singleton()->material_set_line_width(material,p_width); - _change_notify("line_width"); -} - -float Material::get_line_width() const { - - return line_width; -} - - -void Material::_bind_methods() { - - ObjectTypeDB::bind_method(_MD("set_flag","flag","enable"),&Material::set_flag); - ObjectTypeDB::bind_method(_MD("get_flag","flag"),&Material::get_flag); - ObjectTypeDB::bind_method(_MD("set_blend_mode","mode"),&Material::set_blend_mode); - ObjectTypeDB::bind_method(_MD("get_blend_mode"),&Material::get_blend_mode); - ObjectTypeDB::bind_method(_MD("set_line_width","width"),&Material::set_line_width); - ObjectTypeDB::bind_method(_MD("get_line_width"),&Material::get_line_width); - ObjectTypeDB::bind_method(_MD("set_depth_draw_mode","mode"),&Material::set_depth_draw_mode); - ObjectTypeDB::bind_method(_MD("get_depth_draw_mode"),&Material::get_depth_draw_mode); - - - for(int i=0;imaterial_create(); } Material::~Material() { @@ -174,431 +44,15 @@ Material::~Material() { VisualServer::get_singleton()->free(material); } -static const char*_param_names[FixedMaterial::PARAM_MAX]={ - "diffuse", - "detail", - "specular", - "emission", - "specular_exp", - "glow", - "normal", - "shade_param" -}; - -static const char*_full_param_names[FixedMaterial::PARAM_MAX]={ - "params/diffuse", - "params/detail", - "params/specular", - "params/emission", - "params/specular_exp", - "params/glow", - "params/normal", - "params/shade_param" -}; - -/* -static const char*_texture_param_names[FixedMaterial::PARAM_MAX]={ - "tex_diffuse", - "tex_detail", - "tex_specular", - "tex_emission", - "tex_specular_exp", - "tex_glow", - "tex_detail_mix", - "tex_normal", - "tex_shade_param" -}; -*/ -static const FixedMaterial::Parameter _param_indices[FixedMaterial::PARAM_MAX]={ - FixedMaterial::PARAM_DIFFUSE, - FixedMaterial::PARAM_DETAIL, - FixedMaterial::PARAM_SPECULAR, - FixedMaterial::PARAM_EMISSION, - FixedMaterial::PARAM_SPECULAR_EXP, - FixedMaterial::PARAM_GLOW, - FixedMaterial::PARAM_NORMAL, - FixedMaterial::PARAM_SHADE_PARAM, -}; - - - - -void FixedMaterial::set_parameter(Parameter p_parameter, const Variant& p_value) { - - ERR_FAIL_INDEX(p_parameter,PARAM_MAX); - if ((p_parameter==PARAM_DIFFUSE || p_parameter==PARAM_SPECULAR || p_parameter==PARAM_EMISSION)) { - - if (p_value.get_type()!=Variant::COLOR) { - ERR_EXPLAIN(String(_param_names[p_parameter])+" expects Color"); - ERR_FAIL(); - } - } else { - - if (!p_value.is_num()) { - ERR_EXPLAIN(String(_param_names[p_parameter])+" expects scalar"); - ERR_FAIL(); - } - } - - ERR_FAIL_COND( (p_parameter==PARAM_DIFFUSE || p_parameter==PARAM_SPECULAR || p_parameter==PARAM_EMISSION) && p_value.get_type()!=Variant::COLOR ); - ERR_FAIL_COND( p_parameter!=PARAM_SHADE_PARAM && p_parameter!=PARAM_DIFFUSE && p_parameter!=PARAM_DETAIL && p_parameter!=PARAM_SPECULAR && p_parameter!=PARAM_EMISSION && p_value.get_type()!=Variant::REAL && p_value.get_type()!=Variant::INT ); - - param[p_parameter]=p_value; - - VisualServer::get_singleton()->fixed_material_set_param(material,(VS::FixedMaterialParam)p_parameter,p_value); - - _change_notify(_full_param_names[p_parameter]); -} - -Variant FixedMaterial::get_parameter(Parameter p_parameter) const { - ERR_FAIL_INDEX_V(p_parameter,PARAM_MAX,Variant()); - return param[p_parameter]; -} - - - -void FixedMaterial::set_texture(Parameter p_parameter, Ref p_texture) { - - ERR_FAIL_INDEX(p_parameter,PARAM_MAX); - - texture_param[p_parameter]=p_texture; - VisualServer::get_singleton()->fixed_material_set_texture(material,(VS::FixedMaterialParam)p_parameter,p_texture.is_null()?RID():p_texture->get_rid()); - - _change_notify(); -} -Ref FixedMaterial::get_texture(Parameter p_parameter) const { - - ERR_FAIL_INDEX_V(p_parameter,PARAM_MAX,Ref()); - return texture_param[p_parameter]; -} - -void FixedMaterial::set_texcoord_mode(Parameter p_parameter, TexCoordMode p_mode) { - - ERR_FAIL_INDEX(p_parameter,PARAM_MAX); - ERR_FAIL_INDEX(p_mode,4); - - if (p_mode==texture_texcoord[p_parameter]) - return; - - texture_texcoord[p_parameter]=p_mode; - - VisualServer::get_singleton()->fixed_material_set_texcoord_mode(material,(VS::FixedMaterialParam)p_parameter,(VS::FixedMaterialTexCoordMode)p_mode); - - _change_notify(); -} - -FixedMaterial::TexCoordMode FixedMaterial::get_texcoord_mode(Parameter p_parameter) const { - - ERR_FAIL_INDEX_V(p_parameter,PARAM_MAX,TEXCOORD_UV); - return texture_texcoord[p_parameter]; -} - -void FixedMaterial::set_light_shader(LightShader p_shader) { - - light_shader=p_shader; - VS::get_singleton()->fixed_material_set_light_shader(material,VS::FixedMaterialLightShader(p_shader)); -} - -FixedMaterial::LightShader FixedMaterial::get_light_shader() const { - - return light_shader; -} - - -void FixedMaterial::set_uv_transform(const Transform& p_transform) { - - uv_transform=p_transform; - VisualServer::get_singleton()->fixed_material_set_uv_transform(material, p_transform ); - _change_notify(); -} - -Transform FixedMaterial::get_uv_transform() const { - - return uv_transform; -} - - - - - -void FixedMaterial::set_fixed_flag(FixedFlag p_flag, bool p_value) { - ERR_FAIL_INDEX(p_flag,5); - fixed_flags[p_flag]=p_value; - VisualServer::get_singleton()->fixed_material_set_flag(material,(VS::FixedMaterialFlags)p_flag,p_value); - -} - -bool FixedMaterial::get_fixed_flag(FixedFlag p_flag) const { - ERR_FAIL_INDEX_V(p_flag,5,false); - return fixed_flags[p_flag]; -} - -void FixedMaterial::set_point_size(float p_size) { - - ERR_FAIL_COND(p_size<0); - point_size=p_size; - VisualServer::get_singleton()->fixed_material_set_point_size(material,p_size); -} - -float FixedMaterial::get_point_size() const{ - - - return point_size; -} - - -void FixedMaterial::_bind_methods() { - - - ObjectTypeDB::bind_method(_MD("set_parameter","param","value"),&FixedMaterial::set_parameter); - ObjectTypeDB::bind_method(_MD("get_parameter","param"),&FixedMaterial::get_parameter); - - ObjectTypeDB::bind_method(_MD("set_texture","param","texture:Texture"),&FixedMaterial::set_texture); - ObjectTypeDB::bind_method(_MD("get_texture:Texture","param"),&FixedMaterial::get_texture); +FixedMaterial::FixedMaterial() { - ObjectTypeDB::bind_method(_MD("set_texcoord_mode","param","mode"),&FixedMaterial::set_texcoord_mode); - ObjectTypeDB::bind_method(_MD("get_texcoord_mode","param"),&FixedMaterial::get_texcoord_mode); - - ObjectTypeDB::bind_method(_MD("set_fixed_flag","flag","value"),&FixedMaterial::set_fixed_flag); - ObjectTypeDB::bind_method(_MD("get_fixed_flag","flag"),&FixedMaterial::get_fixed_flag); - - ObjectTypeDB::bind_method(_MD("set_uv_transform","transform"),&FixedMaterial::set_uv_transform); - ObjectTypeDB::bind_method(_MD("get_uv_transform"),&FixedMaterial::get_uv_transform); - - ObjectTypeDB::bind_method(_MD("set_light_shader","shader"),&FixedMaterial::set_light_shader); - ObjectTypeDB::bind_method(_MD("get_light_shader"),&FixedMaterial::get_light_shader); - - ObjectTypeDB::bind_method(_MD("set_point_size","size"),&FixedMaterial::set_point_size); - ObjectTypeDB::bind_method(_MD("get_point_size"),&FixedMaterial::get_point_size); - - - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_alpha" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_ALPHA); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_color_array" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_COLOR_ARRAY); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_point_size" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_POINT_SIZE); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/discard_alpha" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_DISCARD_ALPHA); - ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_xy_normalmap" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_XY_NORMALMAP); - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/diffuse" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_DIFFUSE); - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/specular", PROPERTY_HINT_COLOR_NO_ALPHA ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPECULAR ); - ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/emission", PROPERTY_HINT_COLOR_NO_ALPHA ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_EMISSION ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/specular_exp", PROPERTY_HINT_RANGE,"1,64,0.01" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPECULAR_EXP ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/detail_mix", PROPERTY_HINT_RANGE,"0,1,0.01" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_DETAIL ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/normal_depth", PROPERTY_HINT_RANGE,"-4,4,0.01" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_NORMAL ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "params/shader", PROPERTY_HINT_ENUM,"Lambert,Wrap,Velvet,Toon" ), _SCS("set_light_shader"), _SCS("get_light_shader") ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/shader_param", PROPERTY_HINT_RANGE,"0,1,0.01" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SHADE_PARAM ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "params/glow", PROPERTY_HINT_RANGE,"0,8,0.01" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_GLOW ); - ADD_PROPERTY( PropertyInfo( Variant::REAL, "params/point_size", PROPERTY_HINT_RANGE,"0,1024,1" ), _SCS("set_point_size"), _SCS("get_point_size")); - ADD_PROPERTY( PropertyInfo( Variant::TRANSFORM, "uv_xform"), _SCS("set_uv_transform"), _SCS("get_uv_transform") ); - - for(int i=0;ifixed_material_create()) { - - - - param[PARAM_DIFFUSE]=Color(1,1,1); - param[PARAM_SPECULAR]=Color(0.0,0.0,0.0); - param[PARAM_EMISSION]=Color(0.0,0.0,0.0); - param[PARAM_SPECULAR_EXP]=40; - param[PARAM_GLOW]=0; - param[PARAM_NORMAL]=1; - param[PARAM_SHADE_PARAM]=0.5; - param[PARAM_DETAIL]=1.0; - - set_flag(FLAG_COLOR_ARRAY_SRGB,true); - - fixed_flags[FLAG_USE_ALPHA]=false; - fixed_flags[FLAG_USE_COLOR_ARRAY]=false; - fixed_flags[FLAG_USE_POINT_SIZE]=false; - fixed_flags[FLAG_USE_XY_NORMALMAP]=false; - fixed_flags[FLAG_DISCARD_ALPHA]=false; - - - for(int i=0;ishader_shader) { - set_shader(p_value); - return true; - } else { - - if (shader.is_valid()) { - - - StringName pr = shader->remap_param(p_name); - if (!pr) { - String n = p_name; - if (n.find("param/")==0) { //backwards compatibility - pr = n.substr(6,n.length()); - } - } - if (pr) { - VisualServer::get_singleton()->material_set_param(material,pr,p_value); - return true; - } - } - } - - return false; -} - -bool ShaderMaterial::_get(const StringName& p_name,Variant &r_ret) const { - - if (p_name==SceneStringNames::get_singleton()->shader_shader) { - - r_ret=get_shader(); - return true; - } else { - - if (shader.is_valid()) { - - StringName pr = shader->remap_param(p_name); - if (pr) { - r_ret=VisualServer::get_singleton()->material_get_param(material,pr); - return true; - } - } - - } - - - return false; -} - - -void ShaderMaterial::_get_property_list( List *p_list) const { - - p_list->push_back( PropertyInfo( Variant::OBJECT, "shader/shader", PROPERTY_HINT_RESOURCE_TYPE,"MaterialShader,MaterialShaderGraph" ) ); - - if (!shader.is_null()) { - - shader->get_param_list(p_list); - } - -} - - -void ShaderMaterial::_shader_changed() { - - _change_notify(); //also all may have changed then -} - -void ShaderMaterial::set_shader(const Ref& p_shader) { - - ERR_FAIL_COND(p_shader.is_valid() && p_shader->get_mode()!=Shader::MODE_MATERIAL); - - if (shader.is_valid()) - shader->disconnect(SceneStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_shader_changed); - shader=p_shader; - VS::get_singleton()->material_set_shader(material,shader.is_valid()?shader->get_rid():RID()); - if (shader.is_valid()) { - shader->connect(SceneStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_shader_changed); - } - _change_notify(); - -} - -Ref ShaderMaterial::get_shader() const { - - return shader; } - -void ShaderMaterial::set_shader_param(const StringName& p_param,const Variant& p_value) { - - VisualServer::get_singleton()->material_set_param(material,p_param,p_value); - -} - -Variant ShaderMaterial::get_shader_param(const StringName& p_param) const{ - - return VisualServer::get_singleton()->material_get_param(material,p_param); -} - - - -void ShaderMaterial::_bind_methods() { - - ObjectTypeDB::bind_method(_MD("set_shader","shader:Shader"), &ShaderMaterial::set_shader ); - ObjectTypeDB::bind_method(_MD("get_shader:Shader"), &ShaderMaterial::get_shader ); - - ObjectTypeDB::bind_method(_MD("set_shader_param","param","value:Variant"), &ShaderMaterial::set_shader_param); - ObjectTypeDB::bind_method(_MD("get_shader_param:Variant","param"), &ShaderMaterial::get_shader_param); - - ObjectTypeDB::bind_method(_MD("_shader_changed"), &ShaderMaterial::_shader_changed ); -} - - -void ShaderMaterial::get_argument_options(const StringName& p_function,int p_idx,List*r_options) const { - - String f = p_function.operator String(); - if ((f=="get_shader_param" || f=="set_shader_param") && p_idx==0) { - - if (shader.is_valid()) { - List pl; - shader->get_param_list(&pl); - for (List::Element *E=pl.front();E;E=E->next()) { - r_options->push_back("\""+E->get().name.replace_first("shader_param/","")+"\""); - } - } - } - Material::get_argument_options(p_function,p_idx,r_options); -} - -ShaderMaterial::ShaderMaterial() :Material(VisualServer::get_singleton()->material_create()){ - - -} - - ///////////////////////////////// diff --git a/scene/resources/material.h b/scene/resources/material.h index dbd05c466f..87afa60ce9 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -45,209 +45,27 @@ class Material : public Resource { RES_BASE_EXTENSION("mtl"); OBJ_SAVE_TYPE( Material ); -public: - - enum Flag { - FLAG_VISIBLE = VS::MATERIAL_FLAG_VISIBLE, - FLAG_DOUBLE_SIDED = VS::MATERIAL_FLAG_DOUBLE_SIDED, - FLAG_INVERT_FACES = VS::MATERIAL_FLAG_INVERT_FACES, - FLAG_UNSHADED = VS::MATERIAL_FLAG_UNSHADED, - FLAG_ONTOP = VS::MATERIAL_FLAG_ONTOP, - FLAG_LIGHTMAP_ON_UV2 = VS::MATERIAL_FLAG_LIGHTMAP_ON_UV2, - FLAG_COLOR_ARRAY_SRGB = VS::MATERIAL_FLAG_COLOR_ARRAY_SRGB, - FLAG_MAX = VS::MATERIAL_FLAG_MAX - }; - - enum BlendMode { - BLEND_MODE_MIX = VS::MATERIAL_BLEND_MODE_MIX, - BLEND_MODE_MUL = VS::MATERIAL_BLEND_MODE_MUL, - BLEND_MODE_ADD = VS::MATERIAL_BLEND_MODE_ADD, - BLEND_MODE_SUB = VS::MATERIAL_BLEND_MODE_SUB, - BLEND_MODE_PREMULT_ALPHA = VS::MATERIAL_BLEND_MODE_PREMULT_ALPHA, - - }; - - enum DepthDrawMode { - DEPTH_DRAW_ALWAYS = VS::MATERIAL_DEPTH_DRAW_ALWAYS, - DEPTH_DRAW_OPAQUE_ONLY = VS::MATERIAL_DEPTH_DRAW_OPAQUE_ONLY, - DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA = VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA, - DEPTH_DRAW_NEVER = VS::MATERIAL_DEPTH_DRAW_NEVER - }; - - - -private: - BlendMode blend_mode; - bool flags[VS::MATERIAL_FLAG_MAX]; - float line_width; - DepthDrawMode depth_draw_mode; -protected: RID material; - - static void _bind_methods(); - public: - void set_flag(Flag p_flag,bool p_enabled); - bool get_flag(Flag p_flag) const; - - void set_blend_mode(BlendMode p_blend_mode); - BlendMode get_blend_mode() const; - - void set_depth_draw_mode(DepthDrawMode p_depth_draw_mode); - DepthDrawMode get_depth_draw_mode() const; - - void set_line_width(float p_width); - float get_line_width() const; virtual RID get_rid() const; - - Material(const RID& p_rid=RID()); + Material(); virtual ~Material(); }; -VARIANT_ENUM_CAST( Material::Flag ); -VARIANT_ENUM_CAST( Material::DepthDrawMode ); - -VARIANT_ENUM_CAST( Material::BlendMode ); - class FixedMaterial : public Material { - OBJ_TYPE( FixedMaterial, Material ); - REVERSE_GET_PROPERTY_LIST -public: - - enum Parameter { - PARAM_DIFFUSE=VS::FIXED_MATERIAL_PARAM_DIFFUSE, - PARAM_DETAIL=VS::FIXED_MATERIAL_PARAM_DETAIL, - PARAM_SPECULAR=VS::FIXED_MATERIAL_PARAM_SPECULAR, - PARAM_EMISSION=VS::FIXED_MATERIAL_PARAM_EMISSION, - PARAM_SPECULAR_EXP=VS::FIXED_MATERIAL_PARAM_SPECULAR_EXP, - PARAM_GLOW=VS::FIXED_MATERIAL_PARAM_GLOW, - PARAM_NORMAL=VS::FIXED_MATERIAL_PARAM_NORMAL, - PARAM_SHADE_PARAM=VS::FIXED_MATERIAL_PARAM_SHADE_PARAM, - PARAM_MAX=VS::FIXED_MATERIAL_PARAM_MAX - }; - - - enum TexCoordMode { - - TEXCOORD_UV=VS::FIXED_MATERIAL_TEXCOORD_UV, - TEXCOORD_UV_TRANSFORM=VS::FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM, - TEXCOORD_UV2=VS::FIXED_MATERIAL_TEXCOORD_UV2, - TEXCOORD_SPHERE=VS::FIXED_MATERIAL_TEXCOORD_SPHERE - }; - - enum FixedFlag { - FLAG_USE_ALPHA=VS::FIXED_MATERIAL_FLAG_USE_ALPHA, - FLAG_USE_COLOR_ARRAY=VS::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY, - FLAG_USE_POINT_SIZE=VS::FIXED_MATERIAL_FLAG_USE_POINT_SIZE, - FLAG_DISCARD_ALPHA=VS::FIXED_MATERIAL_FLAG_DISCARD_ALPHA, - FLAG_USE_XY_NORMALMAP=VS::FIXED_MATERIAL_FLAG_USE_XY_NORMALMAP, - FLAG_MAX=VS::FIXED_MATERIAL_FLAG_MAX - }; - - enum LightShader { - - LIGHT_SHADER_LAMBERT=VS::FIXED_MATERIAL_LIGHT_SHADER_LAMBERT, - LIGHT_SHADER_WRAP=VS::FIXED_MATERIAL_LIGHT_SHADER_WRAP, - LIGHT_SHADER_VELVET=VS::FIXED_MATERIAL_LIGHT_SHADER_VELVET, - LIGHT_SHADER_TOON=VS::FIXED_MATERIAL_LIGHT_SHADER_TOON - }; - -private: - - - struct Node { - - int param; - int mult; - int tex; - }; - - Variant param[PARAM_MAX]; - Ref texture_param[PARAM_MAX]; - TexCoordMode texture_texcoord[PARAM_MAX]; - LightShader light_shader; - bool fixed_flags[FLAG_MAX]; - float point_size; - - - Transform uv_transform; - -protected: - - - static void _bind_methods(); + OBJ_TYPE(FixedMaterial,Resource); public: - void set_fixed_flag(FixedFlag p_flag, bool p_value); - bool get_fixed_flag(FixedFlag p_flag) const; - - void set_parameter(Parameter p_parameter, const Variant& p_value); - Variant get_parameter(Parameter p_parameter) const; - - void set_texture(Parameter p_parameter, Ref p_texture); - Ref get_texture(Parameter p_parameter) const; - - void set_texcoord_mode(Parameter p_parameter, TexCoordMode p_mode); - TexCoordMode get_texcoord_mode(Parameter p_parameter) const; - - void set_light_shader(LightShader p_shader); - LightShader get_light_shader() const; - - void set_uv_transform(const Transform& p_transform); - Transform get_uv_transform() const; - - void set_point_size(float p_transform); - float get_point_size() const; - FixedMaterial(); - ~FixedMaterial(); - + virtual ~FixedMaterial(); }; - -VARIANT_ENUM_CAST( FixedMaterial::Parameter ); -VARIANT_ENUM_CAST( FixedMaterial::TexCoordMode ); -VARIANT_ENUM_CAST( FixedMaterial::FixedFlag ); -VARIANT_ENUM_CAST( FixedMaterial::LightShader ); - -class ShaderMaterial : public Material { - - OBJ_TYPE( ShaderMaterial, Material ); - - Ref shader; - - - - void _shader_changed(); - static void _shader_parse(void*p_self,ShaderLanguage::ProgramNode*p_node); - -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list( List *p_list) const; - - static void _bind_methods(); - -public: - - void set_shader(const Ref& p_shader); - Ref get_shader() const; - - void set_shader_param(const StringName& p_param,const Variant& p_value); - Variant get_shader_param(const StringName& p_param) const; - - void get_argument_options(const StringName& p_function,int p_idx,List*r_options) const; - - ShaderMaterial(); -}; - ////////////////////// diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 921466585d..132ec54e48 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -122,22 +122,14 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (idx==surfaces.size()) { - if (what=="custom") { - add_custom_surface(p_value); - return true; - - } - //create Dictionary d=p_value; ERR_FAIL_COND_V(!d.has("primitive"),false); ERR_FAIL_COND_V(!d.has("arrays"),false); ERR_FAIL_COND_V(!d.has("morph_arrays"),false); - bool alphasort = d.has("alphasort") && bool(d["alphasort"]); - - add_surface(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"],alphasort); + add_surface(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"]); if (d.has("material")) { surface_set_material(idx,d["material"]); @@ -196,7 +188,6 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { d["primitive"]=surface_get_primitive_type(idx); d["arrays"]=surface_get_arrays(idx); d["morph_arrays"]=surface_get_morph_arrays(idx); - d["alphasort"]=surface_is_alpha_sorting_enabled(idx); Ref m = surface_get_material(idx); if (m.is_valid()) d["material"]=m; @@ -243,14 +234,14 @@ void Mesh::_recompute_aabb() { } -void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes,bool p_alphasort) { +void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes) { ERR_FAIL_COND(p_arrays.size()!=ARRAY_MAX); Surface s; - VisualServer::get_singleton()->mesh_add_surface(mesh,(VisualServer::PrimitiveType)p_primitive, p_arrays,p_blend_shapes,p_alphasort); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh,(VisualServer::PrimitiveType)p_primitive, p_arrays,p_blend_shapes); surfaces.push_back(s); @@ -274,7 +265,6 @@ void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Arr } surfaces[surfaces.size()-1].aabb=aabb; - surfaces[surfaces.size()-1].alphasort=p_alphasort; _recompute_aabb(); @@ -289,29 +279,19 @@ void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Arr Array Mesh::surface_get_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface,surfaces.size(),Array()); - return VisualServer::get_singleton()->mesh_get_surface_arrays(mesh,p_surface); + //return VisualServer::get_singleton()->mesh_get_surface_arrays(mesh,p_surface); + return Array(); } Array Mesh::surface_get_morph_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface,surfaces.size(),Array()); - return VisualServer::get_singleton()->mesh_get_surface_morph_arrays(mesh,p_surface); + return Array(); } -void Mesh::add_custom_surface(const Variant& p_data) { - - Surface s; - s.aabb=AABB(); - VisualServer::get_singleton()->mesh_add_custom_surface(mesh,p_data); - surfaces.push_back(s); - - triangle_mesh=Ref(); - _change_notify(); -} - int Mesh::get_surface_count() const { @@ -418,11 +398,6 @@ Mesh::PrimitiveType Mesh::surface_get_primitive_type(int p_idx) const { return (PrimitiveType)VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, p_idx ); } -bool Mesh::surface_is_alpha_sorting_enabled(int p_idx) const { - - ERR_FAIL_INDEX_V( p_idx, surfaces.size(), 0 ); - return surfaces[p_idx].alphasort; -} void Mesh::surface_set_material(int p_idx, const Ref& p_material) { @@ -968,7 +943,6 @@ void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); ObjectTypeDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); - ObjectTypeDB::bind_method(_MD("add_surface","primitive","arrays","morph_arrays","alphasort"),&Mesh::add_surface,DEFVAL(Array()),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); ObjectTypeDB::bind_method(_MD("surface_remove","surf_idx"),&Mesh::surface_remove); ObjectTypeDB::bind_method(_MD("surface_get_array_len","surf_idx"),&Mesh::surface_get_array_len); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index dc1d97a49e..e329c353a0 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -99,7 +99,6 @@ private: struct Surface { String name; AABB aabb; - bool alphasort; Ref material; }; Vector surfaces; @@ -123,12 +122,10 @@ protected: public: - void add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),bool p_alphasort=false); + void add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array()); Array surface_get_arrays(int p_surface) const; virtual Array surface_get_morph_arrays(int p_surface) const; - void add_custom_surface(const Variant& p_data); //only recognized by driver - void add_morph_target(const StringName& p_name); int get_morph_target_count() const; StringName get_morph_target_name(int p_index) const; diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index c5ade63124..0a005d8c54 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -141,7 +141,7 @@ Ref MultiMesh::get_mesh() const { void MultiMesh::set_instance_count(int p_count) { - VisualServer::get_singleton()->multimesh_set_instance_count(multimesh,p_count); + VisualServer::get_singleton()->multimesh_allocate(multimesh,p_count,VS::MultimeshTransformFormat(transform_format),VS::MultimeshColorFormat(color_format)); } int MultiMesh::get_instance_count() const { @@ -177,7 +177,7 @@ Color MultiMesh::get_instance_color(int p_instance) const { void MultiMesh::set_aabb(const AABB& p_aabb) { aabb=p_aabb; - VisualServer::get_singleton()->multimesh_set_aabb(multimesh,p_aabb); + VisualServer::get_singleton()->multimesh_set_custom_aabb(multimesh,p_aabb); } @@ -220,10 +220,36 @@ RID MultiMesh::get_rid() const { } + +void MultiMesh::set_color_format(ColorFormat p_color_format) { + + color_format=p_color_format; +} + +MultiMesh::ColorFormat MultiMesh::get_color_format() const{ + + return color_format; +} + +void MultiMesh::set_transform_format(TransformFormat p_transform_format){ + + transform_format=p_transform_format; +} +MultiMesh::TransformFormat MultiMesh::get_transform_format() const{ + + return transform_format; +} + + void MultiMesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mesh","mesh:Mesh"),&MultiMesh::set_mesh); ObjectTypeDB::bind_method(_MD("get_mesh:Mesh"),&MultiMesh::get_mesh); + ObjectTypeDB::bind_method(_MD("set_color_format","format"),&MultiMesh::set_color_format); + ObjectTypeDB::bind_method(_MD("get_color_format"),&MultiMesh::get_color_format); + ObjectTypeDB::bind_method(_MD("set_transform_format","format"),&MultiMesh::set_transform_format); + ObjectTypeDB::bind_method(_MD("get_transform_format"),&MultiMesh::get_transform_format); + ObjectTypeDB::bind_method(_MD("set_instance_count","count"),&MultiMesh::set_instance_count); ObjectTypeDB::bind_method(_MD("get_instance_count"),&MultiMesh::get_instance_count); ObjectTypeDB::bind_method(_MD("set_instance_transform","instance","transform"),&MultiMesh::set_instance_transform); @@ -241,17 +267,29 @@ void MultiMesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("_get_color_array"),&MultiMesh::_get_color_array); + ADD_PROPERTY(PropertyInfo(Variant::INT,"color_format",PROPERTY_HINT_ENUM,"None,Byte,Float"), _SCS("set_color_format"), _SCS("get_color_format")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"transform_format",PROPERTY_HINT_ENUM,"None,2D,3D"), _SCS("set_transform_format"), _SCS("get_transform_format")); ADD_PROPERTY(PropertyInfo(Variant::INT,"instance_count",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_instance_count"), _SCS("get_instance_count")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"mesh",PROPERTY_HINT_RESOURCE_TYPE,"Mesh"), _SCS("set_mesh"), _SCS("get_mesh")); ADD_PROPERTY(PropertyInfo(Variant::_AABB,"aabb"), _SCS("set_aabb"), _SCS("get_aabb") ); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"transform_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_transform_array"), _SCS("_get_transform_array")); ADD_PROPERTY(PropertyInfo(Variant::COLOR_ARRAY,"color_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_color_array"), _SCS("_get_color_array")); + + BIND_CONSTANT( TRANSFORM_NONE ); + BIND_CONSTANT( TRANSFORM_2D ); + BIND_CONSTANT( TRANSFORM_3D ); + BIND_CONSTANT( COLOR_NONE ); + BIND_CONSTANT( COLOR_8BIT ); + BIND_CONSTANT( COLOR_FLOAT ); + } MultiMesh::MultiMesh() { multimesh = VisualServer::get_singleton()->multimesh_create(); + color_format=COLOR_NONE; + transform_format=TRANSFORM_NONE; } MultiMesh::~MultiMesh() { diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 0cf9e92def..be4ee38fcd 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -30,16 +30,33 @@ #define MULTIMESH_H #include "scene/resources/mesh.h" - +#include "servers/visual_server.h" class MultiMesh : public Resource { OBJ_TYPE( MultiMesh, Resource ); RES_BASE_EXTENSION("mmsh"); +public: + enum TransformFormat { + TRANSFORM_NONE = VS::MULTIMESH_TRANSFORM_NONE, + TRANSFORM_2D = VS::MULTIMESH_TRANSFORM_2D, + TRANSFORM_3D = VS::MULTIMESH_TRANSFORM_3D + }; + + enum ColorFormat { + COLOR_NONE = VS::MULTIMESH_COLOR_NONE, + COLOR_8BIT = VS::MULTIMESH_COLOR_8BIT, + COLOR_FLOAT = VS::MULTIMESH_COLOR_FLOAT, + }; +private: AABB aabb; Ref mesh; RID multimesh; + TransformFormat transform_format; + ColorFormat color_format; + + protected: static void _bind_methods(); @@ -55,6 +72,12 @@ public: void set_mesh(const Ref& p_mesh); Ref get_mesh() const; + void set_color_format(ColorFormat p_color_format); + ColorFormat get_color_format() const; + + void set_transform_format(TransformFormat p_transform_format); + TransformFormat get_transform_format() const; + void set_instance_count(int p_count); int get_instance_count() const; @@ -76,4 +99,8 @@ public: }; + +VARIANT_ENUM_CAST( MultiMesh::TransformFormat ); +VARIANT_ENUM_CAST( MultiMesh::ColorFormat); + #endif // MULTI_MESH_H diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp index f28220531b..978a15ab5e 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -36,16 +36,6 @@ RID RoomBounds::get_rid() const { return area; } -void RoomBounds::set_bounds( const BSP_Tree& p_bounds ) { - - VisualServer::get_singleton()->room_set_bounds(area,p_bounds); - emit_signal("changed"); -} - -BSP_Tree RoomBounds::get_bounds() const { - - return VisualServer::get_singleton()->room_get_bounds(area); -} void RoomBounds::set_geometry_hint(const DVector& p_geometry_hint) { @@ -57,41 +47,15 @@ DVector RoomBounds::get_geometry_hint() const { return geometry_hint; } -void RoomBounds::_regenerate_bsp_cubic() { - - if (geometry_hint.size()) { - - float err=0; - geometry_hint= Geometry::wrap_geometry( geometry_hint, &err ); ///< create a "wrap" that encloses the given geometry - BSP_Tree new_bounds(geometry_hint,err); - set_bounds(new_bounds); - } - -} - -void RoomBounds::_regenerate_bsp() { - - if (geometry_hint.size()) { - - BSP_Tree new_bounds(geometry_hint,0); - set_bounds(new_bounds); - } -} void RoomBounds::_bind_methods() { - ObjectTypeDB::bind_method(_MD("set_bounds","bsp_tree"),&RoomBounds::set_bounds); - ObjectTypeDB::bind_method(_MD("get_bounds"),&RoomBounds::get_bounds); ObjectTypeDB::bind_method(_MD("set_geometry_hint","triangles"),&RoomBounds::set_geometry_hint); ObjectTypeDB::bind_method(_MD("get_geometry_hint"),&RoomBounds::get_geometry_hint); - ObjectTypeDB::bind_method(_MD("regenerate_bsp"),&RoomBounds::_regenerate_bsp); - ObjectTypeDB::set_method_flags(get_type_static(),_SCS("regenerate_bsp"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); - ObjectTypeDB::bind_method(_MD("regenerate_bsp_cubic"),&RoomBounds::_regenerate_bsp_cubic); - ObjectTypeDB::set_method_flags(get_type_static(),_SCS("regenerate_bsp_cubic"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); - ADD_PROPERTY( PropertyInfo( Variant::DICTIONARY, "bounds"), _SCS("set_bounds"),_SCS("get_bounds") ); + //ADD_PROPERTY( PropertyInfo( Variant::DICTIONARY, "bounds"), _SCS("set_bounds"),_SCS("get_bounds") ); ADD_PROPERTY( PropertyInfo( Variant::VECTOR3_ARRAY, "geometry_hint"),_SCS("set_geometry_hint"),_SCS("get_geometry_hint") ); } diff --git a/scene/resources/room.h b/scene/resources/room.h index dc5e284838..6200521044 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -34,6 +34,7 @@ /** @author Juan Linietsky */ + class RoomBounds : public Resource { OBJ_TYPE( RoomBounds, Resource ); @@ -42,8 +43,7 @@ class RoomBounds : public Resource { RID area; DVector geometry_hint; - void _regenerate_bsp(); - void _regenerate_bsp_cubic(); + protected: static void _bind_methods(); @@ -52,8 +52,6 @@ public: virtual RID get_rid() const; - void set_bounds( const BSP_Tree& p_bounds ); - BSP_Tree get_bounds() const; void set_geometry_hint(const DVector& geometry_hint); DVector get_geometry_hint() const; @@ -63,4 +61,6 @@ public: }; + + #endif // ROOM_H diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index ee9f23dd2a..b6c8fcf7a1 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -39,37 +39,17 @@ Shader::Mode Shader::get_mode() const { return mode; } -void Shader::set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs,int p_light_ofs) { +void Shader::set_code(const String& p_code) { - VisualServer::get_singleton()->shader_set_code(shader,p_vertex,p_fragment,p_light,0,p_fragment_ofs,p_light_ofs); + VisualServer::get_singleton()->shader_set_code(shader,p_code); params_cache_dirty=true; emit_signal(SceneStringNames::get_singleton()->changed); } -String Shader::get_vertex_code() const { +String Shader::get_code() const { - return VisualServer::get_singleton()->shader_get_vertex_code(shader); -} - -String Shader::get_fragment_code() const { - - return VisualServer::get_singleton()->shader_get_fragment_code(shader); - -} - -String Shader::get_light_code() const { - - return VisualServer::get_singleton()->shader_get_light_code(shader); - -} - -bool Shader::has_param(const StringName& p_param) const { - - if (params_cache_dirty) - get_param_list(NULL); - - return (params_cache.has(p_param)); + return VisualServer::get_singleton()->shader_get_code(shader); } @@ -101,48 +81,6 @@ RID Shader::get_rid() const { return shader; } -Dictionary Shader::_get_code() { - - String fs = VisualServer::get_singleton()->shader_get_fragment_code(shader); - String vs = VisualServer::get_singleton()->shader_get_vertex_code(shader); - String ls = VisualServer::get_singleton()->shader_get_light_code(shader); - - Dictionary c; - c["fragment"]=fs; - c["fragment_ofs"]=0; - c["vertex"]=vs; - c["vertex_ofs"]=0; - c["light"]=ls; - c["light_ofs"]=0; - Array arr; - for(const Map >::Element *E=default_textures.front();E;E=E->next()) { - arr.push_back(E->key()); - arr.push_back(E->get()); - } - if (arr.size()) - c["default_tex"]=arr; - return c; -} - -void Shader::_set_code(const Dictionary& p_string) { - - ERR_FAIL_COND(!p_string.has("fragment")); - ERR_FAIL_COND(!p_string.has("vertex")); - String light; - if (p_string.has("light")) - light=p_string["light"]; - - set_code(p_string["vertex"],p_string["fragment"],light); - if (p_string.has("default_tex")) { - Array arr=p_string["default_tex"]; - if ((arr.size()&1)==0) { - for(int i=0;i& p_texture) { @@ -171,29 +109,27 @@ void Shader::get_default_texture_param_list(List* r_textures) const{ } } +bool Shader::has_param(const StringName& p_param) const { + return params_cache.has(p_param); +} void Shader::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_mode"),&Shader::get_mode); - ObjectTypeDB::bind_method(_MD("set_code","vcode","fcode","lcode","fofs","lofs"),&Shader::set_code,DEFVAL(0),DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_vertex_code"),&Shader::get_vertex_code); - ObjectTypeDB::bind_method(_MD("get_fragment_code"),&Shader::get_fragment_code); - ObjectTypeDB::bind_method(_MD("get_light_code"),&Shader::get_light_code); + ObjectTypeDB::bind_method(_MD("set_code","code"),&Shader::set_code); + ObjectTypeDB::bind_method(_MD("get_code"),&Shader::get_code); ObjectTypeDB::bind_method(_MD("set_default_texture_param","param","texture:Texture"),&Shader::set_default_texture_param); ObjectTypeDB::bind_method(_MD("get_default_texture_param:Texture","param"),&Shader::get_default_texture_param); ObjectTypeDB::bind_method(_MD("has_param","name"),&Shader::has_param); - ObjectTypeDB::bind_method(_MD("_set_code","code"),&Shader::_set_code); - ObjectTypeDB::bind_method(_MD("_get_code"),&Shader::_get_code); - //ObjectTypeDB::bind_method(_MD("get_param_list"),&Shader::get_fragment_code); - ADD_PROPERTY( PropertyInfo(Variant::STRING, "_code",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_code"), _SCS("_get_code") ); + ADD_PROPERTY( PropertyInfo(Variant::STRING, "code",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("set_code"), _SCS("get_code") ); BIND_CONSTANT( MODE_MATERIAL ); BIND_CONSTANT( MODE_CANVAS_ITEM ); @@ -214,253 +150,3 @@ Shader::~Shader() { } - -/************ Loader from text ***************/ - - - -RES ResourceFormatLoaderShader::load(const String &p_path, const String& p_original_path, Error *r_error) { - - if (r_error) - *r_error=ERR_FILE_CANT_OPEN; - - String fragment_code; - String vertex_code; - String light_code; - - int mode=-1; - - Error err; - FileAccess *f = FileAccess::open(p_path,FileAccess::READ,&err); - - - ERR_EXPLAIN("Unable to open shader file: "+p_path); - ERR_FAIL_COND_V(err,RES()); - String base_path = p_path.get_base_dir(); - - if (r_error) - *r_error=ERR_FILE_CORRUPT; - - Ref shader;//( memnew( Shader ) ); - - int line=0; - - while(!f->eof_reached()) { - - String l = f->get_line(); - line++; - - if (mode<=0) { - l = l.strip_edges(); - int comment = l.find(";"); - if (comment!=-1) - l=l.substr(0,comment); - } - - if (mode<1) - vertex_code+="\n"; - if (mode<2) - fragment_code+="\n"; - - if (mode < 1 && l=="") - continue; - - if (l.begins_with("[")) { - l=l.strip_edges(); - if (l=="[params]") { - if (mode>=0) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [params] section."); - ERR_FAIL_V(RES()); - } - mode=0; - } else if (l=="[vertex]") { - if (mode>=1) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [vertex] section."); - ERR_FAIL_V(RES()); - } - mode=1; - } else if (l=="[fragment]") { - if (mode>=2) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [fragment] section."); - ERR_FAIL_V(RES()); - } - mode=1; - } else { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Unknown section type: '"+l+"'."); - ERR_FAIL_V(RES()); - } - continue; - } - - if (mode==0) { - - int eqpos = l.find("="); - if (eqpos==-1) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Expected '='."); - ERR_FAIL_V(RES()); - } - - - String right=l.substr(eqpos+1,l.length()).strip_edges(); - if (right=="") { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Expected value after '='."); - ERR_FAIL_V(RES()); - } - - Variant value; - - if (right=="true") { - value = true; - } else if (right=="false") { - value = false; - } else if (right.is_valid_float()) { - //is number - value = right.to_double(); - } else if (right.is_valid_html_color()) { - //is html color - value = Color::html(right); - } else { - //attempt to parse a constructor - int popenpos = right.find("("); - - if (popenpos==-1) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor syntax: "+right); - ERR_FAIL_V(RES()); - } - - int pclosepos = right.find_last(")"); - - if (pclosepos==-1) { - ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor parameter syntax: "+right); - ERR_FAIL_V(RES()); - - } - - String type = right.substr(0,popenpos); - String param = right.substr(popenpos+1,pclosepos-popenpos-1).strip_edges(); - - - if (type=="tex") { - - if (param=="") { - - value=RID(); - } else { - - String path; - - if (param.is_abs_path()) - path=param; - else - path=base_path+"/"+param; - - Ref texture = ResourceLoader::load(path); - if (!texture.is_valid()) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Couldn't find icon at path: "+path); - ERR_FAIL_V(RES()); - } - - value=texture; - } - - } else if (type=="vec3") { - - if (param=="") { - value=Vector3(); - } else { - Vector params = param.split(","); - if (params.size()!=3) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid param count for vec3(): '"+right+"'."); - ERR_FAIL_V(RES()); - - } - - Vector3 v; - for(int i=0;i<3;i++) - v[i]=params[i].to_double(); - value=v; - } - - - } else if (type=="xform") { - - if (param=="") { - value=Transform(); - } else { - - Vector params = param.split(","); - if (params.size()!=12) { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid param count for xform(): '"+right+"'."); - ERR_FAIL_V(RES()); - - } - - Transform t; - for(int i=0;i<9;i++) - t.basis[i%3][i/3]=params[i].to_double(); - for(int i=0;i<3;i++) - t.origin[i]=params[i-9].to_double(); - - value=t; - } - - } else { - memdelete(f); - ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor type: '"+type+"'."); - ERR_FAIL_V(RES()); - - } - - } - - String left= l.substr(0,eqpos); - -// shader->set_param(left,value); - } else if (mode==1) { - - vertex_code+=l; - - } else if (mode==2) { - - fragment_code+=l; - } - } - - shader->set_code(vertex_code,fragment_code,light_code); - - f->close(); - memdelete(f); - if (r_error) - *r_error=OK; - - return shader; -} - -void ResourceFormatLoaderShader::get_recognized_extensions(List *p_extensions) const { - - ObjectTypeDB::get_extensions_for_type("Shader", p_extensions); -} - -bool ResourceFormatLoaderShader::handles_type(const String& p_type) const { - - return ObjectTypeDB::is_type(p_type, "Shader"); -} - - -String ResourceFormatLoaderShader::get_resource_type(const String &p_path) const { - - if (p_path.extension().to_lower()=="shd") - return "Shader"; - return ""; -} - diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 6ee8d4e793..988305b654 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -32,6 +32,7 @@ #include "resource.h" #include "io/resource_loader.h" #include "scene/resources/texture.h" + class Shader : public Resource { OBJ_TYPE(Shader,Resource); @@ -49,9 +50,6 @@ public: private: RID shader; Mode mode; - Dictionary _get_code(); - void _set_code(const Dictionary& p_string); - // hack the name of performance // shaders keep a list of ShaderMaterial -> VisualServer name translations, to make @@ -73,10 +71,8 @@ public: //void set_mode(Mode p_mode); Mode get_mode() const; - void set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs=0,int p_light_ofs=0); - String get_vertex_code() const; - String get_fragment_code() const; - String get_light_code() const; + void set_code( const String& p_code); + String get_code() const; void get_param_list(List *p_params) const; bool has_param(const StringName& p_param) const; @@ -124,14 +120,5 @@ public: -class ResourceFormatLoaderShader : public ResourceFormatLoader { -public: - virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); - virtual void get_recognized_extensions(List *p_extensions) const; - virtual bool handles_type(const String& p_type) const; - virtual String get_resource_type(const String &p_path) const; -}; - - #endif // SHADER_H diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 02faa9425d..c62479ca89 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -29,6 +29,7 @@ #include "shader_graph.h" #include "scene/scene_string_names.h" +#if 0 Array ShaderGraph::_get_node_list(ShaderType p_type) const { List nodes; @@ -2489,7 +2490,7 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector it = memnew( ImageTexture ); it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS); @@ -2559,7 +2560,7 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector it = memnew( ImageTexture ); it->create_from_image(gradient,Texture::FLAG_FILTER|Texture::FLAG_MIPMAPS); @@ -2660,3 +2661,5 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vectorcanvas_item_add_style_box( p_canvas_item,r,region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),draw_center,modulate); + VisualServer::get_singleton()->canvas_item_add_nine_patch( p_canvas_item,r,region_rect,texture->get_rid(),Vector2(margin[MARGIN_LEFT],margin[MARGIN_TOP]),Vector2(margin[MARGIN_RIGHT],margin[MARGIN_BOTTOM]),VS::NINE_PATCH_STRETCH,VS::NINE_PATCH_STRETCH,draw_center,modulate); } void StyleBoxTexture::set_draw_center(bool p_draw) { @@ -423,127 +423,3 @@ StyleBoxFlat::~StyleBoxFlat() { } -//////////////// - - - -void StyleBoxImageMask::_bind_methods() { - - ObjectTypeDB::bind_method(_MD("set_image","image"),&StyleBoxImageMask::set_image); - ObjectTypeDB::bind_method(_MD("get_image"),&StyleBoxImageMask::get_image); - ObjectTypeDB::bind_method(_MD("set_expand","expand"),&StyleBoxImageMask::set_expand); - ObjectTypeDB::bind_method(_MD("get_expand"),&StyleBoxImageMask::get_expand); - ObjectTypeDB::bind_method(_MD("set_expand_margin_size","margin","size"),&StyleBoxImageMask::set_expand_margin_size); - ObjectTypeDB::bind_method(_MD("get_expand_margin_size","margin"),&StyleBoxImageMask::get_expand_margin_size); - - ADD_PROPERTY( PropertyInfo(Variant::IMAGE, "image"), _SCS("set_image"), _SCS("get_image")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL, "expand"), _SCS("set_expand"), _SCS("get_expand")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/left", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_LEFT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/right", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_RIGHT ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/top", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_TOP ); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "expand_margin/bottom", PROPERTY_HINT_RANGE,"0,2048,1" ), _SCS("set_expand_margin_size"),_SCS("get_expand_margin_size"), MARGIN_BOTTOM ); - -} - - -bool StyleBoxImageMask::test_mask(const Point2& p_point, const Rect2& p_rect) const { - - if (image.empty()) - return false; - if (p_rect.size.x<1) - return false; - if (p_rect.size.y<1) - return false; - - Size2i imgsize(image.get_width(),image.get_height()); - if (imgsize.x<=0 || imgsize.y<=0) - return false; - - Point2i img_expand_size( imgsize.x - expand_margin[MARGIN_LEFT] - expand_margin[MARGIN_RIGHT], imgsize.y - expand_margin[MARGIN_TOP] - expand_margin[MARGIN_BOTTOM]); - Point2i rect_expand_size( p_rect.size.x - expand_margin[MARGIN_LEFT] - expand_margin[MARGIN_RIGHT], p_rect.size.y - expand_margin[MARGIN_TOP] - expand_margin[MARGIN_BOTTOM]); - if (rect_expand_size.x<1) - rect_expand_size.x=1; - if (rect_expand_size.y<1) - rect_expand_size.y=1; - - - Point2i click_pos; - - - //treat x - - if (p_point.x=p_rect.pos.x+p_rect.size.x) - click_pos.x=imgsize.x-1; - else if ((p_point.x-p_rect.pos.x) imgsize.x) - click_pos.x=imgsize.x; - - //treat y - - if (p_point.y=p_rect.pos.y+p_rect.size.y) - click_pos.y=imgsize.y-1; - else if ((p_point.y-p_rect.pos.y) imgsize.y) - click_pos.y=imgsize.y; - - return image.get_pixel(click_pos.x,click_pos.y).gray()>0.5; - -} - - -void StyleBoxImageMask::set_image(const Image& p_image) { - - image=p_image; -} -Image StyleBoxImageMask::get_image() const { - - return image; -} - - -void StyleBoxImageMask::set_expand(bool p_expand) { - - expand=p_expand; -} -bool StyleBoxImageMask::get_expand() const { - - return expand; -} -void StyleBoxImageMask::set_expand_margin_size(Margin p_expand_margin,float p_size) { - - ERR_FAIL_INDEX(p_expand_margin,4); - expand_margin[p_expand_margin]=p_size; -} - - -float StyleBoxImageMask::get_expand_margin_size(Margin p_expand_margin) const { - - ERR_FAIL_INDEX_V(p_expand_margin,4,0); - return expand_margin[p_expand_margin]; -} - -StyleBoxImageMask::StyleBoxImageMask() { - - for (int i=0;i<4;i++) { - expand_margin[i]=0; - } - expand=true; -} diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index f667318e24..6ac67148c5 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -167,35 +167,5 @@ public: }; -class StyleBoxImageMask : public StyleBox { - - OBJ_TYPE( StyleBoxImageMask, StyleBox ); - virtual float get_style_margin(Margin p_margin) const { return 0; } - - Image image; - float expand_margin[4]; - bool expand; - -protected: - - static void _bind_methods(); - -public: - - virtual void draw(RID p_canvas_item,const Rect2& p_rect) const {} - virtual bool test_mask(const Point2& p_point, const Rect2& p_rect) const; - - void set_image(const Image& p_image); - Image get_image() const; - - void set_expand(bool p_expand); - bool get_expand() const; - void set_expand_margin_size(Margin p_expand_margin,float p_size); - float get_expand_margin_size(Margin p_expand_margin) const; - - StyleBoxImageMask(); - -}; - #endif diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 726b1938c4..c83c5e6b80 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -258,23 +258,13 @@ void ImageTexture::load(const String& p_path) { void ImageTexture::set_data(const Image& p_image) { VisualServer::get_singleton()->texture_set_data(texture,p_image); - VisualServer::get_singleton()->texture_set_reload_hook(texture,0,StringName()); //hook is erased if data is changed + _change_notify(); } void ImageTexture::_resource_path_changed() { String path=get_path(); - if (VS::get_singleton()->has_feature(VS::FEATURE_NEEDS_RELOAD_HOOK)) { - //this needs to be done much better, but probably will end up being deprecated as technology advances - if (path.is_resource_file() && ImageLoader::recognize(path.extension())) { - - //hook is set only if path is hookable - VisualServer::get_singleton()->texture_set_reload_hook(texture,get_instance_ID(),"_reload_hook"); - } else { - VisualServer::get_singleton()->texture_set_reload_hook(texture,0,StringName()); - } - } } Image ImageTexture::get_data() const { @@ -300,7 +290,7 @@ RID ImageTexture::get_rid() const { void ImageTexture::fix_alpha_edges() { - if (format==Image::FORMAT_RGBA /*&& !(flags&FLAG_CUBEMAP)*/) { + if (format==Image::FORMAT_RGBA8 /*&& !(flags&FLAG_CUBEMAP)*/) { Image img = get_data(); img.fix_alpha_edges(); @@ -310,7 +300,7 @@ void ImageTexture::fix_alpha_edges() { void ImageTexture::premultiply_alpha() { - if (format==Image::FORMAT_RGBA /*&& !(flags&FLAG_CUBEMAP)*/) { + if (format==Image::FORMAT_RGBA8 /*&& !(flags&FLAG_CUBEMAP)*/) { Image img = get_data(); img.premultiply_alpha(); @@ -337,7 +327,7 @@ void ImageTexture::shrink_x2_and_keep_size() { bool ImageTexture::has_alpha() const { - return ( format==Image::FORMAT_GRAYSCALE_ALPHA || format==Image::FORMAT_INDEXED_ALPHA || format==Image::FORMAT_RGBA ); + return ( format==Image::FORMAT_LA8 || format==Image::FORMAT_RGBA8 ); } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 05ea833978..fc5f05479c 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -54,7 +54,7 @@ public: FLAG_FILTER=VisualServer::TEXTURE_FLAG_FILTER, FLAG_ANISOTROPIC_FILTER=VisualServer::TEXTURE_FLAG_ANISOTROPIC_FILTER, FLAG_CONVERT_TO_LINEAR=VisualServer::TEXTURE_FLAG_CONVERT_TO_LINEAR, - FLAG_VIDEO_SURFACE=VisualServer::TEXTURE_FLAG_VIDEO_SURFACE, + FLAG_VIDEO_SURFACE=VisualServer::TEXTURE_FLAG_USED_FOR_STREAMING, FLAGS_DEFAULT=FLAG_MIPMAPS|FLAG_REPEAT|FLAG_FILTER, FLAG_MIRRORED_REPEAT=VisualServer::TEXTURE_FLAG_MIRRORED_REPEAT }; diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index fda952fa94..2f56479404 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -53,7 +53,7 @@ class AudioServerSW : public AudioServer { virtual AudioMixer *get_mixer(); virtual void audio_mixer_chunk_callback(int p_frames); - struct Voice { + struct Voice : public RID_Data { float volume; volatile bool active; @@ -67,7 +67,7 @@ class AudioServerSW : public AudioServer { mutable RID_Owner voice_owner; SelfList::List active_list; - struct Stream { + struct Stream : public RID_Data { bool active; List::Element *E; AudioStream *audio_stream; diff --git a/servers/audio/sample_manager_sw.h b/servers/audio/sample_manager_sw.h index bd7a11a3d2..6ca3a8e8fb 100644 --- a/servers/audio/sample_manager_sw.h +++ b/servers/audio/sample_manager_sw.h @@ -74,7 +74,7 @@ public: class SampleManagerMallocSW : public SampleManagerSW { - struct Sample { + struct Sample : public RID_Data { void *data; int length; diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp index bfe41f8423..f1c19a618f 100644 --- a/servers/physics/broad_phase_octree.cpp +++ b/servers/physics/broad_phase_octree.cpp @@ -29,7 +29,7 @@ #include "broad_phase_octree.h" #include "collision_object_sw.h" -ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) { +BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) { ID oid = octree.create(p_object,AABB(),p_subindex,false,1<get_type(),0); return oid; diff --git a/servers/physics/constraint_sw.h b/servers/physics/constraint_sw.h index d61701ac07..5aa96bc026 100644 --- a/servers/physics/constraint_sw.h +++ b/servers/physics/constraint_sw.h @@ -31,7 +31,7 @@ #include "body_sw.h" -class ConstraintSW { +class ConstraintSW : public RID_Data { BodySW **_body_ptr; int _body_count; diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 39779bcda3..8901c706cc 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -46,7 +46,7 @@ SHAPE_CUSTOM, ///< Server-Implementation based custom shape, calling shape_creat class ShapeSW; -class ShapeOwnerSW { +class ShapeOwnerSW : public RID_Data { public: virtual void _shape_changed()=0; @@ -56,7 +56,7 @@ public: }; -class ShapeSW { +class ShapeSW : public RID_Data { RID self; AABB aabb; diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 3fdef7e62b..30720b8be2 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -57,7 +57,7 @@ public: -class SpaceSW { +class SpaceSW : public RID_Data { public: diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp index 3a95bb2411..0f45735d56 100644 --- a/servers/physics_2d/broad_phase_2d_basic.cpp +++ b/servers/physics_2d/broad_phase_2d_basic.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "broad_phase_2d_basic.h" -ID BroadPhase2DBasic::create(CollisionObject2DSW *p_object_, int p_subindex) { +BroadPhase2DBasic::ID BroadPhase2DBasic::create(CollisionObject2DSW *p_object_, int p_subindex) { current++; diff --git a/servers/physics_2d/constraint_2d_sw.h b/servers/physics_2d/constraint_2d_sw.h index f776dbfe2c..c2d1357f26 100644 --- a/servers/physics_2d/constraint_2d_sw.h +++ b/servers/physics_2d/constraint_2d_sw.h @@ -31,7 +31,7 @@ #include "body_2d_sw.h" -class Constraint2DSW { +class Constraint2DSW : public RID_Data { Body2DSW **_body_ptr; int _body_count; diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index b90c36bc04..e069de883f 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -46,7 +46,7 @@ SHAPE_CUSTOM, ///< Server-Implementation based custom shape, calling shape_creat class Shape2DSW; -class ShapeOwner2DSW { +class ShapeOwner2DSW : public RID_Data{ public: virtual void _shape_changed()=0; @@ -55,7 +55,7 @@ public: virtual ~ShapeOwner2DSW() {} }; -class Shape2DSW { +class Shape2DSW : public RID_Data { RID self; Rect2 aabb; diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index f58e8c3fe7..93dbc99c40 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -58,7 +58,7 @@ public: -class Space2DSW { +class Space2DSW : public RID_Data { public: diff --git a/servers/spatial_sound/spatial_sound_server_sw.h b/servers/spatial_sound/spatial_sound_server_sw.h index b4295bf145..68bcf60707 100644 --- a/servers/spatial_sound/spatial_sound_server_sw.h +++ b/servers/spatial_sound/spatial_sound_server_sw.h @@ -67,7 +67,7 @@ class SpatialSoundServerSW : public SpatialSoundServer { struct Room; - struct Space { + struct Space : public RID_Data { RID default_room; Set rooms; @@ -79,7 +79,7 @@ class SpatialSoundServerSW : public SpatialSoundServer { mutable RID_Owner space_owner; - struct Room { + struct Room : public RID_Data{ RID space; Transform transform; Transform inverse_transform; @@ -97,7 +97,7 @@ class SpatialSoundServerSW : public SpatialSoundServer { - struct Source { + struct Source : public RID_Data { struct Voice { @@ -161,7 +161,7 @@ class SpatialSoundServerSW : public SpatialSoundServer { mutable RID_Owner source_owner; - struct Listener { + struct Listener : public RID_Data { RID space; Transform transform; diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h index 619b11f376..e601de6eed 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h @@ -66,7 +66,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { struct Room; - struct Space { + struct Space : public RID_Data { RID default_room; Set rooms; @@ -78,7 +78,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { mutable RID_Owner space_owner; - struct Room { + struct Room : public RID_Data { RID space; Matrix32 transform; Matrix32 inverse_transform; @@ -96,7 +96,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { - struct Source { + struct Source : public RID_Data { struct Voice { @@ -160,7 +160,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { mutable RID_Owner source_owner; - struct Listener { + struct Listener : public RID_Data { RID space; Matrix32 transform; diff --git a/servers/visual/particle_system_sw.cpp b/servers/visual/particle_system_sw.cpp deleted file mode 100644 index 07cc6d8a2a..0000000000 --- a/servers/visual/particle_system_sw.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/*************************************************************************/ -/* particle_system_sw.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "particle_system_sw.h" -#include "sort.h" - - -ParticleSystemSW::ParticleSystemSW() { - - amount=8; - emitting=true; - - for (int i=0;iamount<=0) { - ERR_EXPLAIN("Invalid amount of particles: "+itos(p_system->amount)); - ERR_FAIL_COND(p_system->amount<=0); - } - if (p_system->attractor_count<0 || p_system->attractor_count>VS::MAX_PARTICLE_ATTRACTORS) { - ERR_EXPLAIN("Invalid amount of particle attractors."); - ERR_FAIL_COND(p_system->attractor_count<0 || p_system->attractor_count>VS::MAX_PARTICLE_ATTRACTORS); - } - float lifetime = p_system->particle_vars[VS::PARTICLE_LIFETIME]; - if (lifetimeamount,ParticleSystemSW::MAX_PARTICLES);; - - - int emission_point_count = p_system->emission_points.size(); - DVector::Read r; - if (emission_point_count) - r=p_system->emission_points.read(); - - if (particle_count!=particle_data.size()) { - - //clear the whole system if particle amount changed - particle_data.clear(); - particle_data.resize(p_system->amount); - particle_system_time=0; - } - - float next_time = particle_system_time+p_time; - - if (next_time > lifetime) - next_time=Math::fmod(next_time,lifetime); - - - ParticleData *pdata=&particle_data[0]; - Vector3 attractor_positions[VS::MAX_PARTICLE_ATTRACTORS]; - - for(int i=0;iattractor_count;i++) { - - attractor_positions[i]=p_transform.xform(p_system->attractors[i].pos); - } - - - for(int i=0;iamount); - - bool restart=false; - - if ( next_time < particle_system_time ) { - - if (restart_time > particle_system_time || restart_time < next_time ) - restart=true; - - } else if (restart_time > particle_system_time && restart_time < next_time ) { - restart=true; - } - - if (restart) { - - - if (p_system->emitting) { - if (emission_point_count==0) { //use AABB - if (p_system->local_coordinates) - p.pos = p_system->emission_half_extents * Vector3( _rand_from_seed(&rand_seed), _rand_from_seed(&rand_seed), _rand_from_seed(&rand_seed) ); - else - p.pos = p_transform.xform( p_system->emission_half_extents * Vector3( _rand_from_seed(&rand_seed), _rand_from_seed(&rand_seed), _rand_from_seed(&rand_seed) ) ); - } else { - //use preset positions - if (p_system->local_coordinates) - p.pos = r[_irand_from_seed(&rand_seed)%emission_point_count]; - else - p.pos = p_transform.xform( r[_irand_from_seed(&rand_seed)%emission_point_count] ); - } - - - float angle1 = _rand_from_seed(&rand_seed)*p_system->particle_vars[VS::PARTICLE_SPREAD]*Math_PI; - float angle2 = _rand_from_seed(&rand_seed)*20.0*Math_PI; // make it more random like - - Vector3 rot_xz=Vector3( Math::sin(angle1), 0.0, Math::cos(angle1) ); - Vector3 rot = Vector3( Math::cos(angle2)*rot_xz.x,Math::sin(angle2)*rot_xz.x, rot_xz.z); - - p.vel=(rot*p_system->particle_vars[VS::PARTICLE_LINEAR_VELOCITY]+rot*p_system->particle_randomness[VS::PARTICLE_LINEAR_VELOCITY]*_rand_from_seed(&rand_seed)); - if (!p_system->local_coordinates) - p.vel=p_transform.basis.xform( p.vel ); - - p.vel+=p_system->emission_base_velocity; - - p.rot=p_system->particle_vars[VS::PARTICLE_INITIAL_ANGLE]+p_system->particle_randomness[VS::PARTICLE_INITIAL_ANGLE]*_rand_from_seed(&rand_seed); - p.active=true; - for(int r=0;rgravity_normal * (p_system->particle_vars[VS::PARTICLE_GRAVITY]+(p_system->particle_randomness[VS::PARTICLE_GRAVITY]*p.random[0])); - //apply linear acceleration - force+=p.vel.normalized() * (p_system->particle_vars[VS::PARTICLE_LINEAR_ACCELERATION]+p_system->particle_randomness[VS::PARTICLE_LINEAR_ACCELERATION]*p.random[1]); - //apply radial acceleration - Vector3 org; - if (!p_system->local_coordinates) - org=p_transform.origin; - force+=(p.pos-org).normalized() * (p_system->particle_vars[VS::PARTICLE_RADIAL_ACCELERATION]+p_system->particle_randomness[VS::PARTICLE_RADIAL_ACCELERATION]*p.random[2]); - //apply tangential acceleration - force+=(p.pos-org).cross(p_system->gravity_normal).normalized() * (p_system->particle_vars[VS::PARTICLE_TANGENTIAL_ACCELERATION]+p_system->particle_randomness[VS::PARTICLE_TANGENTIAL_ACCELERATION]*p.random[3]); - //apply attractor forces - for(int a=0;aattractor_count;a++) { - - force+=(p.pos-attractor_positions[a]).normalized() * p_system->attractors[a].force; - } - - - p.vel+=force * p_time; - if (p_system->particle_vars[VS::PARTICLE_DAMPING]) { - - float v = p.vel.length(); - float damp = p_system->particle_vars[VS::PARTICLE_DAMPING] + p_system->particle_vars[VS::PARTICLE_DAMPING] * p_system->particle_randomness[VS::PARTICLE_DAMPING]; - v -= damp * p_time; - if (v<0) { - p.vel=Vector3(); - } else { - p.vel=p.vel.normalized() * v; - } - - } - p.rot+=(p_system->particle_vars[VS::PARTICLE_ANGULAR_VELOCITY]+p_system->particle_randomness[VS::PARTICLE_ANGULAR_VELOCITY]*p.random[4]) *p_time; - p.pos+=p.vel * p_time; - } - } - - particle_system_time=Math::fmod( particle_system_time+p_time, lifetime ); - - -} - -ParticleSystemProcessSW::ParticleSystemProcessSW() { - - particle_system_time=0; - rand_seed=1234567; - valid=false; -} - - -struct _ParticleSorterSW { - - - _FORCE_INLINE_ bool operator()(const ParticleSystemDrawInfoSW::ParticleDrawInfo *p_a,const ParticleSystemDrawInfoSW::ParticleDrawInfo *p_b) const { - - return p_a->d > p_b->d; // draw from further away to closest - } -}; - -void ParticleSystemDrawInfoSW::prepare(const ParticleSystemSW *p_system,const ParticleSystemProcessSW *p_process,const Transform& p_system_transform,const Transform& p_camera_transform) { - - ERR_FAIL_COND(p_process->particle_data.size() != p_system->amount); - ERR_FAIL_COND(p_system->amount<=0 || p_system->amount>=ParticleSystemSW::MAX_PARTICLES); - - const ParticleSystemProcessSW::ParticleData *pdata=&p_process->particle_data[0]; - float time_pos=p_process->particle_system_time/p_system->particle_vars[VS::PARTICLE_LIFETIME]; - - ParticleSystemSW::ColorPhase cphase[VS::MAX_PARTICLE_COLOR_PHASES]; - - float last=-1; - int col_count=0; - - for(int i=0;icolor_phase_count;i++) { - - if (p_system->color_phases[i].pos<=last) - break; - cphase[i]=p_system->color_phases[i]; - col_count++; - } - - - - - - Vector3 camera_z_axis = p_camera_transform.basis.get_axis(2); - - for(int i=0;iamount;i++) { - - ParticleDrawInfo &pdi=draw_info[i]; - pdi.data=&pdata[i]; - pdi.transform.origin=pdi.data->pos; - if (p_system->local_coordinates) - pdi.transform.origin=p_system_transform.xform(pdi.transform.origin); - - pdi.d=-camera_z_axis.dot(pdi.transform.origin); - - // adjust particle size, color and rotation - - float time = ((float)i / p_system->amount); - if (timeheight_from_velocity) { - - Vector3 veld = pdi.data->vel; - Vector3 cam_z = camera_z_axis.normalized(); - float vc = Math::abs(veld.normalized().dot(cam_z)); - - if (vc<(1.0-CMP_EPSILON)) { - up = Plane(cam_z,0).project(veld).normalized(); - float h = p_system->particle_vars[VS::PARTICLE_HEIGHT]+p_system->particle_randomness[VS::PARTICLE_HEIGHT]*pdi.data->random[7]; - float velh = veld.length(); - h+=velh*(p_system->particle_vars[VS::PARTICLE_HEIGHT_SPEED_SCALE]+p_system->particle_randomness[VS::PARTICLE_HEIGHT_SPEED_SCALE]*pdi.data->random[7]); - - - up_scale=Math::lerp(1.0,h,(1.0-vc)); - } - - } else if (pdi.data->rot) { - - up.rotate(camera_z_axis,pdi.data->rot); - } - - { - // matrix - Vector3 v_z = (p_camera_transform.origin-pdi.transform.origin).normalized(); -// Vector3 v_z = (p_camera_transform.origin-pdi.data->pos).normalized(); - Vector3 v_y = up; - Vector3 v_x = v_y.cross(v_z); - v_y = v_z.cross(v_x); - v_x.normalize(); - v_y.normalize(); - - - float initial_scale, final_scale; - initial_scale = p_system->particle_vars[VS::PARTICLE_INITIAL_SIZE]+p_system->particle_randomness[VS::PARTICLE_INITIAL_SIZE]*pdi.data->random[5]; - final_scale = p_system->particle_vars[VS::PARTICLE_FINAL_SIZE]+p_system->particle_randomness[VS::PARTICLE_FINAL_SIZE]*pdi.data->random[6]; - float scale = initial_scale + time * (final_scale - initial_scale); - - pdi.transform.basis.set_axis(0,v_x * scale); - pdi.transform.basis.set_axis(1,v_y * scale * up_scale); - pdi.transform.basis.set_axis(2,v_z * scale); - } - - - - int cpos=0; - - while(cpos time) - break; - cpos++; - } - - cpos--; - - - if (cpos==-1) - pdi.color=Color(1,1,1,1); - else { - if (cpos==col_count-1) - pdi.color=cphase[cpos].color; - else { - float diff = (cphase[cpos+1].pos-cphase[cpos].pos); - if (diff>0) - pdi.color=cphase[cpos].color.linear_interpolate(cphase[cpos+1].color, (time - cphase[cpos].pos) / diff ); - else - pdi.color=cphase[cpos+1].color; - } - } - - - draw_info_order[i]=&pdi; - - } - - - SortArray particle_sort; - particle_sort.sort(&draw_info_order[0],p_system->amount); - -} diff --git a/servers/visual/particle_system_sw.h b/servers/visual/particle_system_sw.h deleted file mode 100644 index 4edcecaaa9..0000000000 --- a/servers/visual/particle_system_sw.h +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************/ -/* particle_system_sw.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 PARTICLE_SYSTEM_SW_H -#define PARTICLE_SYSTEM_SW_H - -/** - @author Juan Linietsky -*/ - -#include "servers/visual_server.h" - -struct ParticleSystemSW { - enum { - - MAX_PARTICLES=1024 - }; - - float particle_vars[VS::PARTICLE_VAR_MAX]; - float particle_randomness[VS::PARTICLE_VAR_MAX]; - - Vector3 emission_half_extents; - DVector emission_points; - Vector3 gravity_normal; - Vector3 emission_base_velocity; - int amount; - bool emitting; - bool height_from_velocity; - AABB visibility_aabb; - bool sort; - bool local_coordinates; - - struct ColorPhase { - - float pos; - Color color; - ColorPhase() { pos=1.0; color=Color(0.0,0.0,1.0,1.0); } - }; - - int color_phase_count; - ColorPhase color_phases[VS::MAX_PARTICLE_COLOR_PHASES]; - - - struct Attractor { - - Vector3 pos; - float force; - }; - - int attractor_count; - Attractor attractors[VS::MAX_PARTICLE_ATTRACTORS]; - - - ParticleSystemSW(); - ~ParticleSystemSW(); - -}; - - -struct ParticleSystemProcessSW { - - enum { - PARTICLE_RANDOM_NUMBERS = 8, - }; - - struct ParticleData { - - Vector3 pos; - Vector3 vel; - float rot; - bool active; - float random[PARTICLE_RANDOM_NUMBERS]; - - ParticleData() { active=0; rot=0; } - }; - - - bool valid; - float particle_system_time; - uint32_t rand_seed; - Vector particle_data; - - void process(const ParticleSystemSW *p_system,const Transform& p_transform,float p_time); - - ParticleSystemProcessSW(); -}; - -struct ParticleSystemDrawInfoSW { - - struct ParticleDrawInfo { - - const ParticleSystemProcessSW::ParticleData *data; - float d; - Transform transform; - Color color; - - }; - - ParticleDrawInfo draw_info[ParticleSystemSW::MAX_PARTICLES]; - ParticleDrawInfo *draw_info_order[ParticleSystemSW::MAX_PARTICLES]; - - void prepare(const ParticleSystemSW *p_system,const ParticleSystemProcessSW *p_process,const Transform& p_system_transform,const Transform& p_camera_transform); - -}; - -#endif diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index a4b91e17fe..2952098a3c 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -30,6 +30,23 @@ #include "print_string.h" #include "os/os.h" + +Rasterizer* (*Rasterizer::_create_func)()=NULL; + +Rasterizer *Rasterizer::create() { + + return _create_func(); +} + +RasterizerStorage*RasterizerStorage::base_signleton=NULL; + +RasterizerStorage::RasterizerStorage() { + + base_signleton=this; +} + +#if 0 + RID Rasterizer::create_default_material() { return material_create(); @@ -636,3 +653,5 @@ RID Rasterizer::create_overdraw_debug_material() { return mat; } + +#endif diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 8cc567072f..df18dd1679 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -29,6 +29,670 @@ #ifndef RASTERIZER_H #define RASTERIZER_H + +#include "servers/visual_server.h" +#include "camera_matrix.h" + + + +class RasterizerStorage { +public: + /* TEXTURE API */ + + virtual RID texture_create()=0; + virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=VS::TEXTURE_FLAGS_DEFAULT)=0; + virtual void texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT)=0; + virtual Image texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT) const=0; + virtual void texture_set_flags(RID p_texture,uint32_t p_flags)=0; + virtual uint32_t texture_get_flags(RID p_texture) const=0; + virtual Image::Format texture_get_format(RID p_texture) const=0; + virtual uint32_t texture_get_width(RID p_texture) const=0; + virtual uint32_t texture_get_height(RID p_texture) const=0; + virtual void texture_set_size_override(RID p_texture,int p_width, int p_height)=0; + + virtual void texture_set_path(RID p_texture,const String& p_path)=0; + virtual String texture_get_path(RID p_texture) const=0; + + virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0; + + virtual void texture_debug_usage(List *r_info)=0; + + + /* SHADER API */ + + + virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_SPATIAL)=0; + + virtual void shader_set_mode(RID p_shader,VS::ShaderMode p_mode)=0; + virtual VS::ShaderMode shader_get_mode(RID p_shader) const=0; + + virtual void shader_set_code(RID p_shader, const String& p_code)=0; + virtual String shader_get_code(RID p_shader) const=0; + virtual void shader_get_param_list(RID p_shader, List *p_param_list) const=0; + + virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture)=0; + virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const=0; + + + /* COMMON MATERIAL API */ + + virtual RID material_create()=0; + + virtual void material_set_shader(RID p_shader_material, RID p_shader)=0; + virtual RID material_get_shader(RID p_shader_material) const=0; + + virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0; + virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0; + + /* MESH API */ + + virtual RID mesh_create()=0; + + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >())=0; + + virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; + virtual int mesh_get_morph_target_count(RID p_mesh) const=0; + + + virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode)=0; + virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; + + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; + virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; + + virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const=0; + virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const=0; + + virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const=0; + virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; + + + virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; + virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; + + virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; + virtual int mesh_get_surface_count(RID p_mesh) const=0; + + virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb)=0; + virtual AABB mesh_get_custom_aabb(RID p_mesh) const=0; + + virtual AABB mesh_get_aabb(RID p_mesh) const=0; + virtual void mesh_clear(RID p_mesh)=0; + + /* MULTIMESH API */ + + + virtual RID multimesh_create()=0; + + virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb=true)=0; + virtual int multimesh_get_instance_count(RID p_multimesh) const=0; + + virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0; + virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb)=0; + virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0; + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0; + virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; + + virtual RID multimesh_get_mesh(RID p_multimesh) const=0; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const=0; + + virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; + virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; + virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const=0; + + virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0; + virtual int multimesh_get_visible_instances(RID p_multimesh) const=0; + + virtual AABB multimesh_get_aabb(RID p_mesh) const=0; + + /* IMMEDIATE API */ + + virtual RID immediate_create()=0; + virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID())=0; + virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0; + virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0; + virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0; + virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0; + virtual void immediate_color(RID p_immediate,const Color& p_color)=0; + virtual void immediate_uv(RID p_immediate,const Vector2& tex_uv)=0; + virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv)=0; + virtual void immediate_end(RID p_immediate)=0; + virtual void immediate_clear(RID p_immediate)=0; + virtual void immediate_set_material(RID p_immediate,RID p_material)=0; + virtual RID immediate_get_material(RID p_immediate) const=0; + + /* SKELETON API */ + + virtual RID skeleton_create()=0; + virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false)=0; + virtual int skeleton_get_bone_count(RID p_skeleton) const=0; + virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0; + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)=0; + + /* Light API */ + + virtual RID light_create(VS::LightType p_type)=0; + + virtual void light_set_color(RID p_light,const Color& p_color)=0; + virtual void light_set_param(RID p_light,VS::LightParam p_param,float p_value)=0; + virtual void light_set_shadow(RID p_light,bool p_enabled)=0; + virtual void light_set_projector(RID p_light,RID p_texture)=0; + virtual void light_set_attenuation_texure(RID p_light,RID p_texture)=0; + virtual void light_set_negative(RID p_light,bool p_enable)=0; + virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; + virtual void light_set_shader(RID p_light,RID p_shader)=0; + + + virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode)=0; + + /* PROBE API */ + + virtual RID reflection_probe_create()=0; + + virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity)=0; + virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far)=0; + virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance)=0; + virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents)=0; + virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset)=0; + virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution)=0; + virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide)=0; + virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0; + + + /* ROOM API */ + + virtual RID room_create()=0; + virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform)=0; + virtual void room_clear_bounds()=0; + + /* PORTAL API */ + + // portals are only (x/y) points, forming a convex shape, which its clockwise + // order points outside. (z is 0)=0; + + virtual RID portal_create()=0; + virtual void portal_set_shape(RID p_portal, const Vector& p_shape)=0; + virtual void portal_set_enabled(RID p_portal, bool p_enabled)=0; + virtual void portal_set_disable_distance(RID p_portal, float p_distance)=0; + virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0; + + + /* RENDER TARGET */ + + enum RenderTargetFlags { + RENDER_TARGET_VFLIP, + RENDER_TARGET_TRANSPARENT, + RENDER_TARGET_NO_3D, + RENDER_TARGET_NO_SAMPLING, + RENDER_TARGET_FLAG_MAX + }; + + virtual RID render_target_create()=0; + virtual void render_target_set_size(RID p_render_target,int p_width, int p_height)=0; + virtual RID render_target_get_texture(RID p_render_target) const=0; + virtual Image render_target_get_image(RID p_render_target) const=0; + virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value)=0; + virtual bool render_target_renedered_in_frame(RID p_render_target)=0; + + + /* CANVAS SHADOW */ + + virtual RID canvas_light_shadow_buffer_create(int p_width)=0; + + /* LIGHT SHADOW MAPPING */ + + virtual RID canvas_light_occluder_create()=0; + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines)=0; + + virtual bool free(RID p_rid)=0; + + + static RasterizerStorage*base_signleton; + RasterizerStorage(); + virtual ~RasterizerStorage() {} +}; + + + + +class RasterizerCanvas { +public: + + enum CanvasRectFlags { + + CANVAS_RECT_REGION=1, + CANVAS_RECT_TILE=2, + CANVAS_RECT_FLIP_H=4, + CANVAS_RECT_FLIP_V=8, + CANVAS_RECT_TRANSPOSE=16 + }; + + + struct Light : public RID_Data { + + + + bool enabled; + Color color; + Matrix32 xform; + float height; + float energy; + float scale; + int z_min; + int z_max; + int layer_min; + int layer_max; + int item_mask; + int item_shadow_mask; + VS::CanvasLightMode mode; + RID texture; + Vector2 texture_offset; + RID canvas; + RID shadow_buffer; + int shadow_buffer_size; + float shadow_gradient_length; + VS::CanvasLightShadowFilter shadow_filter; + Color shadow_color; + + + void *texture_cache; // implementation dependent + Rect2 rect_cache; + Matrix32 xform_cache; + float radius_cache; //used for shadow far plane + CameraMatrix shadow_matrix_cache; + + Matrix32 light_shader_xform; + Vector2 light_shader_pos; + + Light *shadows_next_ptr; + Light *filter_next_ptr; + Light *next_ptr; + Light *mask_next_ptr; + + RID light_internal; + + Light() { + enabled=true; + color=Color(1,1,1); + shadow_color=Color(0,0,0,0); + height=0; + z_min=-1024; + z_max=1024; + layer_min=0; + layer_max=0; + item_mask=1; + scale=1.0; + energy=1.0; + item_shadow_mask=-1; + mode=VS::CANVAS_LIGHT_MODE_ADD; + texture_cache=NULL; + next_ptr=NULL; + mask_next_ptr=NULL; + filter_next_ptr=NULL; + shadow_buffer_size=256; + shadow_gradient_length=0; + shadow_filter=VS::CANVAS_LIGHT_FILTER_NONE; + + } + }; + + virtual RID light_internal_create()=0; + virtual void light_internal_update(RID p_rid, Light* p_light)=0; + virtual void light_internal_free(RID p_rid)=0; + + struct Item : public RID_Data { + + struct Command { + + enum Type { + + TYPE_LINE, + TYPE_RECT, + TYPE_NINEPATCH, + TYPE_PRIMITIVE, + TYPE_POLYGON, + TYPE_MESH, + TYPE_MULTIMESH, + TYPE_CIRCLE, + TYPE_TRANSFORM, + TYPE_CLIP_IGNORE, + }; + + Type type; + virtual ~Command(){} + }; + + struct CommandLine : public Command { + + Point2 from,to; + Color color; + float width; + bool antialiased; + CommandLine() { type = TYPE_LINE; } + }; + + struct CommandRect : public Command { + + Rect2 rect; + RID texture; + Color modulate; + Rect2 source; + uint8_t flags; + + CommandRect() { flags=0; type = TYPE_RECT; } + }; + + struct CommandNinePatch : public Command { + + Rect2 rect; + Rect2 source; + RID texture; + float margin[4]; + bool draw_center; + Color color; + VS::NinePatchAxisMode axis_x; + VS::NinePatchAxisMode axis_y; + CommandNinePatch() { draw_center=true; type = TYPE_NINEPATCH; } + }; + + struct CommandPrimitive : public Command { + + Vector points; + Vector uvs; + Vector colors; + RID texture; + float width; + + CommandPrimitive() { type = TYPE_PRIMITIVE; width=1;} + }; + + struct CommandPolygon : public Command { + + Vector indices; + Vector points; + Vector uvs; + Vector colors; + RID texture; + int count; + + CommandPolygon() { type = TYPE_POLYGON; count = 0; } + }; + + + struct CommandMesh : public Command { + + RID mesh; + RID skeleton; + CommandMesh() { type = TYPE_MESH; } + }; + + struct CommandMultiMesh : public Command { + + RID multimesh; + RID skeleton; + CommandMultiMesh() { type = TYPE_MULTIMESH; } + }; + + struct CommandCircle : public Command { + + Point2 pos; + float radius; + Color color; + CommandCircle() { type = TYPE_CIRCLE; } + }; + + struct CommandTransform : public Command { + + Matrix32 xform; + CommandTransform() { type = TYPE_TRANSFORM; } + }; + + + struct CommandClipIgnore : public Command { + + bool ignore; + CommandClipIgnore() { type = TYPE_CLIP_IGNORE; ignore=false; } + }; + + + struct ViewportRender { + VisualServer*owner; + void* udata; + Rect2 rect; + }; + + Matrix32 xform; + bool clip; + bool visible; + bool behind; + //VS::MaterialBlendMode blend_mode; + int light_mask; + Vector commands; + mutable bool custom_rect; + mutable bool rect_dirty; + mutable Rect2 rect; + RID material; + Item*next; + + struct CopyBackBuffer { + Rect2 rect; + Rect2 screen_rect; + bool full; + }; + CopyBackBuffer *copy_back_buffer; + + + Color final_modulate; + Matrix32 final_transform; + Rect2 final_clip_rect; + Item* final_clip_owner; + Item* material_owner; + ViewportRender *vp_render; + bool distance_field; + bool light_masked; + + Rect2 global_rect_cache; + + const Rect2& get_rect() const { + if (custom_rect || !rect_dirty) + return rect; + + //must update rect + int s=commands.size(); + if (s==0) { + + rect=Rect2(); + rect_dirty=false; + return rect; + } + + Matrix32 xf; + bool found_xform=false; + bool first=true; + + const Item::Command * const *cmd = &commands[0]; + + + for (int i=0;itype) { + case Item::Command::TYPE_LINE: { + + const Item::CommandLine* line = static_cast< const Item::CommandLine*>(c); + r.pos=line->from; + r.expand_to(line->to); + } break; + case Item::Command::TYPE_RECT: { + + const Item::CommandRect* crect = static_cast< const Item::CommandRect*>(c); + r=crect->rect; + + } break; + case Item::Command::TYPE_NINEPATCH: { + + const Item::CommandNinePatch* style = static_cast< const Item::CommandNinePatch*>(c); + r=style->rect; + } break; + case Item::Command::TYPE_PRIMITIVE: { + + const Item::CommandPrimitive* primitive = static_cast< const Item::CommandPrimitive*>(c); + r.pos=primitive->points[0]; + for(int i=1;ipoints.size();i++) { + + r.expand_to(primitive->points[i]); + + } + } break; + case Item::Command::TYPE_POLYGON: { + + const Item::CommandPolygon* polygon = static_cast< const Item::CommandPolygon*>(c); + int l = polygon->points.size(); + const Point2*pp=&polygon->points[0]; + r.pos=pp[0]; + for(int i=1;i(c); + AABB aabb = RasterizerStorage::base_signleton->mesh_get_aabb(mesh->mesh); + + r=Rect2(aabb.pos.x,aabb.pos.y,aabb.size.x,aabb.size.y); + + } break; + case Item::Command::TYPE_MULTIMESH: { + + const Item::CommandMultiMesh* multimesh = static_cast< const Item::CommandMultiMesh*>(c); + AABB aabb = RasterizerStorage::base_signleton->multimesh_get_aabb(multimesh->multimesh); + + r=Rect2(aabb.pos.x,aabb.pos.y,aabb.size.x,aabb.size.y); + + } break; + case Item::Command::TYPE_CIRCLE: { + + const Item::CommandCircle* circle = static_cast< const Item::CommandCircle*>(c); + r.pos=Point2(-circle->radius,-circle->radius)+circle->pos; + r.size=Point2(circle->radius*2.0,circle->radius*2.0); + } break; + case Item::Command::TYPE_TRANSFORM: { + + const Item::CommandTransform* transform = static_cast(c); + xf=transform->xform; + found_xform=true; + continue; + } break; + + case Item::Command::TYPE_CLIP_IGNORE: { + + } break; + } + + if (found_xform) { + r = xf.xform(r); + found_xform=false; + } + + + if (first) { + rect=r; + first=false; + } else + rect=rect.merge(r); + } + + rect_dirty=false; + return rect; + } + + void clear() { for (int i=0;i */ @@ -41,7 +705,7 @@ class Rasterizer { protected: - typedef void (*CanvasItemDrawViewportFunc)(VisualServer*owner,void*ud,const Rect2& p_rect); + typedef void (*ItemDrawViewportFunc)(VisualServer*owner,void*ud,const Rect2& p_rect); RID create_default_material(); RID create_overdraw_debug_material(); @@ -581,7 +1245,7 @@ public: }; - struct CanvasLight { + struct Light { @@ -597,7 +1261,7 @@ public: int layer_max; int item_mask; int item_shadow_mask; - VS::CanvasLightMode mode; + VS::LightMode mode; RID texture; Vector2 texture_offset; RID canvas; @@ -616,12 +1280,12 @@ public: Matrix32 light_shader_xform; Vector2 light_shader_pos; - CanvasLight *shadows_next_ptr; - CanvasLight *filter_next_ptr; - CanvasLight *next_ptr; - CanvasLight *mask_next_ptr; + Light *shadows_next_ptr; + Light *filter_next_ptr; + Light *next_ptr; + Light *mask_next_ptr; - CanvasLight() { + Light() { enabled=true; color=Color(1,1,1); shadow_color=Color(0,0,0,0); @@ -645,20 +1309,20 @@ public: } }; - struct CanvasItem; + struct Item; - struct CanvasItemMaterial { + struct ItemMaterial { RID shader; Map shader_param; uint32_t shader_version; - Set owners; - VS::CanvasItemShadingMode shading_mode; + Set owners; + VS::ItemShadingMode shading_mode; - CanvasItemMaterial() {shading_mode=VS::CANVAS_ITEM_SHADING_NORMAL; shader_version=0; } + ItemMaterial() {shading_mode=VS::CANVAS_ITEM_SHADING_NORMAL; shader_version=0; } }; - struct CanvasItem { + struct Item { struct Command { @@ -788,8 +1452,8 @@ public: mutable bool custom_rect; mutable bool rect_dirty; mutable Rect2 rect; - CanvasItem*next; - CanvasItemMaterial* material; + Item*next; + ItemMaterial* material; struct CopyBackBuffer { Rect2 rect; Rect2 screen_rect; @@ -801,8 +1465,8 @@ public: float final_opacity; Matrix32 final_transform; Rect2 final_clip_rect; - CanvasItem* final_clip_owner; - CanvasItem* material_owner; + Item* final_clip_owner; + Item* material_owner; ViewportRender *vp_render; bool distance_field; bool light_masked; @@ -826,35 +1490,35 @@ public: bool found_xform=false; bool first=true; - const CanvasItem::Command * const *cmd = &commands[0]; + const Item::Command * const *cmd = &commands[0]; for (int i=0;itype) { - case CanvasItem::Command::TYPE_LINE: { + case Item::Command::TYPE_LINE: { - const CanvasItem::CommandLine* line = static_cast< const CanvasItem::CommandLine*>(c); + const Item::CommandLine* line = static_cast< const Item::CommandLine*>(c); r.pos=line->from; r.expand_to(line->to); } break; - case CanvasItem::Command::TYPE_RECT: { + case Item::Command::TYPE_RECT: { - const CanvasItem::CommandRect* crect = static_cast< const CanvasItem::CommandRect*>(c); + const Item::CommandRect* crect = static_cast< const Item::CommandRect*>(c); r=crect->rect; } break; - case CanvasItem::Command::TYPE_STYLE: { + case Item::Command::TYPE_STYLE: { - const CanvasItem::CommandStyle* style = static_cast< const CanvasItem::CommandStyle*>(c); + const Item::CommandStyle* style = static_cast< const Item::CommandStyle*>(c); r=style->rect; } break; - case CanvasItem::Command::TYPE_PRIMITIVE: { + case Item::Command::TYPE_PRIMITIVE: { - const CanvasItem::CommandPrimitive* primitive = static_cast< const CanvasItem::CommandPrimitive*>(c); + const Item::CommandPrimitive* primitive = static_cast< const Item::CommandPrimitive*>(c); r.pos=primitive->points[0]; for(int i=1;ipoints.size();i++) { @@ -862,9 +1526,9 @@ public: } } break; - case CanvasItem::Command::TYPE_POLYGON: { + case Item::Command::TYPE_POLYGON: { - const CanvasItem::CommandPolygon* polygon = static_cast< const CanvasItem::CommandPolygon*>(c); + const Item::CommandPolygon* polygon = static_cast< const Item::CommandPolygon*>(c); int l = polygon->points.size(); const Point2*pp=&polygon->points[0]; r.pos=pp[0]; @@ -875,9 +1539,9 @@ public: } } break; - case CanvasItem::Command::TYPE_POLYGON_PTR: { + case Item::Command::TYPE_POLYGON_PTR: { - const CanvasItem::CommandPolygonPtr* polygon = static_cast< const CanvasItem::CommandPolygonPtr*>(c); + const Item::CommandPolygonPtr* polygon = static_cast< const Item::CommandPolygonPtr*>(c); int l = polygon->count; if (polygon->indices != NULL) { @@ -894,23 +1558,23 @@ public: } } } break; - case CanvasItem::Command::TYPE_CIRCLE: { + case Item::Command::TYPE_CIRCLE: { - const CanvasItem::CommandCircle* circle = static_cast< const CanvasItem::CommandCircle*>(c); + const Item::CommandCircle* circle = static_cast< const Item::CommandCircle*>(c); r.pos=Point2(-circle->radius,-circle->radius)+circle->pos; r.size=Point2(circle->radius*2.0,circle->radius*2.0); } break; - case CanvasItem::Command::TYPE_TRANSFORM: { + case Item::Command::TYPE_TRANSFORM: { - const CanvasItem::CommandTransform* transform = static_cast(c); + const Item::CommandTransform* transform = static_cast(c); xf=transform->xform; found_xform=true; continue; } break; - case CanvasItem::Command::TYPE_BLEND_MODE: { + case Item::Command::TYPE_BLEND_MODE: { } break; - case CanvasItem::Command::TYPE_CLIP_IGNORE: { + case Item::Command::TYPE_CLIP_IGNORE: { } break; } @@ -933,12 +1597,12 @@ public: } void clear() { for (int i=0;iwidth=p_width; - texture->height=p_height; - texture->format=p_format; - texture->flags=p_flags; -} - -void RasterizerDummy::texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side) { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND(!texture); - ERR_FAIL_COND(texture->format != p_image.get_format() ); - - texture->image[p_cube_side]=p_image; - -} - -Image RasterizerDummy::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,Image()); - - return texture->image[p_cube_side]; -} - -void RasterizerDummy::texture_set_flags(RID p_texture,uint32_t p_flags) { - - Texture *texture = texture_owner.get( p_texture ); - ERR_FAIL_COND(!texture); - uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP; - texture->flags=p_flags|cube; // can't remove a cube from being a cube - -} -uint32_t RasterizerDummy::texture_get_flags(RID p_texture) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,0); - - return texture->flags; - -} -Image::Format RasterizerDummy::texture_get_format(RID p_texture) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,Image::FORMAT_GRAYSCALE); - - return texture->format; -} -uint32_t RasterizerDummy::texture_get_width(RID p_texture) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,0); - - return texture->width; -} -uint32_t RasterizerDummy::texture_get_height(RID p_texture) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,0); - - return texture->height; -} - -bool RasterizerDummy::texture_has_alpha(RID p_texture) const { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND_V(!texture,0); - - return false; - -} - -void RasterizerDummy::texture_set_size_override(RID p_texture,int p_width, int p_height) { - - Texture * texture = texture_owner.get(p_texture); - - ERR_FAIL_COND(!texture); - - ERR_FAIL_COND(p_width<=0 || p_width>4096); - ERR_FAIL_COND(p_height<=0 || p_height>4096); - //real texture size is in alloc width and height -// texture->width=p_width; -// texture->height=p_height; - -} - -void RasterizerDummy::texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const { - - -} - -/* SHADER API */ - -/* SHADER API */ - -RID RasterizerDummy::shader_create(VS::ShaderMode p_mode) { - - Shader *shader = memnew( Shader ); - shader->mode=p_mode; - shader->fragment_line=0; - shader->vertex_line=0; - shader->light_line=0; - RID rid = shader_owner.make_rid(shader); - - return rid; - -} - - - -void RasterizerDummy::shader_set_mode(RID p_shader,VS::ShaderMode p_mode) { - - ERR_FAIL_INDEX(p_mode,3); - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND(!shader); - shader->mode=p_mode; - -} -VS::ShaderMode RasterizerDummy::shader_get_mode(RID p_shader) const { - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND_V(!shader,VS::SHADER_MATERIAL); - return shader->mode; -} - -void RasterizerDummy::shader_set_code(RID p_shader, const String& p_vertex, const String& p_fragment,const String& p_light,int p_vertex_ofs,int p_fragment_ofs,int p_light_ofs) { - - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND(!shader); - shader->fragment_code=p_fragment; - shader->vertex_code=p_vertex; - shader->light_code=p_light; - shader->fragment_line=p_fragment_ofs; - shader->vertex_line=p_vertex_ofs; - shader->light_line=p_vertex_ofs; - -} - - -String RasterizerDummy::shader_get_vertex_code(RID p_shader) const { - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND_V(!shader,String()); - return shader->vertex_code; - -} - -String RasterizerDummy::shader_get_fragment_code(RID p_shader) const { - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND_V(!shader,String()); - return shader->fragment_code; - -} - -String RasterizerDummy::shader_get_light_code(RID p_shader) const { - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND_V(!shader,String()); - return shader->light_code; - -} - -void RasterizerDummy::shader_get_param_list(RID p_shader, List *p_param_list) const { - - Shader *shader=shader_owner.get(p_shader); - ERR_FAIL_COND(!shader); - -} - - -void RasterizerDummy::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture) { - -} - -RID RasterizerDummy::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const { - - return RID(); -} - -Variant RasterizerDummy::shader_get_default_param(RID p_shader, const StringName& p_name) { - - return Variant(); -} - -/* COMMON MATERIAL API */ - - -RID RasterizerDummy::material_create() { - - return material_owner.make_rid( memnew( Material ) ); -} - -void RasterizerDummy::material_set_shader(RID p_material, RID p_shader) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - material->shader=p_shader; - -} - -RID RasterizerDummy::material_get_shader(RID p_material) const { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,RID()); - return material->shader; -} - -void RasterizerDummy::material_set_param(RID p_material, const StringName& p_param, const Variant& p_value) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - - if (p_value.get_type()==Variant::NIL) - material->shader_params.erase(p_param); - else - material->shader_params[p_param]=p_value; -} -Variant RasterizerDummy::material_get_param(RID p_material, const StringName& p_param) const { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,Variant()); - - if (material->shader_params.has(p_param)) - return material->shader_params[p_param]; - else - return Variant(); -} - - -void RasterizerDummy::material_set_flag(RID p_material, VS::MaterialFlag p_flag,bool p_enabled) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - ERR_FAIL_INDEX(p_flag,VS::MATERIAL_FLAG_MAX); - material->flags[p_flag]=p_enabled; - -} -bool RasterizerDummy::material_get_flag(RID p_material,VS::MaterialFlag p_flag) const { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,false); - ERR_FAIL_INDEX_V(p_flag,VS::MATERIAL_FLAG_MAX,false); - return material->flags[p_flag]; - - -} - -void RasterizerDummy::material_set_depth_draw_mode(RID p_material, VS::MaterialDepthDrawMode p_mode) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - material->depth_draw_mode=p_mode; -} - -VS::MaterialDepthDrawMode RasterizerDummy::material_get_depth_draw_mode(RID p_material) const{ - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,VS::MATERIAL_DEPTH_DRAW_ALWAYS); - return material->depth_draw_mode; - -} - - -void RasterizerDummy::material_set_blend_mode(RID p_material,VS::MaterialBlendMode p_mode) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - material->blend_mode=p_mode; - -} -VS::MaterialBlendMode RasterizerDummy::material_get_blend_mode(RID p_material) const { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,VS::MATERIAL_BLEND_MODE_ADD); - return material->blend_mode; -} - -void RasterizerDummy::material_set_line_width(RID p_material,float p_line_width) { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND(!material); - material->line_width=p_line_width; - -} -float RasterizerDummy::material_get_line_width(RID p_material) const { - - Material *material = material_owner.get(p_material); - ERR_FAIL_COND_V(!material,0); - - return material->line_width; -} - -/* MESH API */ - - -RID RasterizerDummy::mesh_create() { - - - return mesh_owner.make_rid( memnew( Mesh ) ); -} - - -void RasterizerDummy::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes,bool p_alpha_sort) { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - - ERR_FAIL_INDEX( p_primitive, VS::PRIMITIVE_MAX ); - ERR_FAIL_COND(p_arrays.size()!=VS::ARRAY_MAX); - - Surface s; - - - s.format=0; - - for(int i=0;imorph_target_count; - s.morph_format=s.format; - - - Surface *surface = memnew( Surface ); - *surface=s; - - mesh->surfaces.push_back(surface); - - -} - - - -void RasterizerDummy::mesh_add_custom_surface(RID p_mesh,const Variant& p_dat) { - - ERR_EXPLAIN("Dummy Rasterizer does not support custom surfaces. Running on wrong platform?"); - ERR_FAIL_V(); -} - -Array RasterizerDummy::mesh_get_surface_arrays(RID p_mesh,int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,Array()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Array() ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, Array() ); - - return surface->data; - - -} -Array RasterizerDummy::mesh_get_surface_morph_arrays(RID p_mesh,int p_surface) const{ - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,Array()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Array() ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, Array() ); - - return surface->morph_data; - -} - - -void RasterizerDummy::mesh_set_morph_target_count(RID p_mesh,int p_amount) { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - ERR_FAIL_COND( mesh->surfaces.size()!=0 ); - - mesh->morph_target_count=p_amount; - -} - -int RasterizerDummy::mesh_get_morph_target_count(RID p_mesh) const{ - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,-1); - - return mesh->morph_target_count; - -} - -void RasterizerDummy::mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode) { - - ERR_FAIL_INDEX(p_mode,2); - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - - mesh->morph_target_mode=p_mode; - -} - -VS::MorphTargetMode RasterizerDummy::mesh_get_morph_target_mode(RID p_mesh) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,VS::MORPH_MODE_NORMALIZED); - - return mesh->morph_target_mode; - -} - - - -void RasterizerDummy::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned) { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - ERR_FAIL_INDEX(p_surface, mesh->surfaces.size() ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND( !surface); - - if (surface->material_owned && surface->material.is_valid()) - free(surface->material); - - surface->material_owned=p_owned; - surface->material=p_material; -} - -RID RasterizerDummy::mesh_surface_get_material(RID p_mesh, int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,RID()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), RID() ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, RID() ); - - return surface->material; -} - -int RasterizerDummy::mesh_surface_get_array_len(RID p_mesh, int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,-1); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), -1 ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, -1 ); - - Vector3Array arr = surface->data[VS::ARRAY_VERTEX]; - return arr.size(); - -} - -int RasterizerDummy::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,-1); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), -1 ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, -1 ); - - IntArray arr = surface->data[VS::ARRAY_INDEX]; - return arr.size(); - -} -uint32_t RasterizerDummy::mesh_surface_get_format(RID p_mesh, int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,0); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), 0 ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, 0 ); - - return surface->format; -} -VS::PrimitiveType RasterizerDummy::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,VS::PRIMITIVE_POINTS); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), VS::PRIMITIVE_POINTS ); - Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V( !surface, VS::PRIMITIVE_POINTS ); - - return surface->primitive; -} - -void RasterizerDummy::mesh_remove_surface(RID p_mesh,int p_index) { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - ERR_FAIL_INDEX(p_index, mesh->surfaces.size() ); - Surface *surface = mesh->surfaces[p_index]; - ERR_FAIL_COND( !surface); - - memdelete( mesh->surfaces[p_index] ); - mesh->surfaces.remove(p_index); - -} -int RasterizerDummy::mesh_get_surface_count(RID p_mesh) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,-1); - - return mesh->surfaces.size(); -} - -AABB RasterizerDummy::mesh_get_aabb(RID p_mesh,RID p_skeleton) const { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,AABB()); - - AABB aabb; - - for (int i=0;isurfaces.size();i++) { - - if (i==0) - aabb=mesh->surfaces[i]->aabb; - else - aabb.merge_with(mesh->surfaces[i]->aabb); - } - - return aabb; -} - -void RasterizerDummy::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb) { - - Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND(!mesh); - - mesh->custom_aabb=p_aabb; -} - -AABB RasterizerDummy::mesh_get_custom_aabb(RID p_mesh) const { - - const Mesh *mesh = mesh_owner.get( p_mesh ); - ERR_FAIL_COND_V(!mesh,AABB()); - - return mesh->custom_aabb; - -} - -/* MULTIMESH API */ - -RID RasterizerDummy::multimesh_create() { - - return multimesh_owner.make_rid( memnew( MultiMesh )); -} - -void RasterizerDummy::multimesh_set_instance_count(RID p_multimesh,int p_count) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh); - - multimesh->elements.clear(); // make sure to delete everything, so it "fails" in all implementations - multimesh->elements.resize(p_count); - -} -int RasterizerDummy::multimesh_get_instance_count(RID p_multimesh) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,-1); - - return multimesh->elements.size(); -} - -void RasterizerDummy::multimesh_set_mesh(RID p_multimesh,RID p_mesh) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh); - - multimesh->mesh=p_mesh; - -} -void RasterizerDummy::multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh); - multimesh->aabb=p_aabb; -} -void RasterizerDummy::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh); - ERR_FAIL_INDEX(p_index,multimesh->elements.size()); - multimesh->elements[p_index].xform=p_transform; - -} -void RasterizerDummy::multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh) - ERR_FAIL_INDEX(p_index,multimesh->elements.size()); - multimesh->elements[p_index].color=p_color; - -} - -RID RasterizerDummy::multimesh_get_mesh(RID p_multimesh) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,RID()); - - return multimesh->mesh; -} -AABB RasterizerDummy::multimesh_get_aabb(RID p_multimesh) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,AABB()); - - return multimesh->aabb; -} - -Transform RasterizerDummy::multimesh_instance_get_transform(RID p_multimesh,int p_index) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,Transform()); - - ERR_FAIL_INDEX_V(p_index,multimesh->elements.size(),Transform()); - - return multimesh->elements[p_index].xform; - -} -Color RasterizerDummy::multimesh_instance_get_color(RID p_multimesh,int p_index) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,Color()); - ERR_FAIL_INDEX_V(p_index,multimesh->elements.size(),Color()); - - return multimesh->elements[p_index].color; -} - -void RasterizerDummy::multimesh_set_visible_instances(RID p_multimesh,int p_visible) { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND(!multimesh); - multimesh->visible=p_visible; - -} - -int RasterizerDummy::multimesh_get_visible_instances(RID p_multimesh) const { - - MultiMesh *multimesh = multimesh_owner.get(p_multimesh); - ERR_FAIL_COND_V(!multimesh,-1); - return multimesh->visible; - -} - -/* IMMEDIATE API */ - - -RID RasterizerDummy::immediate_create() { - - Immediate *im = memnew( Immediate ); - return immediate_owner.make_rid(im); - -} - -void RasterizerDummy::immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture){ - - -} -void RasterizerDummy::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ - - -} -void RasterizerDummy::immediate_normal(RID p_immediate,const Vector3& p_normal){ - - -} -void RasterizerDummy::immediate_tangent(RID p_immediate,const Plane& p_tangent){ - - -} -void RasterizerDummy::immediate_color(RID p_immediate,const Color& p_color){ - - -} -void RasterizerDummy::immediate_uv(RID p_immediate,const Vector2& tex_uv){ - - -} -void RasterizerDummy::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ - - -} - -void RasterizerDummy::immediate_end(RID p_immediate){ - - -} -void RasterizerDummy::immediate_clear(RID p_immediate) { - - -} - -AABB RasterizerDummy::immediate_get_aabb(RID p_immediate) const { - - return AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); -} - -void RasterizerDummy::immediate_set_material(RID p_immediate,RID p_material) { - - Immediate *im = immediate_owner.get(p_immediate); - ERR_FAIL_COND(!im); - im->material=p_material; - -} - -RID RasterizerDummy::immediate_get_material(RID p_immediate) const { - - const Immediate *im = immediate_owner.get(p_immediate); - ERR_FAIL_COND_V(!im,RID()); - return im->material; - -} - -/* PARTICLES API */ - -RID RasterizerDummy::particles_create() { - - Particles *particles = memnew( Particles ); - ERR_FAIL_COND_V(!particles,RID()); - return particles_owner.make_rid(particles); -} - -void RasterizerDummy::particles_set_amount(RID p_particles, int p_amount) { - - ERR_FAIL_COND(p_amount<1); - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.amount=p_amount; - -} - -int RasterizerDummy::particles_get_amount(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.amount; - -} - -void RasterizerDummy::particles_set_emitting(RID p_particles, bool p_emitting) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.emitting=p_emitting;; - -} -bool RasterizerDummy::particles_is_emitting(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,false); - return particles->data.emitting; - -} - -void RasterizerDummy::particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.visibility_aabb=p_visibility; - -} - -void RasterizerDummy::particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - - particles->data.emission_half_extents=p_half_extents; -} -Vector3 RasterizerDummy::particles_get_emission_half_extents(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,Vector3()); - - return particles->data.emission_half_extents; -} - -void RasterizerDummy::particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - - particles->data.emission_base_velocity=p_base_velocity; -} - -Vector3 RasterizerDummy::particles_get_emission_base_velocity(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,Vector3()); - - return particles->data.emission_base_velocity; -} - - -void RasterizerDummy::particles_set_emission_points(RID p_particles, const DVector& p_points) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - - particles->data.emission_points=p_points; -} - -DVector RasterizerDummy::particles_get_emission_points(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,DVector()); - - return particles->data.emission_points; - -} - -void RasterizerDummy::particles_set_gravity_normal(RID p_particles, const Vector3& p_normal) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - - particles->data.gravity_normal=p_normal; - -} -Vector3 RasterizerDummy::particles_get_gravity_normal(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,Vector3()); - - return particles->data.gravity_normal; -} - - -AABB RasterizerDummy::particles_get_visibility_aabb(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,AABB()); - return particles->data.visibility_aabb; - -} - -void RasterizerDummy::particles_set_variable(RID p_particles, VS::ParticleVariable p_variable,float p_value) { - - ERR_FAIL_INDEX(p_variable,VS::PARTICLE_VAR_MAX); - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.particle_vars[p_variable]=p_value; - -} -float RasterizerDummy::particles_get_variable(RID p_particles, VS::ParticleVariable p_variable) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.particle_vars[p_variable]; -} - -void RasterizerDummy::particles_set_randomness(RID p_particles, VS::ParticleVariable p_variable,float p_randomness) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.particle_randomness[p_variable]=p_randomness; - -} -float RasterizerDummy::particles_get_randomness(RID p_particles, VS::ParticleVariable p_variable) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.particle_randomness[p_variable]; - -} - -void RasterizerDummy::particles_set_color_phases(RID p_particles, int p_phases) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - ERR_FAIL_COND( p_phases<0 || p_phases>VS::MAX_PARTICLE_COLOR_PHASES ); - particles->data.color_phase_count=p_phases; - -} -int RasterizerDummy::particles_get_color_phases(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.color_phase_count; -} - - -void RasterizerDummy::particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos) { - - ERR_FAIL_INDEX(p_phase, VS::MAX_PARTICLE_COLOR_PHASES); - if (p_pos<0.0) - p_pos=0.0; - if (p_pos>1.0) - p_pos=1.0; - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.color_phases[p_phase].pos=p_pos; - -} -float RasterizerDummy::particles_get_color_phase_pos(RID p_particles, int p_phase) const { - - ERR_FAIL_INDEX_V(p_phase, VS::MAX_PARTICLE_COLOR_PHASES, -1.0); - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.color_phases[p_phase].pos; - -} - -void RasterizerDummy::particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color) { - - ERR_FAIL_INDEX(p_phase, VS::MAX_PARTICLE_COLOR_PHASES); - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.color_phases[p_phase].color=p_color; - - //update alpha - particles->has_alpha=false; - for(int i=0;idata.color_phases[i].color.a<0.99) - particles->has_alpha=true; - } - -} - -Color RasterizerDummy::particles_get_color_phase_color(RID p_particles, int p_phase) const { - - ERR_FAIL_INDEX_V(p_phase, VS::MAX_PARTICLE_COLOR_PHASES, Color()); - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,Color()); - return particles->data.color_phases[p_phase].color; - -} - -void RasterizerDummy::particles_set_attractors(RID p_particles, int p_attractors) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - ERR_FAIL_COND( p_attractors<0 || p_attractors>VisualServer::MAX_PARTICLE_ATTRACTORS ); - particles->data.attractor_count=p_attractors; - -} -int RasterizerDummy::particles_get_attractors(RID p_particles) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,-1); - return particles->data.attractor_count; -} - -void RasterizerDummy::particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - ERR_FAIL_INDEX(p_attractor,particles->data.attractor_count); - particles->data.attractors[p_attractor].pos=p_pos;; -} -Vector3 RasterizerDummy::particles_get_attractor_pos(RID p_particles,int p_attractor) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,Vector3()); - ERR_FAIL_INDEX_V(p_attractor,particles->data.attractor_count,Vector3()); - return particles->data.attractors[p_attractor].pos; -} - -void RasterizerDummy::particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - ERR_FAIL_INDEX(p_attractor,particles->data.attractor_count); - particles->data.attractors[p_attractor].force=p_force; -} - -float RasterizerDummy::particles_get_attractor_strength(RID p_particles,int p_attractor) const { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,0); - ERR_FAIL_INDEX_V(p_attractor,particles->data.attractor_count,0); - return particles->data.attractors[p_attractor].force; -} - -void RasterizerDummy::particles_set_material(RID p_particles, RID p_material,bool p_owned) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - if (particles->material_owned && particles->material.is_valid()) - free(particles->material); - - particles->material_owned=p_owned; - - particles->material=p_material; - -} -RID RasterizerDummy::particles_get_material(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,RID()); - return particles->material; - -} - -void RasterizerDummy::particles_set_use_local_coordinates(RID p_particles, bool p_enable) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.local_coordinates=p_enable; - -} - -bool RasterizerDummy::particles_is_using_local_coordinates(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,false); - return particles->data.local_coordinates; -} -bool RasterizerDummy::particles_has_height_from_velocity(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,false); - return particles->data.height_from_velocity; -} - -void RasterizerDummy::particles_set_height_from_velocity(RID p_particles, bool p_enable) { - - Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND(!particles); - particles->data.height_from_velocity=p_enable; - -} - -AABB RasterizerDummy::particles_get_aabb(RID p_particles) const { - - const Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,AABB()); - return particles->data.visibility_aabb; -} - -/* SKELETON API */ - -RID RasterizerDummy::skeleton_create() { - - Skeleton *skeleton = memnew( Skeleton ); - ERR_FAIL_COND_V(!skeleton,RID()); - return skeleton_owner.make_rid( skeleton ); -} -void RasterizerDummy::skeleton_resize(RID p_skeleton,int p_bones) { - - Skeleton *skeleton = skeleton_owner.get( p_skeleton ); - ERR_FAIL_COND(!skeleton); - if (p_bones == skeleton->bones.size()) { - return; - }; - - skeleton->bones.resize(p_bones); - -} -int RasterizerDummy::skeleton_get_bone_count(RID p_skeleton) const { - - Skeleton *skeleton = skeleton_owner.get( p_skeleton ); - ERR_FAIL_COND_V(!skeleton, -1); - return skeleton->bones.size(); -} -void RasterizerDummy::skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform) { - - Skeleton *skeleton = skeleton_owner.get( p_skeleton ); - ERR_FAIL_COND(!skeleton); - ERR_FAIL_INDEX( p_bone, skeleton->bones.size() ); - - skeleton->bones[p_bone] = p_transform; -} - -Transform RasterizerDummy::skeleton_bone_get_transform(RID p_skeleton,int p_bone) { - - Skeleton *skeleton = skeleton_owner.get( p_skeleton ); - ERR_FAIL_COND_V(!skeleton, Transform()); - ERR_FAIL_INDEX_V( p_bone, skeleton->bones.size(), Transform() ); - - // something - return skeleton->bones[p_bone]; -} - - -/* LIGHT API */ - -RID RasterizerDummy::light_create(VS::LightType p_type) { - - Light *light = memnew( Light ); - light->type=p_type; - return light_owner.make_rid(light); -} - -VS::LightType RasterizerDummy::light_get_type(RID p_light) const { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND_V(!light,VS::LIGHT_OMNI); - return light->type; -} - -void RasterizerDummy::light_set_color(RID p_light,VS::LightColor p_type, const Color& p_color) { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND(!light); - ERR_FAIL_INDEX( p_type, 3 ); - light->colors[p_type]=p_color; -} -Color RasterizerDummy::light_get_color(RID p_light,VS::LightColor p_type) const { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND_V(!light, Color()); - ERR_FAIL_INDEX_V( p_type, 3, Color() ); - return light->colors[p_type]; -} - -void RasterizerDummy::light_set_shadow(RID p_light,bool p_enabled) { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND(!light); - light->shadow_enabled=p_enabled; -} - -bool RasterizerDummy::light_has_shadow(RID p_light) const { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND_V(!light,false); - return light->shadow_enabled; -} - -void RasterizerDummy::light_set_volumetric(RID p_light,bool p_enabled) { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND(!light); - light->volumetric_enabled=p_enabled; - -} -bool RasterizerDummy::light_is_volumetric(RID p_light) const { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND_V(!light,false); - return light->volumetric_enabled; -} - -void RasterizerDummy::light_set_projector(RID p_light,RID p_texture) { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND(!light); - light->projector=p_texture; -} -RID RasterizerDummy::light_get_projector(RID p_light) const { - - Light *light = light_owner.get(p_light); - ERR_FAIL_COND_V(!light,RID()); - return light->projector; -} - -void RasterizerDummy::light_set_var(RID p_light, VS::LightParam p_var, float p_value) { - - Light * light = light_owner.get( p_light ); - ERR_FAIL_COND(!light); - ERR_FAIL_INDEX( p_var, VS::LIGHT_PARAM_MAX ); - - light->vars[p_var]=p_value; -} -float RasterizerDummy::light_get_var(RID p_light, VS::LightParam p_var) const { - - Light * light = light_owner.get( p_light ); - ERR_FAIL_COND_V(!light,0); - - ERR_FAIL_INDEX_V( p_var, VS::LIGHT_PARAM_MAX,0 ); - - return light->vars[p_var]; -} - -void RasterizerDummy::light_set_operator(RID p_light,VS::LightOp p_op) { - - Light * light = light_owner.get( p_light ); - ERR_FAIL_COND(!light); - - -}; - -VS::LightOp RasterizerDummy::light_get_operator(RID p_light) const { - - return VS::LightOp(0); -}; - -void RasterizerDummy::light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode) { - - -} - -VS::LightOmniShadowMode RasterizerDummy::light_omni_get_shadow_mode(RID p_light) const{ - - return VS::LightOmniShadowMode(0); -} - -void RasterizerDummy::light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode) { - - -} - -VS::LightDirectionalShadowMode RasterizerDummy::light_directional_get_shadow_mode(RID p_light) const { - - return VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; -} - -void RasterizerDummy::light_directional_set_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param, float p_value) { - - -} - -float RasterizerDummy::light_directional_get_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param) const { - - return 0; -} - - -AABB RasterizerDummy::light_get_aabb(RID p_light) const { - - Light *light = light_owner.get( p_light ); - ERR_FAIL_COND_V(!light,AABB()); - - switch( light->type ) { - - case VS::LIGHT_SPOT: { - - float len=light->vars[VS::LIGHT_PARAM_RADIUS]; - float size=Math::tan(Math::deg2rad(light->vars[VS::LIGHT_PARAM_SPOT_ANGLE]))*len; - return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); - } break; - case VS::LIGHT_OMNI: { - - float r = light->vars[VS::LIGHT_PARAM_RADIUS]; - return AABB( -Vector3(r,r,r), Vector3(r,r,r)*2 ); - } break; - case VS::LIGHT_DIRECTIONAL: { - - return AABB(); - } break; - default: {} - } - - ERR_FAIL_V( AABB() ); -} - - -RID RasterizerDummy::light_instance_create(RID p_light) { - - Light *light = light_owner.get( p_light ); - ERR_FAIL_COND_V(!light, RID()); - - LightInstance *light_instance = memnew( LightInstance ); - - light_instance->light=p_light; - light_instance->base=light; - - - return light_instance_owner.make_rid( light_instance ); -} -void RasterizerDummy::light_instance_set_transform(RID p_light_instance,const Transform& p_transform) { - - LightInstance *lighti = light_instance_owner.get( p_light_instance ); - ERR_FAIL_COND(!lighti); - lighti->transform=p_transform; - -} - -bool RasterizerDummy::light_instance_has_shadow(RID p_light_instance) const { - - return false; - -} - - -bool RasterizerDummy::light_instance_assign_shadow(RID p_light_instance) { - - return false; - -} - - -Rasterizer::ShadowType RasterizerDummy::light_instance_get_shadow_type(RID p_light_instance) const { - - LightInstance *lighti = light_instance_owner.get( p_light_instance ); - ERR_FAIL_COND_V(!lighti,Rasterizer::SHADOW_NONE); - - switch(lighti->base->type) { - - case VS::LIGHT_DIRECTIONAL: return SHADOW_PSM; break; - case VS::LIGHT_OMNI: return SHADOW_DUAL_PARABOLOID; break; - case VS::LIGHT_SPOT: return SHADOW_SIMPLE; break; - } - - return Rasterizer::SHADOW_NONE; -} - -Rasterizer::ShadowType RasterizerDummy::light_instance_get_shadow_type(RID p_light_instance,bool p_far) const { - - return SHADOW_NONE; -} -void RasterizerDummy::light_instance_set_shadow_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near,float p_split_far) { - - -} - -int RasterizerDummy::light_instance_get_shadow_passes(RID p_light_instance) const { - - return 0; -} - -bool RasterizerDummy::light_instance_get_pssm_shadow_overlap(RID p_light_instance) const { - - return false; -} - - -void RasterizerDummy::light_instance_set_custom_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near,float p_split_far) { - - LightInstance *lighti = light_instance_owner.get( p_light_instance ); - ERR_FAIL_COND(!lighti); - - ERR_FAIL_COND(lighti->base->type!=VS::LIGHT_DIRECTIONAL); - ERR_FAIL_INDEX(p_index,1); - - lighti->custom_projection=p_camera; - lighti->custom_transform=p_transform; - -} -void RasterizerDummy::shadow_clear_near() { - - -} - -bool RasterizerDummy::shadow_allocate_near(RID p_light) { - - return false; -} - -bool RasterizerDummy::shadow_allocate_far(RID p_light) { - - return false; -} - -/* PARTICLES INSTANCE */ - -RID RasterizerDummy::particles_instance_create(RID p_particles) { - - ERR_FAIL_COND_V(!particles_owner.owns(p_particles),RID()); - ParticlesInstance *particles_instance = memnew( ParticlesInstance ); - ERR_FAIL_COND_V(!particles_instance, RID() ); - particles_instance->particles=p_particles; - return particles_instance_owner.make_rid(particles_instance); -} - -void RasterizerDummy::particles_instance_set_transform(RID p_particles_instance,const Transform& p_transform) { - - ParticlesInstance *particles_instance=particles_instance_owner.get(p_particles_instance); - ERR_FAIL_COND(!particles_instance); - particles_instance->transform=p_transform; -} - - -/* RENDER API */ -/* all calls (inside begin/end shadow) are always warranted to be in the following order: */ - - -RID RasterizerDummy::viewport_data_create() { - - return RID(); -} - -RID RasterizerDummy::render_target_create(){ - - return RID(); - -} -void RasterizerDummy::render_target_set_size(RID p_render_target, int p_width, int p_height){ - - -} -RID RasterizerDummy::render_target_get_texture(RID p_render_target) const{ - - return RID(); - -} -bool RasterizerDummy::render_target_renedered_in_frame(RID p_render_target){ - - return false; -} - - -void RasterizerDummy::begin_frame() { - - - -} - -void RasterizerDummy::capture_viewport(Image* r_capture) { - - -} - - -void RasterizerDummy::clear_viewport(const Color& p_color) { - - -}; - -void RasterizerDummy::set_viewport(const VS::ViewportRect& p_viewport) { - - - -} - -void RasterizerDummy::set_render_target(RID p_render_target, bool p_transparent_bg, bool p_vflip) { - - -} - - -void RasterizerDummy::begin_scene(RID p_viewport_data,RID p_env,VS::ScenarioDebugMode p_debug) { - - -}; - -void RasterizerDummy::begin_shadow_map( RID p_light_instance, int p_shadow_pass ) { - -} - -void RasterizerDummy::set_camera(const Transform& p_world, const CameraMatrix& p_projection, bool p_ortho_hint) { - - -} - -void RasterizerDummy::add_light( RID p_light_instance ) { - - - -} - - - - -void RasterizerDummy::add_mesh( const RID& p_mesh, const InstanceData *p_data) { - - -} - -void RasterizerDummy::add_multimesh( const RID& p_multimesh, const InstanceData *p_data){ - - - - -} - -void RasterizerDummy::add_particles( const RID& p_particle_instance, const InstanceData *p_data){ - - - -} - - - -void RasterizerDummy::end_scene() { - - -} -void RasterizerDummy::end_shadow_map() { - -} - - -void RasterizerDummy::end_frame() { - - -} - -RID RasterizerDummy::canvas_light_occluder_create() { - return RID(); -} - -void RasterizerDummy::canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines) { - - -} - -RID RasterizerDummy::canvas_light_shadow_buffer_create(int p_width) { - - return RID(); -} - -void RasterizerDummy::canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, CanvasLightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache) { - - -} - -void RasterizerDummy::canvas_debug_viewport_shadows(CanvasLight* p_lights_with_shadow) { - - -} - -/* CANVAS API */ - - -void RasterizerDummy::begin_canvas_bg() { - -} -void RasterizerDummy::canvas_begin() { - - - -} -void RasterizerDummy::canvas_disable_blending() { - - - -} - -void RasterizerDummy::canvas_set_opacity(float p_opacity) { - - -} - -void RasterizerDummy::canvas_set_blend_mode(VS::MaterialBlendMode p_mode) { - - -} - - -void RasterizerDummy::canvas_begin_rect(const Matrix32& p_transform) { - - - -} - -void RasterizerDummy::canvas_set_clip(bool p_clip, const Rect2& p_rect) { - - - - -} - -void RasterizerDummy::canvas_end_rect() { - - -} - -void RasterizerDummy::canvas_draw_line(const Point2& p_from, const Point2& p_to, const Color& p_color, float p_width, bool p_antialiased) { - - - -} - -void RasterizerDummy::canvas_draw_rect(const Rect2& p_rect, int p_flags, const Rect2& p_source,RID p_texture,const Color& p_modulate) { - - - - -} -void RasterizerDummy::canvas_draw_style_box(const Rect2& p_rect, const Rect2& p_src_region, RID p_texture,const float *p_margin, bool p_draw_center,const Color& p_modulate) { - - -} -void RasterizerDummy::canvas_draw_primitive(const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width) { - - - -} - - -void RasterizerDummy::canvas_draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor) { - - - -} - -void RasterizerDummy::canvas_set_transform(const Matrix32& p_transform) { - - -} - -void RasterizerDummy::canvas_render_items(CanvasItem *p_item_list,int p_z,const Color& p_modulate,CanvasLight *p_light) { - - -} - -/* ENVIRONMENT */ - -RID RasterizerDummy::environment_create() { - - Environment * env = memnew( Environment ); - return environment_owner.make_rid(env); -} - -void RasterizerDummy::environment_set_background(RID p_env,VS::EnvironmentBG p_bg) { - - ERR_FAIL_INDEX(p_bg,VS::ENV_BG_MAX); - Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND(!env); - env->bg_mode=p_bg; -} - -VS::EnvironmentBG RasterizerDummy::environment_get_background(RID p_env) const{ - - const Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND_V(!env,VS::ENV_BG_MAX); - return env->bg_mode; -} - -void RasterizerDummy::environment_set_background_param(RID p_env,VS::EnvironmentBGParam p_param, const Variant& p_value){ - - ERR_FAIL_INDEX(p_param,VS::ENV_BG_PARAM_MAX); - Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND(!env); - env->bg_param[p_param]=p_value; - -} -Variant RasterizerDummy::environment_get_background_param(RID p_env,VS::EnvironmentBGParam p_param) const{ - - ERR_FAIL_INDEX_V(p_param,VS::ENV_BG_PARAM_MAX,Variant()); - const Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND_V(!env,Variant()); - return env->bg_param[p_param]; - -} - -void RasterizerDummy::environment_set_enable_fx(RID p_env,VS::EnvironmentFx p_effect,bool p_enabled){ - - ERR_FAIL_INDEX(p_effect,VS::ENV_FX_MAX); - Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND(!env); - env->fx_enabled[p_effect]=p_enabled; -} -bool RasterizerDummy::environment_is_fx_enabled(RID p_env,VS::EnvironmentFx p_effect) const{ - - ERR_FAIL_INDEX_V(p_effect,VS::ENV_FX_MAX,false); - const Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND_V(!env,false); - return env->fx_enabled[p_effect]; - -} - -void RasterizerDummy::environment_fx_set_param(RID p_env,VS::EnvironmentFxParam p_param,const Variant& p_value){ - - ERR_FAIL_INDEX(p_param,VS::ENV_FX_PARAM_MAX); - Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND(!env); - env->fx_param[p_param]=p_value; -} -Variant RasterizerDummy::environment_fx_get_param(RID p_env,VS::EnvironmentFxParam p_param) const{ - - ERR_FAIL_INDEX_V(p_param,VS::ENV_FX_PARAM_MAX,Variant()); - const Environment * env = environment_owner.get(p_env); - ERR_FAIL_COND_V(!env,Variant()); - return env->fx_param[p_param]; - -} - - -RID RasterizerDummy::sampled_light_dp_create(int p_width,int p_height) { - - return sampled_light_owner.make_rid(memnew(SampledLight)); -} - -void RasterizerDummy::sampled_light_dp_update(RID p_sampled_light, const Color *p_data, float p_multiplier) { - - -} - - -/*MISC*/ - -bool RasterizerDummy::is_texture(const RID& p_rid) const { - - return texture_owner.owns(p_rid); -} -bool RasterizerDummy::is_material(const RID& p_rid) const { - - return material_owner.owns(p_rid); -} -bool RasterizerDummy::is_mesh(const RID& p_rid) const { - - return mesh_owner.owns(p_rid); -} - -bool RasterizerDummy::is_immediate(const RID& p_rid) const { - - return immediate_owner.owns(p_rid); -} - -bool RasterizerDummy::is_multimesh(const RID& p_rid) const { - - return multimesh_owner.owns(p_rid); -} -bool RasterizerDummy::is_particles(const RID &p_beam) const { - - return particles_owner.owns(p_beam); -} - -bool RasterizerDummy::is_light(const RID& p_rid) const { - - return light_owner.owns(p_rid); -} -bool RasterizerDummy::is_light_instance(const RID& p_rid) const { - - return light_instance_owner.owns(p_rid); -} -bool RasterizerDummy::is_particles_instance(const RID& p_rid) const { - - return particles_instance_owner.owns(p_rid); -} -bool RasterizerDummy::is_skeleton(const RID& p_rid) const { - - return skeleton_owner.owns(p_rid); -} -bool RasterizerDummy::is_environment(const RID& p_rid) const { - - return environment_owner.owns(p_rid); -} - -bool RasterizerDummy::is_canvas_light_occluder(const RID& p_rid) const { - - return false; -} - -bool RasterizerDummy::is_shader(const RID& p_rid) const { - - return false; -} - -void RasterizerDummy::free(const RID& p_rid) { - - if (texture_owner.owns(p_rid)) { - - // delete the texture - Texture *texture = texture_owner.get(p_rid); - texture_owner.free(p_rid); - memdelete(texture); - - } else if (shader_owner.owns(p_rid)) { - - // delete the texture - Shader *shader = shader_owner.get(p_rid); - shader_owner.free(p_rid); - memdelete(shader); - - } else if (material_owner.owns(p_rid)) { - - Material *material = material_owner.get( p_rid ); - material_owner.free(p_rid); - memdelete(material); - - } else if (mesh_owner.owns(p_rid)) { - - Mesh *mesh = mesh_owner.get(p_rid); - - for (int i=0;isurfaces.size();i++) { - - memdelete( mesh->surfaces[i] ); - }; - - mesh->surfaces.clear(); - mesh_owner.free(p_rid); - memdelete(mesh); - - } else if (multimesh_owner.owns(p_rid)) { - - MultiMesh *multimesh = multimesh_owner.get(p_rid); - multimesh_owner.free(p_rid); - memdelete(multimesh); - - } else if (immediate_owner.owns(p_rid)) { - - Immediate *immediate = immediate_owner.get(p_rid); - immediate_owner.free(p_rid); - memdelete(immediate); - - } else if (particles_owner.owns(p_rid)) { - - Particles *particles = particles_owner.get(p_rid); - particles_owner.free(p_rid); - memdelete(particles); - } else if (particles_instance_owner.owns(p_rid)) { - - ParticlesInstance *particles_isntance = particles_instance_owner.get(p_rid); - particles_instance_owner.free(p_rid); - memdelete(particles_isntance); - - } else if (skeleton_owner.owns(p_rid)) { - - Skeleton *skeleton = skeleton_owner.get( p_rid ); - skeleton_owner.free(p_rid); - memdelete(skeleton); - - } else if (light_owner.owns(p_rid)) { - - Light *light = light_owner.get( p_rid ); - light_owner.free(p_rid); - memdelete(light); - - } else if (light_instance_owner.owns(p_rid)) { - - LightInstance *light_instance = light_instance_owner.get( p_rid ); - light_instance_owner.free(p_rid); - memdelete( light_instance ); - - - } else if (environment_owner.owns(p_rid)) { - - Environment *env = environment_owner.get( p_rid ); - environment_owner.free(p_rid); - memdelete( env ); - } else if (sampled_light_owner.owns(p_rid)) { - - SampledLight *sampled_light = sampled_light_owner.get( p_rid ); - ERR_FAIL_COND(!sampled_light); - - sampled_light_owner.free(p_rid); - memdelete( sampled_light ); - - }; -} - - -void RasterizerDummy::custom_shade_model_set_shader(int p_model, RID p_shader) { - - -}; - -RID RasterizerDummy::custom_shade_model_get_shader(int p_model) const { - - return RID(); -}; - -void RasterizerDummy::custom_shade_model_set_name(int p_model, const String& p_name) { - -}; - -String RasterizerDummy::custom_shade_model_get_name(int p_model) const { - - return String(); -}; - -void RasterizerDummy::custom_shade_model_set_param_info(int p_model, const List& p_info) { - -}; - -void RasterizerDummy::custom_shade_model_get_param_info(int p_model, List* p_info) const { - -}; - - - -void RasterizerDummy::init() { - - -} - -void RasterizerDummy::finish() { - - -} - -int RasterizerDummy::get_render_info(VS::RenderInfo p_info) { - - return 0; -} - -bool RasterizerDummy::needs_to_draw_next_frame() const { - - return false; -} - - -bool RasterizerDummy::has_feature(VS::Features p_feature) const { - - return false; - -} - -void RasterizerDummy::restore_framebuffer() { - -} - -RasterizerDummy::RasterizerDummy() { - -}; - -RasterizerDummy::~RasterizerDummy() { - -}; diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h deleted file mode 100644 index cac36eb6fc..0000000000 --- a/servers/visual/rasterizer_dummy.h +++ /dev/null @@ -1,791 +0,0 @@ -/*************************************************************************/ -/* rasterizer_dummy.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 RASTERIZER_DUMMY_H -#define RASTERIZER_DUMMY_H - -#include "servers/visual/rasterizer.h" - - -#include "image.h" -#include "rid.h" -#include "servers/visual_server.h" -#include "list.h" -#include "map.h" -#include "camera_matrix.h" -#include "sort.h" - - -#include "servers/visual/particle_system_sw.h" - -/** - @author Juan Linietsky -*/ -class RasterizerDummy : public Rasterizer { - - struct Texture { - - uint32_t flags; - int width,height; - Image::Format format; - Image image[6]; - Texture() { - - flags=width=height=0; - format=Image::FORMAT_GRAYSCALE; - } - - ~Texture() { - - } - }; - - mutable RID_Owner texture_owner; - - struct Shader { - - String vertex_code; - String fragment_code; - String light_code; - VS::ShaderMode mode; - Map params; - int fragment_line; - int vertex_line; - int light_line; - bool valid; - bool has_alpha; - bool use_world_transform; - - }; - - mutable RID_Owner shader_owner; - - - struct Material { - - bool flags[VS::MATERIAL_FLAG_MAX]; - - VS::MaterialDepthDrawMode depth_draw_mode; - - VS::MaterialBlendMode blend_mode; - - float line_width; - float point_size; - - RID shader; // shader material - - Map shader_params; - - - Material() { - - - for(int i=0;i material_owner; - - void _material_check_alpha(Material *p_material); - - - struct Geometry { - - enum Type { - GEOMETRY_INVALID, - GEOMETRY_SURFACE, - GEOMETRY_POLY, - GEOMETRY_PARTICLES, - GEOMETRY_MULTISURFACE, - }; - - Type type; - RID material; - bool has_alpha; - bool material_owned; - - Geometry() { has_alpha=false; material_owned = false; } - virtual ~Geometry() {}; - }; - - struct GeometryOwner { - - virtual ~GeometryOwner() {} - }; - - class Mesh; - - struct Surface : public Geometry { - - Array data; - Array morph_data; - - bool packed; - bool alpha_sort; - int morph_target_count; - AABB aabb; - - VS::PrimitiveType primitive; - - uint32_t format; - uint32_t morph_format; - - Surface() { - - packed=false; - morph_target_count=0; - material_owned=false; - format=0; - morph_format=0; - - primitive=VS::PRIMITIVE_POINTS; - } - - ~Surface() { - - } - }; - - - struct Mesh { - - bool active; - Vector surfaces; - int morph_target_count; - VS::MorphTargetMode morph_target_mode; - AABB custom_aabb; - - mutable uint64_t last_pass; - Mesh() { - morph_target_mode=VS::MORPH_MODE_NORMALIZED; - morph_target_count=0; - last_pass=0; - active=false; - } - }; - mutable RID_Owner mesh_owner; - - struct MultiMesh; - - struct MultiMeshSurface : public Geometry { - - Surface *surface; - MultiMeshSurface() { type=GEOMETRY_MULTISURFACE; } - }; - - struct MultiMesh : public GeometryOwner { - - struct Element { - - Transform xform; - Color color; - }; - - AABB aabb; - RID mesh; - int visible; - - //IDirect3DVertexBuffer9* instance_buffer; - Vector elements; - - MultiMesh() { - visible=-1; - } - - - }; - - - mutable RID_Owner multimesh_owner; - - struct Immediate { - - - RID material; - int empty; - }; - - mutable RID_Owner immediate_owner; - - struct Particles : public Geometry { - - ParticleSystemSW data; // software particle system - - Particles() { - type=GEOMETRY_PARTICLES; - - } - }; - - mutable RID_Owner particles_owner; - - struct ParticlesInstance : public GeometryOwner { - - RID particles; - - ParticleSystemProcessSW particles_process; - Transform transform; - - ParticlesInstance() { } - }; - - mutable RID_Owner particles_instance_owner; - ParticleSystemDrawInfoSW particle_draw_info; - - struct Skeleton { - - Vector bones; - - }; - - mutable RID_Owner skeleton_owner; - - - struct Light { - - VS::LightType type; - float vars[VS::LIGHT_PARAM_MAX]; - Color colors[3]; - bool shadow_enabled; - RID projector; - bool volumetric_enabled; - Color volumetric_color; - - - Light() { - - vars[VS::LIGHT_PARAM_SPOT_ATTENUATION]=1; - vars[VS::LIGHT_PARAM_SPOT_ANGLE]=45; - vars[VS::LIGHT_PARAM_ATTENUATION]=1.0; - vars[VS::LIGHT_PARAM_ENERGY]=1.0; - vars[VS::LIGHT_PARAM_RADIUS]=1.0; - vars[VS::LIGHT_PARAM_SHADOW_Z_OFFSET]=0.05; - - colors[VS::LIGHT_COLOR_DIFFUSE]=Color(1,1,1); - colors[VS::LIGHT_COLOR_SPECULAR]=Color(1,1,1); - shadow_enabled=false; - volumetric_enabled=false; - } - }; - - - struct Environment { - - - VS::EnvironmentBG bg_mode; - Variant bg_param[VS::ENV_BG_PARAM_MAX]; - bool fx_enabled[VS::ENV_FX_MAX]; - Variant fx_param[VS::ENV_FX_PARAM_MAX]; - - Environment() { - - bg_mode=VS::ENV_BG_DEFAULT_COLOR; - bg_param[VS::ENV_BG_PARAM_COLOR]=Color(0,0,0); - bg_param[VS::ENV_BG_PARAM_TEXTURE]=RID(); - bg_param[VS::ENV_BG_PARAM_CUBEMAP]=RID(); - bg_param[VS::ENV_BG_PARAM_ENERGY]=1.0; - - for(int i=0;i environment_owner; - - struct SampledLight { - - int w,h; - }; - - mutable RID_Owner sampled_light_owner; - - struct ShadowBuffer; - - struct LightInstance { - - struct SplitInfo { - - CameraMatrix camera; - Transform transform; - float near; - float far; - }; - - RID light; - Light *base; - Transform transform; - CameraMatrix projection; - - Transform custom_transform; - CameraMatrix custom_projection; - - Vector3 light_vector; - Vector3 spot_vector; - float linear_att; - - - LightInstance() { linear_att=1.0; } - - }; - - mutable RID_Owner light_owner; - mutable RID_Owner light_instance_owner; - - - RID default_material; - - - - -public: - - /* TEXTURE API */ - - virtual RID texture_create(); - virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=VS::TEXTURE_FLAGS_DEFAULT); - virtual void texture_set_data(RID p_texture,const Image& p_image,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT); - virtual Image texture_get_data(RID p_texture,VS::CubeMapSide p_cube_side=VS::CUBEMAP_LEFT) const; - virtual void texture_set_flags(RID p_texture,uint32_t p_flags); - virtual uint32_t texture_get_flags(RID p_texture) const; - virtual Image::Format texture_get_format(RID p_texture) const; - virtual uint32_t texture_get_width(RID p_texture) const; - virtual uint32_t texture_get_height(RID p_texture) const; - virtual bool texture_has_alpha(RID p_texture) const; - virtual void texture_set_size_override(RID p_texture,int p_width, int p_height); - virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const; - - virtual void texture_set_path(RID p_texture,const String& p_path) {} - virtual String texture_get_path(RID p_texture) const { return String(); } - virtual void texture_debug_usage(List *r_info) {} - - virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable) {} - - /* SHADER API */ - - virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_MATERIAL); - - virtual void shader_set_mode(RID p_shader,VS::ShaderMode p_mode); - virtual VS::ShaderMode shader_get_mode(RID p_shader) const; - - virtual void shader_set_code(RID p_shader, const String& p_vertex, const String& p_fragment,const String& p_light,int p_vertex_ofs=0,int p_fragment_ofs=0,int p_light_ofs=0); - virtual String shader_get_fragment_code(RID p_shader) const; - virtual String shader_get_vertex_code(RID p_shader) const; - virtual String shader_get_light_code(RID p_shader) const; - - virtual void shader_get_param_list(RID p_shader, List *p_param_list) const; - - - virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); - virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const; - - virtual Variant shader_get_default_param(RID p_shader, const StringName& p_name); - - /* COMMON MATERIAL API */ - - virtual RID material_create(); - - virtual void material_set_shader(RID p_shader_material, RID p_shader); - virtual RID material_get_shader(RID p_shader_material) const; - - virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); - virtual Variant material_get_param(RID p_material, const StringName& p_param) const; - - virtual void material_set_flag(RID p_material, VS::MaterialFlag p_flag,bool p_enabled); - virtual bool material_get_flag(RID p_material,VS::MaterialFlag p_flag) const; - - virtual void material_set_depth_draw_mode(RID p_material, VS::MaterialDepthDrawMode p_mode); - virtual VS::MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const; - - virtual void material_set_blend_mode(RID p_material,VS::MaterialBlendMode p_mode); - virtual VS::MaterialBlendMode material_get_blend_mode(RID p_material) const; - - virtual void material_set_line_width(RID p_material,float p_line_width); - virtual float material_get_line_width(RID p_material) const; - - /* MESH API */ - - - virtual RID mesh_create(); - - virtual void mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),bool p_alpha_sort=false); - virtual Array mesh_get_surface_arrays(RID p_mesh,int p_surface) const; - virtual Array mesh_get_surface_morph_arrays(RID p_mesh,int p_surface) const; - virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat); - - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); - virtual int mesh_get_morph_target_count(RID p_mesh) const; - - virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode); - virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; - - virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false); - virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; - - virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; - virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; - virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; - virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; - - virtual void mesh_remove_surface(RID p_mesh,int p_index); - virtual int mesh_get_surface_count(RID p_mesh) const; - - virtual AABB mesh_get_aabb(RID p_mesh,RID p_skeleton=RID()) const; - - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); - virtual AABB mesh_get_custom_aabb(RID p_mesh) const; - - - /* MULTIMESH API */ - - virtual RID multimesh_create(); - - virtual void multimesh_set_instance_count(RID p_multimesh,int p_count); - virtual int multimesh_get_instance_count(RID p_multimesh) const; - - virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); - virtual void multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb); - virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); - virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); - - virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_aabb(RID p_multimesh) const;; - - virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; - virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; - - virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); - virtual int multimesh_get_visible_instances(RID p_multimesh) const; - - /* IMMEDIATE API */ - - virtual RID immediate_create(); - virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID()); - virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); - virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); - virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); - virtual void immediate_color(RID p_immediate,const Color& p_color); - virtual void immediate_uv(RID p_immediate,const Vector2& tex_uv); - virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv); - virtual void immediate_end(RID p_immediate); - virtual void immediate_clear(RID p_immediate); - virtual void immediate_set_material(RID p_immediate,RID p_material); - virtual RID immediate_get_material(RID p_immediate) const; - - virtual AABB immediate_get_aabb(RID p_mesh) const; - - /* PARTICLES API */ - - virtual RID particles_create(); - - virtual void particles_set_amount(RID p_particles, int p_amount); - virtual int particles_get_amount(RID p_particles) const; - - virtual void particles_set_emitting(RID p_particles, bool p_emitting); - virtual bool particles_is_emitting(RID p_particles) const; - - virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility); - virtual AABB particles_get_visibility_aabb(RID p_particles) const; - - virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents); - virtual Vector3 particles_get_emission_half_extents(RID p_particles) const; - - virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity); - virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const; - - virtual void particles_set_emission_points(RID p_particles, const DVector& p_points); - virtual DVector particles_get_emission_points(RID p_particles) const; - - virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal); - virtual Vector3 particles_get_gravity_normal(RID p_particles) const; - - virtual void particles_set_variable(RID p_particles, VS::ParticleVariable p_variable,float p_value); - virtual float particles_get_variable(RID p_particles, VS::ParticleVariable p_variable) const; - - virtual void particles_set_randomness(RID p_particles, VS::ParticleVariable p_variable,float p_randomness); - virtual float particles_get_randomness(RID p_particles, VS::ParticleVariable p_variable) const; - - virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos); - virtual float particles_get_color_phase_pos(RID p_particles, int p_phase) const; - - virtual void particles_set_color_phases(RID p_particles, int p_phases); - virtual int particles_get_color_phases(RID p_particles) const; - - virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color); - virtual Color particles_get_color_phase_color(RID p_particles, int p_phase) const; - - virtual void particles_set_attractors(RID p_particles, int p_attractors); - virtual int particles_get_attractors(RID p_particles) const; - - virtual void particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos); - virtual Vector3 particles_get_attractor_pos(RID p_particles,int p_attractor) const; - - virtual void particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force); - virtual float particles_get_attractor_strength(RID p_particles,int p_attractor) const; - - virtual void particles_set_material(RID p_particles, RID p_material,bool p_owned=false); - virtual RID particles_get_material(RID p_particles) const; - - virtual AABB particles_get_aabb(RID p_particles) const; - - virtual void particles_set_height_from_velocity(RID p_particles, bool p_enable); - virtual bool particles_has_height_from_velocity(RID p_particles) const; - - virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable); - virtual bool particles_is_using_local_coordinates(RID p_particles) const; - - /* SKELETON API */ - - virtual RID skeleton_create(); - virtual void skeleton_resize(RID p_skeleton,int p_bones); - virtual int skeleton_get_bone_count(RID p_skeleton) const; - virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); - - - /* LIGHT API */ - - virtual RID light_create(VS::LightType p_type); - virtual VS::LightType light_get_type(RID p_light) const; - - virtual void light_set_color(RID p_light,VS::LightColor p_type, const Color& p_color); - virtual Color light_get_color(RID p_light,VS::LightColor p_type) const; - - virtual void light_set_shadow(RID p_light,bool p_enabled); - virtual bool light_has_shadow(RID p_light) const; - - virtual void light_set_volumetric(RID p_light,bool p_enabled); - virtual bool light_is_volumetric(RID p_light) const; - - virtual void light_set_projector(RID p_light,RID p_texture); - virtual RID light_get_projector(RID p_light) const; - - virtual void light_set_var(RID p_light, VS::LightParam p_var, float p_value); - virtual float light_get_var(RID p_light, VS::LightParam p_var) const; - - virtual void light_set_operator(RID p_light,VS::LightOp p_op); - virtual VS::LightOp light_get_operator(RID p_light) const; - - virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode); - virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const; - - - virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode); - virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const; - virtual void light_directional_set_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param, float p_value); - virtual float light_directional_get_shadow_param(RID p_light,VS::LightDirectionalShadowParam p_param) const; - - virtual AABB light_get_aabb(RID p_poly) const; - - - virtual RID light_instance_create(RID p_light); - virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform); - - virtual bool light_instance_has_shadow(RID p_light_instance) const; - virtual bool light_instance_assign_shadow(RID p_light_instance); - virtual ShadowType light_instance_get_shadow_type(RID p_light_instance) const; - virtual int light_instance_get_shadow_passes(RID p_light_instance) const; - virtual bool light_instance_get_pssm_shadow_overlap(RID p_light_instance) const; - virtual void light_instance_set_custom_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near=0,float p_split_far=0); - virtual int light_instance_get_shadow_size(RID p_light_instance, int p_index=0) const { return 1; } - - virtual ShadowType light_instance_get_shadow_type(RID p_light_instance,bool p_far=false) const; - virtual void light_instance_set_shadow_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near=0,float p_split_far=0); - - virtual void shadow_clear_near(); - virtual bool shadow_allocate_near(RID p_light); - virtual bool shadow_allocate_far(RID p_light); - - - /* PARTICLES INSTANCE */ - - virtual RID particles_instance_create(RID p_particles); - virtual void particles_instance_set_transform(RID p_particles_instance,const Transform& p_transform); - - /* VIEWPORT */ - - virtual RID viewport_data_create(); - - virtual RID render_target_create(); - virtual void render_target_set_size(RID p_render_target, int p_width, int p_height); - virtual RID render_target_get_texture(RID p_render_target) const; - virtual bool render_target_renedered_in_frame(RID p_render_target); - - /* RENDER API */ - /* all calls (inside begin/end shadow) are always warranted to be in the following order: */ - - virtual void begin_frame(); - - virtual void set_viewport(const VS::ViewportRect& p_viewport); - virtual void set_render_target(RID p_render_target,bool p_transparent_bg=false,bool p_vflip=false); - virtual void clear_viewport(const Color& p_color); - virtual void capture_viewport(Image* r_capture); - - - virtual void begin_scene(RID p_viewport_data,RID p_env,VS::ScenarioDebugMode p_debug); - virtual void begin_shadow_map( RID p_light_instance, int p_shadow_pass ); - - virtual void set_camera(const Transform& p_world,const CameraMatrix& p_projection,bool p_ortho_hint); - - virtual void add_light( RID p_light_instance ); ///< all "add_light" calls happen before add_geometry calls - - - virtual void add_mesh( const RID& p_mesh, const InstanceData *p_data); - virtual void add_multimesh( const RID& p_multimesh, const InstanceData *p_data); - virtual void add_immediate( const RID& p_immediate, const InstanceData *p_data) {} - virtual void add_particles( const RID& p_particle_instance, const InstanceData *p_data); - - virtual void end_scene(); - virtual void end_shadow_map(); - - virtual void end_frame(); - - /* CANVAS API */ - - virtual void begin_canvas_bg(); - virtual void canvas_begin(); - virtual void canvas_disable_blending(); - virtual void canvas_set_opacity(float p_opacity); - virtual void canvas_set_blend_mode(VS::MaterialBlendMode p_mode); - virtual void canvas_begin_rect(const Matrix32& p_transform); - virtual void canvas_set_clip(bool p_clip, const Rect2& p_rect); - virtual void canvas_end_rect(); - virtual void canvas_draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased); - virtual void canvas_draw_rect(const Rect2& p_rect, int p_flags, const Rect2& p_source,RID p_texture,const Color& p_modulate); - virtual void canvas_draw_style_box(const Rect2& p_rect, const Rect2& p_src_region, RID p_texture,const float *p_margins, bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); - virtual void canvas_draw_primitive(const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width); - virtual void canvas_draw_polygon(int p_vertex_count, const int* p_indices, const Vector2* p_vertices, const Vector2* p_uvs, const Color* p_colors,const RID& p_texture,bool p_singlecolor); - virtual void canvas_set_transform(const Matrix32& p_transform); - - virtual void canvas_render_items(CanvasItem *p_item_list,int p_z,const Color& p_modulate,CanvasLight *p_light); - - virtual RID canvas_light_occluder_create(); - virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines); - - virtual RID canvas_light_shadow_buffer_create(int p_width); - virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Matrix32& p_light_xform, int p_light_mask,float p_near, float p_far, CanvasLightOccluderInstance* p_occluders, CameraMatrix *p_xform_cache); - - virtual void canvas_debug_viewport_shadows(CanvasLight* p_lights_with_shadow); - - /* ENVIRONMENT */ - - virtual RID environment_create(); - - virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); - virtual VS::EnvironmentBG environment_get_background(RID p_env) const; - - virtual void environment_set_background_param(RID p_env,VS::EnvironmentBGParam p_param, const Variant& p_value); - virtual Variant environment_get_background_param(RID p_env,VS::EnvironmentBGParam p_param) const; - - virtual void environment_set_enable_fx(RID p_env,VS::EnvironmentFx p_effect,bool p_enabled); - virtual bool environment_is_fx_enabled(RID p_env,VS::EnvironmentFx p_effect) const; - - virtual void environment_fx_set_param(RID p_env,VS::EnvironmentFxParam p_param,const Variant& p_value); - virtual Variant environment_fx_get_param(RID p_env,VS::EnvironmentFxParam p_param) const; - - /* SAMPLED LIGHT */ - virtual RID sampled_light_dp_create(int p_width,int p_height); - virtual void sampled_light_dp_update(RID p_sampled_light,const Color *p_data,float p_multiplier); - - - /*MISC*/ - - virtual bool is_texture(const RID& p_rid) const; - virtual bool is_material(const RID& p_rid) const; - virtual bool is_mesh(const RID& p_rid) const; - virtual bool is_immediate(const RID& p_rid) const; - virtual bool is_multimesh(const RID& p_rid) const; - virtual bool is_particles(const RID &p_beam) const; - - virtual bool is_light(const RID& p_rid) const; - virtual bool is_light_instance(const RID& p_rid) const; - virtual bool is_particles_instance(const RID& p_rid) const; - virtual bool is_skeleton(const RID& p_rid) const; - virtual bool is_environment(const RID& p_rid) const; - virtual bool is_canvas_light_occluder(const RID& p_rid) const; - - virtual bool is_shader(const RID& p_rid) const; - - virtual void free(const RID& p_rid); - - virtual void custom_shade_model_set_shader(int p_model, RID p_shader); - virtual RID custom_shade_model_get_shader(int p_model) const; - virtual void custom_shade_model_set_name(int p_model, const String& p_name); - virtual String custom_shade_model_get_name(int p_model) const; - virtual void custom_shade_model_set_param_info(int p_model, const List& p_info); - virtual void custom_shade_model_get_param_info(int p_model, List* p_info) const; - - - virtual void init(); - virtual void finish(); - - virtual int get_render_info(VS::RenderInfo p_info); - - virtual bool needs_to_draw_next_frame() const; - - virtual bool has_feature(VS::Features p_feature) const; - - virtual void restore_framebuffer(); - - RasterizerDummy(); - virtual ~RasterizerDummy(); -}; - - -#endif // RASTERIZER_DUMMY_H diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index fdf3cb622d..287293a437 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -46,7 +46,7 @@ static bool _is_hex(CharType c) { const char * ShaderLanguage::token_names[TK_MAX]={ "EMPTY", - "INDENTIFIER", + "IDENTIFIER", "TRUE", "FALSE", "REAL_CONSTANT", @@ -97,401 +97,402 @@ const char * ShaderLanguage::token_names[TK_MAX]={ "ERROR", }; -ShaderLanguage::Token ShaderLanguage::read_token(const CharType* p_text,int p_len,int &r_line,int &r_chars) { +String ShaderLanguage::get_token_text(Token p_token) { -#define GETCHAR(m_idx) ((m_idx': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_GREATER_EQUAL); - }/* else if (GETCHAR(1)=='<') { - r_chars++; - if (GETCHAR(2)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_SHIFT_RIGHT); + } break; + default: + return _make_token(TK_OP_DIV); } - return Token(TK_OP_SHIFT_RIGHT); - }*/ + continue; //a comment, continue to next token + } break; + case '=': { - return Token(TK_OP_GREATER); - - } break; - case '!': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_NOT_EQUAL); - } + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_EQUAL); + } - return Token(TK_OP_NOT); + return _make_token(TK_OP_ASSIGN); + + } break; + case '<': { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_LESS_EQUAL); + } else if (GETCHAR(0)=='<') { + char_idx++; + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_SHIFT_LEFT); + } - } break; - //case '"' //string - no strings in shader - //case '\'' //string - no strings in shader - case '{': - return Token(TK_CURLY_BRACKET_OPEN); - case '}': - return Token(TK_CURLY_BRACKET_CLOSE); - //case '[': - // return Token(TK_BRACKET_OPEN); - //case ']': - // return Token(TK_BRACKET_CLOSE); - case '(': - return Token(TK_PARENTHESIS_OPEN); - case ')': - return Token(TK_PARENTHESIS_CLOSE); - case ',': - return Token(TK_COMMA); - case ';': - return Token(TK_SEMICOLON); - //case '?': - // return Token(TK_QUESTION_MARK); - //case ':': - // return Token(TK_COLON); //for methods maybe but now useless. - //case '^': - // return Token(TK_OP_BIT_XOR); - //case '~': - // return Token(TK_OP_BIT_INVERT); - case '&': { - - if (GETCHAR(1)=='&') { - - r_chars++; - return Token(TK_OP_AND); - } + return _make_token(TK_OP_SHIFT_LEFT); + } - return Token(TK_ERROR,"Unknown character"); + return _make_token(TK_OP_LESS); + + } break; + case '>': { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_GREATER_EQUAL); + } else if (GETCHAR(0)=='<') { + char_idx++;; + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_SHIFT_RIGHT); + } -/* - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_BIT_AND); - } else if (GETCHAR(1)=='&') { - r_chars++; - return Token(TK_OP_AND); - } - return TK_OP_BIT_AND;*/ - } break; - case '|': { + return _make_token(TK_OP_SHIFT_RIGHT); + } - if (GETCHAR(1)=='|') { + return _make_token(TK_OP_GREATER); - r_chars++; - return Token(TK_OP_OR); - } + } break; + case '!': { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_NOT_EQUAL); + } - return Token(TK_ERROR,"Unknown character"); + return _make_token(TK_OP_NOT); + + } break; + //case '"' //string - no strings in shader + //case '\'' //string - no strings in shader + case '{': + return _make_token(TK_CURLY_BRACKET_OPEN); + case '}': + return _make_token(TK_CURLY_BRACKET_CLOSE); + case '[': + return _make_token(TK_BRACKET_OPEN); + case ']': + return _make_token(TK_BRACKET_CLOSE); + case '(': + return _make_token(TK_PARENTHESIS_OPEN); + case ')': + return _make_token(TK_PARENTHESIS_CLOSE); + case ',': + return _make_token(TK_COMMA); + case ';': + return _make_token(TK_SEMICOLON); + case '?': + return _make_token(TK_QUESTION); + case ':': + return _make_token(TK_COLON); + case '^': + return _make_token(TK_OP_BIT_XOR); + case '~': + return _make_token(TK_OP_BIT_INVERT); + case '&': { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_BIT_AND); + } else if (GETCHAR(0)=='&') { + char_idx++; + return _make_token(TK_OP_AND); + } + return _make_token(TK_OP_BIT_AND); + } break; + case '|': { + + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_BIT_OR); + } else if (GETCHAR(0)=='|') { + char_idx++; + return _make_token(TK_OP_OR); + } + return _make_token(TK_OP_BIT_OR); - /* - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_BIT_OR); - } else if (GETCHAR(1)=='|') { - r_chars++; - return Token(TK_OP_OR); - } - return TK_OP_BIT_OR; - */ - } break; - case '*': { + } break; + case '*': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_MUL); - } - return TK_OP_MUL; - } break; - case '+': { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_MUL); + } + return _make_token(TK_OP_MUL); + } break; + case '+': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_ADD); - } /*else if (GETCHAR(1)=='+') { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_ADD); + } else if (GETCHAR(0)=='+') { - r_chars++; - return Token(TK_OP_PLUS_PLUS); - }*/ + char_idx++; + return _make_token(TK_OP_INCREMENT); + } - return TK_OP_ADD; - } break; - case '-': { + return _make_token(TK_OP_ADD); + } break; + case '-': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_SUB); - }/* else if (GETCHAR(1)=='-') { + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_SUB); + }else if (GETCHAR(0)=='-') { - r_chars++; - return Token(TK_OP_MINUS_MINUS); - }*/ + char_idx++; + return _make_token(TK_OP_DECREMENT); + } - return TK_OP_SUB; - } break; - /*case '%': { + return _make_token(TK_OP_SUB); + } break; + case '%': { - if (GETCHAR(1)=='=') { - r_chars++; - return Token(TK_OP_ASSIGN_MOD); - } + if (GETCHAR(0)=='=') { + char_idx++; + return _make_token(TK_OP_ASSIGN_MOD); + } - return TK_OP_MOD; - } break;*/ - default: { + return _make_token(TK_OP_MOD); + } break; + default: { - if (_is_number(GETCHAR(0)) || (GETCHAR(0)=='.' && _is_number(GETCHAR(1)))) { - // parse number - bool period_found=false; - bool exponent_found=false; - bool hexa_found=false; - bool sign_found=false; + char_idx--; //go back one, since we have no idea what this is - String str; - int i=0; + if (_is_number(GETCHAR(0)) || (GETCHAR(0)=='.' && _is_number(GETCHAR(1)))) { + // parse number + bool period_found=false; + bool exponent_found=false; + bool hexa_found=false; + bool sign_found=false; + bool minus_exponent_found=false; - while(true) { - if (GETCHAR(i)=='.') { - if (period_found || exponent_found) - return Token(TK_ERROR,"Invalid numeric constant"); - period_found=true; - } else if (GETCHAR(i)=='x') { - if (hexa_found || str.length()!=1 || str[0]!='0') - return Token(TK_ERROR,"Invalid numeric constant"); - hexa_found=true; - } else if (GETCHAR(i)=='e') { - if (hexa_found || exponent_found) - return Token(TK_ERROR,"Invalid numeric constant"); - exponent_found=true; - } else if (_is_number(GETCHAR(i))) { - //all ok - } else if (hexa_found && _is_hex(GETCHAR(i))) { - - } else if ((GETCHAR(i)=='-' || GETCHAR(i)=='+') && exponent_found) { - if (sign_found) - return Token(TK_ERROR,"Invalid numeric constant"); - sign_found=true; - } else - break; + String str; + int i=0; - str+=CharType(GETCHAR(i)); - i++; - } + while(true) { + if (GETCHAR(i)=='.') { + if (period_found || exponent_found) + return _make_token(TK_ERROR,"Invalid numeric constant"); + period_found=true; + } else if (GETCHAR(i)=='x') { + if (hexa_found || str.length()!=1 || str[0]!='0') + return _make_token(TK_ERROR,"Invalid numeric constant"); + hexa_found=true; + } else if (GETCHAR(i)=='e') { + if (hexa_found || exponent_found) + return _make_token(TK_ERROR,"Invalid numeric constant"); + exponent_found=true; + } else if (_is_number(GETCHAR(i))) { + //all ok + } else if (hexa_found && _is_hex(GETCHAR(i))) { + + } else if ((GETCHAR(i)=='-' || GETCHAR(i)=='+') && exponent_found) { + if (sign_found) + return _make_token(TK_ERROR,"Invalid numeric constant"); + sign_found=true; + if (GETCHAR(i)=='-') + minus_exponent_found=true; + } else + break; - if (!_is_number(str[str.length()-1])) - return Token(TK_ERROR,"Invalid numeric constant"); + str+=CharType(GETCHAR(i)); + i++; + } - r_chars+=str.length()-1; - return Token(TK_REAL_CONSTANT,str); - /* - if (period_found) - return Token(TK_NUMBER_REAL,str); - else - return Token(TK_NUMBER_INTEGER,str);*/ + if (!_is_number(str[str.length()-1])) + return _make_token(TK_ERROR,"Invalid numeric constant"); - } + char_idx+=str.length()-1; + Token tk; + if (period_found || minus_exponent_found) + tk.type=TK_REAL_CONSTANT; + else + tk.type=TK_INT_CONSTANT; - if (GETCHAR(0)=='.') { - //parse period - return Token(TK_PERIOD); - } + if (!str.is_valid_float()) { + return _make_token(TK_ERROR,"Invalid numeric constant"); + } - if (_is_text_char(GETCHAR(0))) { - // parse identifier - String str; - str+=CharType(GETCHAR(0)); + tk.constant=str.to_double(); + tk.line=tk_line; - while(_is_text_char(GETCHAR(r_chars))) { + return tk; - str+=CharType(GETCHAR(r_chars)); - r_chars++; } - //see if keyword - struct _kws { TokenType token; const char *text;}; - static const _kws keyword_list[]={ - {TK_TRUE,"true"}, - {TK_FALSE,"false"}, - {TK_TYPE_VOID,"void"}, - {TK_TYPE_BOOL,"bool"}, - /*{TK_TYPE_INT,"int"}, - {TK_TYPE_INT2,"int2"}, - {TK_TYPE_INT3,"int3"}, - {TK_TYPE_INT4,"int4"},*/ - {TK_TYPE_FLOAT,"float"}, - /*{TK_TYPE_FLOAT2,"float2"}, - {TK_TYPE_FLOAT3,"float3"}, - {TK_TYPE_FLOAT4,"float4"},*/ - {TK_TYPE_VEC2,"vec2"}, - {TK_TYPE_VEC3,"vec3"}, - {TK_TYPE_VEC4,"vec4"}, - {TK_TYPE_TEXTURE,"texture"}, - {TK_TYPE_CUBEMAP,"cubemap"}, - {TK_TYPE_COLOR,"color"}, - - {TK_TYPE_MAT2,"mat2"}, - /*{TK_TYPE_MAT3,"mat3"}, - {TK_TYPE_MAT4,"mat3"},*/ - {TK_TYPE_MAT3,"mat3"}, - {TK_TYPE_MAT4,"mat4"}, - {TK_CF_IF,"if"}, - {TK_CF_ELSE,"else"}, - /* - {TK_CF_FOR,"for"}, - {TK_CF_WHILE,"while"}, - {TK_CF_DO,"do"}, - {TK_CF_SWITCH,"switch"}, - {TK_CF_BREAK,"break"}, - {TK_CF_CONTINUE,"continue"},*/ - {TK_CF_RETURN,"return"}, - {TK_UNIFORM,"uniform"}, - {TK_ERROR,NULL} - }; - - int idx=0; - - while(keyword_list[idx].text) { - - if (str==keyword_list[idx].text) - return Token(keyword_list[idx].token); - idx++; + if (GETCHAR(0)=='.') { + //parse period + return _make_token(TK_PERIOD); } + if (_is_text_char(GETCHAR(0))) { + // parse identifier + String str; + str+=CharType(GETCHAR(0)); - return Token(TK_INDENTIFIER,str); - } - - if (GETCHAR(0)>32) - return Token(TK_ERROR,"Tokenizer: Unknown character #"+itos(GETCHAR(0))+": '"+String::chr(GETCHAR(0))+"'"); - else - return Token(TK_ERROR,"Tokenizer: Unknown character #"+itos(GETCHAR(0))); - - } break; - } - - ERR_PRINT("BUG"); - return Token(); -} - -Error ShaderLanguage::tokenize(const String& p_text,Vector *p_tokens,String *r_error,int *r_err_line,int *r_err_column) { + while(_is_text_char(GETCHAR(1))) { - int len =p_text.length(); - int pos=0; + str+=CharType(GETCHAR(1)); + char_idx++; + } - int line=0; + //see if keyword + //should be converted to a static map + struct _kws { TokenType token; const char *text;}; + static const _kws keyword_list[]={ + {TK_TRUE,"true"}, + {TK_FALSE,"false"}, + {TK_TYPE_VOID,"void"}, + {TK_TYPE_BOOL,"bool"}, + {TK_TYPE_BVEC2,"bvec2"}, + {TK_TYPE_BVEC3,"bvec3"}, + {TK_TYPE_BVEC4,"bvec4"}, + {TK_TYPE_INT,"int"}, + {TK_TYPE_IVEC2,"ivec2"}, + {TK_TYPE_IVEC3,"ivec3"}, + {TK_TYPE_IVEC4,"ivec4"}, + {TK_TYPE_UINT,"uint"}, + {TK_TYPE_UVEC2,"uvec2"}, + {TK_TYPE_UVEC3,"uvec3"}, + {TK_TYPE_UVEC4,"uvec4"}, + {TK_TYPE_FLOAT,"float"}, + {TK_TYPE_VEC2,"vec2"}, + {TK_TYPE_VEC3,"vec3"}, + {TK_TYPE_VEC4,"vec4"}, + {TK_TYPE_MAT2,"mat2"}, + {TK_TYPE_MAT3,"mat3"}, + {TK_TYPE_MAT4,"mat4"}, + {TK_TYPE_SAMPLER2D,"sampler2D"}, + {TK_TYPE_ISAMPLER2D,"isampler2D"}, + {TK_TYPE_USAMPLER2D,"usampler2D"}, + {TK_TYPE_SAMPLERCUBE,"samplerCube"}, + {TK_PRECISION_LOW,"lowp"}, + {TK_PRECISION_MID,"mediump"}, + {TK_PRECISION_HIGH,"highp"}, + {TK_CF_IF,"if"}, + {TK_CF_ELSE,"else"}, + {TK_CF_FOR,"for"}, + {TK_CF_WHILE,"while"}, + {TK_CF_DO,"do"}, + {TK_CF_SWITCH,"switch"}, + {TK_CF_CASE,"case"}, + {TK_CF_BREAK,"break"}, + {TK_CF_CONTINUE,"continue"}, + {TK_CF_RETURN,"return"}, + {TK_UNIFORM,"uniform"}, + {TK_VARYING,"varying"}, + {TK_RENDER_MODE,"render_mode"}, + {TK_HINT_WHITE_TEXTURE,"hint_white"}, + {TK_HINT_BLACK_TEXTURE,"hint_black"}, + {TK_HINT_NORMAL_TEXTURE,"hint_normal"}, + {TK_HINT_RANGE,"hint_range"}, + + {TK_ERROR,NULL} + }; + + int idx=0; + + while(keyword_list[idx].text) { + + if (str==keyword_list[idx].text) { + + _make_token(keyword_list[idx].token); + } + idx++; + } - while(pos32) + return _make_token(TK_ERROR,"Tokenizer: Unknown character #"+itos(GETCHAR(0))+": '"+String::chr(GETCHAR(0))+"'"); + else + return _make_token(TK_ERROR,"Tokenizer: Unknown character #"+itos(GETCHAR(0))); - if (r_error) { - *r_error=t.text; - *r_err_line=line; - return ERR_COMPILATION_FAILED; - } + } break; } - - if (t.type!=TK_EMPTY) - p_tokens->push_back(t); - //if (prev_line!=line) - // p_tokens->push_back(Token(TK_LINE,itos(line))); - - pos+=advance; - } - - return OK; - + ERR_PRINT("BUG"); + return Token(); } + String ShaderLanguage::lex_debug(const String& p_code) { +#if 0 Vector tokens; String error; int errline,errcol; @@ -503,47 +504,64 @@ String ShaderLanguage::lex_debug(const String& p_code) { } return ret; +#endif + return String(); } bool ShaderLanguage::is_token_datatype(TokenType p_type) { - return - (p_type==TK_TYPE_VOID) || - (p_type==TK_TYPE_BOOL) || - (p_type==TK_TYPE_FLOAT) || - (p_type==TK_TYPE_VEC2) || - (p_type==TK_TYPE_VEC3) || - (p_type==TK_TYPE_VEC4) || - (p_type==TK_TYPE_COLOR) || - (p_type==TK_TYPE_MAT2) || - (p_type==TK_TYPE_MAT3) || - (p_type==TK_TYPE_MAT4) || - (p_type==TK_TYPE_CUBEMAP) || - (p_type==TK_TYPE_TEXTURE); + return ( + p_type==TK_TYPE_VOID || + p_type==TK_TYPE_BOOL || + p_type==TK_TYPE_BVEC2 || + p_type==TK_TYPE_BVEC3 || + p_type==TK_TYPE_BVEC4 || + p_type==TK_TYPE_INT || + p_type==TK_TYPE_IVEC2 || + p_type==TK_TYPE_IVEC3 || + p_type==TK_TYPE_IVEC4 || + p_type==TK_TYPE_UINT || + p_type==TK_TYPE_UVEC2 || + p_type==TK_TYPE_UVEC3 || + p_type==TK_TYPE_UVEC4 || + p_type==TK_TYPE_FLOAT || + p_type==TK_TYPE_VEC2 || + p_type==TK_TYPE_VEC3 || + p_type==TK_TYPE_VEC4 || + p_type==TK_TYPE_MAT2 || + p_type==TK_TYPE_MAT3 || + p_type==TK_TYPE_MAT4 || + p_type==TK_TYPE_SAMPLER2D || + p_type==TK_TYPE_ISAMPLER2D || + p_type==TK_TYPE_USAMPLER2D || + p_type==TK_TYPE_SAMPLERCUBE ); } ShaderLanguage::DataType ShaderLanguage::get_token_datatype(TokenType p_type) { - switch(p_type) { + return DataType(p_type-TK_TYPE_VOID); +} - case TK_TYPE_VOID: return TYPE_VOID; - case TK_TYPE_BOOL: return TYPE_BOOL; - case TK_TYPE_FLOAT: return TYPE_FLOAT; - case TK_TYPE_VEC2: return TYPE_VEC2; - case TK_TYPE_VEC3: return TYPE_VEC3; - case TK_TYPE_VEC4: return TYPE_VEC4; - case TK_TYPE_COLOR: return TYPE_VEC4; - case TK_TYPE_MAT2: return TYPE_MAT2; - case TK_TYPE_MAT3: return TYPE_MAT3; - case TK_TYPE_MAT4: return TYPE_MAT4; - case TK_TYPE_TEXTURE: return TYPE_TEXTURE; - case TK_TYPE_CUBEMAP: return TYPE_CUBEMAP; - default: return TYPE_VOID; - } - return TYPE_VOID; +bool ShaderLanguage::is_token_precision(TokenType p_type) { + + return ( + p_type==TK_PRECISION_LOW || + p_type==TK_PRECISION_MID || + p_type==TK_PRECISION_HIGH ); + +} + +ShaderLanguage::DataPrecision ShaderLanguage::get_token_precision(TokenType p_type) { + + if (p_type==TK_PRECISION_LOW) + return PRECISION_LOWP; + else if (p_type==TK_PRECISION_HIGH) + return PRECISION_HIGHP; + else + return PRECISION_MEDIUMP; } @@ -553,16 +571,28 @@ String ShaderLanguage::get_datatype_name(DataType p_type) { case TYPE_VOID: return "void"; case TYPE_BOOL: return "bool"; + case TYPE_BVEC2: return "bvec2"; + case TYPE_BVEC3: return "bvec3"; + case TYPE_BVEC4: return "bvec4"; + case TYPE_INT: return "int"; + case TYPE_IVEC2: return "ivec2"; + case TYPE_IVEC3: return "ivec3"; + case TYPE_IVEC4: return "ivec4"; + case TYPE_UINT: return "uint"; + case TYPE_UVEC2: return "uvec2"; + case TYPE_UVEC3: return "uvec3"; + case TYPE_UVEC4: return "uvec4"; case TYPE_FLOAT: return "float"; case TYPE_VEC2: return "vec2"; case TYPE_VEC3: return "vec3"; - case TYPE_VEC4: return "vec4"; + case TYPE_VEC4: return "vec5"; case TYPE_MAT2: return "mat2"; case TYPE_MAT3: return "mat3"; case TYPE_MAT4: return "mat4"; - case TYPE_TEXTURE: return "texture"; - case TYPE_CUBEMAP: return "cubemap"; - default: return ""; + case TYPE_SAMPLER2D: return "sampler2D"; + case TYPE_ISAMPLER2D: return "isampler2D"; + case TYPE_USAMPLER2D: return "usampler2D"; + case TYPE_SAMPLERCUBE: return "samplerCube"; } return ""; @@ -571,211 +601,488 @@ String ShaderLanguage::get_datatype_name(DataType p_type) { bool ShaderLanguage::is_token_nonvoid_datatype(TokenType p_type) { - return - (p_type==TK_TYPE_BOOL) || - (p_type==TK_TYPE_FLOAT) || - (p_type==TK_TYPE_VEC2) || - (p_type==TK_TYPE_VEC3) || - (p_type==TK_TYPE_VEC4) || - (p_type==TK_TYPE_COLOR) || - (p_type==TK_TYPE_MAT2) || - (p_type==TK_TYPE_MAT3) || - (p_type==TK_TYPE_MAT4) || - (p_type==TK_TYPE_TEXTURE) || - (p_type==TK_TYPE_CUBEMAP); + return is_token_datatype(p_type) && p_type!=TK_TYPE_VOID; } -bool ShaderLanguage::parser_is_at_function(Parser& parser) { +void ShaderLanguage::clear() { - return (is_token_datatype(parser.get_token_type(0)) && parser.get_token_type(1)==TK_INDENTIFIER && parser.get_token_type(2)==TK_PARENTHESIS_OPEN); -} + tk_line=0; + char_idx=0; + error_set=false; + error_str=""; + while(nodes) { + Node *n = nodes; + nodes=nodes->next; + memdelete(n); + } +} -bool ShaderLanguage::test_existing_identifier(Node *p_node,const StringName p_identifier,bool p_func,bool p_var,bool p_builtin) { +bool ShaderLanguage::_find_identifier(const BlockNode* p_block,const Map &p_builtin_types,const StringName& p_identifier, DataType *r_data_type, IdentifierType *r_type) { - Node *node = p_node; - while(node) { + if (p_builtin_types.has(p_identifier)) { - if (node->type==Node::TYPE_BLOCK) { + if (r_data_type) { + *r_data_type=p_builtin_types[p_identifier]; + } + if (r_type) { + *r_type=IDENTIFIER_BUILTIN_VAR; + } - BlockNode *block = (BlockNode*)node; - if (block->variables.has(p_identifier)) - return true; - } else if (node->type==Node::TYPE_PROGRAM) { + return true; + } - ProgramNode *program = (ProgramNode*)node; - for(int i=0;ifunctions.size();i++) { + FunctionNode *function=NULL; - if (program->functions[i].name==p_identifier) { - return true; - } - } + while(p_block) { - if(program->builtin_variables.has(p_identifier)) { - return true; + if (p_block->variables.has(p_identifier)) { + if (r_data_type) { + *r_data_type=p_block->variables[p_identifier].type; } - if(program->uniforms.has(p_identifier)) { - return true; + if (r_type) { + *r_type=IDENTIFIER_LOCAL_VAR; } - } else if (node->type==Node::TYPE_FUNCTION) { - - FunctionNode *func=(FunctionNode*)node; - for(int i=0;iarguments.size();i++) - if (func->arguments[i].name==p_identifier) - return true; + return true; } - node=node->parent; + if (p_block->parent_function) { + function=p_block->parent_function; + break; + } else { + ERR_FAIL_COND_V(!p_block->parent_block,false); + p_block=p_block->parent_block; + } } - // try keywords - - int idx=0; - - //todo optimize - while(intrinsic_func_defs[idx].name) { + if (function) { + for(int i=0;iarguments.size();i++) { + if (function->arguments[i].name==p_identifier) { + if (r_data_type) { + *r_data_type=function->arguments[i].type; + } + if (r_type) { + *r_type=IDENTIFIER_FUNCTION_ARGUMENT; + } - if (p_identifier.operator String()==intrinsic_func_defs[idx].name) - return true; - idx++; + return true; + } + } } - return false; - -} + if (shader->varyings.has(p_identifier)) { + if (r_data_type) { + *r_data_type=shader->varyings[p_identifier].type; + } + if (r_type) { + *r_type=IDENTIFIER_VARYING; + } + return true; + } + if (shader->uniforms.has(p_identifier)) { + if (r_data_type) { + *r_data_type=shader->uniforms[p_identifier].type; + } + if (r_type) { + *r_type=IDENTIFIER_UNIFORM; + } + return true; + } -Error ShaderLanguage::parse_function(Parser& parser,BlockNode *p_block) { + for(int i=0;ifunctions.size();i++) { - if (!p_block->parent || p_block->parent->type!=Node::TYPE_PROGRAM) { - parser.set_error("Misplaced function"); - return ERR_PARSE_ERROR; + if (!shader->functions[i].callable) + continue; + if (shader->functions[i].name==p_identifier) { + if (r_data_type) { + *r_data_type=shader->functions[i].function->return_type; + } + if (r_type) { + *r_type=IDENTIFIER_FUNCTION; + } + } } + return false; - ProgramNode *program = (ProgramNode*)p_block->parent; +} - StringName name = parser.get_token(1).text; - if (test_existing_identifier(p_block,name)) { +bool ShaderLanguage::_validate_operator(OperatorNode *p_op,DataType *r_ret_type) { - parser.set_error("Duplicate Identifier (existing variable/builtin/function): "+name); - return ERR_PARSE_ERROR; + bool valid=false; + DataType ret_type; + + switch(p_op->op) { + case OP_EQUAL: + case OP_NOT_EQUAL: { + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); + valid=na==nb; + ret_type=TYPE_BOOL; + } break; + case OP_LESS: + case OP_LESS_EQUAL: + case OP_GREATER: + case OP_GREATER_EQUAL: { + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - } + valid = na==nb && (na==TYPE_UINT || na==TYPE_INT || na==TYPE_FLOAT); + ret_type=TYPE_BOOL; + } break; + case OP_AND: + case OP_OR: { + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - FunctionNode *function = parser.create_node(program); - function->body = parser.create_node(function); + valid = na==nb && na==TYPE_BOOL; + ret_type=TYPE_BOOL; - function->name=name; + } break; + case OP_NOT: { - function->return_type=get_token_datatype(parser.get_token_type(0)); + DataType na = p_op->arguments[0]->get_datatype(); + valid = na==TYPE_BOOL; + ret_type=TYPE_BOOL; - { //add to programnode - ProgramNode::Function f; - f.name=name; - f.function=function; - program->functions.push_back(f); - } + } break; + case OP_INCREMENT: + case OP_DECREMENT: + case OP_POST_INCREMENT: + case OP_POST_DECREMENT: + case OP_NEGATE: { + DataType na = p_op->arguments[0]->get_datatype(); + valid = na>TYPE_BOOL && naarguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); + + if (na>nb) { + //make things easier; + SWAP(na,nb); + } + + if (na==nb) { + valid = (na>TYPE_BOOL && naop==OP_MUL && na>=TYPE_MAT2 && na<=TYPE_MAT4); + ret_type=na; + } else if (na==TYPE_INT && nb==TYPE_IVEC2) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_INT && nb==TYPE_IVEC3) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_INT && nb==TYPE_IVEC4) { + valid=true; + ret_type=TYPE_IVEC4; + } else if (na==TYPE_UINT && nb==TYPE_UVEC2) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UINT && nb==TYPE_UVEC3) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UINT && nb==TYPE_UVEC4) { + valid=true; + ret_type=TYPE_UVEC4; + } else if (na==TYPE_FLOAT && nb==TYPE_VEC2) { + valid=true; + ret_type=TYPE_VEC2; + } else if (na==TYPE_FLOAT && nb==TYPE_VEC3) { + valid=true; + ret_type=TYPE_VEC3; + } else if (na==TYPE_FLOAT && nb==TYPE_VEC4) { + valid=true; + ret_type=TYPE_VEC4; + } else if (p_op->op==OP_MUL && na==TYPE_VEC2 && nb==TYPE_MAT2) { + valid=true; + ret_type=TYPE_MAT2; + } else if (p_op->op==OP_MUL && na==TYPE_VEC3 && nb==TYPE_MAT3) { + valid=true; + ret_type=TYPE_MAT3; + } else if (p_op->op==OP_MUL && na==TYPE_VEC4 && nb==TYPE_MAT4) { + valid=true; + ret_type=TYPE_MAT4; + } + } break; + case OP_ASSIGN_MOD: + case OP_MOD: { + /* + * The operator modulus (%) operates on signed or unsigned integers or integer vectors. The operand + * types must both be signed or both be unsigned. The operands cannot be vectors of differing size. If + * one operand is a scalar and the other vector, then the scalar is applied component-wise to the vector, + * resulting in the same type as the vector. If both are vectors of the same size, the result is computed + * component-wise. + */ - int ofs=3; + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - while(true) { - //end of arguments - if (parser.get_token_type(ofs)==TK_PARENTHESIS_CLOSE) { - ofs++; - break; - } - //next argument awaits - if (parser.get_token_type(ofs)==TK_COMMA) { - if (!is_token_nonvoid_datatype(parser.get_token_type(ofs+1))) { - parser.set_error("Expected Identifier or ')' following ','"); - return ERR_PARSE_ERROR; + if (na==TYPE_INT && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_INT; + } else if (na==TYPE_IVEC2 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC4; + } else if (na==TYPE_IVEC2 && nb==TYPE_IVEC2) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_IVEC3) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_IVEC4) { + valid=true; + ret_type=TYPE_IVEC4; + ///// + } else if (na==TYPE_UINT && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UINT; + } else if (na==TYPE_UVEC2 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UVEC3 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UVEC4 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC4; + } else if (na==TYPE_UVEC2 && nb==TYPE_UVEC2) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UVEC3 && nb==TYPE_UVEC3) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UVEC4 && nb==TYPE_UVEC4) { + valid=true; + ret_type=TYPE_UVEC4; } - ofs++; - continue; - } - - + } break; + case OP_ASSIGN_SHIFT_LEFT: + case OP_ASSIGN_SHIFT_RIGHT: + case OP_SHIFT_LEFT: + case OP_SHIFT_RIGHT: { - if (!is_token_nonvoid_datatype(parser.get_token_type(ofs+0))) { - parser.set_error("Invalid Argument Type"); - return ERR_PARSE_ERROR; - } + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - DataType identtype=get_token_datatype(parser.get_token_type(ofs+0)); + if (na>=TYPE_UINT && na<=TYPE_UVEC4) { + na=DataType(na-4); + } - if (parser.get_token_type(ofs+1)!=TK_INDENTIFIER) { - parser.set_error("Expected Argument Identifier"); - return ERR_PARSE_ERROR; - } + if (nb>=TYPE_UINT && nb<=TYPE_UVEC4) { + nb=DataType(nb-4); + } - StringName identname=parser.get_token(ofs+1).text; + if (na==TYPE_INT && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_INT; + } else if (na==TYPE_IVEC2 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC4; + } else if (na==TYPE_IVEC2 && nb==TYPE_IVEC2) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_IVEC3) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_IVEC4) { + valid=true; + ret_type=TYPE_IVEC4; + } + } break; + case OP_ASSIGN: { + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); + valid=na==nb; + ret_type=na; + } break; + case OP_ASSIGN_ADD: + case OP_ASSIGN_SUB: + case OP_ASSIGN_MUL: + case OP_ASSIGN_DIV: { - if (test_existing_identifier(function,identname)) { - parser.set_error("Duplicate Argument Identifier: "+identname); - return ERR_DUPLICATE_SYMBOL; - } + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - FunctionNode::Argument arg; - arg.name=identname; - arg.type=identtype; - //function->body->variables[arg.name]=arg.type; - function->arguments.push_back(arg); - ofs+=2; - } + if (na==nb) { + valid = (na>TYPE_BOOL && naop==OP_ASSIGN_MUL && na>=TYPE_MAT2 && na<=TYPE_MAT4); + ret_type=na; + } else if (na==TYPE_IVEC2 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_INT ) { + valid=true; + ret_type=TYPE_IVEC4; + } else if (na==TYPE_UVEC2 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UVEC3 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UVEC4 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC4; + } else if (na==TYPE_VEC2 && nb==TYPE_FLOAT ) { + valid=true; + ret_type=TYPE_VEC2; + } else if (na==TYPE_VEC3 && nb==TYPE_FLOAT) { + valid=true; + ret_type=TYPE_VEC3; + } else if (na==TYPE_VEC4 && nb==TYPE_FLOAT) { + valid=true; + ret_type=TYPE_VEC4; + } else if (p_op->op==OP_ASSIGN_MUL && na==TYPE_MAT2 && nb==TYPE_VEC2) { + valid=true; + ret_type=TYPE_MAT2; + } else if (p_op->op==OP_ASSIGN_MUL && na==TYPE_MAT3 && nb==TYPE_VEC3) { + valid=true; + ret_type=TYPE_MAT3; + } else if (p_op->op==OP_ASSIGN_MUL && na==TYPE_MAT4 && nb==TYPE_VEC4) { + valid=true; + ret_type=TYPE_MAT4; + } + } break; + case OP_ASSIGN_BIT_AND: + case OP_ASSIGN_BIT_OR: + case OP_ASSIGN_BIT_XOR: + case OP_BIT_AND: + case OP_BIT_OR: + case OP_BIT_XOR: { - parser.advance(ofs); - // match { - if (parser.get_token_type()!=TK_CURLY_BRACKET_OPEN) { - parser.set_error("Expected '{'"); - return ERR_PARSE_ERROR; - } + /* + * The bitwise operators and (&), exclusive-or (^), and inclusive-or (|). The operands must be of type + * signed or unsigned integers or integer vectors. The operands cannot be vectors of differing size. If + * one operand is a scalar and the other a vector, the scalar is applied component-wise to the vector, + * resulting in the same type as the vector. The fundamental types of the operands (signed or unsigned) + * must match. + */ - parser.advance(); - Error err = parse_block(parser,function->body); + DataType na = p_op->arguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); - if (err) - return err; + if (na>nb && p_op->op>=OP_BIT_AND) { + //can swap for non assign + SWAP(na,nb); + } - // make sure that if the function has a return type, it does return something.. - if (function->return_type!=TYPE_VOID) { - bool found=false; - for(int i=0;ibody->statements.size();i++) { - if (function->body->statements[i]->type==Node::TYPE_CONTROL_FLOW) { - - ControlFlowNode *cf = (ControlFlowNode*)function->body->statements[i]; - if (cf->flow_op==FLOW_OP_RETURN) { - // type of return was already checked when inserted - // no need to check here - found=true; - } + if (na==TYPE_INT && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_INT; + } else if (na==TYPE_IVEC2 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_INT) { + valid=true; + ret_type=TYPE_IVEC4; + } else if (na==TYPE_IVEC2 && nb==TYPE_IVEC2) { + valid=true; + ret_type=TYPE_IVEC2; + } else if (na==TYPE_IVEC3 && nb==TYPE_IVEC3) { + valid=true; + ret_type=TYPE_IVEC3; + } else if (na==TYPE_IVEC4 && nb==TYPE_IVEC4) { + valid=true; + ret_type=TYPE_IVEC4; + ///// + } else if (na==TYPE_UINT && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UINT; + } else if (na==TYPE_UVEC2 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UVEC3 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UVEC4 && nb==TYPE_UINT) { + valid=true; + ret_type=TYPE_UVEC4; + } else if (na==TYPE_UVEC2 && nb==TYPE_UVEC2) { + valid=true; + ret_type=TYPE_UVEC2; + } else if (na==TYPE_UVEC3 && nb==TYPE_UVEC3) { + valid=true; + ret_type=TYPE_UVEC3; + } else if (na==TYPE_UVEC4 && nb==TYPE_UVEC4) { + valid=true; + ret_type=TYPE_UVEC4; } - } + } break; + case OP_BIT_INVERT: { //unaries + DataType na = p_op->arguments[0]->get_datatype(); + valid = na>=TYPE_INT && naarguments[0]->get_datatype(); + DataType nb = p_op->arguments[1]->get_datatype(); + DataType nc = p_op->arguments[2]->get_datatype(); - if (!found) { - parser.set_error("Function must return a value (use the main block)"); - return ERR_PARSE_ERROR; + valid = na==TYPE_BOOL && (nb==nc); + ret_type=nb; + } break; + default: { + ERR_FAIL_V(false); } } - return OK; -} + if (r_ret_type) + *r_ret_type=ret_type; + return valid; +} const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ //constructors {"bool",TYPE_BOOL,{TYPE_BOOL,TYPE_VOID}}, + {"bvec2",TYPE_BVEC2,{TYPE_BOOL,TYPE_VOID}}, + {"bvec2",TYPE_BVEC2,{TYPE_BOOL,TYPE_BOOL,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_BOOL,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_BOOL,TYPE_BOOL,TYPE_BOOL,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_BVEC2,TYPE_BOOL,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_BOOL,TYPE_BVEC2,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BOOL,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BOOL,TYPE_BOOL,TYPE_BOOL,TYPE_BOOL,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BOOL,TYPE_BVEC2,TYPE_BOOL,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BVEC2,TYPE_BOOL,TYPE_BOOL,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BOOL,TYPE_BOOL,TYPE_BVEC2,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BOOL,TYPE_BVEC3,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BVEC3,TYPE_BOOL,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_BVEC2,TYPE_BVEC2,TYPE_VOID}}, + + {"float",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, {"vec2",TYPE_VEC2,{TYPE_FLOAT,TYPE_VOID}}, {"vec2",TYPE_VEC2,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, @@ -791,17 +1098,139 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"vec4",TYPE_VEC4,{TYPE_FLOAT,TYPE_VEC3,TYPE_VOID}}, {"vec4",TYPE_VEC4,{TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, {"vec4",TYPE_VEC4,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + + {"int",TYPE_INT,{TYPE_INT,TYPE_VOID}}, + {"ivec2",TYPE_IVEC2,{TYPE_INT,TYPE_VOID}}, + {"ivec2",TYPE_IVEC2,{TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_INT,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_INT,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_IVEC2,TYPE_INT,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_INT,TYPE_IVEC2,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_INT,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_INT,TYPE_INT,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_INT,TYPE_IVEC2,TYPE_INT,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_IVEC2,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_INT,TYPE_INT,TYPE_IVEC2,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_INT,TYPE_IVEC3,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_IVEC3,TYPE_INT,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + + {"uint",TYPE_UINT,{TYPE_UINT,TYPE_VOID}}, + {"uvec2",TYPE_UVEC2,{TYPE_UINT,TYPE_VOID}}, + {"uvec2",TYPE_UVEC2,{TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_UINT,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_UINT,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_UVEC2,TYPE_UINT,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_UINT,TYPE_UVEC2,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UINT,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UINT,TYPE_UINT,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UINT,TYPE_UVEC2,TYPE_UINT,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UVEC2,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UINT,TYPE_UINT,TYPE_UVEC2,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UINT,TYPE_UVEC3,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UVEC3,TYPE_UINT,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"mat2",TYPE_MAT2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, {"mat3",TYPE_MAT3,{TYPE_VEC3,TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, {"mat4",TYPE_MAT4,{TYPE_VEC4,TYPE_VEC4,TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, - //intrinsics - trigonometry - {"sin",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"cos",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"tan",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"asin",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"acos",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"atan",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {"atan2",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, + + {"mat2",TYPE_MAT2,{TYPE_FLOAT,TYPE_VOID}}, + {"mat3",TYPE_MAT3,{TYPE_FLOAT,TYPE_VOID}}, + {"mat4",TYPE_MAT4,{TYPE_FLOAT,TYPE_VOID}}, + + //conversion scalars + + {"int",TYPE_INT,{TYPE_BOOL,TYPE_VOID}}, + {"int",TYPE_INT,{TYPE_INT,TYPE_VOID}}, + {"int",TYPE_INT,{TYPE_UINT,TYPE_VOID}}, + {"int",TYPE_INT,{TYPE_FLOAT,TYPE_VOID}}, + + {"float",TYPE_FLOAT,{TYPE_BOOL,TYPE_VOID}}, + {"float",TYPE_FLOAT,{TYPE_INT,TYPE_VOID}}, + {"float",TYPE_FLOAT,{TYPE_UINT,TYPE_VOID}}, + {"float",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + + {"uint",TYPE_UINT,{TYPE_BOOL,TYPE_VOID}}, + {"uint",TYPE_UINT,{TYPE_INT,TYPE_VOID}}, + {"uint",TYPE_UINT,{TYPE_UINT,TYPE_VOID}}, + {"uint",TYPE_UINT,{TYPE_FLOAT,TYPE_VOID}}, + + {"bool",TYPE_BOOL,{TYPE_BOOL,TYPE_VOID}}, + {"bool",TYPE_BOOL,{TYPE_INT,TYPE_VOID}}, + {"bool",TYPE_BOOL,{TYPE_UINT,TYPE_VOID}}, + {"bool",TYPE_BOOL,{TYPE_FLOAT,TYPE_VOID}}, + + //conversion vectors + + {"ivec2",TYPE_IVEC2,{TYPE_BVEC2,TYPE_VOID}}, + {"ivec2",TYPE_IVEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"ivec2",TYPE_IVEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"ivec2",TYPE_IVEC2,{TYPE_VEC2,TYPE_VOID}}, + + {"vec2",TYPE_VEC2,{TYPE_BVEC2,TYPE_VOID}}, + {"vec2",TYPE_VEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"vec2",TYPE_VEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"vec2",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, + + {"uvec2",TYPE_UVEC2,{TYPE_BVEC2,TYPE_VOID}}, + {"uvec2",TYPE_UVEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"uvec2",TYPE_UVEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"uvec2",TYPE_UVEC2,{TYPE_VEC2,TYPE_VOID}}, + + {"bvec2",TYPE_BVEC2,{TYPE_BVEC2,TYPE_VOID}}, + {"bvec2",TYPE_BVEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"bvec2",TYPE_BVEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"bvec2",TYPE_BVEC2,{TYPE_VEC2,TYPE_VOID}}, + + {"ivec3",TYPE_IVEC3,{TYPE_BVEC3,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"ivec3",TYPE_IVEC3,{TYPE_VEC3,TYPE_VOID}}, + + {"vec3",TYPE_VEC3,{TYPE_BVEC3,TYPE_VOID}}, + {"vec3",TYPE_VEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"vec3",TYPE_VEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"vec3",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, + + {"uvec3",TYPE_UVEC3,{TYPE_BVEC3,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"uvec3",TYPE_UVEC3,{TYPE_VEC3,TYPE_VOID}}, + + {"bvec3",TYPE_BVEC3,{TYPE_BVEC3,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"bvec3",TYPE_BVEC3,{TYPE_VEC3,TYPE_VOID}}, + + {"ivec4",TYPE_IVEC4,{TYPE_BVEC4,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_IVEC4,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_UVEC4,TYPE_VOID}}, + {"ivec4",TYPE_IVEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"vec4",TYPE_VEC4,{TYPE_BVEC4,TYPE_VOID}}, + {"vec4",TYPE_VEC4,{TYPE_IVEC4,TYPE_VOID}}, + {"vec4",TYPE_VEC4,{TYPE_UVEC4,TYPE_VOID}}, + {"vec4",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"uvec4",TYPE_UVEC4,{TYPE_BVEC4,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_IVEC4,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_UVEC4,TYPE_VOID}}, + {"uvec4",TYPE_UVEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"bvec4",TYPE_BVEC4,{TYPE_BVEC4,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_IVEC4,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_UVEC4,TYPE_VOID}}, + {"bvec4",TYPE_BVEC4,{TYPE_VEC4,TYPE_VOID}}, + + //intrinsics - trigonometry + {"sin",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"cos",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"tan",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"asin",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"acos",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"atan",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"atan2",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"sinh",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, {"cosh",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, {"tanh",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, @@ -830,10 +1259,29 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"abs",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, {"abs",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, {"abs",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"abs",TYPE_INT,{TYPE_INT,TYPE_VOID}}, + {"abs",TYPE_IVEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"abs",TYPE_IVEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"abs",TYPE_IVEC4,{TYPE_IVEC4,TYPE_VOID}}, + + {"abs",TYPE_UINT,{TYPE_UINT,TYPE_VOID}}, + {"abs",TYPE_UVEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"abs",TYPE_UVEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"abs",TYPE_UVEC4,{TYPE_UVEC4,TYPE_VOID}}, + + {"sign",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, {"sign",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, {"sign",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, {"sign",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"sign",TYPE_INT,{TYPE_INT,TYPE_VOID}}, + {"sign",TYPE_IVEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"sign",TYPE_IVEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"sign",TYPE_IVEC4,{TYPE_IVEC4,TYPE_VOID}}, + + {"floor",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, {"floor",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, {"floor",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, @@ -854,18 +1302,51 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"fract",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, {"fract",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, {"fract",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + {"mod",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"mod",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"mod",TYPE_VEC2,{TYPE_VEC2,TYPE_FLOAT,TYPE_VOID}}, {"mod",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"mod",TYPE_VEC3,{TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, {"mod",TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + {"mod",TYPE_VEC4,{TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"modf",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, + {"modf",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"modf",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"modf",TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + {"min",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"min",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, {"min",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, {"min",TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + + {"min",TYPE_INT,{TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"min",TYPE_IVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"min",TYPE_IVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"min",TYPE_IVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + + {"min",TYPE_UINT,{TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"min",TYPE_UVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"min",TYPE_UVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"min",TYPE_UVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, + {"max",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"max",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, {"max",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, {"max",TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + + {"max",TYPE_INT,{TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"max",TYPE_IVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"max",TYPE_IVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"max",TYPE_IVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + + {"max",TYPE_UINT,{TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"max",TYPE_UVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"max",TYPE_UVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"max",TYPE_UVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, + + {"clamp",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"clamp",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, {"clamp",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, @@ -873,6 +1354,24 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"clamp",TYPE_VEC2,{TYPE_VEC2,TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"clamp",TYPE_VEC3,{TYPE_VEC3,TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"clamp",TYPE_VEC4,{TYPE_VEC4,TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, + + + {"clamp",TYPE_INT,{TYPE_INT,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"clamp",TYPE_IVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"clamp",TYPE_IVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"clamp",TYPE_IVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + {"clamp",TYPE_IVEC2,{TYPE_IVEC2,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"clamp",TYPE_IVEC3,{TYPE_IVEC3,TYPE_INT,TYPE_INT,TYPE_VOID}}, + {"clamp",TYPE_IVEC4,{TYPE_IVEC4,TYPE_INT,TYPE_INT,TYPE_VOID}}, + + {"clamp",TYPE_UINT,{TYPE_UINT,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"clamp",TYPE_UVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"clamp",TYPE_UVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"clamp",TYPE_UVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, + {"clamp",TYPE_UVEC2,{TYPE_UVEC2,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"clamp",TYPE_UVEC3,{TYPE_UVEC3,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"clamp",TYPE_UVEC4,{TYPE_UVEC4,TYPE_UINT,TYPE_UINT,TYPE_VOID}}, + {"mix",TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT,TYPE_FLOAT,TYPE_VOID}}, {"mix",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_FLOAT,TYPE_VOID}}, {"mix",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, @@ -895,6 +1394,36 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"smoothstep",TYPE_VEC3,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VEC3,TYPE_VOID}}, {"smoothstep",TYPE_VEC4,{TYPE_FLOAT,TYPE_FLOAT,TYPE_VEC4,TYPE_VOID}}, + {"isnan",TYPE_BOOL,{TYPE_FLOAT,TYPE_VOID}}, + {"isnan",TYPE_BOOL,{TYPE_VEC2,TYPE_VOID}}, + {"isnan",TYPE_BOOL,{TYPE_VEC3,TYPE_VOID}}, + {"isnan",TYPE_BOOL,{TYPE_VEC4,TYPE_VOID}}, + + {"isinf",TYPE_BOOL,{TYPE_FLOAT,TYPE_VOID}}, + {"isinf",TYPE_BOOL,{TYPE_VEC2,TYPE_VOID}}, + {"isinf",TYPE_BOOL,{TYPE_VEC3,TYPE_VOID}}, + {"isinf",TYPE_BOOL,{TYPE_VEC4,TYPE_VOID}}, + + {"floatBitsToInt",TYPE_INT,{TYPE_FLOAT,TYPE_VOID}}, + {"floatBitsToInt",TYPE_IVEC2,{TYPE_VEC2,TYPE_VOID}}, + {"floatBitsToInt",TYPE_IVEC3,{TYPE_VEC3,TYPE_VOID}}, + {"floatBitsToInt",TYPE_IVEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"floatBitsToUInt",TYPE_UINT,{TYPE_FLOAT,TYPE_VOID}}, + {"floatBitsToUInt",TYPE_UVEC2,{TYPE_VEC2,TYPE_VOID}}, + {"floatBitsToUInt",TYPE_UVEC3,{TYPE_VEC3,TYPE_VOID}}, + {"floatBitsToUInt",TYPE_UVEC4,{TYPE_VEC4,TYPE_VOID}}, + + {"intBitsToFloat",TYPE_FLOAT,{TYPE_INT,TYPE_VOID}}, + {"intBitsToFloat",TYPE_VEC2,{TYPE_IVEC2,TYPE_VOID}}, + {"intBitsToFloat",TYPE_VEC3,{TYPE_IVEC3,TYPE_VOID}}, + {"intBitsToFloat",TYPE_VEC4,{TYPE_IVEC4,TYPE_VOID}}, + + {"uintBitsToFloat",TYPE_FLOAT,{TYPE_UINT,TYPE_VOID}}, + {"uintBitsToFloat",TYPE_VEC2,{TYPE_UVEC2,TYPE_VOID}}, + {"uintBitsToFloat",TYPE_VEC3,{TYPE_UVEC3,TYPE_VOID}}, + {"uintBitsToFloat",TYPE_VEC4,{TYPE_UVEC4,TYPE_VOID}}, + //intrinsics - geometric {"length",TYPE_FLOAT,{TYPE_VEC2,TYPE_VOID}}, {"length",TYPE_FLOAT,{TYPE_VEC3,TYPE_VOID}}, @@ -911,318 +1440,211 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={ {"normalize",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, {"reflect",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, {"refract",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, - //intrinsics - texture - {"tex",TYPE_VEC4,{TYPE_TEXTURE,TYPE_VEC2,TYPE_VOID}}, - {"texcube",TYPE_VEC4,{TYPE_CUBEMAP,TYPE_VEC3,TYPE_VOID}}, - {"texscreen",TYPE_VEC3,{TYPE_VEC2,TYPE_VOID}}, - {"texpos",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, - {NULL,TYPE_VOID,{TYPE_VOID}} + {"facefordward",TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"facefordward",TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"facefordward",TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, -}; + {"matrixCompMult",TYPE_MAT2,{TYPE_MAT2,TYPE_MAT2,TYPE_VOID}}, + {"matrixCompMult",TYPE_MAT3,{TYPE_MAT3,TYPE_MAT3,TYPE_VOID}}, + {"matrixCompMult",TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4,TYPE_VOID}}, -const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={ - - {OP_ASSIGN,TYPE_VOID,{TYPE_BOOL,TYPE_BOOL}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_MAT2,TYPE_MAT2}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_MAT3,TYPE_MAT3}}, - {OP_ASSIGN,TYPE_VOID,{TYPE_MAT4,TYPE_MAT4}}, - {OP_ADD,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ADD,TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ADD,TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ADD,TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4}}, - {OP_SUB,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_SUB,TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2}}, - {OP_SUB,TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3}}, - {OP_SUB,TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4}}, - {OP_MUL,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2}}, - {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_MUL,TYPE_VEC2,{TYPE_FLOAT,TYPE_VEC2}}, - {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT3}}, - {OP_MUL,TYPE_VEC2,{TYPE_MAT2,TYPE_VEC2}}, - {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT2}}, - {OP_MUL,TYPE_VEC2,{TYPE_MAT3,TYPE_VEC2}}, - {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT4}}, - {OP_MUL,TYPE_VEC2,{TYPE_MAT4,TYPE_VEC2}}, - {OP_MUL,TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3}}, - {OP_MUL,TYPE_VEC3,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_MUL,TYPE_VEC3,{TYPE_FLOAT,TYPE_VEC3}}, - {OP_MUL,TYPE_VEC3,{TYPE_MAT3,TYPE_VEC3}}, - {OP_MUL,TYPE_VEC3,{TYPE_MAT4,TYPE_VEC3}}, - {OP_MUL,TYPE_VEC3,{TYPE_VEC3,TYPE_MAT3}}, - {OP_MUL,TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4}}, - {OP_MUL,TYPE_VEC4,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_MUL,TYPE_VEC4,{TYPE_FLOAT,TYPE_VEC4}}, - {OP_MUL,TYPE_VEC4,{TYPE_MAT4,TYPE_VEC4}}, - {OP_MUL,TYPE_VEC4,{TYPE_VEC4,TYPE_MAT4}}, - {OP_MUL,TYPE_MAT2,{TYPE_MAT2,TYPE_MAT2}}, - {OP_MUL,TYPE_MAT3,{TYPE_MAT3,TYPE_MAT3}}, - {OP_MUL,TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4}}, - {OP_DIV,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_DIV,TYPE_VEC2,{TYPE_VEC2,TYPE_VEC2}}, - {OP_DIV,TYPE_VEC2,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_DIV,TYPE_VEC2,{TYPE_FLOAT,TYPE_VEC2}}, - {OP_DIV,TYPE_VEC3,{TYPE_VEC3,TYPE_VEC3}}, - {OP_DIV,TYPE_VEC3,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_DIV,TYPE_VEC3,{TYPE_FLOAT,TYPE_VEC3}}, - {OP_DIV,TYPE_VEC4,{TYPE_VEC4,TYPE_VEC4}}, - {OP_DIV,TYPE_VEC4,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_DIV,TYPE_VEC4,{TYPE_FLOAT,TYPE_VEC4}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_ASSIGN_ADD,TYPE_VOID,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_ASSIGN_SUB,TYPE_VOID,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_MAT2}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT2,TYPE_MAT2}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_MAT3}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_MAT4}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_MAT4}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT3,TYPE_MAT3}}, - {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT4,TYPE_MAT4}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC2,TYPE_FLOAT}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC3,TYPE_FLOAT}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}}, - {OP_ASSIGN_DIV,TYPE_VOID,{TYPE_VEC4,TYPE_FLOAT}}, - {OP_NEG,TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, - {OP_NEG,TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, - {OP_NEG,TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, - {OP_NEG,TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, - {OP_NOT,TYPE_BOOL,{TYPE_BOOL,TYPE_VOID}}, - {OP_CMP_EQ,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}}, - {OP_CMP_EQ,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC2}}, - {OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC3}}, - {OP_CMP_EQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC4}}, - //{OP_CMP_EQ,TYPE_MAT3,{TYPE_MAT4,TYPE_MAT3}}, ?? - //{OP_CMP_EQ,TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4}}, ?? - {OP_CMP_NEQ,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}}, - {OP_CMP_NEQ,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_NEQ,TYPE_BOOL,{TYPE_VEC2,TYPE_VEC2}}, - {OP_CMP_NEQ,TYPE_BOOL,{TYPE_VEC3,TYPE_VEC3}}, - {OP_CMP_NEQ,TYPE_BOOL,{TYPE_VEC4,TYPE_VEC4}}, - //{OP_CMP_NEQ,TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4}}, //? - {OP_CMP_LEQ,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_GEQ,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_LESS,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_GREATER,TYPE_BOOL,{TYPE_FLOAT,TYPE_FLOAT}}, - {OP_CMP_OR,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}}, - {OP_CMP_AND,TYPE_BOOL,{TYPE_BOOL,TYPE_BOOL}}, - {OP_MAX,TYPE_VOID,{TYPE_VOID,TYPE_VOID}} -}; + {"outerProduct",TYPE_MAT2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"outerProduct",TYPE_MAT3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"outerProduct",TYPE_MAT4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + {"transpose",TYPE_MAT2,{TYPE_MAT2,TYPE_VOID}}, + {"transpose",TYPE_MAT3,{TYPE_MAT3,TYPE_VOID}}, + {"transpose",TYPE_MAT4,{TYPE_MAT4,TYPE_VOID}}, -const ShaderLanguage::BuiltinsDef ShaderLanguage::vertex_builtins_defs[]={ - - { "SRC_VERTEX", TYPE_VEC3}, - { "SRC_NORMAL", TYPE_VEC3}, - { "SRC_TANGENT", TYPE_VEC3}, - { "SRC_BINORMALF", TYPE_FLOAT}, - - { "POSITION", TYPE_VEC4 }, - { "VERTEX", TYPE_VEC3}, - { "NORMAL", TYPE_VEC3}, - { "TANGENT", TYPE_VEC3}, - { "BINORMAL", TYPE_VEC3}, - { "UV", TYPE_VEC2}, - { "UV2", TYPE_VEC2}, - { "COLOR", TYPE_VEC4}, - { "BONES", TYPE_VEC4}, - { "WEIGHTS", TYPE_VEC4}, - { "VAR1", TYPE_VEC4}, - { "VAR2", TYPE_VEC4}, - { "SPEC_EXP", TYPE_FLOAT}, - { "POINT_SIZE", TYPE_FLOAT}, - - //builtins - { "WORLD_MATRIX", TYPE_MAT4}, - { "INV_CAMERA_MATRIX", TYPE_MAT4}, - { "PROJECTION_MATRIX", TYPE_MAT4}, - { "MODELVIEW_MATRIX", TYPE_MAT4}, - { "INSTANCE_ID", TYPE_FLOAT}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID}, -}; -const ShaderLanguage::BuiltinsDef ShaderLanguage::fragment_builtins_defs[]={ - - { "VERTEX", TYPE_VEC3}, - { "POSITION", TYPE_VEC4}, - { "NORMAL", TYPE_VEC3}, - { "TANGENT", TYPE_VEC3}, - { "BINORMAL", TYPE_VEC3}, - { "NORMALMAP", TYPE_VEC3}, - { "NORMALMAP_DEPTH", TYPE_FLOAT}, - { "UV", TYPE_VEC2}, - { "UV2", TYPE_VEC2}, - { "COLOR", TYPE_VEC4}, - { "NORMAL", TYPE_VEC3}, - { "VAR1", TYPE_VEC4}, - { "VAR2", TYPE_VEC4}, - { "DIFFUSE", TYPE_VEC3}, - { "DIFFUSE_ALPHA", TYPE_VEC4}, - { "SPECULAR", TYPE_VEC3}, - { "EMISSION", TYPE_VEC3}, - { "SPEC_EXP", TYPE_FLOAT}, - { "GLOW", TYPE_FLOAT}, - { "SHADE_PARAM", TYPE_FLOAT}, - { "DISCARD", TYPE_BOOL}, - { "SCREEN_UV", TYPE_VEC2}, - { "POINT_COORD", TYPE_VEC2}, - { "INV_CAMERA_MATRIX", TYPE_MAT4}, - -// { "SCREEN_POS", TYPE_VEC2}, -// { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID} + {"determinant",TYPE_FLOAT,{TYPE_MAT2,TYPE_VOID}}, + {"determinant",TYPE_FLOAT,{TYPE_MAT3,TYPE_VOID}}, + {"determinant",TYPE_FLOAT,{TYPE_MAT4,TYPE_VOID}}, -}; + {"inverse",TYPE_MAT2,{TYPE_MAT2,TYPE_VOID}}, + {"inverse",TYPE_MAT3,{TYPE_MAT3,TYPE_VOID}}, + {"inverse",TYPE_MAT4,{TYPE_MAT4,TYPE_VOID}}, -const ShaderLanguage::BuiltinsDef ShaderLanguage::light_builtins_defs[]={ - - { "NORMAL", TYPE_VEC3}, - { "LIGHT_DIR", TYPE_VEC3}, - { "LIGHT_DIFFUSE", TYPE_VEC3}, - { "LIGHT_SPECULAR", TYPE_VEC3}, - { "EYE_VEC", TYPE_VEC3}, - { "DIFFUSE", TYPE_VEC3}, - { "SPECULAR", TYPE_VEC3}, - { "SPECULAR_EXP", TYPE_FLOAT}, - { "SHADE_PARAM", TYPE_FLOAT}, - { "LIGHT", TYPE_VEC3}, - { "SHADOW", TYPE_VEC3 }, - { "POINT_COORD", TYPE_VEC2 }, -// { "SCREEN_POS", TYPE_VEC2}, -// { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID} -}; + {"lessThan",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"lessThan",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"lessThan",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + {"lessThan",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"lessThan",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"lessThan",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + {"lessThan",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"lessThan",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"lessThan",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, -const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_vertex_builtins_defs[]={ + {"greaterThan",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, - { "SRC_VERTEX", TYPE_VEC2}, - { "VERTEX", TYPE_VEC2}, - { "WORLD_VERTEX", TYPE_VEC2}, - { "UV", TYPE_VEC2}, - { "COLOR", TYPE_VEC4}, - { "VAR1", TYPE_VEC4}, - { "VAR2", TYPE_VEC4}, - { "POINT_SIZE", TYPE_FLOAT}, + {"greaterThan",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, - //builtins - { "WORLD_MATRIX", TYPE_MAT4}, - { "PROJECTION_MATRIX", TYPE_MAT4}, - { "EXTRA_MATRIX", TYPE_MAT4}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID}, -}; -const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_fragment_builtins_defs[]={ - - { "SRC_COLOR", TYPE_VEC4}, - { "POSITION", TYPE_VEC4}, - { "NORMAL", TYPE_VEC3}, - { "NORMALMAP", TYPE_VEC3}, - { "NORMALMAP_DEPTH", TYPE_FLOAT}, - { "UV", TYPE_VEC2}, - { "COLOR", TYPE_VEC4}, - { "TEXTURE", TYPE_TEXTURE}, - { "TEXTURE_PIXEL_SIZE", TYPE_VEC2}, - { "VAR1", TYPE_VEC4}, - { "VAR2", TYPE_VEC4}, - { "SCREEN_UV", TYPE_VEC2}, - { "POINT_COORD", TYPE_VEC2}, - -// { "SCREEN_POS", TYPE_VEC2}, -// { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID} + {"greaterThan",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"greaterThan",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, -}; + {"lessThanEqual",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, -const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_light_builtins_defs[]={ - - { "POSITION", TYPE_VEC4}, - { "NORMAL", TYPE_VEC3}, - { "UV", TYPE_VEC2}, - { "COLOR", TYPE_VEC4}, - { "TEXTURE", TYPE_TEXTURE}, - { "TEXTURE_PIXEL_SIZE", TYPE_VEC2}, - { "VAR1", TYPE_VEC4}, - { "VAR2", TYPE_VEC4}, - { "SCREEN_UV", TYPE_VEC2}, - { "LIGHT_VEC", TYPE_VEC2}, - { "LIGHT_HEIGHT", TYPE_FLOAT}, - { "LIGHT_COLOR", TYPE_VEC4}, - { "LIGHT_UV", TYPE_VEC2}, - { "LIGHT_SHADOW", TYPE_VEC4}, - { "LIGHT", TYPE_VEC4}, - { "SHADOW", TYPE_VEC4}, - { "POINT_COORD", TYPE_VEC2}, -// { "SCREEN_POS", TYPE_VEC2}, -// { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID} + {"lessThanEqual",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, -}; + {"lessThanEqual",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"lessThanEqual",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, -const ShaderLanguage::BuiltinsDef ShaderLanguage::postprocess_fragment_builtins_defs[]={ + {"greaterThanEqual",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, - { "IN_COLOR", TYPE_VEC3}, - { "IN_POSITION", TYPE_VEC3}, - { "OUT_COLOR", TYPE_VEC3}, - { "SCREEN_POS", TYPE_VEC2}, - { "SCREEN_TEXEL_SIZE", TYPE_VEC2}, - { "TIME", TYPE_FLOAT}, - { NULL, TYPE_VOID} -}; + {"greaterThanEqual",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"greaterThanEqual",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, + {"equal",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"equal",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"equal",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, -ShaderLanguage::DataType ShaderLanguage::compute_node_type(Node *p_node) { + {"equal",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"equal",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"equal",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, - switch(p_node->type) { + {"equal",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"equal",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"equal",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, - case Node::TYPE_PROGRAM: ERR_FAIL_V(TYPE_VOID); - case Node::TYPE_FUNCTION: return static_cast(p_node)->return_type; - case Node::TYPE_BLOCK: ERR_FAIL_V(TYPE_VOID); - case Node::TYPE_VARIABLE: return static_cast(p_node)->datatype_cache; - case Node::TYPE_CONSTANT: return static_cast(p_node)->datatype; - case Node::TYPE_OPERATOR: return static_cast(p_node)->return_cache; - case Node::TYPE_CONTROL_FLOW: ERR_FAIL_V(TYPE_VOID); - case Node::TYPE_MEMBER: return static_cast(p_node)->datatype; - } + {"equal",TYPE_BVEC2,{TYPE_BVEC2,TYPE_BVEC2,TYPE_VOID}}, + {"equal",TYPE_BVEC3,{TYPE_BVEC3,TYPE_BVEC3,TYPE_VOID}}, + {"equal",TYPE_BVEC4,{TYPE_BVEC4,TYPE_BVEC4,TYPE_VOID}}, - return TYPE_VOID; -} + {"notEqual",TYPE_BVEC2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"notEqual",TYPE_BVEC3,{TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + {"notEqual",TYPE_BVEC4,{TYPE_VEC4,TYPE_VEC4,TYPE_VOID}}, + + {"notEqual",TYPE_BVEC2,{TYPE_IVEC2,TYPE_IVEC2,TYPE_VOID}}, + {"notEqual",TYPE_BVEC3,{TYPE_IVEC3,TYPE_IVEC3,TYPE_VOID}}, + {"notEqual",TYPE_BVEC4,{TYPE_IVEC4,TYPE_IVEC4,TYPE_VOID}}, + + {"notEqual",TYPE_BVEC2,{TYPE_UVEC2,TYPE_UVEC2,TYPE_VOID}}, + {"notEqual",TYPE_BVEC3,{TYPE_UVEC3,TYPE_UVEC3,TYPE_VOID}}, + {"notEqual",TYPE_BVEC4,{TYPE_UVEC4,TYPE_UVEC4,TYPE_VOID}}, + + {"notEqual",TYPE_BVEC2,{TYPE_BVEC2,TYPE_BVEC2,TYPE_VOID}}, + {"notEqual",TYPE_BVEC3,{TYPE_BVEC3,TYPE_BVEC3,TYPE_VOID}}, + {"notEqual",TYPE_BVEC4,{TYPE_BVEC4,TYPE_BVEC4,TYPE_VOID}}, + + {"any",TYPE_BOOL,{TYPE_BVEC2,TYPE_VOID}}, + {"any",TYPE_BOOL,{TYPE_BVEC3,TYPE_VOID}}, + {"any",TYPE_BOOL,{TYPE_BVEC4,TYPE_VOID}}, + + {"all",TYPE_BOOL,{TYPE_BVEC2,TYPE_VOID}}, + {"all",TYPE_BOOL,{TYPE_BVEC3,TYPE_VOID}}, + {"all",TYPE_BOOL,{TYPE_BVEC4,TYPE_VOID}}, + + {"not",TYPE_BOOL,{TYPE_BVEC2,TYPE_VOID}}, + {"not",TYPE_BOOL,{TYPE_BVEC3,TYPE_VOID}}, + {"not",TYPE_BOOL,{TYPE_BVEC4,TYPE_VOID}}, + + //intrinsics - texture + {"textureSize",TYPE_VEC2,{TYPE_SAMPLER2D,TYPE_INT,TYPE_VOID}}, + {"textureSize",TYPE_VEC2,{TYPE_ISAMPLER2D,TYPE_INT,TYPE_VOID}}, + {"textureSize",TYPE_VEC2,{TYPE_USAMPLER2D,TYPE_INT,TYPE_VOID}}, + {"textureSize",TYPE_VEC2,{TYPE_SAMPLERCUBE,TYPE_INT,TYPE_VOID}}, + + {"texture",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC2,TYPE_VOID}}, + {"texture",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"texture",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC2,TYPE_FLOAT,TYPE_VOID}}, + {"texture",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + + {"texture",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC2,TYPE_VOID}}, + {"texture",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"texture",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC2,TYPE_FLOAT,TYPE_VOID}}, + {"texture",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + + {"texture",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC2,TYPE_VOID}}, + {"texture",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"texture",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC2,TYPE_FLOAT,TYPE_VOID}}, + {"texture",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + + {"texture",TYPE_VEC4,{TYPE_SAMPLERCUBE,TYPE_VEC3,TYPE_VOID}}, + {"texture",TYPE_VEC4,{TYPE_SAMPLERCUBE,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + + {"textureProj",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"textureProj",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC4,TYPE_VOID}}, + {"textureProj",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProj",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureProj",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"textureProj",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC4,TYPE_VOID}}, + {"textureProj",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProj",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureProj",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_VOID}}, + {"textureProj",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC4,TYPE_VOID}}, + {"textureProj",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProj",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureLod",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureLod",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureLod",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureLod",TYPE_VEC4,{TYPE_SAMPLERCUBE,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + + {"texelFetch",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_IVEC2,TYPE_INT,TYPE_VOID}}, + {"texelFetch",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_IVEC2,TYPE_INT,TYPE_VOID}}, + {"texelFetch",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_IVEC2,TYPE_INT,TYPE_VOID}}, + + {"textureProjLod",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProjLod",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureProjLod",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProjLod",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureProjLod",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}}, + {"textureProjLod",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC4,TYPE_FLOAT,TYPE_VOID}}, + + {"textureGrad",TYPE_VEC4,{TYPE_SAMPLER2D,TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"textureGrad",TYPE_IVEC4,{TYPE_ISAMPLER2D,TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"textureGrad",TYPE_UVEC4,{TYPE_USAMPLER2D,TYPE_VEC2,TYPE_VEC2,TYPE_VEC2,TYPE_VOID}}, + {"textureGrad",TYPE_VEC4,{TYPE_SAMPLERCUBE,TYPE_VEC3,TYPE_VEC3,TYPE_VEC3,TYPE_VOID}}, + + {"textureScreen",TYPE_VEC4,{TYPE_VEC2,TYPE_VOID}}, + + {"dFdx",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"dFdx",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, + {"dFdx",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, + {"dFdx",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + {"dFdy",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"dFdy",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, + {"dFdy",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, + {"dFdy",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, -ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, OperatorNode *p_func) { + {"fwidth",TYPE_FLOAT,{TYPE_FLOAT,TYPE_VOID}}, + {"fwidth",TYPE_VEC2,{TYPE_VEC2,TYPE_VOID}}, + {"fwidth",TYPE_VEC3,{TYPE_VEC3,TYPE_VOID}}, + {"fwidth",TYPE_VEC4,{TYPE_VEC4,TYPE_VOID}}, + + + {NULL,TYPE_VOID,{TYPE_VOID}} + +}; + + + +bool ShaderLanguage::_validate_function_call(BlockNode* p_block, OperatorNode *p_func,DataType *r_ret_type) { ERR_FAIL_COND_V(p_func->op!=OP_CALL && p_func->op!=OP_CONSTRUCT,NULL); @@ -1231,13 +1653,13 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper ERR_FAIL_COND_V( p_func->arguments[0]->type!=Node::TYPE_VARIABLE, NULL ); - String name = static_cast(p_func->arguments[0])->name.operator String(); + StringName name = static_cast(p_func->arguments[0])->name.operator String(); bool all_const=true; for(int i=1;iarguments.size();i++) { if (p_func->arguments[i]->type!=Node::TYPE_CONSTANT) all_const=false; - args.push_back(compute_node_type(p_func->arguments[i])); + args.push_back(p_func->arguments[i]->get_datatype()); } int argcount=args.size(); @@ -1265,10 +1687,11 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper fail=true; //make sure the number of arguments matches if (!fail) { - p_func->return_cache=intrinsic_func_defs[idx].rettype; found_intrinsic=true; - break; + if (r_ret_type) + *r_ret_type=intrinsic_func_defs[idx].rettype; + return true; } } @@ -1277,7 +1700,7 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper } } - +#if 0 if (found_intrinsic) { if (p_func->op==OP_CONSTRUCT && all_const) { @@ -1290,6 +1713,7 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper switch(v.get_type()) { case Variant::REAL: cdata.push_back(v); break; + case Variant::INT: cdata.push_back(v); break; case Variant::VECTOR2: { Vector2 v2=v; cdata.push_back(v2.x); cdata.push_back(v2.y); } break; case Variant::VECTOR3: { Vector3 v3=v; cdata.push_back(v3.x); cdata.push_back(v3.y); cdata.push_back(v3.z);} break; case Variant::PLANE: { Plane v4=v; cdata.push_back(v4.normal.x); cdata.push_back(v4.normal.y); cdata.push_back(v4.normal.z); cdata.push_back(v4.d); } break; @@ -1331,39 +1755,45 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper } return p_func; } - +#endif // try existing functions.. - FunctionNode *exclude_function=NULL; //exclude current function (in case inside one) + StringName exclude_function; + BlockNode *block = p_block; + while(block) { - Node *node = p_func; + if (block->parent_function) { + exclude_function=block->parent_function->name; + } + block=block->parent_block; + } - while(node->parent) { - if (node->type==Node::TYPE_FUNCTION) { + for(int i=0;ifunctions.size();i++) { - exclude_function = (FunctionNode*)node; + if (shader->functions[i].name==exclude_function) { + _set_error("Recursion is not allowed"); + return false; } - node=node->parent; - } - - ERR_FAIL_COND_V(node->type!=Node::TYPE_PROGRAM,NULL); - ProgramNode *program = (ProgramNode*)node; - - for(int i=0;ifunctions.size();i++) { + if (!shader->functions[i].callable) { + _set_error("Function '"+String(name)+" can't be called from source code."); + return false; + } - if (program->functions[i].function==exclude_function) + if (name != shader->functions[i].name) continue; - FunctionNode *pfunc = program->functions[i].function; + FunctionNode *pfunc = shader->functions[i].function; + if (pfunc->arguments.size()!=args.size()) continue; bool fail=false; + for(int i=0;iarguments[i].type) { fail=true; @@ -1371,153 +1801,94 @@ ShaderLanguage::Node* ShaderLanguage::validate_function_call(Parser&parser, Oper } } - if (!fail && name == program->functions[i].name) { + if (!fail) { p_func->return_cache=pfunc->return_type; - return p_func; + return true; } } - return NULL; + return false; } -ShaderLanguage::Node * ShaderLanguage::validate_operator(Parser& parser,OperatorNode *p_func) { +bool ShaderLanguage::_parse_function_arguments(BlockNode* p_block,const Map &p_builtin_types,OperatorNode* p_func) { - int argcount = p_func->arguments.size(); - ERR_FAIL_COND_V(argcount>2,NULL); + Token tk = _get_token(); - DataType argtype[2]={TYPE_VOID,TYPE_VOID}; - bool all_const=true; - - for(int i=0;iarguments[i]); - if (p_func->arguments[i]->type!=Node::TYPE_CONSTANT) - all_const=false; - - } - int idx=0; - bool valid=false; - while(operator_defs[idx].op!=OP_MAX) { + while(true) { - if (p_func->op==operator_defs[idx].op) { + if (tk.type==TK_PARENTHESIS_CLOSE) { + return true; + } + Node *arg= _parse_expression(p_block,p_builtin_types); + if (!arg) + return false; + p_func->arguments.push_back(arg); - if (operator_defs[idx].args[0]==argtype[0] && operator_defs[idx].args[1]==argtype[1]) { + tk = _get_token(); - p_func->return_cache=operator_defs[idx].rettype; - valid=true; - break; - } + if (tk.type==TK_PARENTHESIS_CLOSE) { + //none + } else if (tk.type==TK_COMMA) { + tk = _get_token(); //next + } else { + // something is broken + _set_error("Expected ',' or ')' after argument"); + return false; } - idx++; - } - - if (!valid) - return NULL; - -#define _RCO2(m_op,m_vop)\ -case m_op: {\ - ConstantNode *cn = parser.create_node(p_func->parent);\ - cn->datatype=p_func->return_cache; \ - Variant::evaluate(m_vop,static_cast(p_func->arguments[0])->value,static_cast(p_func->arguments[1])->value,cn->value,valid);\ - if (!valid)\ - return NULL;\ - return cn;\ -} break; - -#define _RCO1(m_op,m_vop)\ -case m_op: {\ - ConstantNode *cn = parser.create_node(p_func->parent);\ - cn->datatype=p_func->return_cache; \ - Variant::evaluate(m_vop,static_cast(p_func->arguments[0])->value,Variant(),cn->value,valid);\ - if (!valid)\ - return NULL;\ - return cn;\ -} break; - - if (all_const) { - //reduce constant operator - switch(p_func->op) { - _RCO2(OP_ADD,Variant::OP_ADD); - _RCO2(OP_SUB,Variant::OP_SUBSTRACT); - _RCO2(OP_MUL,Variant::OP_MULTIPLY); - _RCO2(OP_DIV,Variant::OP_DIVIDE); - _RCO1(OP_NEG,Variant::OP_NEGATE); - _RCO1(OP_NOT,Variant::OP_NOT); - _RCO2(OP_CMP_EQ,Variant::OP_EQUAL); - _RCO2(OP_CMP_NEQ,Variant::OP_NOT_EQUAL); - _RCO2(OP_CMP_LEQ,Variant::OP_LESS_EQUAL); - _RCO2(OP_CMP_GEQ,Variant::OP_GREATER_EQUAL); - _RCO2(OP_CMP_LESS,Variant::OP_LESS); - _RCO2(OP_CMP_GREATER,Variant::OP_GREATER); - _RCO2(OP_CMP_OR,Variant::OP_OR); - _RCO2(OP_CMP_AND,Variant::OP_AND); - default: {} - } } - - return p_func; - + return true; } bool ShaderLanguage::is_token_operator(TokenType p_type) { - return (p_type==TK_OP_EQUAL) || - (p_type==TK_OP_NOT_EQUAL) || - (p_type==TK_OP_LESS) || - (p_type==TK_OP_LESS_EQUAL) || - (p_type==TK_OP_GREATER) || - (p_type==TK_OP_GREATER_EQUAL) || - (p_type==TK_OP_AND) || - (p_type==TK_OP_OR) || - (p_type==TK_OP_NOT) || - (p_type==TK_OP_ADD) || - (p_type==TK_OP_SUB) || - (p_type==TK_OP_MUL) || - (p_type==TK_OP_DIV) || - (p_type==TK_OP_NEG) || - (p_type==TK_OP_ASSIGN) || - (p_type==TK_OP_ASSIGN_ADD) || - (p_type==TK_OP_ASSIGN_SUB) || - (p_type==TK_OP_ASSIGN_MUL) || - (p_type==TK_OP_ASSIGN_DIV); -} -ShaderLanguage::Operator ShaderLanguage::get_token_operator(TokenType p_type) { - - switch(p_type) { - case TK_OP_EQUAL: return OP_CMP_EQ ; - case TK_OP_NOT_EQUAL: return OP_CMP_NEQ; - case TK_OP_LESS: return OP_CMP_LESS ; - case TK_OP_LESS_EQUAL: return OP_CMP_LEQ ; - case TK_OP_GREATER: return OP_CMP_GREATER ; - case TK_OP_GREATER_EQUAL: return OP_CMP_GEQ ; - case TK_OP_AND: return OP_CMP_AND ; - case TK_OP_OR: return OP_CMP_OR ; - case TK_OP_NOT: return OP_NOT ; - case TK_OP_ADD: return OP_ADD ; - case TK_OP_SUB: return OP_SUB ; - case TK_OP_MUL: return OP_MUL ; - case TK_OP_DIV: return OP_DIV ; - case TK_OP_NEG: return OP_NEG ; - case TK_OP_ASSIGN: return OP_ASSIGN ; - case TK_OP_ASSIGN_ADD: return OP_ASSIGN_ADD ; - case TK_OP_ASSIGN_SUB: return OP_ASSIGN_SUB ; - case TK_OP_ASSIGN_MUL: return OP_ASSIGN_MUL ; - case TK_OP_ASSIGN_DIV: return OP_ASSIGN_DIV ; - default: ERR_FAIL_V(OP_MAX); - } + return (p_type==TK_OP_EQUAL || + p_type==TK_OP_NOT_EQUAL || + p_type==TK_OP_LESS || + p_type==TK_OP_LESS_EQUAL || + p_type==TK_OP_GREATER || + p_type==TK_OP_GREATER_EQUAL || + p_type==TK_OP_AND || + p_type==TK_OP_OR || + p_type==TK_OP_NOT || + p_type==TK_OP_ADD || + p_type==TK_OP_SUB || + p_type==TK_OP_MUL || + p_type==TK_OP_DIV || + p_type==TK_OP_MOD || + p_type==TK_OP_SHIFT_LEFT || + p_type==TK_OP_SHIFT_RIGHT || + p_type==TK_OP_ASSIGN || + p_type==TK_OP_ASSIGN_ADD || + p_type==TK_OP_ASSIGN_SUB || + p_type==TK_OP_ASSIGN_MUL || + p_type==TK_OP_ASSIGN_DIV || + p_type==TK_OP_ASSIGN_MOD || + p_type==TK_OP_ASSIGN_SHIFT_LEFT || + p_type==TK_OP_ASSIGN_SHIFT_RIGHT || + p_type==TK_OP_ASSIGN_BIT_AND || + p_type==TK_OP_ASSIGN_BIT_OR || + p_type==TK_OP_ASSIGN_BIT_XOR || + p_type==TK_OP_BIT_AND || + p_type==TK_OP_BIT_OR || + p_type==TK_OP_BIT_XOR || + p_type==TK_OP_BIT_INVERT || + p_type==TK_OP_INCREMENT || + p_type==TK_OP_DECREMENT || + p_type==TK_QUESTION || + p_type==TK_COLON ); - return OP_MAX; } -Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_expr) { + +ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const Map &p_builtin_types) { Vector expression; //Vector operators; @@ -1525,416 +1896,413 @@ Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_ex while(true) { Node *expr=NULL; + int pos = char_idx; + Token tk = _get_token(); - if (parser.get_token_type()==TK_PARENTHESIS_OPEN) { + if (tk.type==TK_PARENTHESIS_OPEN) { //handle subexpression - parser.advance(); - Error err = parse_expression(parser,p_parent,&expr); - if (err) - return err; - if (parser.get_token_type()!=TK_PARENTHESIS_CLOSE) { + expr = _parse_expression(p_block,p_builtin_types); + if (!expr) + return NULL; - parser.set_error("Expected ')' in expression"); - return ERR_PARSE_ERROR; - } + tk = _get_token(); + + if (tk.type!=TK_PARENTHESIS_CLOSE) { - parser.advance(); + _set_error("Expected ')' in expression"); + return NULL; + } - } else if (parser.get_token_type()==TK_REAL_CONSTANT) { + } else if (tk.type==TK_REAL_CONSTANT) { - ConstantNode *constant = parser.create_node(p_parent); - constant->value=parser.get_token().text.operator String().to_double(); + ConstantNode *constant = alloc_node(); + constant->value=tk.constant; constant->datatype=TYPE_FLOAT; expr=constant; - parser.advance(); - } else if (parser.get_token_type()==TK_TRUE) { + + } else if (tk.type==TK_REAL_CONSTANT) { + + + ConstantNode *constant = alloc_node(); + constant->value=int(tk.constant); + constant->datatype=TYPE_INT; + expr=constant; + + } else if (tk.type==TK_TRUE) { //print_line("found true"); //handle true constant - ConstantNode *constant = parser.create_node(p_parent); + ConstantNode *constant = alloc_node(); constant->value=true; constant->datatype=TYPE_BOOL; expr=constant; - parser.advance(); - } else if (parser.get_token_type()==TK_FALSE) { + + } else if (tk.type==TK_FALSE) { //handle false constant - ConstantNode *constant = parser.create_node(p_parent); + ConstantNode *constant = alloc_node(); constant->value=false; constant->datatype=TYPE_BOOL; expr=constant; - parser.advance(); - } else if (parser.get_token_type()==TK_TYPE_VOID) { - - //make sure void is not used in expression - parser.set_error("Void value not allowed in Expression"); - return ERR_PARSE_ERROR; - } else if (parser.get_token_type(1)==TK_PARENTHESIS_OPEN && (is_token_nonvoid_datatype(parser.get_token_type()) || parser.get_token_type()==TK_INDENTIFIER)) { - - - //function or constructor - StringName name; - DataType constructor=TYPE_VOID; - if (is_token_nonvoid_datatype(parser.get_token_type())) { - - constructor=get_token_datatype(parser.get_token_type()); - switch(get_token_datatype(parser.get_token_type())) { - case TYPE_BOOL: name="bool"; break; - case TYPE_FLOAT: name="float"; break; - case TYPE_VEC2: name="vec2"; break; - case TYPE_VEC3: name="vec3"; break; - case TYPE_VEC4: name="vec4"; break; - case TYPE_MAT2: name="mat2"; break; - case TYPE_MAT3: name="mat3"; break; - case TYPE_MAT4: name="mat4"; break; - default: ERR_FAIL_V(ERR_BUG); - } - } else { - name=parser.get_token().text; - } + } else if (tk.type==TK_TYPE_VOID) { - if (!test_existing_identifier(p_parent,name)) { + //make sure void is not used in expression + _set_error("Void value not allowed in Expression"); + return NULL; + } else if (is_token_precision(tk.type) || is_token_nonvoid_datatype(tk.type)) { + //basic type constructor - parser.set_error("Unknown identifier in expression: "+name); - return ERR_PARSE_ERROR; - } + OperatorNode *func = alloc_node(); + func->op=OP_CONSTRUCT; - parser.advance(2); - OperatorNode *func = parser.create_node(p_parent); + if (is_token_precision(tk.type)) { - func->op=constructor!=TYPE_VOID?OP_CONSTRUCT:OP_CALL; + func->return_precision_cache=get_token_precision(tk.type); + tk=_get_token(); + } - VariableNode *funcname = parser.create_node(func); - funcname->name=name; + VariableNode *funcname = alloc_node(); + funcname->name=get_datatype_name(get_token_datatype(tk.type)); func->arguments.push_back(funcname); - //parse parameters - - if (parser.get_token_type()==TK_PARENTHESIS_CLOSE) { - parser.advance(); - } else { - - while(true) { - - - Node *arg=NULL; - Error err = parse_expression(parser,func,&arg); - if (err) - return err; - func->arguments.push_back(arg); - - if (parser.get_token_type()==TK_PARENTHESIS_CLOSE) { - parser.advance(); - break; - - } else if (parser.get_token_type()==TK_COMMA) { - - if (parser.get_token_type(1)==TK_PARENTHESIS_CLOSE) { - - parser.set_error("Expression expected"); - return ERR_PARSE_ERROR; - } - - parser.advance(); - } else { - // something is broken - parser.set_error("Expected ',' or ')'"); - return ERR_PARSE_ERROR; - } - - } + tk=_get_token(); + if (tk.type!=TK_PARENTHESIS_OPEN) { + _set_error("Expected '(' after type name"); + return NULL; } - expr=validate_function_call(parser,func); - if (!expr) { + if (!_parse_function_arguments(p_block,p_builtin_types,func)) + return NULL; - parser.set_error("Invalid arguments to function/constructor: "+StringName(name)); - return ERR_PARSE_ERROR; + if (!_validate_function_call(p_block,func,&func->return_cache)) { + _set_error("No matching constructor found for: '"+String(funcname->name)+"'"); + return NULL; } + //validate_Function_call() - } else if (parser.get_token_type()==TK_INDENTIFIER) { - //probably variable + expr=func; - Node *node =p_parent; - bool existing=false; - DataType datatype; - StringName identifier=parser.get_token().text; + } else if (tk.type==TK_IDENTIFIER) { - while(node) { - if (node->type==Node::TYPE_BLOCK) { + tk=_get_token(); + if (tk.type==TK_PARENTHESIS_OPEN) { + //a function + StringName name = tk.text; - BlockNode *block = (BlockNode*)node; + OperatorNode *func = alloc_node(); + func->op=OP_CALL; + VariableNode *funcname = alloc_node(); + funcname->name=name; + func->arguments.push_back(funcname); - if (block->variables.has(identifier)) { - existing=true; - datatype=block->variables[identifier]; - break; - } - } + if (!_parse_function_arguments(p_block,p_builtin_types,func)) + return NULL; - if (node->type==Node::TYPE_FUNCTION) { - FunctionNode *function=(FunctionNode*)node; - for(int i=0;iarguments.size();i++) { - if (function->arguments[i].name==identifier) { - existing=true; - datatype=function->arguments[i].type; - break; - } - } + if (!_validate_function_call(p_block,func,&func->return_cache)) { + _set_error("No matching function found for: '"+String(funcname->name)+"'"); + return NULL; + } - if (existing) - break; + expr=func; - } + } else { + //an identifier + char_idx=pos; //rollback - if (node->type==Node::TYPE_PROGRAM) { + StringName identifier = tk.text; - ProgramNode *program = (ProgramNode*)node; - if (program->builtin_variables.has(identifier)) { - datatype = program->builtin_variables[identifier]; - existing=true; - break; - } - if (program->uniforms.has(identifier)) { - datatype = program->uniforms[identifier].type; - existing=true; - break; - } + DataType data_type; + IdentifierType ident_type; + if (!_find_identifier(p_block,p_builtin_types,identifier,&data_type,&ident_type)) { + _set_error("Unknown identifier in expression: "+String(identifier)); + return NULL; } - node=node->parent; - } + if (ident_type==IDENTIFIER_FUNCTION) { + _set_error("Can't use function as identifier: "+String(identifier)); + return NULL; + } - if (!existing) { - parser.set_error("Nonexistent identifier in expression: "+identifier); - return ERR_PARSE_ERROR; + VariableNode *varname = alloc_node(); + varname->name=identifier; + varname->datatype_cache=data_type; + expr=varname; } - VariableNode *varname = parser.create_node(p_parent); - varname->name=identifier; - varname->datatype_cache=datatype; - parser.advance(); - expr=varname; - - } else if (parser.get_token_type()==TK_OP_SUB || parser.get_token_type()==TK_OP_NOT) { - //single prefix operators - TokenType token_type=parser.get_token_type(); - parser.advance(); - //Node *subexpr=NULL; - //Error err = parse_expression(parser,p_parent,&subexpr); - //if (err) - // return err; + } else if (tk.type==TK_OP_ADD) { + continue; //this one does nothing + } if (tk.type==TK_OP_SUB || tk.type==TK_OP_NOT || tk.type==TK_OP_BIT_INVERT || tk.type==TK_OP_INCREMENT || tk.type==TK_OP_DECREMENT) { - //OperatorNode *op = parser.create_node(p_parent); Expression e; e.is_op=true; - switch(token_type) { - case TK_OP_SUB: e.op=TK_OP_NEG; break; - case TK_OP_NOT: e.op=TK_OP_NOT; break; - //case TK_OP_PLUS_PLUS: op->op=OP_PLUS_PLUS; break; - //case TK_OP_MINUS_MINUS: op->op=OP_MINUS_MINUS; break; - default: ERR_FAIL_V(ERR_BUG); + switch(tk.type) { + case TK_OP_SUB: e.op=OP_NEGATE; break; + case TK_OP_NOT: e.op=OP_NOT; break; + case TK_OP_BIT_INVERT: e.op=OP_BIT_INVERT; break; + case TK_OP_INCREMENT: e.op=OP_INCREMENT; break; + case TK_OP_DECREMENT: e.op=OP_DECREMENT; break; + default: ERR_FAIL_V(NULL); } expression.push_back(e); - continue; } else { - print_line("found bug?"); - print_line("misplaced token: "+String(token_names[parser.get_token_type()])); - - parser.set_error("Error parsing expression, misplaced: "+String(token_names[parser.get_token_type()])); - return ERR_PARSE_ERROR; + _set_error("Expected expression, found: "+get_token_text(tk)); + return NULL; //nothing } - ERR_FAIL_COND_V(!expr,ERR_BUG); + ERR_FAIL_COND_V(!expr,NULL); /* OK now see what's NEXT to the operator.. */ /* OK now see what's NEXT to the operator.. */ /* OK now see what's NEXT to the operator.. */ + while(true) { + int pos = char_idx; + tk=_get_token(); - if (parser.get_token_type()==TK_PERIOD) { - - if (parser.get_token_type(1)!=TK_INDENTIFIER) { - parser.set_error("Expected identifier as member"); - return ERR_PARSE_ERROR; - } - - DataType dt = compute_node_type(expr); - String ident = parser.get_token(1).text; - - bool ok=true; - DataType member_type; - switch(dt) { - case TYPE_VEC2: { - - int l = ident.length(); - if (l==1) { - member_type=TYPE_FLOAT; - } else if (l==2) { - member_type=TYPE_VEC2; - } else { - ok=false; - break; - } + if (tk.type==TK_PERIOD) { - const CharType *c=ident.ptr(); - for(int i=0;iget_datatype(); + String ident = tk.text; + + bool ok=true; + DataType member_type; + switch(dt) { + case TYPE_BVEC2: + case TYPE_IVEC2: + case TYPE_UVEC2: + case TYPE_VEC2: { + + int l = ident.length(); + if (l==1) { + member_type=DataType(dt-1); + } else if (l==2) { + member_type=dt; + } else { + ok=false; + break; } - } - } break; - case TYPE_VEC3: { - - int l = ident.length(); - if (l==1) { - member_type=TYPE_FLOAT; - } else if (l==2) { - member_type=TYPE_VEC2; - } else if (l==3) { - member_type=TYPE_VEC3; - } else { - ok=false; - break; - } + const CharType *c=ident.ptr(); + for(int i=0;i(); + mn->basetype=dt; + mn->datatype=member_type; + mn->name=ident; + mn->owner=expr; + expr=mn; - MemberNode *mn = parser.create_node(p_parent); - mn->basetype=dt; - mn->datatype=member_type; - mn->name=ident; - mn->owner=expr; - expr=mn; - parser.advance(2); - //todo - //member (period) has priority over any operator - //creates a subindexing expression in place + //todo + //member (period) has priority over any operator + //creates a subindexing expression in place - } else if (parser.get_token_type()==TK_BRACKET_OPEN) { - //todo - //subindexing has priority over any operator - //creates a subindexing expression in place + /*} else if (tk.type==TK_BRACKET_OPEN) { + //todo + //subindexing has priority over any operator + //creates a subindexing expression in place + */ + } else if (tk.type==TK_OP_INCREMENT || tk.type==TK_OP_DECREMENT) { - } /*else if (parser.get_token_type()==TK_OP_PLUS_PLUS || parser.get_token_type()==TK_OP_MINUS_MINUS) { - //todo - //inc/dec operators have priority over any operator - //creates a subindexing expression in place - //return OK; //wtfs + OperatorNode *op = alloc_node(); + op->op=tk.type==TK_OP_DECREMENT ? OP_POST_DECREMENT : OP_POST_INCREMENT; + op->arguments.push_back(expr); - } */ + if (!_validate_operator(op,&op->return_cache)) { + _set_error("Invalid base type for increment/decrement operator"); + return NULL; + } + expr=op; + } else { + char_idx=pos; //rollback + break; + } + } Expression e; e.is_op=false; e.node=expr; expression.push_back(e); + pos = char_idx; + tk = _get_token(); - if (is_token_operator(parser.get_token_type())) { + if (is_token_operator(tk.type)) { Expression o; o.is_op=true; - o.op=parser.get_token_type(); + + switch(tk.type) { + + case TK_OP_EQUAL: o.op = OP_EQUAL; break; + case TK_OP_NOT_EQUAL: o.op = OP_NOT_EQUAL; break; + case TK_OP_LESS: o.op = OP_LESS; break; + case TK_OP_LESS_EQUAL: o.op = OP_LESS_EQUAL; break; + case TK_OP_GREATER: o.op = OP_GREATER; break; + case TK_OP_GREATER_EQUAL: o.op = OP_GREATER_EQUAL; break; + case TK_OP_AND: o.op = OP_AND; break; + case TK_OP_OR: o.op = OP_OR; break; + case TK_OP_ADD: o.op = OP_ADD; break; + case TK_OP_SUB: o.op = OP_SUB; break; + case TK_OP_MUL: o.op = OP_MUL; break; + case TK_OP_DIV: o.op = OP_DIV; break; + case TK_OP_MOD: o.op = OP_MOD; break; + case TK_OP_SHIFT_LEFT: o.op = OP_SHIFT_LEFT; break; + case TK_OP_SHIFT_RIGHT: o.op = OP_SHIFT_RIGHT; break; + case TK_OP_ASSIGN: o.op = OP_ASSIGN; break; + case TK_OP_ASSIGN_ADD: o.op = OP_ASSIGN_ADD; break; + case TK_OP_ASSIGN_SUB: o.op = OP_ASSIGN_SUB; break; + case TK_OP_ASSIGN_MUL: o.op = OP_ASSIGN_MUL; break; + case TK_OP_ASSIGN_DIV: o.op = OP_ASSIGN_DIV; break; + case TK_OP_ASSIGN_MOD: o.op = OP_ASSIGN_MOD; break; + case TK_OP_ASSIGN_SHIFT_LEFT: o.op = OP_ASSIGN_SHIFT_LEFT; break; + case TK_OP_ASSIGN_SHIFT_RIGHT: o.op = OP_ASSIGN_SHIFT_RIGHT; break; + case TK_OP_ASSIGN_BIT_AND: o.op = OP_ASSIGN_BIT_AND; break; + case TK_OP_ASSIGN_BIT_OR: o.op = OP_ASSIGN_BIT_OR; break; + case TK_OP_ASSIGN_BIT_XOR: o.op = OP_ASSIGN_BIT_XOR; break; + case TK_OP_BIT_AND: o.op = OP_BIT_AND; break; + case TK_OP_BIT_OR: o.op = OP_BIT_OR ; break; + case TK_OP_BIT_XOR: o.op = OP_BIT_XOR; break; + case TK_QUESTION: o.op = OP_SELECT_IF; break; + case TK_COLON: o.op = OP_SELECT_ELSE; break; + default: { + _set_error("Invalid token for operator: "+get_token_text(tk)); + return NULL; + } + } break; + expression.push_back(o); - parser.advance(); + } else { + char_idx=pos; //something else, so rollback and end break; } } @@ -1948,6 +2316,7 @@ Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_ex int next_op=-1; int min_priority=0xFFFFF; bool is_unary=false; + bool is_ternary=false; for(int i=0;i=next_op;i--) { - OperatorNode *op = parser.create_node(p_parent); - op->op=get_token_operator(expression[i].op); + OperatorNode *op = alloc_node(); + op->op=expression[i].op; op->arguments.push_back(expression[i+1].node); expression[i].is_op=false; - expression[i].node=validate_operator(parser,op); - if (!expression[i].node) { + expression[i].node=op; + + + if (!_validate_operator(op,&op->return_cache)) { String at; for(int i=0;iarguments.size();i++) { if (i>0) at+=" and "; - at+=get_datatype_name(compute_node_type(op->arguments[i])); + at+=get_datatype_name(op->arguments[i]->get_datatype()); } - parser.set_error("Invalid argument to unary operator "+String(token_names[op->op])+": "+at); - return ERR_PARSE_ERROR; + _set_error("Invalid argument to unary operator: "+at); + return NULL; } expression.remove(i+1); } - } else { + + } else if (is_ternary) { if (next_op <1 || next_op>=(expression.size()-1)) { - parser.set_error("Parser bug.."); - ERR_FAIL_V(ERR_BUG); + _set_error("Parser bug.."); + ERR_FAIL_V(NULL); } - OperatorNode *op = parser.create_node(p_parent); - op->op=get_token_operator(expression[next_op].op); + if (next_op+2 >= expression.size() || !expression[next_op+2].is_op || expression[next_op+2].op!=OP_SELECT_ELSE) { + _set_error("Mising matching ':' for select operator"); + return NULL; + } - if (expression[next_op-1].is_op) { - parser.set_error("Parser bug.."); - ERR_FAIL_V(ERR_BUG); - } - if (expression[next_op+1].is_op) { - // this is not invalid and can really appear + OperatorNode *op = alloc_node(); + op->op=expression[next_op].op; + op->arguments.push_back(expression[next_op-1].node); + op->arguments.push_back(expression[next_op+1].node); + op->arguments.push_back(expression[next_op+3].node); + + expression[next_op-1].is_op=false; + expression[next_op-1].node=op; + if (!_validate_operator(op,&op->return_cache)) { + + String at; + for(int i=0;iarguments.size();i++) { + if (i>0) + at+=" and "; + at+=get_datatype_name(op->arguments[i]->get_datatype()); + + } + _set_error("Invalid argument to ternary ?: operator: "+at); + return NULL; + } + + for(int i=0;i<4;i++) { + expression.remove(next_op); + } + + } else { + + if (next_op <1 || next_op>=(expression.size()-1)) { + _set_error("Parser bug.."); + ERR_FAIL_V(NULL); + } + + OperatorNode *op = alloc_node(); + op->op=expression[next_op].op; + + if (expression[next_op-1].is_op) { + + _set_error("Parser bug.."); + ERR_FAIL_V(NULL); + } + + if (expression[next_op+1].is_op) { + // this is not invalid and can really appear // but it becomes invalid anyway because no binary op // can be followed by an unary op in a valid combination, // due to how precedence works, unaries will always dissapear first - parser.set_error("Parser bug.."); + _set_error("Parser bug.."); } op->arguments.push_back(expression[next_op-1].node); //expression goes as left op->arguments.push_back(expression[next_op+1].node); //next expression goes as right + expression[next_op-1].node=op; //replace all 3 nodes by this operator and make it an expression - expression[next_op-1].node=validate_operator(parser,op); - if (!expression[next_op-1].node) { + + if (!_validate_operator(op,&op->return_cache)) { String at; for(int i=0;iarguments.size();i++) { if (i>0) at+=" and "; - at+=get_datatype_name(compute_node_type(op->arguments[i])); + at+=get_datatype_name(op->arguments[i]->get_datatype()); } - static const char *op_names[OP_MAX]={"=","+","-","*","/","+=","-=","*=","/=","-","!","==","!=","<=",">=","<",">","||","&&","call","()"}; - - parser.set_error("Invalid arguments to operator "+String(op_names[op->op])+": "+at); - return ERR_PARSE_ERROR; + _set_error("Invalid arguments to operator: "+at); + return NULL; } + expression.remove(next_op); expression.remove(next_op); } -#if 0 - OperatorNode *op = parser.create_node(p_parent); - op->op=get_token_operator(operators[next_op]); + } - op->arguments.push_back(expressions[next_op]); //expression goes as left - op->arguments.push_back(expressions[next_op+1]); //next expression goes as right + return expression[0].node; +} - expressions[next_op]=validate_operator(parser,op); - if (!expressions[next_op]) { - String at; - for(int i=0;iarguments.size();i++) { - if (i>0) - at+=" and "; - at+=get_datatype_name(compute_node_type(op->arguments[i])); +ShaderLanguage::Node* ShaderLanguage::_reduce_expression(BlockNode *p_block, ShaderLanguage::Node *p_node) { - } - parser.set_error("Invalid arguments to operator "+String(token_names[operators[next_op]])+": "+at); - return ERR_PARSE_ERROR; - } + if (p_node->type!=Node::TYPE_OPERATOR) + return p_node; + //for now only reduce simple constructors + OperatorNode *op=static_cast(p_node); - expressions.remove(next_op+1); - operators.remove(next_op); -#endif + if (op->op==OP_CONSTRUCT) { - } + ERR_FAIL_COND_V(op->arguments[0]->type!=Node::TYPE_VARIABLE,p_node); + VariableNode *vn = static_cast(op->arguments[0]); + StringName name=vn->name; - *r_expr=expression[0].node; + if (name=="vec2" || name=="vec3" || name=="vec4") { + Vector values; - return OK; + for(int i=1;iarguments.size();i++) { -/* - TokenType token_type=parser.get_token_type(); - OperatorNode *op = parser.create_node(p_parent); - op->op=get_token_operator(parser.get_token_type()); + op->arguments[i]=_reduce_expression(p_block,op->arguments[i]); + if (op->arguments[i]->type==Node::TYPE_CONSTANT) { + ConstantNode *cn = static_cast(op->arguments[i]); + values.push_back(cn->value); - op->arguments.push_back(*r_expr); //expression goes as left - parser.advance(); - Node *right_expr=NULL; - Error err = parse_expression(parser,p_parent,&right_expr); - if (err) - return err; - op->arguments.push_back(right_expr); + } else { + return p_node; //do not bother, not reducible + } + } - if (!validate_operator(op)) { + ConstantNode *cn=alloc_node(); - parser.set_error("Invalid arguments to operator "+String(token_names[token_type])); - return ERR_PARSE_ERROR; + if (name=="vec2") { + cn->datatype=TYPE_VEC2; + cn->value=Vector2(values[0],values[1]); + } else if (name=="vec3") { + cn->datatype=TYPE_VEC3; + cn->value=Vector3(values[0],values[1],values[2]); + } else if (name=="vec4") { + cn->datatype=TYPE_VEC4; + cn->value=Plane(values[0],values[1],values[2],values[3]); + } else { + ERR_FAIL_V(p_node); } -*/ + return cn; + } + } + + + return p_node; + } -Error ShaderLanguage::parse_variable_declaration(Parser& parser,BlockNode *p_block) { - bool uniform = parser.get_token(-1).type==TK_UNIFORM; +ShaderLanguage::Node* ShaderLanguage::_parse_and_reduce_expression(BlockNode *p_block, const Map &p_builtin_types) { - DataType type=get_token_datatype(parser.get_token_type(0)); - bool iscolor = parser.get_token_type(0)==TK_TYPE_COLOR; - if (type==TYPE_VOID) { + ShaderLanguage::Node* expr = _parse_expression(p_block,p_builtin_types); - parser.set_error("Cannot Declare a 'void' Variable"); - return ERR_PARSE_ERROR; - } + expr = _reduce_expression(p_block,expr); - if (type==TYPE_TEXTURE && !uniform) { + return expr; +} - parser.set_error("Cannot Declare a Non-Uniform Texture"); - return ERR_PARSE_ERROR; - } - if (type==TYPE_CUBEMAP && !uniform) { - parser.set_error("Cannot Declare a Non-Uniform Cubemap"); - return ERR_PARSE_ERROR; - } - parser.advance(); - int found=0; +Error ShaderLanguage::_parse_block(BlockNode* p_block,const Map &p_builtin_types,bool p_just_one,bool p_can_break,bool p_can_continue) { while(true) { + int pos = char_idx; - if (found && parser.get_token_type()!=TK_COMMA) { - break; - } + Token tk = _get_token(); + if (tk.type==TK_CURLY_BRACKET_CLOSE) { //end of block + if (p_just_one) { + _set_error("Unexpected '}'"); + return ERR_PARSE_ERROR; + } - if (parser.get_token_type()!=TK_INDENTIFIER) { + return OK; - parser.set_error("Identifier Expected"); - return ERR_PARSE_ERROR; + } else if (is_token_precision(tk.type) || is_token_nonvoid_datatype(tk.type)) { + DataPrecision precision=PRECISION_DEFAULT; + if (is_token_precision(tk.type)) { + precision=get_token_precision(tk.type); + tk = _get_token(); + if (!is_token_nonvoid_datatype(tk.type)) { + _set_error("Expected datatype after precission"); + return ERR_PARSE_ERROR; + } + } - } + DataType type = get_token_datatype(tk.type); - StringName name = parser.get_token().text; + tk = _get_token(); - if (test_existing_identifier(p_block,name)) { - parser.set_error("Duplicate Identifier (existing variable/function): "+name); - return ERR_PARSE_ERROR; - } + while(true) { - found=true; + if (tk.type!=TK_IDENTIFIER) { + _set_error("Expected identifier after type"); + return ERR_PARSE_ERROR; + } - parser.advance(); - //see if declaration has an initializer - if (parser.get_token_type()==TK_OP_ASSIGN) { - parser.advance(); - OperatorNode * op = parser.create_node(p_block); - VariableNode * var = parser.create_node(op); - var->name=name; - var->datatype_cache=type; - var->uniform=uniform; - Node *expr; - Error err = parse_expression(parser,p_block,&expr); + StringName name = tk.text; + if (_find_identifier(p_block,p_builtin_types,name)) { + _set_error("Redefinition of '"+String(name)+"'"); + return ERR_PARSE_ERROR; + } - if (err) - return err; + BlockNode::Variable var; + var.type=type; + var.precision=precision; + p_block->variables[name]=var; - if (var->uniform) { + tk = _get_token(); - if (expr->type!=Node::TYPE_CONSTANT) { + if (tk.type==TK_OP_ASSIGN) { + //variable creted with assignment! must parse an expression + Node* n = _parse_and_reduce_expression(p_block,p_builtin_types); + if (!n) + return ERR_PARSE_ERROR; - parser.set_error("Uniform can only be initialized to a constant."); - return ERR_PARSE_ERROR; + OperatorNode *assign = alloc_node(); + VariableNode *vnode = alloc_node(); + vnode->name=name; + vnode->datatype_cache=type; + assign->arguments.push_back(vnode); + assign->arguments.push_back(n); + assign->op=OP_ASSIGN; + p_block->statements.push_back(assign); + tk = _get_token(); } - Uniform u; - u.order=parser.program->uniforms.size(); - u.type=type; - u.default_value=static_cast(expr)->value; - if (iscolor && u.default_value.get_type()==Variant::PLANE) { - Color c; - Plane p = u.default_value; - c=Color(p.normal.x,p.normal.y,p.normal.z,p.d); - u.default_value=c; - } - parser.program->uniforms[var->name]=u; - } else { - op->op=OP_ASSIGN; - op->arguments.push_back(var); - op->arguments.push_back(expr); - Node *n=validate_operator(parser,op); - if (!n) { - parser.set_error("Invalid initializer for variable: "+name); + if (tk.type==TK_COMMA) { + tk = _get_token(); + //another variable + } else if (tk.type==TK_SEMICOLON) { + break; + } else { + _set_error("Expected ',' or ';' after variable"); return ERR_PARSE_ERROR; } - p_block->statements.push_back(n); + } + } else if (tk.type==TK_CURLY_BRACKET_OPEN) { + //a sub block, just because.. + BlockNode* block = alloc_node(); + block->parent_block=p_block; + _parse_block(block,p_builtin_types,false,p_can_break,p_can_continue); + } else if (tk.type==TK_CF_IF) { + //if () {} + tk = _get_token(); + if (tk.type!=TK_PARENTHESIS_OPEN) { + _set_error("Expected '(' after if"); + return ERR_PARSE_ERROR; } - } else { - //initialize it EMPTY - - OperatorNode * op = parser.create_node(p_block); - VariableNode * var = parser.create_node(op); - ConstantNode * con = parser.create_node(op); - - var->name=name; - var->datatype_cache=type; - var->uniform=uniform; - con->datatype=type; - - switch(type) { - case TYPE_BOOL: con->value=false; break; - case TYPE_FLOAT: con->value=0.0; break; - case TYPE_VEC2: con->value=Vector2(); break; - case TYPE_VEC3: con->value=Vector3(); break; - case TYPE_VEC4: con->value=iscolor?Variant(Color()):Variant(Plane()); break; - case TYPE_MAT2: con->value=Matrix32(); break; - case TYPE_MAT3: con->value=Matrix3(); break; - case TYPE_MAT4: con->value=Transform(); break; - case TYPE_TEXTURE: - case TYPE_CUBEMAP: con->value=RID(); break; - default: {} + ControlFlowNode *cf = alloc_node(); + cf->flow_op=FLOW_OP_IF; + Node* n = _parse_and_reduce_expression(p_block,p_builtin_types); + if (!n) + return ERR_PARSE_ERROR; + + tk = _get_token(); + if (tk.type!=TK_PARENTHESIS_CLOSE) { + _set_error("Expected '(' after expression"); + return ERR_PARSE_ERROR; } - if (uniform) { - Uniform u; - u.type=type; - u.default_value=con->value; - u.order=parser.program->uniforms.size(); - parser.program->uniforms[var->name]=u; + BlockNode* block = alloc_node(); + block->parent_block=p_block; + cf->blocks.push_back(block); + + + Error err=_parse_block(p_block,p_builtin_types,true,p_can_break,p_can_continue); + + pos=char_idx; + tk = _get_token(); + if (tk.type==TK_CF_ELSE) { + + block = alloc_node(); + block->parent_block=p_block; + cf->blocks.push_back(block); + err=_parse_block(p_block,p_builtin_types,true,p_can_break,p_can_continue); } else { - op->op=OP_ASSIGN; - op->arguments.push_back(var); - op->arguments.push_back(con); - p_block->statements.push_back(op); + char_idx=pos; //rollback } - } + } else { - if (!uniform) - p_block->variables[name]=type; + //nothng else, so expression + char_idx=pos; //rollback + _parse_and_reduce_expression(p_block,p_builtin_types); + tk = _get_token(); - } + if (tk.type!=TK_SEMICOLON) { + _set_error("Expected ';' after statement"); + return ERR_PARSE_ERROR; + } + } - if (parser.get_token_type()!=TK_SEMICOLON) { - parser.set_error("Expected ';'"); - return ERR_PARSE_ERROR; + if (p_just_one) + break; } - return OK; - } -Error ShaderLanguage::parse_flow_if(Parser& parser,Node *p_parent,Node **r_statement) { - ControlFlowNode *cf = parser.create_node(p_parent); +Error ShaderLanguage::_parse_shader(const Map< StringName, Map > &p_functions, const Set &p_render_modes) { - cf->flow_op=FLOW_OP_IF; - parser.advance(); + Token tk = _get_token(); - if (parser.get_token_type()!=TK_PARENTHESIS_OPEN) { - parser.set_error("Expected '(' after 'if'"); - return ERR_PARSE_ERROR; - } - parser.advance(); + while(tk.type!=TK_EOF) { - Node *expression=NULL; - Error err = parse_expression(parser,cf,&expression); - if (err) - return err; + switch(tk.type) { + case TK_RENDER_MODE: { - if (compute_node_type(expression)!=TYPE_BOOL) { + while(true) { + tk = _get_token(); + if (tk.type!=TK_IDENTIFIER) { + _set_error("Expected identifier for render mode"); + return ERR_PARSE_ERROR; + } - parser.set_error("Expression for 'if' is not boolean"); - return ERR_PARSE_ERROR; - } + if (!p_render_modes.has(tk.text)) { + _set_error("Invalid render mode: '"+String(tk.text)+"'"); + return ERR_PARSE_ERROR; + } - cf->statements.push_back(expression); + if (shader->render_modes.has(tk.text)) { + _set_error("Duplicate render mode: '"+String(tk.text)+"'"); + return ERR_PARSE_ERROR; + } - if (parser.get_token_type()!=TK_PARENTHESIS_CLOSE) { - parser.set_error("Expected ')' after expression"); - return ERR_PARSE_ERROR; - } + shader->render_modes.insert(tk.text); - parser.advance(); + tk = _get_token(); + if (tk.type==TK_COMMA) { + //all good, do nothing + } else if (tk.type==TK_SEMICOLON) { + break; //done + } else { + _set_error("Unexpected token: "+get_token_text(tk)); + return ERR_PARSE_ERROR; + } + } + } break; + case TK_UNIFORM: + case TK_VARYING: { + + bool uniform = tk.type==TK_UNIFORM; + DataPrecision precision = PRECISION_DEFAULT; + DataType type; + StringName name; + + tk = _get_token(); + if (is_token_precision(tk.type)) { + precision=get_token_precision(tk.type); + tk = _get_token(); + } - if (parser.get_token_type()!=TK_CURLY_BRACKET_OPEN) { - parser.set_error("Expected statement block after 'if()'"); - return ERR_PARSE_ERROR; - } + if (!is_token_datatype(tk.type)) { + _set_error("Expected datatype. "); + return ERR_PARSE_ERROR; + } - Node *substatement=NULL; - err = parse_statement(parser,cf,&substatement); - if (err) - return err; + type = get_token_datatype(tk.type); - cf->statements.push_back(substatement); + if (type==TYPE_VOID) { + _set_error("void datatype not allowed here"); + return ERR_PARSE_ERROR; + } + if (!uniform && typeTYPE_VEC4) { + _set_error("Invalid type for varying, only float,vec2,vec3,vec4 allowed."); + return ERR_PARSE_ERROR; + } - if (parser.get_token_type()==TK_CF_ELSE) { + tk = _get_token(); + if (tk.type!=TK_IDENTIFIER) { + _set_error("Expected identifier!"); + return ERR_PARSE_ERROR; + } - parser.advance(); + name=tk.text; - if (parser.get_token_type()!=TK_CURLY_BRACKET_OPEN) { - parser.set_error("Expected statement block after 'else'"); - return ERR_PARSE_ERROR; - } + if (_find_identifier(NULL,Map(),name)) { + _set_error("Redefinition of '"+String(name)+"'"); + return ERR_PARSE_ERROR; + } - substatement=NULL; - err = parse_statement(parser,cf,&substatement); - if (err) - return err; + if (uniform) { - cf->statements.push_back(substatement); - } + ShaderNode::Uniform uniform; + uniform.order=shader->uniforms.size(); + uniform.type=type; + uniform.precission=precision; + shader->uniforms[name]=uniform; + //todo parse default value + tk = _get_token(); + if (tk.type==TK_OP_ASSIGN) { - *r_statement=cf; + Node* expr = _parse_and_reduce_expression(NULL,Map()); + if (!expr) + return ERR_PARSE_ERROR; + if (expr->type!=Node::TYPE_CONSTANT) { + _set_error("Expected constant expression after '='"); + return ERR_PARSE_ERROR; + } - return OK; -} + uniform.default_value=static_cast(expr)->value; + tk = _get_token(); + } -Error ShaderLanguage::parse_flow_return(Parser& parser,Node *p_parent,Node **r_statement) { + if (tk.type==TK_COLON) { + //hint + tk = _get_token(); + if (tk.type==TK_HINT_WHITE_TEXTURE) { + uniform.hint=ShaderNode::Uniform::HINT_WHITE_TEXTURE; + } else if (tk.type==TK_HINT_BLACK_TEXTURE) { + uniform.hint=ShaderNode::Uniform::HINT_BLACK_TEXTURE; + } else if (tk.type==TK_HINT_NORMAL_TEXTURE) { + uniform.hint=ShaderNode::Uniform::HINT_NORMAL_TEXTURE; + } else if (tk.type==TK_HINT_RANGE) { + uniform.hint=ShaderNode::Uniform::HINT_RANGE; + if (type!=TYPE_FLOAT && type!=TYPE_INT) { + _set_error("Range hint is for float and int only"); + return ERR_PARSE_ERROR; + } - FunctionNode *function=NULL; + tk = _get_token(); + if (tk.type!=TK_PARENTHESIS_OPEN) { + _set_error("Expected '(' after hint_range"); + return ERR_PARSE_ERROR; + } - Node *parent=p_parent; + tk = _get_token(); - while(parent) { + if (tk.type!=TK_REAL_CONSTANT ||tk.type!=TK_INT_CONSTANT) { + _set_error("Expected integer constant"); + return ERR_PARSE_ERROR; + } - if (parent->type==Node::TYPE_FUNCTION) { + uniform.hint_range[0]=tk.constant; - function=(FunctionNode*)parent; - break; - } + tk = _get_token(); - parent=parent->parent; - } + if (tk.type!=TK_COMMA) { + _set_error("Expected ',' after integer constant"); + return ERR_PARSE_ERROR; + } - if (!function) { + tk = _get_token(); - parser.set_error("'return' must be inside a function"); - return ERR_PARSE_ERROR; - } + if (tk.type!=TK_REAL_CONSTANT || tk.type!=TK_INT_CONSTANT) { + _set_error("Expected integer constant after ','"); + return ERR_PARSE_ERROR; + } - ControlFlowNode *cf = parser.create_node(p_parent); + uniform.hint_range[1]=tk.constant; - cf->flow_op=FLOW_OP_RETURN; + tk = _get_token(); - parser.advance(); + if (tk.type==TK_COMMA) { + tk = _get_token(); - if (function->return_type!=TYPE_VOID) { - // should expect a return expression. + if (tk.type!=TK_REAL_CONSTANT || tk.type!=TK_INT_CONSTANT) { + _set_error("Expected integer constant after ','"); + return ERR_PARSE_ERROR; + } - Node *expr=NULL; - Error err = parse_expression(parser,cf,&expr); - if (err) - return err; + uniform.hint_range[2]=tk.constant; + tk = _get_token(); + } else { + if (type==TYPE_INT) { + uniform.hint_range[2]=1; + } else { + uniform.hint_range[2]=0.001; + } + } - if (compute_node_type(expr)!=function->return_type) { - parser.set_error("Invalid type for 'return' expression"); - return ERR_PARSE_ERROR; - } - cf->statements.push_back(expr); - } + if (tk.type!=TK_PARENTHESIS_CLOSE) { + _set_error("Expected ','"); + return ERR_PARSE_ERROR; + } - *r_statement=cf; + } - if (parser.get_token_type()!=TK_SEMICOLON) { - parser.set_error("Expected ';'"); - return ERR_PARSE_ERROR; - } + if (uniform.hint!=ShaderNode::Uniform::HINT_RANGE && uniform.hint!=ShaderNode::Uniform::HINT_NONE && type <=TYPE_MAT4) { + _set_error("This hint is only for sampler types"); + return ERR_PARSE_ERROR; - return OK; -} + } -Error ShaderLanguage::parse_statement(Parser& parser,Node *p_parent,Node **r_statement) { - *r_statement=NULL; + } - TokenType token_type = parser.get_token_type(); + if (tk.type!=TK_SEMICOLON) { + _set_error("Expected ';'"); + return ERR_PARSE_ERROR; + } + } else { - if (token_type==TK_CURLY_BRACKET_OPEN) { - //sub-block - parser.advance(); - BlockNode *block = parser.create_node(p_parent); + ShaderNode::Varying varying; + varying.type=type; + varying.precission=precision; + shader->varyings[name]=varying; - *r_statement=block; - return parse_block(parser,block); - } else if (token_type==TK_SEMICOLON) { - // empty ; - parser.advance(); - return OK; - } else if (token_type==TK_CF_IF) { - return parse_flow_if(parser,p_parent,r_statement); + tk = _get_token(); + if (tk.type!=TK_SEMICOLON) { + _set_error("Expected ';'"); + return ERR_PARSE_ERROR; + } - } else if (token_type==TK_CF_RETURN) { - return parse_flow_return(parser,p_parent,r_statement); - } else { - Error err=parse_expression(parser,p_parent,r_statement); + } - if (err) - return err; - if (parser.get_token_type()!=TK_SEMICOLON) { - parser.set_error("Expected ';'"); - return ERR_PARSE_ERROR; - } - } + } break; + default: { + //function - return OK; -} + DataPrecision precision = PRECISION_DEFAULT; + DataType type; + StringName name; -Error ShaderLanguage::parse_block(Parser& parser,BlockNode *p_block) { + if (is_token_precision(tk.type)) { + precision=get_token_precision(tk.type); + tk = _get_token(); + } - while(true) { + if (!is_token_datatype(tk.type)) { + _set_error("Expected funtion, uniform or varying "); + return ERR_PARSE_ERROR; + } - if (parser.is_at_end()) { - if (p_block->parent->type!=Node::TYPE_PROGRAM) { - parser.set_error("Unexpected End of File"); - return ERR_PARSE_ERROR; - } - return OK; //bye - } + type = get_token_datatype(tk.type); - TokenType token_type = parser.get_token_type(); - if (token_type==TK_CURLY_BRACKET_CLOSE) { - if (p_block->parent->type==Node::TYPE_PROGRAM) { - parser.set_error("Unexpected '}'"); - return ERR_PARSE_ERROR; - } - parser.advance(); - return OK; // exit block + tk = _get_token(); + if (tk.type!=TK_IDENTIFIER) { + _set_error("Expected function name after datatype"); + return ERR_PARSE_ERROR; - } else if (token_type==TK_UNIFORM) { + } - if (p_block!=parser.program->body) { + name=tk.text; - parser.set_error("Uniform only allowed in main program body."); - return ERR_PARSE_ERROR; - } - parser.advance(); - Error err=parse_variable_declaration(parser,p_block); - if (err) - return err; - - } else if (is_token_datatype(token_type)) { - - Error err=OK; - if (parser_is_at_function(parser)) - err = parse_function(parser,p_block); - else { - err = parse_variable_declaration(parser,p_block); - } + if (_find_identifier(NULL,Map(),name)) { + _set_error("Redefinition of '"+String(name)+"'"); + return ERR_PARSE_ERROR; + } - if (err) - return err; + tk = _get_token(); + if (tk.type!=TK_PARENTHESIS_OPEN) { + _set_error("Expected '(' after identifier"); + return ERR_PARSE_ERROR; - } else { - // must be a statement - Node *statement=NULL; - - Error err = parse_statement(parser,p_block,&statement); - if (err) - return err; - if (statement) { - p_block->statements.push_back(statement); - } + } - } - } - return OK; -} + Map builtin_types; + if (p_functions.has(name)) { + builtin_types=p_functions[name]; + } + ShaderNode::Function function; + function.callable=!p_functions.has(name); + function.name=name; -Error ShaderLanguage::parse(const Vector& p_tokens,ShaderType p_type,CompileFunc p_compile_func,void *p_userdata,String *r_error,int *r_err_line,int *r_err_column) { + FunctionNode* func_node=alloc_node(); + function.function=func_node; - Parser parser(p_tokens); - parser.program = parser.create_node(NULL); - parser.program->body = parser.create_node(parser.program); + shader->functions.push_back(function); + func_node->name=name; + func_node->return_type=type; + func_node->return_precision=precision; - //add builtins - switch(p_type) { - case SHADER_MATERIAL_VERTEX: { - int idx=0; - while (vertex_builtins_defs[idx].name) { - parser.program->builtin_variables[vertex_builtins_defs[idx].name]=vertex_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_MATERIAL_FRAGMENT: { - int idx=0; - while (fragment_builtins_defs[idx].name) { - parser.program->builtin_variables[fragment_builtins_defs[idx].name]=fragment_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_MATERIAL_LIGHT: { - int idx=0; - while (light_builtins_defs[idx].name) { - parser.program->builtin_variables[light_builtins_defs[idx].name]=light_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_CANVAS_ITEM_VERTEX: { - int idx=0; - while (ci_vertex_builtins_defs[idx].name) { - parser.program->builtin_variables[ci_vertex_builtins_defs[idx].name]=ci_vertex_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_CANVAS_ITEM_FRAGMENT: { - int idx=0; - while (ci_fragment_builtins_defs[idx].name) { - parser.program->builtin_variables[ci_fragment_builtins_defs[idx].name]=ci_fragment_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_CANVAS_ITEM_LIGHT: { - int idx=0; - while (ci_light_builtins_defs[idx].name) { - parser.program->builtin_variables[ci_light_builtins_defs[idx].name]=ci_light_builtins_defs[idx].type; - idx++; - } - } break; - case SHADER_POST_PROCESS: { - int idx=0; - while (postprocess_fragment_builtins_defs[idx].name) { - parser.program->builtin_variables[postprocess_fragment_builtins_defs[idx].name]=postprocess_fragment_builtins_defs[idx].type; - idx++; - } - } break; - } + func_node->body = alloc_node(); + func_node->body->parent_function=func_node; - Error err = parse_block(parser,parser.program->body); - if (err) { - parser.get_error(r_error,r_err_line,r_err_column); - return err; - } - if (p_compile_func) { - err = p_compile_func(p_userdata,parser.program); - } + tk = _get_token(); - //clean up nodes created - while(parser.nodegc.size()) { + while(true) { + if (tk.type==TK_PARENTHESIS_CLOSE) { + break; + } - memdelete( parser.nodegc.front()->get() ); - parser.nodegc.pop_front(); - } - return err; -} + DataType ptype; + StringName pname; + DataPrecision pprecision = PRECISION_DEFAULT; -Error ShaderLanguage::compile(const String& p_code,ShaderType p_type,CompileFunc p_compile_func,void *p_userdata,String *r_error,int *r_err_line,int *r_err_column) { + if (is_token_precision(tk.type)) { + pprecision=get_token_precision(tk.type); + tk = _get_token(); + } - *r_error=""; - *r_err_line=0; - *r_err_column=0; - Vector tokens; + if (!is_token_datatype(tk.type)) { + _set_error("Expected a valid datatype for argument"); + return ERR_PARSE_ERROR; + } - Error err = tokenize(p_code,&tokens,r_error,r_err_line,r_err_column); - if (err!=OK) { - print_line("tokenizer error!"); - } + ptype=get_token_datatype(tk.type); - if (err!=OK) { - return err; - } - err = parse(tokens,p_type,p_compile_func,p_userdata,r_error,r_err_line,r_err_column); - if (err!=OK) { - return err; + if (ptype==TYPE_VOID) { + _set_error("void not allowed in argument"); + return ERR_PARSE_ERROR; + } + + tk = _get_token(); + + if (tk.type!=TK_IDENTIFIER) { + _set_error("Expected identifier for argument name"); + return ERR_PARSE_ERROR; + } + + pname = tk.text; + + if (_find_identifier(func_node->body,builtin_types,pname)) { + _set_error("Redefinition of '"+String(pname)+"'"); + return ERR_PARSE_ERROR; + } + FunctionNode::Argument arg; + arg.type=ptype; + arg.name=pname; + arg.precision=pprecision; + + func_node->arguments.push_back(arg); + + tk = _get_token(); + + + if (tk.type==TK_COMMA) { + tk = _get_token(); + //do none and go on + } else if (tk.type!=TK_PARENTHESIS_CLOSE) { + _set_error("Expected ',' or ')' after identifier"); + return ERR_PARSE_ERROR; + } + + } + + if (p_functions.has(name)) { + //if one of the core functions, make sure they are of the correct form + if (func_node->arguments.size() > 0) { + _set_error("Function '"+String(name)+"' expects no arguments."); + return ERR_PARSE_ERROR; + } + if (func_node->return_type!=TYPE_VOID) { + _set_error("Function '"+String(name)+"' must be of void return type."); + return ERR_PARSE_ERROR; + } + } + + + //all good let's parse inside the fucntion! + tk = _get_token(); + if (tk.type!=TK_CURLY_BRACKET_OPEN) { + _set_error("Expected '{' to begin function"); + return ERR_PARSE_ERROR; + } + + Error err = _parse_block(func_node->body,builtin_types); + if (err) + return err; + } + } + + tk = _get_token(); } + return OK; } +Error ShaderLanguage::compile(const String& p_code, const Map< StringName, Map > &p_functions, const Set &p_render_modes) { + + clear(); -void ShaderLanguage::get_keyword_list(ShaderType p_type, List *p_keywords) { + code=p_code; - int idx=0; + nodes=NULL; - p_keywords->push_back("uniform"); - p_keywords->push_back("texture"); - p_keywords->push_back("cubemap"); - p_keywords->push_back("color"); - p_keywords->push_back("if"); - p_keywords->push_back("else"); - while(intrinsic_func_defs[idx].name) { + shader = alloc_node(); + Error err = _parse_shader(p_functions,p_render_modes); - p_keywords->push_back(intrinsic_func_defs[idx].name); - idx++; + if (err!=OK) { + return err; } + return OK; +} +String ShaderLanguage::get_error_text() { + return error_str; +} - switch(p_type) { - case SHADER_MATERIAL_VERTEX: { - idx=0; - while (vertex_builtins_defs[idx].name) { - p_keywords->push_back(vertex_builtins_defs[idx].name); - idx++; - } - } break; - case SHADER_MATERIAL_FRAGMENT: { - idx=0; - while (fragment_builtins_defs[idx].name) { - p_keywords->push_back(fragment_builtins_defs[idx].name); - idx++; - } - } break; - case SHADER_MATERIAL_LIGHT: { - idx=0; - while (light_builtins_defs[idx].name) { - p_keywords->push_back(light_builtins_defs[idx].name); - idx++; - } - } break; - case SHADER_CANVAS_ITEM_VERTEX: { - idx=0; - while (ci_vertex_builtins_defs[idx].name) { - p_keywords->push_back(ci_vertex_builtins_defs[idx].name); - idx++; - } - } break; - case SHADER_CANVAS_ITEM_FRAGMENT: { - idx=0; - while (ci_fragment_builtins_defs[idx].name) { - p_keywords->push_back(ci_fragment_builtins_defs[idx].name); - idx++; - } - } break; - case SHADER_CANVAS_ITEM_LIGHT: { - idx=0; - while (ci_light_builtins_defs[idx].name) { - p_keywords->push_back(ci_light_builtins_defs[idx].name); - idx++; - } - } break; +int ShaderLanguage::get_error_line() { - case SHADER_POST_PROCESS: { - idx=0; - while (postprocess_fragment_builtins_defs[idx].name) { - p_keywords->push_back(postprocess_fragment_builtins_defs[idx].name); - idx++; - } - } break; + return error_line; +} - } +ShaderLanguage::ShaderLanguage() { + + nodes=NULL; +} + +ShaderLanguage::~ShaderLanguage() { + clear(); } + + diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 31e9fcda5b..b37853c77e 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -46,12 +46,24 @@ public: enum TokenType { TK_EMPTY, - TK_INDENTIFIER, + TK_IDENTIFIER, TK_TRUE, TK_FALSE, TK_REAL_CONSTANT, + TK_INT_CONSTANT, TK_TYPE_VOID, TK_TYPE_BOOL, + TK_TYPE_BVEC2, + TK_TYPE_BVEC3, + TK_TYPE_BVEC4, + TK_TYPE_INT, + TK_TYPE_IVEC2, + TK_TYPE_IVEC3, + TK_TYPE_IVEC4, + TK_TYPE_UINT, + TK_TYPE_UVEC2, + TK_TYPE_UVEC3, + TK_TYPE_UVEC4, TK_TYPE_FLOAT, TK_TYPE_VEC2, TK_TYPE_VEC3, @@ -59,9 +71,13 @@ public: TK_TYPE_MAT2, TK_TYPE_MAT3, TK_TYPE_MAT4, - TK_TYPE_TEXTURE, - TK_TYPE_CUBEMAP, - TK_TYPE_COLOR, + TK_TYPE_SAMPLER2D, + TK_TYPE_ISAMPLER2D, + TK_TYPE_USAMPLER2D, + TK_TYPE_SAMPLERCUBE, + TK_PRECISION_LOW, + TK_PRECISION_MID, + TK_PRECISION_HIGH, TK_OP_EQUAL, TK_OP_NOT_EQUAL, TK_OP_LESS, @@ -75,14 +91,35 @@ public: TK_OP_SUB, TK_OP_MUL, TK_OP_DIV, - TK_OP_NEG, + TK_OP_MOD, + TK_OP_SHIFT_LEFT, + TK_OP_SHIFT_RIGHT, TK_OP_ASSIGN, TK_OP_ASSIGN_ADD, TK_OP_ASSIGN_SUB, TK_OP_ASSIGN_MUL, TK_OP_ASSIGN_DIV, + TK_OP_ASSIGN_MOD, + TK_OP_ASSIGN_SHIFT_LEFT, + TK_OP_ASSIGN_SHIFT_RIGHT, + TK_OP_ASSIGN_BIT_AND, + TK_OP_ASSIGN_BIT_OR, + TK_OP_ASSIGN_BIT_XOR, + TK_OP_BIT_AND, + TK_OP_BIT_OR, + TK_OP_BIT_XOR, + TK_OP_BIT_INVERT, + TK_OP_INCREMENT, + TK_OP_DECREMENT, TK_CF_IF, TK_CF_ELSE, + TK_CF_FOR, + TK_CF_WHILE, + TK_CF_DO, + TK_CF_SWITCH, + TK_CF_CASE, + TK_CF_BREAK, + TK_CF_CONTINUE, TK_CF_RETURN, TK_BRACKET_OPEN, TK_BRACKET_CLOSE, @@ -90,31 +127,39 @@ public: TK_CURLY_BRACKET_CLOSE, TK_PARENTHESIS_OPEN, TK_PARENTHESIS_CLOSE, + TK_QUESTION, TK_COMMA, + TK_COLON, TK_SEMICOLON, TK_PERIOD, TK_UNIFORM, + TK_VARYING, + TK_RENDER_MODE, + TK_HINT_WHITE_TEXTURE, + TK_HINT_BLACK_TEXTURE, + TK_HINT_NORMAL_TEXTURE, + TK_HINT_RANGE, TK_ERROR, + TK_EOF, TK_MAX }; - - /* COMPILER */ - enum ShaderType { - SHADER_MATERIAL_VERTEX, - SHADER_MATERIAL_FRAGMENT, - SHADER_MATERIAL_LIGHT, - SHADER_CANVAS_ITEM_VERTEX, - SHADER_CANVAS_ITEM_FRAGMENT, - SHADER_CANVAS_ITEM_LIGHT, - SHADER_POST_PROCESS, - }; - enum DataType { TYPE_VOID, TYPE_BOOL, + TYPE_BVEC2, + TYPE_BVEC3, + TYPE_BVEC4, + TYPE_INT, + TYPE_IVEC2, + TYPE_IVEC3, + TYPE_IVEC4, + TYPE_UINT, + TYPE_UVEC2, + TYPE_UVEC3, + TYPE_UVEC4, TYPE_FLOAT, TYPE_VEC2, TYPE_VEC3, @@ -122,30 +167,58 @@ public: TYPE_MAT2, TYPE_MAT3, TYPE_MAT4, - TYPE_TEXTURE, - TYPE_CUBEMAP, + TYPE_SAMPLER2D, + TYPE_ISAMPLER2D, + TYPE_USAMPLER2D, + TYPE_SAMPLERCUBE, + }; + + enum DataPrecision { + PRECISION_LOWP, + PRECISION_MEDIUMP, + PRECISION_HIGHP, + PRECISION_DEFAULT, }; enum Operator { - OP_ASSIGN, + OP_EQUAL, + OP_NOT_EQUAL, + OP_LESS, + OP_LESS_EQUAL, + OP_GREATER, + OP_GREATER_EQUAL, + OP_AND, + OP_OR, + OP_NOT, + OP_NEGATE, OP_ADD, OP_SUB, OP_MUL, OP_DIV, + OP_MOD, + OP_SHIFT_LEFT, + OP_SHIFT_RIGHT, + OP_ASSIGN, OP_ASSIGN_ADD, OP_ASSIGN_SUB, OP_ASSIGN_MUL, OP_ASSIGN_DIV, - OP_NEG, - OP_NOT, - OP_CMP_EQ, - OP_CMP_NEQ, - OP_CMP_LEQ, - OP_CMP_GEQ, - OP_CMP_LESS, - OP_CMP_GREATER, - OP_CMP_OR, - OP_CMP_AND, + OP_ASSIGN_MOD, + OP_ASSIGN_SHIFT_LEFT, + OP_ASSIGN_SHIFT_RIGHT, + OP_ASSIGN_BIT_AND, + OP_ASSIGN_BIT_OR, + OP_ASSIGN_BIT_XOR, + OP_BIT_AND, + OP_BIT_OR, + OP_BIT_XOR, + OP_BIT_INVERT, + OP_INCREMENT, + OP_DECREMENT, + OP_SELECT_IF, + OP_SELECT_ELSE, //used only internally, then only IF appears with 3 arguments + OP_POST_INCREMENT, + OP_POST_DECREMENT, OP_CALL, OP_CONSTRUCT, OP_MAX @@ -154,18 +227,21 @@ public: enum FlowOperation { FLOW_OP_IF, FLOW_OP_RETURN, - //FLOW_OP_FOR, - //FLOW_OP_WHILE, - //FLOW_OP_DO, - //FLOW_OP_BREAK, - //FLOW_OP_CONTINUE, + FLOW_OP_FOR, + FLOW_OP_WHILE, + FLOW_OP_DO, + FLOW_OP_BREAK, + FLOW_OP_SWITCH, + FLOW_OP_CONTINUE }; struct Node { + Node *next; + enum Type { - TYPE_PROGRAM, + TYPE_SHADER, TYPE_FUNCTION, TYPE_BLOCK, TYPE_VARIABLE, @@ -175,7 +251,6 @@ public: TYPE_MEMBER }; - Node * parent; Type type; virtual DataType get_datatype() const { return TYPE_VOID; } @@ -183,24 +258,34 @@ public: virtual ~Node() {} }; + template + T* alloc_node() { + T* node = memnew(T); + node->next=nodes; + nodes=node; + return node; + } + + Node *nodes; + struct OperatorNode : public Node { DataType return_cache; + DataPrecision return_precision_cache; Operator op; Vector arguments; virtual DataType get_datatype() const { return return_cache; } - OperatorNode() { type=TYPE_OPERATOR; return_cache=TYPE_VOID; } + OperatorNode() { type=TYPE_OPERATOR; return_cache=TYPE_VOID; return_precision_cache=PRECISION_DEFAULT; } }; struct VariableNode : public Node { - bool uniform; DataType datatype_cache; StringName name; virtual DataType get_datatype() const { return datatype_cache; } - VariableNode() { type=TYPE_VARIABLE; datatype_cache=TYPE_VOID; uniform=false; } + VariableNode() { type=TYPE_VARIABLE; datatype_cache=TYPE_VOID; } }; struct ConstantNode : public Node { @@ -212,17 +297,26 @@ public: ConstantNode() { type=TYPE_CONSTANT; } }; + struct FunctionNode; + struct BlockNode : public Node { + FunctionNode *parent_function; + BlockNode *parent_block; - Map variables; + struct Variable { + DataType type; + DataPrecision precision; + }; + + Map variables; List statements; - BlockNode() { type=TYPE_BLOCK; } + BlockNode() { type=TYPE_BLOCK; parent_block=NULL; parent_function=NULL; } }; struct ControlFlowNode : public Node { FlowOperation flow_op; - Vector statements; + Vector blocks; ControlFlowNode() { type=TYPE_CONTROL_FLOW; flow_op=FLOW_OP_IF;} }; @@ -244,39 +338,60 @@ public: StringName name; DataType type; + DataPrecision precision; }; StringName name; DataType return_type; + DataPrecision return_precision; Vector arguments; BlockNode *body; - FunctionNode() { type=TYPE_FUNCTION; } + FunctionNode() { type=TYPE_FUNCTION; return_precision=PRECISION_DEFAULT; } }; - struct Uniform { - - int order; - DataType type; - Variant default_value; - }; - struct ProgramNode : public Node { + struct ShaderNode : public Node { struct Function { StringName name; FunctionNode*function; + bool callable; + }; + + struct Varying { + DataType type; + DataPrecision precission; + }; + + struct Uniform { + enum Hint { + HINT_NONE, + HINT_WHITE_TEXTURE, + HINT_BLACK_TEXTURE, + HINT_NORMAL_TEXTURE, + HINT_RANGE, + }; + + int order; + DataType type; + DataPrecision precission; + Variant default_value; + Hint hint; + float hint_range[3]; + + Uniform() { hint=HINT_NONE; hint_range[0]=0; hint_range[1]=1; hint_range[2]=0.001;} }; - Map builtin_variables; + Map varyings; Map uniforms; + Set render_modes; Vector functions; - BlockNode *body; - ProgramNode() { type=TYPE_PROGRAM; } + ShaderNode() { type=TYPE_SHADER; } }; @@ -284,12 +399,12 @@ public: bool is_op; union { - TokenType op; + Operator op; Node *node; }; }; - typedef Error (*CompileFunc)(void*,ProgramNode*); + struct VarInfo { @@ -297,59 +412,78 @@ public: DataType type; }; -private: - - - - static const char * token_names[TK_MAX]; + enum CompletionType { + COMPLETION_NONE, + COMPLETION_BUILT_IN_TYPE_CONSTANT, + COMPLETION_FUNCTION, + COMPLETION_IDENTIFIER, + COMPLETION_PARENT_FUNCTION, + COMPLETION_METHOD, + COMPLETION_CALL_ARGUMENTS, + COMPLETION_INDEX, + COMPLETION_VIRTUAL_FUNC, + COMPLETION_YIELD, + }; struct Token { TokenType type; StringName text; - uint16_t line,col; - - Token(TokenType p_type=TK_EMPTY,const String& p_text=String()) { type=p_type; text=p_text; line=0; col=0; } + double constant; + uint16_t line; }; + static String get_token_text(Token p_token); + static bool is_token_datatype(TokenType p_type); + static DataType get_token_datatype(TokenType p_type); + static bool is_token_precision(TokenType p_type); + static DataPrecision get_token_precision(TokenType p_type); + static String get_datatype_name(DataType p_type); + static bool is_token_nonvoid_datatype(TokenType p_type); + static bool is_token_operator(TokenType p_type); + +private: + bool error_set; + String error_str; + int error_line; - static Token read_token(const CharType* p_text,int p_len,int &r_line,int &r_chars); - static Error tokenize(const String& p_text,Vector *p_tokens,String *r_error,int *r_err_line,int *r_err_column); + String code; + int char_idx; + int tk_line; + void _set_error(const String& p_str) { + if (error_set) + return; + error_set=true; + error_str=p_str; + } - class Parser { + static const char * token_names[TK_MAX]; - Vector tokens; - int pos; - String error; - public: - void set_error(const String& p_error) { error=p_error; } - void get_error(String *r_error, int *r_line, int *r_column) { - *r_error=error; - *r_line=get_token(pos).line; - *r_column=get_token(pos).col; - } + Token _make_token(TokenType p_type, const StringName& p_text=StringName()); + Token _get_token(); + ShaderNode *shader; + enum IdentifierType { + IDENTIFIER_FUNCTION, + IDENTIFIER_UNIFORM, + IDENTIFIER_VARYING, + IDENTIFIER_FUNCTION_ARGUMENT, + IDENTIFIER_LOCAL_VAR, + IDENTIFIER_BUILTIN_VAR, + }; - Token get_token(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return Token(TK_ERROR); return tokens[idx]; } - TokenType get_token_type(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return TK_ERROR; return tokens[idx].type; } - void advance(int p_amount=1) { pos+=p_amount; } - bool is_at_end() const { return pos>=tokens.size(); } + bool _find_identifier(const BlockNode* p_block,const Map &p_builtin_types,const StringName& p_identifier, DataType *r_data_type=NULL, IdentifierType *r_type=NULL); - ProgramNode *program; - template - T* create_node(Node *p_parent) { T*n=memnew( T ); nodegc.push_back(n); n->parent=p_parent; return n; } - List nodegc; + bool _validate_operator(OperatorNode *p_op,DataType *r_ret_type=NULL); - Parser(const Vector& p_tokens) { tokens=p_tokens; pos=0;} - }; struct IntrinsicFuncDef { @@ -360,70 +494,35 @@ private: }; - static const IntrinsicFuncDef intrinsic_func_defs[]; - - struct OperatorDef { - - enum { MAX_ARGS=2 }; - Operator op; - DataType rettype; - const DataType args[MAX_ARGS]; - }; - - static const OperatorDef operator_defs[]; - - struct BuiltinsDef { - - const char* name; - DataType type; - }; - - static const BuiltinsDef vertex_builtins_defs[]; - static const BuiltinsDef fragment_builtins_defs[]; - static const BuiltinsDef light_builtins_defs[]; - - static const BuiltinsDef ci_vertex_builtins_defs[]; - static const BuiltinsDef ci_fragment_builtins_defs[]; - static const BuiltinsDef ci_light_builtins_defs[]; - - static const BuiltinsDef postprocess_fragment_builtins_defs[]; - - static DataType get_token_datatype(TokenType p_type); - static String get_datatype_name(DataType p_type); - static bool is_token_datatype(TokenType p_type); - static bool is_token_nonvoid_datatype(TokenType p_type); - - static bool test_existing_identifier(Node *p_node,const StringName p_identifier,bool p_func=true,bool p_var=true,bool p_builtin=true); + static const IntrinsicFuncDef intrinsic_func_defs[]; + bool _validate_function_call(BlockNode* p_block, OperatorNode *p_func,DataType *r_ret_type); - static bool parser_is_at_function(Parser& parser); - static DataType compute_node_type(Node *p_node); + bool _parse_function_arguments(BlockNode *p_block, const Map &p_builtin_types, OperatorNode* p_func); - static Node* validate_function_call(Parser&parser, OperatorNode *p_func); - static Node* validate_operator(Parser& parser,OperatorNode *p_func); - static bool is_token_operator(TokenType p_type); - static Operator get_token_operator(TokenType p_type); + Node* _parse_expression(BlockNode *p_block, const Map &p_builtin_types); - static Error parse_expression(Parser& parser,Node *p_parent,Node **r_expr); + ShaderLanguage::Node* _reduce_expression(BlockNode *p_block, ShaderLanguage::Node *p_node); + Node* _parse_and_reduce_expression(BlockNode *p_block,const Map &p_builtin_types); - static Error parse_variable_declaration(Parser& parser,BlockNode *p_block); - static Error parse_function(Parser& parser,BlockNode *p_block); - static Error parse_flow_if(Parser& parser,Node *p_parent,Node **r_statement); - static Error parse_flow_return(Parser& parser,Node *p_parent,Node **r_statement); - static Error parse_statement(Parser& parser,Node *p_parent,Node **r_statement); - static Error parse_block(Parser& parser,BlockNode *p_block); + Error _parse_block(BlockNode *p_block, const Map &p_builtin_types, bool p_just_one=false, bool p_can_break=false, bool p_can_continue=false); + Error _parse_shader(const Map< StringName, Map > &p_functions, const Set &p_render_modes); - static Error parse(const Vector &p_tokens,ShaderType p_type,CompileFunc p_compile_func,void *p_userdata,String *r_error,int *r_err_line,int *r_err_column); -; public: - static void get_keyword_list(ShaderType p_type,List *p_keywords); +// static void get_keyword_list(ShaderType p_type,List *p_keywords); + + void clear(); + Error compile(const String& p_code,const Map< StringName, Map > &p_functions,const Set& p_render_modes); + String get_error_text(); + int get_error_line(); - static Error compile(const String& p_code,ShaderType p_type, CompileFunc p_compile_func,void *p_userdata,String *r_error,int *r_err_line,int *r_err_column); static String lex_debug(const String& p_code); + ShaderLanguage(); + ~ShaderLanguage(); }; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp new file mode 100644 index 0000000000..f70ce46a3d --- /dev/null +++ b/servers/visual/visual_server_canvas.cpp @@ -0,0 +1,1268 @@ +#include "visual_server_canvas.h" +#include "visual_server_global.h" +#include "visual_server_viewport.h" + +void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color& p_modulate, RasterizerCanvas::Light *p_lights) { + + + static const int z_range = VS::CANVAS_ITEM_Z_MAX-VS::CANVAS_ITEM_Z_MIN+1; + RasterizerCanvas::Item *z_list[z_range]; + RasterizerCanvas::Item *z_last_list[z_range]; + + for(int i=0;icanvas_render_items(z_list[i],VS::CANVAS_ITEM_Z_MIN+i,p_modulate,p_lights); + } + +} + +void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item,const Matrix32& p_transform,const Rect2& p_clip_rect, const Color &p_modulate,int p_z,RasterizerCanvas::Item **z_list,RasterizerCanvas::Item **z_last_list,Item *p_canvas_clip,Item *p_material_owner) { + + Item *ci = p_canvas_item; + + if (!ci->visible) + return; + + Rect2 rect = ci->get_rect(); + Matrix32 xform = p_transform * ci->xform; + Rect2 global_rect = xform.xform(rect); + global_rect.pos+=p_clip_rect.pos; + + + if (ci->use_parent_material && p_material_owner) + ci->material_owner=p_material_owner; + else { + p_material_owner=ci; + ci->material_owner=NULL; + } + + + Color modulate( ci->modulate.r * p_modulate.r, ci->modulate.g * p_modulate.g,ci->modulate.b * p_modulate.b,ci->modulate.a * p_modulate.a); + + if (modulate.a<0.007) + return; + + + int child_item_count=ci->child_items.size(); + Item **child_items=(Item**)alloca(child_item_count*sizeof(Item*)); + copymem(child_items,ci->child_items.ptr(),child_item_count*sizeof(Item*)); + + if (ci->clip) { + if (p_canvas_clip != NULL) { + ci->final_clip_rect=p_canvas_clip->final_clip_rect.clip(global_rect); + } else { + ci->final_clip_rect=global_rect; + } + ci->final_clip_owner=ci; + + } else { + ci->final_clip_owner=p_canvas_clip; + } + + if (ci->sort_y) { + + SortArray sorter; + sorter.sort(child_items,child_item_count); + } + + if (ci->z_relative) + p_z=CLAMP(p_z+ci->z,VS::CANVAS_ITEM_Z_MIN,VS::CANVAS_ITEM_Z_MAX); + else + p_z=ci->z; + + for(int i=0;ibehind) + continue; + _render_canvas_item(child_items[i],xform,p_clip_rect,modulate,p_z,z_list,z_last_list,(Item*)ci->final_clip_owner,p_material_owner); + } + + if (ci->copy_back_buffer) { + + ci->copy_back_buffer->screen_rect = xform.xform(ci->copy_back_buffer->rect).clip(p_clip_rect); + } + + if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render || ci->copy_back_buffer) { + //something to draw? + ci->final_transform=xform; + ci->final_modulate=Color(modulate.r*ci->self_modulate.r, modulate.g*ci->self_modulate.g, modulate.b*ci->self_modulate.b, modulate.a*ci->self_modulate.a ); + ci->global_rect_cache=global_rect; + ci->global_rect_cache.pos-=p_clip_rect.pos; + ci->light_masked=false; + + int zidx = p_z-VS::CANVAS_ITEM_Z_MIN; + + if (z_last_list[zidx]) { + z_last_list[zidx]->next=ci; + z_last_list[zidx]=ci; + + } else { + z_list[zidx]=ci; + z_last_list[zidx]=ci; + } + + ci->next=NULL; + + } + + for(int i=0;ibehind) + continue; + _render_canvas_item(child_items[i],xform,p_clip_rect,modulate,p_z,z_list,z_last_list,(Item*)ci->final_clip_owner,p_material_owner); + } + +} + +void VisualServerCanvas::_light_mask_canvas_items(int p_z,RasterizerCanvas::Item *p_canvas_item,RasterizerCanvas::Light *p_masked_lights) { + + if (!p_masked_lights) + return; + + RasterizerCanvas::Item *ci=p_canvas_item; + + while(ci) { + + RasterizerCanvas::Light *light=p_masked_lights; + while(light) { + + if (ci->light_mask&light->item_mask && p_z>=light->z_min && p_z<=light->z_max && ci->global_rect_cache.intersects_transformed(light->xform_cache,light->rect_cache)) { + ci->light_masked=true; + } + + light=light->mask_next_ptr; + } + + ci=ci->next; + } + + + + +} + +void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) { + + VSG::canvas_render->canvas_begin(); + + int l = p_canvas->child_items.size(); + Canvas::ChildItem *ci=p_canvas->child_items.ptr(); + + bool has_mirror=false; + for(int i=0;icanvas_render_items(z_list[i],VS::CANVAS_ITEM_Z_MIN+i,p_canvas->modulate,p_lights); + } + } else { + + for(int i=0;ichild_items[i]; + _render_canvas_item_tree(ci.item,p_transform,p_clip_rect,p_canvas->modulate,p_lights); + + //mirroring (useful for scrolling backgrounds) + if (ci.mirror.x!=0) { + + Matrix32 xform2 = p_transform * Matrix32(0,Vector2(ci.mirror.x,0)); + _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); + } + if (ci.mirror.y!=0) { + + Matrix32 xform2 = p_transform * Matrix32(0,Vector2(0,ci.mirror.y)); + _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); + } + if (ci.mirror.y!=0 && ci.mirror.x!=0) { + + Matrix32 xform2 = p_transform * Matrix32(0,ci.mirror); + _render_canvas_item_tree(ci.item,xform2,p_clip_rect,p_canvas->modulate,p_lights); + } + + } + } + +} + + +RID VisualServerCanvas::canvas_create() { + + Canvas * canvas = memnew( Canvas ); + ERR_FAIL_COND_V(!canvas,RID()); + RID rid = canvas_owner.make_rid( canvas ); + + return rid; +} + +void VisualServerCanvas::canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring) { + + Canvas * canvas = canvas_owner.getornull(p_canvas); + ERR_FAIL_COND(!canvas); + Item *canvas_item = canvas_item_owner.getornull(p_item); + ERR_FAIL_COND(!canvas_item); + + int idx = canvas->find_item(canvas_item); + ERR_FAIL_COND(idx==-1); + canvas->child_items[idx].mirror=p_mirroring; + +} +void VisualServerCanvas::canvas_set_modulate(RID p_canvas,const Color& p_color) { + + Canvas * canvas = canvas_owner.get(p_canvas); + ERR_FAIL_COND(!canvas); + canvas->modulate=p_color; +} + + +RID VisualServerCanvas::canvas_item_create() { + + Item *canvas_item = memnew( Item ); + ERR_FAIL_COND_V(!canvas_item,RID()); + + return canvas_item_owner.make_rid( canvas_item ); +} + +void VisualServerCanvas::canvas_item_set_parent(RID p_item,RID p_parent) { + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + if (canvas_item->parent.is_valid()) { + + if (canvas_owner.owns(canvas_item->parent)) { + + Canvas *canvas = canvas_owner.get(canvas_item->parent); + canvas->erase_item(canvas_item); + } else if (canvas_item_owner.owns(canvas_item->parent)) { + + Item *item_owner = canvas_item_owner.get(canvas_item->parent); + item_owner->child_items.erase(canvas_item); + } + + canvas_item->parent=RID(); + } + + + if (p_parent.is_valid()) { + if (canvas_owner.owns(p_parent)) { + + Canvas *canvas = canvas_owner.get(p_parent); + Canvas::ChildItem ci; + ci.item=canvas_item; + canvas->child_items.push_back(ci); + canvas->children_order_dirty=true; + } else if (canvas_item_owner.owns(p_parent)) { + + Item *item_owner = canvas_item_owner.get(p_parent); + item_owner->child_items.push_back(canvas_item); + item_owner->children_order_dirty=true; + + } else { + + ERR_EXPLAIN("Invalid parent"); + ERR_FAIL(); + } + + + } + + canvas_item->parent=p_parent; + + +} +void VisualServerCanvas::canvas_item_set_visible(RID p_item,bool p_visible){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->visible=p_visible; + +} +void VisualServerCanvas::canvas_item_set_light_mask(RID p_item,int p_mask){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->light_mask=p_mask; + +} + +void VisualServerCanvas::canvas_item_set_transform(RID p_item, const Matrix32& p_transform){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->xform=p_transform; + +} +void VisualServerCanvas::canvas_item_set_clip(RID p_item, bool p_clip){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->clip=p_clip; + +} +void VisualServerCanvas::canvas_item_set_distance_field_mode(RID p_item, bool p_enable){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->distance_field=p_enable; + + +} +void VisualServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->custom_rect=p_custom_rect; + canvas_item->rect=p_rect; + +} +void VisualServerCanvas::canvas_item_set_modulate(RID p_item, const Color& p_color) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->modulate=p_color; + +} +void VisualServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color& p_color){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->self_modulate=p_color; + +} + +void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->behind=p_enable; + +} + + +void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandLine * line = memnew( Item::CommandLine ); + ERR_FAIL_COND(!line); + line->color=p_color; + line->from=p_from; + line->to=p_to; + line->width=p_width; + line->antialiased=p_antialiased; + canvas_item->rect_dirty=true; + + + canvas_item->commands.push_back(line); +} + +void VisualServerCanvas::canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandRect * rect = memnew( Item::CommandRect ); + ERR_FAIL_COND(!rect); + rect->modulate=p_color; + rect->rect=p_rect; + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(rect); +} + +void VisualServerCanvas::canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color) { + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandCircle * circle = memnew( Item::CommandCircle ); + ERR_FAIL_COND(!circle); + circle->color=p_color; + circle->pos=p_pos; + circle->radius=p_radius; + + canvas_item->commands.push_back(circle); + +} + +void VisualServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile,const Color& p_modulate,bool p_transpose) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandRect * rect = memnew( Item::CommandRect ); + ERR_FAIL_COND(!rect); + rect->modulate=p_modulate; + rect->rect=p_rect; + rect->flags=0; + if (p_tile) { + rect->flags|=RasterizerCanvas::CANVAS_RECT_TILE; + rect->flags|=RasterizerCanvas::CANVAS_RECT_REGION; + rect->source=Rect2(0,0,p_rect.size.width,p_rect.size.height); + } + + if (p_rect.size.x<0) { + + rect->flags|=RasterizerCanvas::CANVAS_RECT_FLIP_H; + rect->rect.size.x = -rect->rect.size.x; + } + if (p_rect.size.y<0) { + + rect->flags|=RasterizerCanvas::CANVAS_RECT_FLIP_V; + rect->rect.size.y = -rect->rect.size.y; + } + if (p_transpose) { + rect->flags|=RasterizerCanvas::CANVAS_RECT_TRANSPOSE; + SWAP(rect->rect.size.x, rect->rect.size.y); + } + rect->texture=p_texture; + canvas_item->rect_dirty=true; + canvas_item->commands.push_back(rect); +} + +void VisualServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate,bool p_transpose) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandRect * rect = memnew( Item::CommandRect ); + ERR_FAIL_COND(!rect); + rect->modulate=p_modulate; + rect->rect=p_rect; + rect->texture=p_texture; + rect->source=p_src_rect; + rect->flags=RasterizerCanvas::CANVAS_RECT_REGION; + + if (p_rect.size.x<0) { + + rect->flags|=RasterizerCanvas::CANVAS_RECT_FLIP_H; + rect->rect.size.x = -rect->rect.size.x; + } + if (p_rect.size.y<0) { + + rect->flags|=RasterizerCanvas::CANVAS_RECT_FLIP_V; + rect->rect.size.y = -rect->rect.size.y; + } + if (p_transpose) { + rect->flags|=RasterizerCanvas::CANVAS_RECT_TRANSPOSE; + SWAP(rect->rect.size.x, rect->rect.size.y); + } + + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(rect); + +} + +void VisualServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,VS::NinePatchAxisMode p_x_axis_mode, VS::NinePatchAxisMode p_y_axis_mode,bool p_draw_center,const Color& p_modulate) { + + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandNinePatch * style = memnew( Item::CommandNinePatch ); + ERR_FAIL_COND(!style); + style->texture=p_texture; + style->rect=p_rect; + style->source=p_source; + style->draw_center=p_draw_center; + style->color=p_modulate; + style->margin[MARGIN_LEFT]=p_topleft.x; + style->margin[MARGIN_TOP]=p_topleft.y; + style->margin[MARGIN_RIGHT]=p_bottomright.x; + style->margin[MARGIN_BOTTOM]=p_bottomright.y; + style->axis_x=p_x_axis_mode; + style->axis_y=p_y_axis_mode; + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(style); +} +void VisualServerCanvas::canvas_item_add_primitive(RID p_item,const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width) { + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandPrimitive * prim = memnew( Item::CommandPrimitive ); + ERR_FAIL_COND(!prim); + prim->texture=p_texture; + prim->points=p_points; + prim->uvs=p_uvs; + prim->colors=p_colors; + prim->width=p_width; + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(prim); +} + +void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture) { + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); +#ifdef DEBUG_ENABLED + int pointcount = p_points.size(); + ERR_FAIL_COND(pointcount<3); + int color_size=p_colors.size(); + int uv_size=p_uvs.size(); + ERR_FAIL_COND(color_size!=0 && color_size!=1 && color_size!=pointcount); + ERR_FAIL_COND(uv_size!=0 && (uv_size!=pointcount || !p_texture.is_valid())); +#endif + Vector indices = Geometry::triangulate_polygon(p_points); + + if (indices.empty()) { + + ERR_EXPLAIN("Bad Polygon!"); + ERR_FAIL_V(); + } + + Item::CommandPolygon * polygon = memnew( Item::CommandPolygon ); + ERR_FAIL_COND(!polygon); + polygon->texture=p_texture; + polygon->points=p_points; + polygon->uvs=p_uvs; + polygon->colors=p_colors; + polygon->indices=indices; + polygon->count=indices.size(); + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(polygon); + +} + + +void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture, int p_count) { + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + int ps = p_points.size(); + ERR_FAIL_COND(!p_colors.empty() && p_colors.size()!=ps && p_colors.size()!=1); + ERR_FAIL_COND(!p_uvs.empty() && p_uvs.size()!=ps); + + Vector indices = p_indices; + + int count = p_count * 3; + + if (indices.empty()) { + + ERR_FAIL_COND( ps % 3 != 0 ); + if (p_count == -1) + count = ps; + } else { + + ERR_FAIL_COND( indices.size() % 3 != 0 ); + if (p_count == -1) + count = indices.size(); + } + + Item::CommandPolygon * polygon = memnew( Item::CommandPolygon ); + ERR_FAIL_COND(!polygon); + polygon->texture=p_texture; + polygon->points=p_points; + polygon->uvs=p_uvs; + polygon->colors=p_colors; + polygon->indices=indices; + polygon->count = count; + canvas_item->rect_dirty=true; + + canvas_item->commands.push_back(polygon); +} + + +void VisualServerCanvas::canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform) { + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandTransform * tr = memnew( Item::CommandTransform ); + ERR_FAIL_COND(!tr); + tr->xform=p_transform; + + canvas_item->commands.push_back(tr); + +} + +void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandMesh * m = memnew( Item::CommandMesh ); + ERR_FAIL_COND(!m); + m->mesh=p_mesh; + m->skeleton=p_skeleton; + + canvas_item->commands.push_back(m); +} +void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandMultiMesh * mm = memnew( Item::CommandMultiMesh ); + ERR_FAIL_COND(!mm); + mm->multimesh=p_mesh; + mm->skeleton=p_skeleton; + + canvas_item->commands.push_back(mm); + +} + +void VisualServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore){ + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + Item::CommandClipIgnore * ci = memnew( Item::CommandClipIgnore); + ERR_FAIL_COND(!ci); + ci->ignore=p_ignore; + + canvas_item->commands.push_back(ci); +} +void VisualServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable){ + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->sort_y=p_enable; +} +void VisualServerCanvas::canvas_item_set_z(RID p_item, int p_z){ + + ERR_FAIL_COND(p_zVS::CANVAS_ITEM_Z_MAX); + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->z=p_z; +} +void VisualServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->z_relative=p_enable; + +} +void VisualServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect){ + + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + if (bool(canvas_item->copy_back_buffer!=NULL) !=p_enable) { + if (p_enable) { + canvas_item->copy_back_buffer = memnew( RasterizerCanvas::Item::CopyBackBuffer ); + } else { + memdelete(canvas_item->copy_back_buffer); + canvas_item->copy_back_buffer=NULL; + } + } + + if (p_enable) { + canvas_item->copy_back_buffer->rect=p_rect; + canvas_item->copy_back_buffer->full=p_rect==Rect2(); + } + +} + +void VisualServerCanvas::canvas_item_clear(RID p_item){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->clear(); +} +void VisualServerCanvas::canvas_item_set_draw_index(RID p_item,int p_index){ + + Item *canvas_item = canvas_item_owner.getornull( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->index=p_index; + + if (canvas_item_owner.owns( canvas_item->parent)) { + Item *canvas_item_parent = canvas_item_owner.getornull( canvas_item->parent ); + canvas_item_parent->children_order_dirty=true; + return; + } + + Canvas* canvas = canvas_owner.getornull( canvas_item->parent ); + if (canvas) { + canvas->children_order_dirty=true; + return; + } + +} + +void VisualServerCanvas::canvas_item_set_material(RID p_item, RID p_material){ + + Item *canvas_item = canvas_item_owner.get( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->material=p_material; +} + +void VisualServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool p_enable){ + + Item *canvas_item = canvas_item_owner.get( p_item ); + ERR_FAIL_COND(!canvas_item); + + canvas_item->use_parent_material=p_enable; + +} + +RID VisualServerCanvas::canvas_light_create(){ + + RasterizerCanvas::Light *clight = memnew( RasterizerCanvas::Light ); + clight->light_internal = VSG::canvas_render->light_internal_create(); + return canvas_light_owner.make_rid(clight); + +} +void VisualServerCanvas::canvas_light_attach_to_canvas(RID p_light,RID p_canvas){ + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + if (clight->canvas.is_valid()) { + + Canvas *canvas = canvas_owner.getornull(clight->canvas); + canvas->lights.erase(clight); + } + + if (!canvas_owner.owns(p_canvas)) + p_canvas=RID(); + + clight->canvas=p_canvas; + + if (clight->canvas.is_valid()) { + + Canvas *canvas = canvas_owner.get(clight->canvas); + canvas->lights.insert(clight); + } +} + + +void VisualServerCanvas::canvas_light_set_enabled(RID p_light, bool p_enabled){ + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->enabled=p_enabled; + +} +void VisualServerCanvas::canvas_light_set_scale(RID p_light, float p_scale){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->scale=p_scale; + +} +void VisualServerCanvas::canvas_light_set_transform(RID p_light, const Matrix32& p_transform){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->xform=p_transform; + +} +void VisualServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->texture=p_texture; + +} +void VisualServerCanvas::canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->texture_offset=p_offset; + +} +void VisualServerCanvas::canvas_light_set_color(RID p_light, const Color& p_color){ + + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->color=p_color; +} +void VisualServerCanvas::canvas_light_set_height(RID p_light, float p_height){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->height=p_height; + +} +void VisualServerCanvas::canvas_light_set_energy(RID p_light, float p_energy){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->energy=p_energy; + +} +void VisualServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->z_min=p_min_z; + clight->z_max=p_max_z; + +} +void VisualServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + + clight->layer_max=p_max_layer; + clight->layer_min=p_min_layer; + + +} +void VisualServerCanvas::canvas_light_set_item_cull_mask(RID p_light, int p_mask){ + + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->item_mask=p_mask; + +} +void VisualServerCanvas::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask){ + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->item_shadow_mask=p_mask; + +} +void VisualServerCanvas::canvas_light_set_mode(RID p_light, VS::CanvasLightMode p_mode){ + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->mode=p_mode; + +} + + +void VisualServerCanvas::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled){ + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + if (clight->shadow_buffer.is_valid()==p_enabled) + return; + if (p_enabled) { + clight->shadow_buffer=VSG::storage->canvas_light_shadow_buffer_create(clight->shadow_buffer_size); + } else { + VSG::storage->free(clight->shadow_buffer); + clight->shadow_buffer=RID(); + } + +} +void VisualServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_size){ + + ERR_FAIL_COND(p_size<32 || p_size>16384); + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + int new_size = nearest_power_of_2(p_size);; + if (new_size==clight->shadow_buffer_size) + return; + + clight->shadow_buffer_size=nearest_power_of_2(p_size); + + if (clight->shadow_buffer.is_valid()) { + VSG::storage->free(clight->shadow_buffer); + clight->shadow_buffer=VSG::storage->canvas_light_shadow_buffer_create(clight->shadow_buffer_size); + } +} + +void VisualServerCanvas::canvas_light_set_shadow_gradient_length(RID p_light, float p_length) { + + ERR_FAIL_COND(p_length<0); + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->shadow_gradient_length=p_length; + +} +void VisualServerCanvas::canvas_light_set_shadow_filter(RID p_light, VS::CanvasLightShadowFilter p_filter) { + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->shadow_filter=p_filter; + +} +void VisualServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color& p_color) { + + RasterizerCanvas::Light *clight = canvas_light_owner.get(p_light); + ERR_FAIL_COND(!clight); + + clight->shadow_color=p_color; +} + + + +RID VisualServerCanvas::canvas_light_occluder_create() { + + RasterizerCanvas::LightOccluderInstance *occluder = memnew( RasterizerCanvas::LightOccluderInstance ); + + return canvas_light_occluder_owner.make_rid(occluder); +} +void VisualServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas){ + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!occluder); + + if (occluder->canvas.is_valid()) { + + Canvas *canvas = canvas_owner.get(occluder->canvas); + canvas->occluders.erase(occluder); + } + + if (!canvas_owner.owns(p_canvas)) + p_canvas=RID(); + + occluder->canvas=p_canvas; + + if (occluder->canvas.is_valid()) { + + Canvas *canvas = canvas_owner.get(occluder->canvas); + canvas->occluders.insert(occluder); + } +} +void VisualServerCanvas::canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled) { + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!occluder); + + occluder->enabled=p_enabled; +} +void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon) { + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!occluder); + + if (occluder->polygon.is_valid()) { + LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_polygon); + if (occluder_poly) { + occluder_poly->owners.erase(occluder); + } + } + + occluder->polygon=p_polygon; + occluder->polygon_buffer=RID(); + + if (occluder->polygon.is_valid()) { + LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_polygon); + if (!occluder_poly) + occluder->polygon=RID(); + ERR_FAIL_COND(!occluder_poly); + occluder_poly->owners.insert(occluder); + occluder->polygon_buffer=occluder_poly->occluder; + occluder->aabb_cache=occluder_poly->aabb; + occluder->cull_cache=occluder_poly->cull_mode; + } + +} +void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform) { + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!occluder); + + occluder->xform=p_xform; +} +void VisualServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask) { + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_occluder); + ERR_FAIL_COND(!occluder); + + occluder->light_mask=p_mask; +} + +RID VisualServerCanvas::canvas_occluder_polygon_create() { + + LightOccluderPolygon * occluder_poly = memnew( LightOccluderPolygon ); + occluder_poly->occluder=VSG::storage->canvas_light_occluder_create(); + return canvas_light_occluder_polygon_owner.make_rid(occluder_poly); + +} +void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed) { + + if (p_shape.size()<3) { + canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,p_shape); + return; + } + + DVector lines; + int lc = p_shape.size()*2; + + lines.resize(lc-(p_closed?0:2)); + { + DVector::Write w = lines.write(); + DVector::Read r = p_shape.read(); + + int max=lc/2; + if (!p_closed) { + max--; + } + for(int i=0;i& p_shape) { + + LightOccluderPolygon * occluder_poly = canvas_light_occluder_polygon_owner.get(p_occluder_polygon); + ERR_FAIL_COND(!occluder_poly); + ERR_FAIL_COND(p_shape.size()&1); + + int lc = p_shape.size(); + occluder_poly->aabb=Rect2(); + { + DVector::Read r = p_shape.read(); + for(int i=0;iaabb.pos=r[i]; + else + occluder_poly->aabb.expand_to(r[i]); + } + } + + VSG::storage->canvas_light_occluder_set_polylines(occluder_poly->occluder,p_shape); + for( Set::Element *E=occluder_poly->owners.front();E;E=E->next()) { + E->get()->aabb_cache=occluder_poly->aabb; + } +} + + +void VisualServerCanvas::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,VS::CanvasOccluderPolygonCullMode p_mode) { + + LightOccluderPolygon * occluder_poly = canvas_light_occluder_polygon_owner.get(p_occluder_polygon); + ERR_FAIL_COND(!occluder_poly); + occluder_poly->cull_mode=p_mode; + for( Set::Element *E=occluder_poly->owners.front();E;E=E->next()) { + E->get()->cull_cache=p_mode; + } +} + + + +bool VisualServerCanvas::free(RID p_rid) { + + if (canvas_owner.owns(p_rid)) { + + Canvas *canvas = canvas_owner.get(p_rid); + ERR_FAIL_COND_V(!canvas,false); + + while(canvas->viewports.size()) { + + VisualServerViewport::Viewport *vp = VSG::viewport->viewport_owner.get(canvas->viewports.front()->get()); + ERR_FAIL_COND_V(!vp,true); + + Map::Element *E=vp->canvas_map.find(p_rid); + ERR_FAIL_COND_V(!E,true); + vp->canvas_map.erase(p_rid); + + canvas->viewports.erase( canvas->viewports.front() ); + } + + for (int i=0;ichild_items.size();i++) { + + canvas->child_items[i].item->parent=RID(); + } + + for (Set::Element *E=canvas->lights.front();E;E=E->next()) { + + E->get()->canvas=RID(); + } + + for (Set::Element *E=canvas->occluders.front();E;E=E->next()) { + + E->get()->canvas=RID(); + } + + canvas_owner.free( p_rid ); + + memdelete( canvas ); + + } else if (canvas_item_owner.owns(p_rid)) { + + Item *canvas_item = canvas_item_owner.get(p_rid); + ERR_FAIL_COND_V(!canvas_item,true); + + if (canvas_item->parent.is_valid()) { + + if (canvas_owner.owns(canvas_item->parent)) { + + Canvas *canvas = canvas_owner.get(canvas_item->parent); + canvas->erase_item(canvas_item); + } else if (canvas_item_owner.owns(canvas_item->parent)) { + + Item *item_owner = canvas_item_owner.get(canvas_item->parent); + item_owner->child_items.erase(canvas_item); + + } + } + + for (int i=0;ichild_items.size();i++) { + + canvas_item->child_items[i]->parent=RID(); + } + +// if (canvas_item->material) { +// canvas_item->material->owners.erase(canvas_item); +// } + + canvas_item_owner.free( p_rid ); + + memdelete( canvas_item ); + + } else if (canvas_light_owner.owns(p_rid)) { + + RasterizerCanvas::Light *canvas_light = canvas_light_owner.get(p_rid); + ERR_FAIL_COND_V(!canvas_light,true); + + if (canvas_light->canvas.is_valid()) { + Canvas* canvas = canvas_owner.get(canvas_light->canvas); + if (canvas) + canvas->lights.erase(canvas_light); + } + + if (canvas_light->shadow_buffer.is_valid()) + VSG::storage->free(canvas_light->shadow_buffer); + + VSG::canvas_render->light_internal_free(canvas_light->light_internal); + + canvas_light_owner.free( p_rid ); + memdelete( canvas_light ); + + } else if (canvas_light_occluder_owner.owns(p_rid)) { + + RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_rid); + ERR_FAIL_COND_V(!occluder,true); + + if (occluder->polygon.is_valid()) { + + LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(occluder->polygon); + if (occluder_poly) { + occluder_poly->owners.erase(occluder); + } + + } + + if (occluder->canvas.is_valid() && canvas_owner.owns(occluder->canvas)) { + + Canvas *canvas = canvas_owner.get(occluder->canvas); + canvas->occluders.erase(occluder); + + } + + canvas_light_occluder_owner.free( p_rid ); + memdelete(occluder); + + } else if (canvas_light_occluder_polygon_owner.owns(p_rid)) { + + LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_rid); + ERR_FAIL_COND_V(!occluder_poly,true); + VSG::storage->free(occluder_poly->occluder); + + while(occluder_poly->owners.size()) { + + occluder_poly->owners.front()->get()->polygon=RID(); + occluder_poly->owners.erase( occluder_poly->owners.front() ); + } + + canvas_light_occluder_polygon_owner.free( p_rid ); + memdelete(occluder_poly); + } else { + return false; + } + + return true; +} + + + +VisualServerCanvas::VisualServerCanvas() +{ + +} diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h new file mode 100644 index 0000000000..b5412ed608 --- /dev/null +++ b/servers/visual/visual_server_canvas.h @@ -0,0 +1,214 @@ +#ifndef VISUALSERVERCANVAS_H +#define VISUALSERVERCANVAS_H + +#include "rasterizer.h" +#include "visual_server_viewport.h" + +class VisualServerCanvas { +public: + + + struct Item : public RasterizerCanvas::Item { + + + RID parent; // canvas it belongs to + List::Element *E; + int z; + bool z_relative; + bool sort_y; + Color modulate; + Color self_modulate; + bool use_parent_material; + int index; + bool children_order_dirty; + + + Vector child_items; + + + Item() { + children_order_dirty=true; + E=NULL; + z=0; + modulate=Color(1,1,1,1); + self_modulate=Color(1,1,1,1); + sort_y=false; + use_parent_material=false; + z_relative=true; + index=0; + } + }; + + + struct ItemPtrSort { + + _FORCE_INLINE_ bool operator()(const Item* p_left,const Item* p_right) const { + + return p_left->xform.elements[2].y < p_right->xform.elements[2].y; + } + }; + + struct LightOccluderPolygon : RID_Data { + + bool active; + Rect2 aabb; + VS::CanvasOccluderPolygonCullMode cull_mode; + RID occluder; + Set owners; + + LightOccluderPolygon() { active=false; cull_mode=VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED; } + }; + + + RID_Owner canvas_light_occluder_polygon_owner; + + RID_Owner canvas_light_occluder_owner; + + struct Canvas : public VisualServerViewport::CanvasBase { + + Set viewports; + struct ChildItem { + + Point2 mirror; + Item *item; + bool operator<(const ChildItem& p_item) const { + return item->index < p_item.item->index; + } + }; + + + + Set lights; + + Set occluders; + + bool children_order_dirty; + Vector child_items; + Color modulate; + + int find_item(Item *p_item) { + for(int i=0;i=0) + child_items.remove(idx); + } + + + Canvas() { modulate=Color(1,1,1,1); children_order_dirty=true; } + + }; + + + RID_Owner canvas_owner; + RID_Owner canvas_item_owner; + RID_Owner canvas_light_owner; + +private: + + void _render_canvas_item_tree(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights); + void _render_canvas_item(Item *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner); + void _light_mask_canvas_items(int p_z,RasterizerCanvas::Item *p_canvas_item,RasterizerCanvas::Light *p_masked_lights); +public: + + void render_canvas(Canvas *p_canvas, const Matrix32 &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights,const Rect2& p_clip_rect); + + RID canvas_create(); + void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring); + void canvas_set_modulate(RID p_canvas,const Color& p_color); + + + RID canvas_item_create(); + void canvas_item_set_parent(RID p_item,RID p_parent); + + void canvas_item_set_visible(RID p_item,bool p_visible); + void canvas_item_set_light_mask(RID p_item,int p_mask); + + void canvas_item_set_transform(RID p_item, const Matrix32& p_transform); + void canvas_item_set_clip(RID p_item, bool p_clip); + void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); + void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2()); + void canvas_item_set_modulate(RID p_item, const Color& p_color); + void canvas_item_set_self_modulate(RID p_item, const Color& p_color); + + void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); + + + void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width=1.0,bool p_antialiased=false); + void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color); + void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color); + void canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile=false,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); + void canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); + void canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,VS::NinePatchAxisMode p_x_axis_mode=VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode=VS::NINE_PATCH_STRETCH,bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); + void canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width=1.0); + void canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID()); + void canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID(), int p_count=-1); + void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID()); + void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID()); + void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform); + void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); + void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); + void canvas_item_set_z(RID p_item, int p_z); + void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); + void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect); + + void canvas_item_clear(RID p_item); + void canvas_item_set_draw_index(RID p_item, int p_index); + + void canvas_item_set_material(RID p_item, RID p_material); + + void canvas_item_set_use_parent_material(RID p_item, bool p_enable); + + RID canvas_light_create(); + void canvas_light_attach_to_canvas(RID p_light,RID p_canvas); + void canvas_light_set_enabled(RID p_light, bool p_enabled); + void canvas_light_set_scale(RID p_light, float p_scale); + void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); + void canvas_light_set_texture(RID p_light, RID p_texture); + void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset); + void canvas_light_set_color(RID p_light, const Color& p_color); + void canvas_light_set_height(RID p_light, float p_height); + void canvas_light_set_energy(RID p_light, float p_energy); + void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z); + void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer); + void canvas_light_set_item_cull_mask(RID p_light, int p_mask); + void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask); + + void canvas_light_set_mode(RID p_light, VS::CanvasLightMode p_mode); + + + void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled); + void canvas_light_set_shadow_buffer_size(RID p_light, int p_size); + void canvas_light_set_shadow_gradient_length(RID p_light, float p_length); + void canvas_light_set_shadow_filter(RID p_light, VS::CanvasLightShadowFilter p_filter); + void canvas_light_set_shadow_color(RID p_light, const Color& p_color); + + + + RID canvas_light_occluder_create(); + void canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas); + void canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled); + void canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon); + void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform); + void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask); + + RID canvas_occluder_polygon_create(); + void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed); + void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape); + + + void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,VS::CanvasOccluderPolygonCullMode p_mode); + + + bool free(RID p_rid); + VisualServerCanvas(); + + +}; + +#endif // VISUALSERVERCANVAS_H diff --git a/servers/visual/visual_server_global.cpp b/servers/visual/visual_server_global.cpp new file mode 100644 index 0000000000..32b9710f42 --- /dev/null +++ b/servers/visual/visual_server_global.cpp @@ -0,0 +1,10 @@ +#include "visual_server_global.h" + +RasterizerStorage *VisualServerGlobals::storage=NULL; +RasterizerCanvas *VisualServerGlobals::canvas_render=NULL; +RasterizerScene *VisualServerGlobals::scene_render=NULL; +Rasterizer *VisualServerGlobals::rasterizer=NULL; + +VisualServerCanvas *VisualServerGlobals::canvas=NULL; +VisualServerViewport *VisualServerGlobals::viewport=NULL; +VisualServerScene *VisualServerGlobals::scene=NULL; diff --git a/servers/visual/visual_server_global.h b/servers/visual/visual_server_global.h new file mode 100644 index 0000000000..d413334ac4 --- /dev/null +++ b/servers/visual/visual_server_global.h @@ -0,0 +1,26 @@ +#ifndef VISUALSERVERGLOBAL_H +#define VISUALSERVERGLOBAL_H + +#include "rasterizer.h" + +class VisualServerCanvas; +class VisualServerViewport; +class VisualServerScene; + +class VisualServerGlobals +{ +public: + + static RasterizerStorage *storage; + static RasterizerCanvas *canvas_render; + static RasterizerScene *scene_render; + static Rasterizer *rasterizer; + + static VisualServerCanvas *canvas; + static VisualServerViewport *viewport; + static VisualServerScene *scene; +}; + +#define VSG VisualServerGlobals + +#endif // VISUALSERVERGLOBAL_H diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 8d228ad859..168afac77f 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -32,8 +32,1280 @@ #include "default_mouse_cursor.xpm" #include "sort.h" #include "io/marshalls.h" +#include "visual_server_canvas.h" +#include "visual_server_global.h" + // careful, these may run in different threads than the visual server +RID VisualServerRaster::texture_create(){ + + return VSG::storage->texture_create(); +} +void VisualServerRaster::texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags){ + + VSG::storage->texture_allocate(p_texture,p_width,p_height,p_format,p_flags); +} +void VisualServerRaster::texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side){ + + VSG::storage->texture_set_data(p_texture,p_image,p_cube_side); +} +Image VisualServerRaster::texture_get_data(RID p_texture,CubeMapSide p_cube_side) const{ + + return VSG::storage->texture_get_data(p_texture,p_cube_side); +} +void VisualServerRaster::texture_set_flags(RID p_texture,uint32_t p_flags) { + + VSG::storage->texture_set_flags(p_texture,p_flags); +} +uint32_t VisualServerRaster::texture_get_flags(RID p_texture) const{ + + return VSG::storage->texture_get_flags(p_texture); +} +Image::Format VisualServerRaster::texture_get_format(RID p_texture) const{ + + return VSG::storage->texture_get_format(p_texture); +} +uint32_t VisualServerRaster::texture_get_width(RID p_texture) const{ + + return VSG::storage->texture_get_width(p_texture); +} +uint32_t VisualServerRaster::texture_get_height(RID p_texture) const{ + + return VSG::storage->texture_get_height(p_texture); +} +void VisualServerRaster::texture_set_size_override(RID p_texture,int p_width, int p_height){ + VSG::storage->texture_set_size_override(p_texture,p_width,p_height); + +} + +void VisualServerRaster::texture_set_path(RID p_texture,const String& p_path){ + + VSG::storage->texture_set_path(p_texture,p_path); +} + +String VisualServerRaster::texture_get_path(RID p_texture) const{ + + return VSG::storage->texture_get_path(p_texture); +} + +void VisualServerRaster::texture_set_shrink_all_x2_on_set_data(bool p_enable){ + + VSG::storage->texture_set_shrink_all_x2_on_set_data(p_enable); +} + +void VisualServerRaster::texture_debug_usage(List *r_info){ + + VSG::storage->texture_debug_usage(r_info); +} + + +/* SHADER API */ + + +RID VisualServerRaster::shader_create(ShaderMode p_mode){ + + return VSG::storage->shader_create(p_mode); +} + +void VisualServerRaster::shader_set_mode(RID p_shader,ShaderMode p_mode){ + + VSG::storage->shader_set_mode(p_shader,p_mode); +} +VisualServerRaster::ShaderMode VisualServerRaster::shader_get_mode(RID p_shader) const{ + + return VSG::storage->shader_get_mode(p_shader); +} + +void VisualServerRaster::shader_set_code(RID p_shader, const String& p_code){ + + VSG::storage->shader_set_code(p_shader,p_code); +} +String VisualServerRaster::shader_get_code(RID p_shader) const{ + + return VSG::storage->shader_get_code(p_shader); +} +void VisualServerRaster::shader_get_param_list(RID p_shader, List *p_param_list) const{ + + VSG::storage->shader_get_param_list(p_shader,p_param_list); +} + +void VisualServerRaster::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture){ + + VSG::storage->shader_set_default_texture_param(p_shader,p_name,p_texture); +} +RID VisualServerRaster::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{ + + return VSG::storage->shader_get_default_texture_param(p_shader,p_name); +} + + +/* COMMON MATERIAL API */ + +RID VisualServerRaster::material_create(){ + + return VSG::storage->material_create(); +} + +void VisualServerRaster::material_set_shader(RID p_shader_material, RID p_shader){ + + VSG::storage->material_set_shader(p_shader_material,p_shader); +} +RID VisualServerRaster::material_get_shader(RID p_shader_material) const{ + + return VSG::storage->material_get_shader(p_shader_material); +} + +void VisualServerRaster::material_set_param(RID p_material, const StringName& p_param, const Variant& p_value){ + + VSG::storage->material_set_param(p_material,p_param,p_value); +} +Variant VisualServerRaster::material_get_param(RID p_material, const StringName& p_param) const{ + + return VSG::storage->material_get_param(p_material,p_param); +} + +/* MESH API */ + +RID VisualServerRaster::mesh_create(){ + + return VSG::storage->mesh_create(); +} + +void VisualServerRaster::mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes){ + + VSG::storage->mesh_add_surface(p_mesh,p_format,p_primitive,p_array,p_vertex_count,p_index_array,p_index_count,p_blend_shapes); +} + +void VisualServerRaster::mesh_set_morph_target_count(RID p_mesh,int p_amount){ + + VSG::storage->mesh_set_morph_target_count(p_mesh,p_amount); +} +int VisualServerRaster::mesh_get_morph_target_count(RID p_mesh) const{ + + return VSG::storage->mesh_get_morph_target_count(p_mesh); +} + + +void VisualServerRaster::mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode){ + + VSG::storage->mesh_set_morph_target_mode(p_mesh,p_mode); +} +VisualServerRaster::MorphTargetMode VisualServerRaster::mesh_get_morph_target_mode(RID p_mesh) const{ + + return VSG::storage->mesh_get_morph_target_mode(p_mesh); +} + +void VisualServerRaster::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ + + VSG::storage->mesh_surface_set_material(p_mesh,p_surface,p_material); +} +RID VisualServerRaster::mesh_surface_get_material(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_material(p_mesh,p_surface); +} + +int VisualServerRaster::mesh_surface_get_array_len(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_array_len(p_mesh,p_surface); +} +int VisualServerRaster::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_array_index_len(p_mesh,p_surface); +} + +DVector VisualServerRaster::mesh_surface_get_array(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_array(p_mesh,p_surface); +} +DVector VisualServerRaster::mesh_surface_get_index_array(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_index_array(p_mesh,p_surface); +} + + +uint32_t VisualServerRaster::mesh_surface_get_format(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_format(p_mesh,p_surface); +} +VisualServerRaster::PrimitiveType VisualServerRaster::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const{ + + return VSG::storage->mesh_surface_get_primitive_type(p_mesh,p_surface); +} + +void VisualServerRaster::mesh_remove_surface(RID p_mesh,int p_index){ + + VSG::storage->mesh_remove_surface(p_mesh,p_index); +} +int VisualServerRaster::mesh_get_surface_count(RID p_mesh) const{ + + return VSG::storage->mesh_get_surface_count(p_mesh); +} + +void VisualServerRaster::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb){ + + VSG::storage->mesh_set_custom_aabb(p_mesh,p_aabb); +} +AABB VisualServerRaster::mesh_get_custom_aabb(RID p_mesh) const{ + + return VSG::storage->mesh_get_custom_aabb(p_mesh); +} + +void VisualServerRaster::mesh_clear(RID p_mesh){ + + VSG::storage->mesh_clear(p_mesh); +} + +/* MULTIMESH API */ + + +RID VisualServerRaster::multimesh_create() { + + return VSG::storage->multimesh_create(); +} + +void VisualServerRaster::multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb){ + + VSG::storage->multimesh_allocate(p_multimesh,p_instances,p_transform_format,p_color_format,p_gen_aabb); +} +int VisualServerRaster::multimesh_get_instance_count(RID p_multimesh) const{ + + return VSG::storage->multimesh_get_instance_count(p_multimesh); +} + +void VisualServerRaster::multimesh_set_mesh(RID p_multimesh,RID p_mesh){ + + VSG::storage->multimesh_set_mesh(p_multimesh,p_mesh); +} +void VisualServerRaster::multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb){ + + VSG::storage->multimesh_set_custom_aabb(p_multimesh,p_aabb); +} +void VisualServerRaster::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform){ + + VSG::storage->multimesh_instance_set_transform(p_multimesh,p_index,p_transform); +} +void VisualServerRaster::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform){ + + VSG::storage->multimesh_instance_set_transform_2d(p_multimesh,p_index,p_transform); +} +void VisualServerRaster::multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color){ + + VSG::storage->multimesh_instance_set_color(p_multimesh,p_index,p_color); +} + +RID VisualServerRaster::multimesh_get_mesh(RID p_multimesh) const{ + + return VSG::storage->multimesh_get_mesh(p_multimesh); +} +AABB VisualServerRaster::multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const{ + + return VSG::storage->multimesh_get_custom_aabb(p_multimesh,p_aabb); +} + +Transform VisualServerRaster::multimesh_instance_get_transform(RID p_multimesh,int p_index) const{ + + return VSG::storage->multimesh_instance_get_transform(p_multimesh,p_index); +} +Matrix32 VisualServerRaster::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ + + return VSG::storage->multimesh_instance_get_transform_2d(p_multimesh,p_index); +} +Color VisualServerRaster::multimesh_instance_get_color(RID p_multimesh,int p_index) const{ + + return VSG::storage->multimesh_instance_get_color(p_multimesh,p_index); +} + +void VisualServerRaster::multimesh_set_visible_instances(RID p_multimesh,int p_visible){ + + VSG::storage->multimesh_set_visible_instances(p_multimesh,p_visible); +} +int VisualServerRaster::multimesh_get_visible_instances(RID p_multimesh) const{ + + return VSG::storage->multimesh_get_visible_instances(p_multimesh); +} + + +/* IMMEDIATE API */ + +RID VisualServerRaster::immediate_create(){ + + return VSG::storage->immediate_create(); +} +void VisualServerRaster::immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture){ + + VSG::storage->immediate_begin(p_immediate,p_rimitive,p_texture); +} +void VisualServerRaster::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ + + VSG::storage->immediate_vertex(p_immediate,p_vertex); +} +void VisualServerRaster::immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex){ + + VSG::storage->immediate_vertex_2d(p_immediate,p_vertex); + +} +void VisualServerRaster::immediate_normal(RID p_immediate,const Vector3& p_normal){ + + VSG::storage->immediate_normal(p_immediate,p_normal); + +} +void VisualServerRaster::immediate_tangent(RID p_immediate,const Plane& p_tangent){ + + VSG::storage->immediate_tangent(p_immediate,p_tangent); +} +void VisualServerRaster::immediate_color(RID p_immediate,const Color& p_color){ + + VSG::storage->immediate_color(p_immediate,p_color); + +} +void VisualServerRaster::immediate_uv(RID p_immediate,const Vector2& tex_uv){ + + VSG::storage->immediate_uv(p_immediate,tex_uv); + +} +void VisualServerRaster::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ + + VSG::storage->immediate_uv2(p_immediate,tex_uv); + +} +void VisualServerRaster::immediate_end(RID p_immediate){ + + VSG::storage->immediate_end(p_immediate); + +} +void VisualServerRaster::immediate_clear(RID p_immediate){ + + VSG::storage->immediate_clear(p_immediate); + +} +void VisualServerRaster::immediate_set_material(RID p_immediate,RID p_material){ + + VSG::storage->immediate_set_material(p_immediate,p_material); + +} +RID VisualServerRaster::immediate_get_material(RID p_immediate) const{ + + return VSG::storage->immediate_get_material(p_immediate); +} + +/* SKELETON API */ + +RID VisualServerRaster::skeleton_create(){ + + return VSG::storage->skeleton_create(); +} +void VisualServerRaster::skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton){ + + VSG::storage->skeleton_allocate(p_skeleton,p_bones,p_2d_skeleton); +} +int VisualServerRaster::skeleton_get_bone_count(RID p_skeleton) const{ + + return VSG::storage->skeleton_get_bone_count(p_skeleton); +} +void VisualServerRaster::skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform){ + + VSG::storage->skeleton_bone_set_transform(p_skeleton,p_bone,p_transform); +} +Transform VisualServerRaster::skeleton_bone_get_transform(RID p_skeleton,int p_bone){ + + return VSG::storage->skeleton_bone_get_transform(p_skeleton,p_bone); +} +void VisualServerRaster::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform){ + + VSG::storage->skeleton_bone_set_transform_2d(p_skeleton,p_bone,p_transform); +} +Matrix32 VisualServerRaster::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone){ + + return VSG::storage->skeleton_bone_get_transform_2d(p_skeleton,p_bone); +} + +/* Light API */ + +RID VisualServerRaster::light_create(LightType p_type){ + + return VSG::storage->light_create(p_type); +} + +void VisualServerRaster::light_set_color(RID p_light,const Color& p_color){ + + VSG::storage->light_set_color(p_light,p_color); +} +void VisualServerRaster::light_set_param(RID p_light,LightParam p_param,float p_value){ + + VSG::storage->light_set_param(p_light,p_param,p_value); +} +void VisualServerRaster::light_set_shadow(RID p_light,bool p_enabled){ + + VSG::storage->light_set_shadow(p_light,p_enabled); +} +void VisualServerRaster::light_set_projector(RID p_light,RID p_texture){ + + VSG::storage->light_set_projector(p_light,p_texture); +} +void VisualServerRaster::light_set_attenuation_texure(RID p_light,RID p_texture){ + + VSG::storage->light_set_attenuation_texure(p_light,p_texture); +} +void VisualServerRaster::light_set_negative(RID p_light,bool p_enable){ + + VSG::storage->light_set_negative(p_light,p_enable); +} +void VisualServerRaster::light_set_cull_mask(RID p_light,uint32_t p_mask){ + + VSG::storage->light_set_cull_mask(p_light,p_mask); +} +void VisualServerRaster::light_set_shader(RID p_light,RID p_shader){ + + VSG::storage->light_set_shader(p_light,p_shader); +} + + +void VisualServerRaster::light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode){ + + VSG::storage->light_directional_set_shadow_mode(p_light,p_mode); +} + +/* PROBE API */ + +RID VisualServerRaster::reflection_probe_create(){ + + return VSG::storage->reflection_probe_create(); +} + +void VisualServerRaster::reflection_probe_set_intensity(RID p_probe, float p_intensity){ + + VSG::storage->reflection_probe_set_intensity(p_probe,p_intensity); +} +void VisualServerRaster::reflection_probe_set_clip(RID p_probe, float p_near, float p_far){ + + VSG::storage->reflection_probe_set_clip(p_probe,p_near,p_far); +} +void VisualServerRaster::reflection_probe_set_min_blend_distance(RID p_probe, float p_distance){ + + VSG::storage->reflection_probe_set_min_blend_distance(p_probe,p_distance); +} +void VisualServerRaster::reflection_probe_set_extents(RID p_probe, const Vector3& p_extents){ + + VSG::storage->reflection_probe_set_extents(p_probe,p_extents); +} +void VisualServerRaster::reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset){ + + VSG::storage->reflection_probe_set_origin_offset(p_probe,p_offset); +} +void VisualServerRaster::reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable){ + + VSG::storage->reflection_probe_set_enable_parallax_correction(p_probe,p_enable); +} +void VisualServerRaster::reflection_probe_set_resolution(RID p_probe, int p_resolution){ + + VSG::storage->reflection_probe_set_resolution(p_probe,p_resolution); +} +void VisualServerRaster::reflection_probe_set_hide_skybox(RID p_probe, bool p_hide){ + + VSG::storage->reflection_probe_set_hide_skybox(p_probe,p_hide); +} +void VisualServerRaster::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers){ + + VSG::storage->reflection_probe_set_cull_mask(p_probe,p_layers); +} + + +/* ROOM API */ + +RID VisualServerRaster::room_create(){ + + return VSG::storage->room_create(); +} +void VisualServerRaster::room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform){ + + VSG::storage->room_add_bounds(p_room,p_convex_polygon,p_height,p_transform); +} +void VisualServerRaster::room_clear_bounds(){ + + VSG::storage->room_clear_bounds(); +} + +/* PORTAL API */ + +// portals are only (x/y) points, forming a convex shape, which its clockwise +// order points outside. (z is 0); + +RID VisualServerRaster::portal_create(){ + + return VSG::storage->portal_create(); +} +void VisualServerRaster::portal_set_shape(RID p_portal, const Vector& p_shape){ + + VSG::storage->portal_set_shape(p_portal,p_shape); +} +void VisualServerRaster::portal_set_enabled(RID p_portal, bool p_enabled) { + + VSG::storage->portal_set_enabled(p_portal,p_enabled); +} +void VisualServerRaster::portal_set_disable_distance(RID p_portal, float p_distance){ + + VSG::storage->portal_set_disable_distance(p_portal,p_distance); +} +void VisualServerRaster::portal_set_disabled_color(RID p_portal, const Color& p_color){ + + VSG::storage->portal_set_disabled_color(p_portal,p_color); +} + +/* CAMERA API */ + +RID VisualServerRaster::camera_create() { + + return RID(); +} +void VisualServerRaster::camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far) { + +} +void VisualServerRaster::camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far){ + +} +void VisualServerRaster::camera_set_transform(RID p_camera,const Transform& p_transform) { + +} +void VisualServerRaster::camera_set_cull_mask(RID p_camera,uint32_t p_layers){ + +} +void VisualServerRaster::camera_set_environment(RID p_camera,RID p_env){ + +} +void VisualServerRaster::camera_set_use_vertical_aspect(RID p_camera,bool p_enable){ + +} + + +/* VIEWPORT TARGET API */ + +RID VisualServerRaster::viewport_create(){ + + return VSG::viewport->viewport_create(); +} + +void VisualServerRaster::viewport_set_size(RID p_viewport,int p_width,int p_height){ + + VSG::viewport->viewport_set_size(p_viewport,p_width,p_height); +} + +void VisualServerRaster::viewport_set_active(RID p_viewport,bool p_active) { + + VSG::viewport->viewport_set_active(p_viewport,p_active); +} + +void VisualServerRaster::viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode) { + + VSG::viewport->viewport_set_clear_mode(p_viewport,p_clear_mode); +} + +void VisualServerRaster::viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect,int p_screen){ + + VSG::viewport->viewport_attach_to_screen(p_viewport,p_rect,p_screen); + +} +void VisualServerRaster::viewport_detach(RID p_viewport){ + + VSG::viewport->viewport_detach(p_viewport); + +} + +void VisualServerRaster::viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode){ + + VSG::viewport->viewport_set_update_mode(p_viewport,p_mode); + +} +void VisualServerRaster::viewport_set_vflip(RID p_viewport,bool p_enable){ + + VSG::viewport->viewport_set_vflip(p_viewport,p_enable); + +} + +RID VisualServerRaster::viewport_get_texture(RID p_viewport) const{ + + return VSG::viewport->viewport_get_texture(p_viewport); + +} +Image VisualServerRaster::viewport_capture(RID p_viewport) const{ + + return VSG::viewport->viewport_capture(p_viewport); +} + +void VisualServerRaster::viewport_set_hide_scenario(RID p_viewport,bool p_hide){ + + return VSG::viewport->viewport_set_hide_scenario(p_viewport,p_hide); +} +void VisualServerRaster::viewport_set_hide_canvas(RID p_viewport,bool p_hide){ + + return VSG::viewport->viewport_set_hide_canvas(p_viewport,p_hide); + +} +void VisualServerRaster::viewport_set_disable_environment(RID p_viewport,bool p_disable){ + + return VSG::viewport->viewport_set_disable_environment(p_viewport,p_disable); + +} + +void VisualServerRaster::viewport_attach_camera(RID p_viewport,RID p_camera){ + + return VSG::viewport->viewport_attach_camera(p_viewport,p_camera); + +} +void VisualServerRaster::viewport_set_scenario(RID p_viewport,RID p_scenario){ + + return VSG::viewport->viewport_set_scenario(p_viewport,p_scenario); + +} +void VisualServerRaster::viewport_attach_canvas(RID p_viewport,RID p_canvas){ + + return VSG::viewport->viewport_attach_canvas(p_viewport,p_canvas); + +} +void VisualServerRaster::viewport_remove_canvas(RID p_viewport,RID p_canvas){ + + return VSG::viewport->viewport_remove_canvas(p_viewport,p_canvas); + +} +void VisualServerRaster::viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset){ + + return VSG::viewport->viewport_set_canvas_transform(p_viewport,p_canvas,p_offset); + +} +void VisualServerRaster::viewport_set_transparent_background(RID p_viewport,bool p_enabled){ + + return VSG::viewport->viewport_set_transparent_background(p_viewport,p_enabled); + +} + +void VisualServerRaster::viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform){ + + return VSG::viewport->viewport_set_global_canvas_transform(p_viewport,p_transform); + +} +void VisualServerRaster::viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer){ + + return VSG::viewport->viewport_set_canvas_layer(p_viewport,p_canvas,p_layer); + +} + + +/* ENVIRONMENT API */ + +RID VisualServerRaster::environment_create(){ + + return RID(); +} + +void VisualServerRaster::environment_set_background(RID p_env,EnvironmentBG p_bg){ + +} +void VisualServerRaster::environment_set_skybox(RID p_env,RID p_skybox,float p_energy){ + +} +void VisualServerRaster::environment_set_bg_color(RID p_env,const Color& p_color){ + +} +void VisualServerRaster::environment_set_canvas_max_layer(RID p_env,int p_max_layer){ + +} +void VisualServerRaster::environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy){ + +} + +void VisualServerRaster::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode){ + +} +void VisualServerRaster::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ + +} + +void VisualServerRaster::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper){ + +} +void VisualServerRaster::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ + +} +void VisualServerRaster::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ + +} +void VisualServerRaster::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ + +} +void VisualServerRaster::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ + +} + + +/* SCENARIO API */ + + +RID VisualServerRaster::scenario_create() { + + return RID(); +} + +void VisualServerRaster::scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode){ + +} +void VisualServerRaster::scenario_set_environment(RID p_scenario, RID p_environment){ + +} +RID VisualServerRaster::scenario_get_environment(RID p_scenario, RID p_environment) const{ + + return RID(); +} +void VisualServerRaster::scenario_set_fallback_environment(RID p_scenario, RID p_environment){ + +} + + +/* INSTANCING API */ +// from can be mesh, light, area and portal so far. +RID VisualServerRaster::instance_create(){ + + return RID(); +} + +void VisualServerRaster::instance_set_base(RID p_instance, RID p_base){ + +} +void VisualServerRaster::instance_set_scenario(RID p_instance, RID p_scenario){ + +} +void VisualServerRaster::instance_set_layer_mask(RID p_instance, uint32_t p_mask){ + +} +void VisualServerRaster::instance_set_transform(RID p_instance, const Transform& p_transform){ + +} +void VisualServerRaster::instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID){ + +} +void VisualServerRaster::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ + +} +void VisualServerRaster::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ + +} + +void VisualServerRaster::instance_attach_skeleton(RID p_instance,RID p_skeleton){ + +} +void VisualServerRaster::instance_set_exterior( RID p_instance, bool p_enabled ){ + +} +void VisualServerRaster::instance_set_room( RID p_instance, RID p_room ){ + +} + +void VisualServerRaster::instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ){ + +} + +// don't use these in a game! +Vector VisualServerRaster::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const{ + + return Vector(); +} + +Vector VisualServerRaster::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{ + + return Vector(); +} +Vector VisualServerRaster::instances_cull_convex(const Vector& p_convex, RID p_scenario) const { + + return Vector(); +} + + +void VisualServerRaster::instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled){ + +} +void VisualServerRaster::instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) { + +} +void VisualServerRaster::instance_geometry_set_material_override(RID p_instance, RID p_material){ + +} + + +void VisualServerRaster::instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin){ + +} +void VisualServerRaster::instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance){ + +} + +/* CANVAS (2D) */ + +RID VisualServerRaster::canvas_create(){ + + return VSG::canvas->canvas_create(); + +} +void VisualServerRaster::canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring){ + + VSG::canvas->canvas_set_item_mirroring(p_canvas,p_item,p_mirroring); +} +void VisualServerRaster::canvas_set_modulate(RID p_canvas,const Color& p_color){ + + VSG::canvas->canvas_set_modulate(p_canvas,p_color); +} + + +RID VisualServerRaster::canvas_item_create(){ + + return VSG::canvas->canvas_item_create(); +} +void VisualServerRaster::canvas_item_set_parent(RID p_item,RID p_parent){ + + VSG::canvas->canvas_item_set_parent(p_item,p_parent); + +} + +void VisualServerRaster::canvas_item_set_visible(RID p_item,bool p_visible){ + + VSG::canvas->canvas_item_set_visible(p_item,p_visible); + +} +void VisualServerRaster::canvas_item_set_light_mask(RID p_item,int p_mask){ + + VSG::canvas->canvas_item_set_light_mask(p_item,p_mask); + +} + +void VisualServerRaster::canvas_item_set_transform(RID p_item, const Matrix32& p_transform){ + + VSG::canvas->canvas_item_set_transform(p_item,p_transform); + +} +void VisualServerRaster::canvas_item_set_clip(RID p_item, bool p_clip){ + + VSG::canvas->canvas_item_set_clip(p_item,p_clip); + +} +void VisualServerRaster::canvas_item_set_distance_field_mode(RID p_item, bool p_enable){ + + VSG::canvas->canvas_item_set_distance_field_mode(p_item,p_enable); + +} +void VisualServerRaster::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect){ + + VSG::canvas->canvas_item_set_custom_rect(p_item,p_custom_rect,p_rect); + +} +void VisualServerRaster::canvas_item_set_modulate(RID p_item, const Color& p_color){ + + VSG::canvas->canvas_item_set_modulate(p_item,p_color); + +} +void VisualServerRaster::canvas_item_set_self_modulate(RID p_item, const Color& p_color){ + + VSG::canvas->canvas_item_set_self_modulate(p_item,p_color); + +} + +void VisualServerRaster::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable){ + + VSG::canvas->canvas_item_set_draw_behind_parent(p_item,p_enable); + +} + + +void VisualServerRaster::canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased){ + + VSG::canvas->canvas_item_add_line(p_item,p_from,p_to,p_color,p_width,p_antialiased); + +} +void VisualServerRaster::canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color){ + + VSG::canvas->canvas_item_add_rect(p_item,p_rect,p_color); + +} +void VisualServerRaster::canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color){ + + VSG::canvas->canvas_item_add_circle(p_item,p_pos,p_radius,p_color); + +} +void VisualServerRaster::canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile,const Color& p_modulate,bool p_transpose){ + + VSG::canvas->canvas_item_add_texture_rect(p_item,p_rect,p_texture,p_tile,p_modulate,p_transpose); + +} +void VisualServerRaster::canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate,bool p_transpose){ + + VSG::canvas->canvas_item_add_texture_rect_region(p_item,p_rect,p_texture,p_src_rect,p_modulate,p_transpose); + +} +void VisualServerRaster::canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode, NinePatchAxisMode p_y_axis_mode,bool p_draw_center,const Color& p_modulate){ + + VSG::canvas->canvas_item_add_nine_patch(p_item,p_rect,p_source,p_texture,p_topleft,p_bottomright,p_x_axis_mode,p_y_axis_mode,p_draw_center,p_modulate); + +} +void VisualServerRaster::canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width){ + + VSG::canvas->canvas_item_add_primitive(p_item,p_points,p_colors,p_uvs,p_texture,p_width); + +} +void VisualServerRaster::canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture){ + + VSG::canvas->canvas_item_add_polygon(p_item,p_points,p_colors,p_uvs,p_texture); + +} +void VisualServerRaster::canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture, int p_count){ + + VSG::canvas->canvas_item_add_triangle_array(p_item,p_indices,p_points,p_colors,p_uvs,p_texture,p_count); + +} +void VisualServerRaster::canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton){ + + VSG::canvas->canvas_item_add_mesh(p_item,p_mesh,p_skeleton); + +} +void VisualServerRaster::canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton){ + + VSG::canvas->canvas_item_add_multimesh(p_item,p_mesh,p_skeleton); + +} +void VisualServerRaster::canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform){ + + VSG::canvas->canvas_item_add_set_transform(p_item,p_transform); + +} +void VisualServerRaster::canvas_item_add_clip_ignore(RID p_item, bool p_ignore){ + + VSG::canvas->canvas_item_add_clip_ignore(p_item,p_ignore); + +} +void VisualServerRaster::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable){ + + VSG::canvas->canvas_item_set_sort_children_by_y(p_item,p_enable); + +} +void VisualServerRaster::canvas_item_set_z(RID p_item, int p_z){ + + VSG::canvas->canvas_item_set_z(p_item,p_z); + +} +void VisualServerRaster::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable){ + + VSG::canvas->canvas_item_set_z_as_relative_to_parent(p_item,p_enable); + +} +void VisualServerRaster::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect){ + + VSG::canvas->canvas_item_set_copy_to_backbuffer(p_item,p_enable,p_rect); + +} + +void VisualServerRaster::canvas_item_clear(RID p_item){ + + VSG::canvas->canvas_item_clear(p_item); + +} +void VisualServerRaster::canvas_item_set_draw_index(RID p_item,int p_index){ + + VSG::canvas->canvas_item_set_draw_index(p_item,p_index); + +} + +void VisualServerRaster::canvas_item_set_material(RID p_item, RID p_material){ + + VSG::canvas->canvas_item_set_material(p_item,p_material); + +} + +void VisualServerRaster::canvas_item_set_use_parent_material(RID p_item, bool p_enable) { + + VSG::canvas->canvas_item_set_use_parent_material(p_item,p_enable); +} + +RID VisualServerRaster::canvas_light_create(){ + + return VSG::canvas->canvas_light_create(); +} + +void VisualServerRaster::canvas_light_attach_to_canvas(RID p_light,RID p_canvas){ + + VSG::canvas->canvas_light_attach_to_canvas(p_light,p_canvas); + +} +void VisualServerRaster::canvas_light_set_enabled(RID p_light, bool p_enabled){ + + VSG::canvas->canvas_light_set_enabled(p_light,p_enabled); + +} +void VisualServerRaster::canvas_light_set_scale(RID p_light, float p_scale){ + + VSG::canvas->canvas_light_set_scale(p_light,p_scale); + +} +void VisualServerRaster::canvas_light_set_transform(RID p_light, const Matrix32& p_transform){ + + VSG::canvas->canvas_light_set_transform(p_light,p_transform); + +} +void VisualServerRaster::canvas_light_set_texture(RID p_light, RID p_texture){ + + VSG::canvas->canvas_light_set_texture(p_light,p_texture); + +} +void VisualServerRaster::canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset){ + + VSG::canvas->canvas_light_set_texture_offset(p_light,p_offset); + +} +void VisualServerRaster::canvas_light_set_color(RID p_light, const Color& p_color){ + + VSG::canvas->canvas_light_set_color(p_light,p_color); + +} +void VisualServerRaster::canvas_light_set_height(RID p_light, float p_height){ + + VSG::canvas->canvas_light_set_height(p_light,p_height); + +} +void VisualServerRaster::canvas_light_set_energy(RID p_light, float p_energy){ + + VSG::canvas->canvas_light_set_energy(p_light,p_energy); + +} +void VisualServerRaster::canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z){ + + VSG::canvas->canvas_light_set_z_range(p_light,p_min_z,p_max_z); + +} +void VisualServerRaster::canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer){ + + VSG::canvas->canvas_light_set_layer_range(p_light,p_min_layer,p_max_layer); + +} +void VisualServerRaster::canvas_light_set_item_cull_mask(RID p_light, int p_mask){ + + VSG::canvas->canvas_light_set_item_cull_mask(p_light,p_mask); + +} +void VisualServerRaster::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask){ + + VSG::canvas->canvas_light_set_item_shadow_cull_mask(p_light,p_mask); + +} + +void VisualServerRaster::canvas_light_set_mode(RID p_light, CanvasLightMode p_mode){ + + VSG::canvas->canvas_light_set_mode(p_light,p_mode); + +} + + +void VisualServerRaster::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) { + + VSG::canvas->canvas_light_set_shadow_enabled(p_light,p_enabled); + +} +void VisualServerRaster::canvas_light_set_shadow_buffer_size(RID p_light, int p_size) { + + VSG::canvas->canvas_light_set_shadow_buffer_size(p_light,p_size); + +} +void VisualServerRaster::canvas_light_set_shadow_gradient_length(RID p_light, float p_length) { + + VSG::canvas->canvas_light_set_shadow_gradient_length(p_light,p_length); + +} +void VisualServerRaster::canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter){ + + VSG::canvas->canvas_light_set_shadow_filter(p_light,p_filter); + +} +void VisualServerRaster::canvas_light_set_shadow_color(RID p_light, const Color& p_color){ + + VSG::canvas->canvas_light_set_shadow_color(p_light,p_color); + +} + + + +RID VisualServerRaster::canvas_light_occluder_create() { + + return VSG::canvas->canvas_light_occluder_create(); +} + +void VisualServerRaster::canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas){ + + VSG::canvas->canvas_light_occluder_attach_to_canvas(p_occluder,p_canvas); + +} +void VisualServerRaster::canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled) { + + VSG::canvas->canvas_light_occluder_set_enabled(p_occluder,p_enabled); + +} +void VisualServerRaster::canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon){ + + VSG::canvas->canvas_light_occluder_set_polygon(p_occluder,p_polygon); + +} +void VisualServerRaster::canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform){ + + VSG::canvas->canvas_light_occluder_set_transform(p_occluder,p_xform); + +} +void VisualServerRaster::canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask){ + + VSG::canvas->canvas_light_occluder_set_light_mask(p_occluder,p_mask); + +} + +RID VisualServerRaster::canvas_occluder_polygon_create() { + + return VSG::canvas->canvas_occluder_polygon_create(); +} +void VisualServerRaster::canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed){ + + VSG::canvas->canvas_occluder_polygon_set_shape(p_occluder_polygon,p_shape,p_closed); +} +void VisualServerRaster::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape){ + + VSG::canvas->canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,p_shape); + +} + + +void VisualServerRaster::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode){ + + VSG::canvas->canvas_occluder_polygon_set_cull_mode(p_occluder_polygon,p_mode); + +} + + +/* CURSOR */ +void VisualServerRaster::cursor_set_rotation(float p_rotation, int p_cursor ){ + +} +void VisualServerRaster::cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor, const Rect2 &p_region){ + +} +void VisualServerRaster::cursor_set_visible(bool p_visible, int p_cursor ){ + +} +void VisualServerRaster::cursor_set_pos(const Point2& p_pos, int p_cursor ){ + +} + +/* BLACK BARS */ + + +void VisualServerRaster::black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom){ + +} +void VisualServerRaster::black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom){ + +} + + +/* FREE */ + +void VisualServerRaster::free( RID p_rid ){ + + if (VSG::storage->free(p_rid)) + return; + if (VSG::canvas->free(p_rid)) + return; + if (VSG::viewport->free(p_rid)) + return; + +} + +/* EVENT QUEUING */ + +void VisualServerRaster::draw(){ + + //if (changes) + // print_line("changes: "+itos(changes)); + +// changes=0; + VSG::rasterizer->begin_frame(); + VSG::viewport->draw_viewports(); + //_draw_cursors_and_margins(); + VSG::rasterizer->end_frame(); + //draw_extra_frame=VS:rasterizer->needs_to_draw_next_frame(); +} +void VisualServerRaster::sync(){ + +} +bool VisualServerRaster::has_changed() const{ + + return false; +} +void VisualServerRaster::init(){ + + VSG::rasterizer->initialize(); + +} +void VisualServerRaster::finish(){ + + if (test_cube.is_valid()) { + free(test_cube); + } + + VSG::rasterizer->finalize(); +} + +/* STATUS INFORMATION */ + + +int VisualServerRaster::get_render_info(RenderInfo p_info){ + + return 0; +} + + + +/* TESTING */ + + + +void VisualServerRaster::set_boot_image(const Image& p_image, const Color& p_color,bool p_scale){ + +} +void VisualServerRaster::set_default_clear_color(const Color& p_color){ + +} + +bool VisualServerRaster::has_feature(Features p_feature) const { + + return false; +} + +RID VisualServerRaster::get_test_cube() { + if (!test_cube.is_valid()) { + test_cube=_make_test_cube(); + } + return test_cube; +} + +VisualServerRaster::VisualServerRaster() { + + VSG::canvas = memnew( VisualServerCanvas); + VSG::viewport = memnew( VisualServerViewport); + VSG::rasterizer = Rasterizer::create(); + VSG::storage=VSG::rasterizer->get_storage(); + VSG::canvas_render=VSG::rasterizer->get_canvas(); + VSG::scene_render=VSG::rasterizer->get_scene(); + +} + +VisualServerRaster::~VisualServerRaster() { + + memdelete(VSG::canvas); + memdelete(VSG::viewport); + memdelete(VSG::rasterizer); +} + + +#if 0 + BalloonAllocator<> *VisualServerRaster::OctreeAllocator::allocator=NULL; #define VS_CHANGED\ @@ -1146,7 +2418,7 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< if (p_octree.size()==0) { if (baked_light->data.octree_texture.is_valid()) rasterizer->free(baked_light->data.octree_texture); - baked_light->data.octree_texture=RID(); + baked_light->data.octree_texture; baked_light->octree_aabb=AABB(); baked_light->octree_tex_size=Size2(); } else { @@ -1203,7 +2475,7 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< if (tex_w!=baked_light->octree_tex_size.x || tex_h!=baked_light->octree_tex_size.y) { rasterizer->free(baked_light->data.octree_texture); - baked_light->data.octree_texture=RID(); + baked_light->data.octree_texture; baked_light->octree_tex_size.x=0; baked_light->octree_tex_size.y=0; } @@ -1212,7 +2484,7 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< if (baked_light->data.light_texture.is_valid()) { if (!has_light_tex || light_tex_w!=baked_light->light_tex_size.x || light_tex_h!=baked_light->light_tex_size.y) { rasterizer->free(baked_light->data.light_texture); - baked_light->data.light_texture=RID(); + baked_light->data.light_texture; baked_light->light_tex_size.x=0; baked_light->light_tex_size.y=0; } @@ -1220,20 +2492,20 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< if (!baked_light->data.octree_texture.is_valid()) { baked_light->data.octree_texture=rasterizer->texture_create(); - rasterizer->texture_allocate(baked_light->data.octree_texture,tex_w,tex_h,Image::FORMAT_RGBA,TEXTURE_FLAG_FILTER); + rasterizer->texture_allocate(baked_light->data.octree_texture,tex_w,tex_h,Image::FORMAT_RGBA8,TEXTURE_FLAG_FILTER); baked_light->octree_tex_size.x=tex_w; baked_light->octree_tex_size.y=tex_h; } if (!baked_light->data.light_texture.is_valid() && has_light_tex) { baked_light->data.light_texture=rasterizer->texture_create(); - rasterizer->texture_allocate(baked_light->data.light_texture,light_tex_w,light_tex_h,Image::FORMAT_RGBA,TEXTURE_FLAG_FILTER); + rasterizer->texture_allocate(baked_light->data.light_texture,light_tex_w,light_tex_h,Image::FORMAT_RGBA8,TEXTURE_FLAG_FILTER); baked_light->light_tex_size.x=light_tex_w; baked_light->light_tex_size.y=light_tex_h; } - Image img(tex_w,tex_h,0,Image::FORMAT_RGBA,p_octree); + Image img(tex_w,tex_h,0,Image::FORMAT_RGBA8,p_octree); rasterizer->texture_set_data(baked_light->data.octree_texture,img); } @@ -1276,7 +2548,7 @@ void VisualServerRaster::baked_light_set_light(RID p_baked_light,const DVectortexture_set_data(baked_light->data.light_texture,img); @@ -1611,8 +2883,8 @@ void VisualServerRaster::viewport_set_as_render_target(RID p_viewport,bool p_ena if (!p_enable) { rasterizer->free(viewport->render_target); - viewport->render_target=RID(); - viewport->render_target_texture=RID(); + viewport->render_target; + viewport->render_target_texture; if (viewport->update_list.in_list()) viewport_update_list.remove(&viewport->update_list); @@ -1811,7 +3083,7 @@ void VisualServerRaster::viewport_attach_camera(RID p_viewport,RID p_camera) { // a camera viewport->camera=p_camera; } else { - viewport->camera=RID(); + viewport->camera; } } @@ -1830,7 +3102,7 @@ void VisualServerRaster::viewport_set_scenario(RID p_viewport,RID p_scenario) { // a camera viewport->scenario=p_scenario; } else { - viewport->scenario=RID(); + viewport->scenario; } } @@ -2284,7 +3556,7 @@ void VisualServerRaster::instance_set_base(RID p_instance, RID p_base) { instance->base_type=INSTANCE_NONE; - instance->base_rid=RID(); + instance->base_rid; if (p_base.is_valid()) { @@ -3003,7 +4275,7 @@ void VisualServerRaster::instance_geometry_set_baked_light_sampler(RID p_instanc if (instance->sampled_light) { instance->sampled_light->baked_light_sampler_info->owned_instances.erase(instance); - instance->data.sampled_light=RID(); + instance->data.sampled_light; } if(p_baked_light_sampler.is_valid()) { @@ -3016,7 +4288,7 @@ void VisualServerRaster::instance_geometry_set_baked_light_sampler(RID p_instanc instance->sampled_light=NULL; } - instance->data.sampled_light=RID(); + instance->data.sampled_light; } @@ -3432,7 +4704,7 @@ void VisualServerRaster::canvas_item_set_parent(RID p_item,RID p_parent) { item_owner->child_items.erase(canvas_item); } - canvas_item->parent=RID(); + canvas_item->parent; } @@ -4057,7 +5329,7 @@ void VisualServerRaster::canvas_light_attach_to_canvas(RID p_light,RID p_canvas) } if (!canvas_owner.owns(p_canvas)) - p_canvas=RID(); + p_canvas; clight->canvas=p_canvas; if (clight->canvas.is_valid()) { @@ -4184,7 +5456,7 @@ void VisualServerRaster::canvas_light_set_shadow_enabled(RID p_light, bool p_ena clight->shadow_buffer=rasterizer->canvas_light_shadow_buffer_create(clight->shadow_buffer_size); } else { rasterizer->free(clight->shadow_buffer); - clight->shadow_buffer=RID(); + clight->shadow_buffer; } @@ -4246,7 +5518,7 @@ void VisualServerRaster::canvas_light_occluder_attach_to_canvas(RID p_occluder,R } if (!canvas_owner.owns(p_canvas)) - p_canvas=RID(); + p_canvas; occluder->canvas=p_canvas; @@ -4279,12 +5551,12 @@ void VisualServerRaster::canvas_light_occluder_set_polygon(RID p_occluder,RID p_ } occluder->polygon=p_polygon; - occluder->polygon_buffer=RID(); + occluder->polygon_buffer; if (occluder->polygon.is_valid()) { CanvasLightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_polygon); if (!occluder_poly) - occluder->polygon=RID(); + occluder->polygon; ERR_FAIL_COND(!occluder_poly); occluder_poly->owners.insert(occluder); occluder->polygon_buffer=occluder_poly->occluder; @@ -4558,7 +5830,7 @@ void VisualServerRaster::free( RID p_rid ) { //detach skeletons for (Set::Element *F=E->get().front();F;F=F->next()) { - F->get()->data.skeleton=RID(); + F->get()->data.skeleton; } skeleton_dependency_map.erase(E); } @@ -4688,17 +5960,17 @@ void VisualServerRaster::free( RID p_rid ) { for (int i=0;ichild_items.size();i++) { - canvas->child_items[i].item->parent=RID(); + canvas->child_items[i].item->parent; } for (Set::Element *E=canvas->lights.front();E;E=E->next()) { - E->get()->canvas=RID(); + E->get()->canvas; } for (Set::Element *E=canvas->occluders.front();E;E=E->next()) { - E->get()->canvas=RID(); + E->get()->canvas; } canvas_owner.free( p_rid ); @@ -4726,7 +5998,7 @@ void VisualServerRaster::free( RID p_rid ) { for (int i=0;ichild_items.size();i++) { - canvas_item->child_items[i]->parent=RID(); + canvas_item->child_items[i]->parent; } if (canvas_item->material) { @@ -4798,7 +6070,7 @@ void VisualServerRaster::free( RID p_rid ) { while(occluder_poly->owners.size()) { - occluder_poly->owners.front()->get()->polygon=RID(); + occluder_poly->owners.front()->get()->polygon; occluder_poly->owners.erase( occluder_poly->owners.front() ); } @@ -6417,7 +7689,7 @@ void VisualServerRaster::_process_sampled_light(const Transform& p_camera,Instan for(Set::Element *F=p_sampled_light->baked_light_sampler_info->owned_instances.front();F;F=F->next()) { - F->get()->data.sampled_light=RID(); //do not use because nothing close + F->get()->data.sampled_light; //do not use because nothing close } } @@ -7679,7 +8951,7 @@ void VisualServerRaster::init() { Image img; img.create(default_mouse_cursor_xpm); - //img.convert(Image::FORMAT_RGB); + //img.convert(Image::FORMAT_RGB8); default_cursor_texture = texture_create_from_image(img, 0); aabb_random_points.resize( GLOBAL_DEF("render/aabb_random_points",16) ); @@ -7766,3 +9038,4 @@ VisualServerRaster::VisualServerRaster(Rasterizer *p_rasterizer) { VisualServerRaster::~VisualServerRaster() { } +#endif diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 496820f4a8..4cad03928b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -40,6 +40,8 @@ */ + + class VisualServerRaster : public VisualServer { @@ -57,6 +59,12 @@ class VisualServerRaster : public VisualServer { }; + int changes; + bool draw_extra_frame; + RID test_cube; + + + #if 0 struct Room { bool occlude_exterior; @@ -374,97 +382,6 @@ class VisualServerRaster : public VisualServer { mutable RID_Owner canvas_item_material_owner; - struct CanvasItem : public Rasterizer::CanvasItem { - - - RID parent; // canvas it belongs to - List::Element *E; - RID viewport; - int z; - bool z_relative; - bool sort_y; - float opacity; - float self_opacity; - bool use_parent_material; - - - Vector child_items; - - - CanvasItem() { - E=NULL; - z=0; - opacity=1; - self_opacity=1; - sort_y=false; - use_parent_material=false; - z_relative=true; - } - }; - - - struct CanvasItemPtrSort { - - _FORCE_INLINE_ bool operator()(const CanvasItem* p_left,const CanvasItem* p_right) const { - - return p_left->xform.elements[2].y < p_right->xform.elements[2].y; - } - }; - - struct CanvasLightOccluder; - - struct CanvasLightOccluderPolygon { - - bool active; - Rect2 aabb; - CanvasOccluderPolygonCullMode cull_mode; - RID occluder; - Set owners; - - CanvasLightOccluderPolygon() { active=false; cull_mode=CANVAS_OCCLUDER_POLYGON_CULL_DISABLED; } - }; - - - RID_Owner canvas_light_occluder_polygon_owner; - - RID_Owner canvas_light_occluder_owner; - - struct CanvasLight; - - struct Canvas { - - Set viewports; - struct ChildItem { - - Point2 mirror; - CanvasItem *item; - }; - - Set lights; - Set occluders; - - Vector child_items; - Color modulate; - - int find_item(CanvasItem *p_item) { - for(int i=0;i=0) - child_items.remove(idx); - } - - Canvas() { modulate=Color(1,1,1,1); } - - }; - - - RID_Owner canvas_light_owner; struct Viewport { @@ -658,8 +575,14 @@ class VisualServerRaster : public VisualServer { Rasterizer *rasterizer; + +#endif + public: + + /* TEXTURE API */ + virtual RID texture_create(); virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=TEXTURE_FLAGS_DEFAULT); virtual void texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side=CUBEMAP_LEFT); @@ -670,29 +593,27 @@ public: virtual uint32_t texture_get_width(RID p_texture) const; virtual uint32_t texture_get_height(RID p_texture) const; virtual void texture_set_size_override(RID p_texture,int p_width, int p_height); - virtual bool texture_can_stream(RID p_texture) const; - virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const; + + virtual void texture_set_path(RID p_texture,const String& p_path); virtual String texture_get_path(RID p_texture) const; - virtual void texture_debug_usage(List *r_info); - virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable); + virtual void texture_debug_usage(List *r_info); + /* SHADER API */ - virtual RID shader_create(ShaderMode p_mode=SHADER_MATERIAL); + + virtual RID shader_create(ShaderMode p_mode=SHADER_SPATIAL); virtual void shader_set_mode(RID p_shader,ShaderMode p_mode); virtual ShaderMode shader_get_mode(RID p_shader) const; - virtual void shader_set_code(RID p_shader, const String& p_vertex, const String& p_fragment,const String& p_light,int p_vertex_ofs=0,int p_fragment_ofs=0,int p_light_ofs=0); - virtual String shader_get_vertex_code(RID p_shader) const; - virtual String shader_get_fragment_code(RID p_shader) const; - virtual String shader_get_light_code(RID p_shader) const; - + virtual void shader_set_code(RID p_shader, const String& p_code); + virtual String shader_get_code(RID p_shader) const; virtual void shader_get_param_list(RID p_shader, List *p_param_list) const; virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); @@ -709,65 +630,29 @@ public: virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); virtual Variant material_get_param(RID p_material, const StringName& p_param) const; - virtual void material_set_flag(RID p_material, MaterialFlag p_flag,bool p_enabled); - virtual bool material_get_flag(RID p_material,MaterialFlag p_flag) const; - - virtual void material_set_depth_draw_mode(RID p_material, MaterialDepthDrawMode p_mode); - virtual MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const; - - virtual void material_set_blend_mode(RID p_material,MaterialBlendMode p_mode); - virtual MaterialBlendMode material_get_blend_mode(RID p_material) const; - - virtual void material_set_line_width(RID p_material,float p_line_width); - virtual float material_get_line_width(RID p_material) const; - - /* FIXED MATERIAL */ - - - virtual RID fixed_material_create(); - - virtual void fixed_material_set_flag(RID p_material, FixedMaterialFlags p_flag, bool p_enabled); - virtual bool fixed_material_get_flag(RID p_material, FixedMaterialFlags p_flag) const; + /* MESH API */ - virtual void fixed_material_set_param(RID p_material, FixedMaterialParam p_parameter, const Variant& p_value); - virtual Variant fixed_material_get_param(RID p_material,FixedMaterialParam p_parameter) const; - - virtual void fixed_material_set_texture(RID p_material,FixedMaterialParam p_parameter, RID p_texture); - virtual RID fixed_material_get_texture(RID p_material,FixedMaterialParam p_parameter) const; - - virtual void fixed_material_set_texcoord_mode(RID p_material,FixedMaterialParam p_parameter, FixedMaterialTexCoordMode p_mode); - virtual FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,FixedMaterialParam p_parameter) const; - - - virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform); - virtual Transform fixed_material_get_uv_transform(RID p_material) const; - - virtual void fixed_material_set_light_shader(RID p_material,FixedMaterialLightShader p_shader); - virtual FixedMaterialLightShader fixed_material_get_light_shader(RID p_material) const; - - virtual void fixed_material_set_point_size(RID p_material,float p_size); - virtual float fixed_material_get_point_size(RID p_material) const; - - /* SURFACE API */ virtual RID mesh_create(); + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >()); + virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); virtual int mesh_get_morph_target_count(RID p_mesh) const; + virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode); virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; - virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat); //this is used by each platform in a different way - - virtual void mesh_add_surface(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),bool p_alpha_sort=false); - virtual Array mesh_get_surface_arrays(RID p_mesh,int p_surface) const; - virtual Array mesh_get_surface_morph_arrays(RID p_mesh,int p_surface) const; - - virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false); + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; + + virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const; + virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const; + + virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; @@ -781,199 +666,102 @@ public: /* MULTIMESH API */ + virtual RID multimesh_create(); - virtual void multimesh_set_instance_count(RID p_multimesh,int p_count); + + virtual void multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb=true); virtual int multimesh_get_instance_count(RID p_multimesh) const; virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); - virtual void multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb); + virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb); virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform); virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_aabb(RID p_multimesh,const AABB& p_aabb) const; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const; + virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; + virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); virtual int multimesh_get_visible_instances(RID p_multimesh) const; + /* IMMEDIATE API */ virtual RID immediate_create(); virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID()); virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); + virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex); virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); virtual void immediate_color(RID p_immediate,const Color& p_color); - virtual void immediate_uv(RID p_immediate, const Vector2& p_uv); + virtual void immediate_uv(RID p_immediate,const Vector2& tex_uv); virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv); virtual void immediate_end(RID p_immediate); virtual void immediate_clear(RID p_immediate); virtual void immediate_set_material(RID p_immediate,RID p_material); virtual RID immediate_get_material(RID p_immediate) const; + /* SKELETON API */ - /* PARTICLES API */ - - virtual RID particles_create(); - - virtual void particles_set_amount(RID p_particles, int p_amount); - virtual int particles_get_amount(RID p_particles) const; - - virtual void particles_set_emitting(RID p_particles, bool p_emitting); - virtual bool particles_is_emitting(RID p_particles) const; - - virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility); - virtual AABB particles_get_visibility_aabb(RID p_particles) const; - - virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents); - virtual Vector3 particles_get_emission_half_extents(RID p_particles) const; - - virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity); - virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const; - - virtual void particles_set_emission_points(RID p_particles, const DVector& p_points); - virtual DVector particles_get_emission_points(RID p_particles) const; - - virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal); - virtual Vector3 particles_get_gravity_normal(RID p_particles) const; - - virtual void particles_set_variable(RID p_particles, ParticleVariable p_variable,float p_value); - virtual float particles_get_variable(RID p_particles, ParticleVariable p_variable) const; - - virtual void particles_set_randomness(RID p_particles, ParticleVariable p_variable,float p_randomness); - virtual float particles_get_randomness(RID p_particles, ParticleVariable p_variable) const; - - virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos); - virtual float particles_get_color_phase_pos(RID p_particles, int p_phase) const; - - virtual void particles_set_color_phases(RID p_particles, int p_phases); - virtual int particles_get_color_phases(RID p_particles) const; - - virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color); - virtual Color particles_get_color_phase_color(RID p_particles, int p_phase) const; - - virtual void particles_set_attractors(RID p_particles, int p_attractors); - virtual int particles_get_attractors(RID p_particles) const; - - virtual void particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos); - virtual Vector3 particles_get_attractor_pos(RID p_particles,int p_attractor) const; - - virtual void particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force); - virtual float particles_get_attractor_strength(RID p_particles,int p_attractor) const; - - virtual void particles_set_material(RID p_particles, RID p_material,bool p_owned=false); - virtual RID particles_get_material(RID p_particles) const; - - virtual void particles_set_height_from_velocity(RID p_particles, bool p_enable); - virtual bool particles_has_height_from_velocity(RID p_particles) const; - - virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable); - virtual bool particles_is_using_local_coordinates(RID p_particles) const; - + virtual RID skeleton_create(); + virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false); + virtual int skeleton_get_bone_count(RID p_skeleton) const; + virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform); + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone); /* Light API */ virtual RID light_create(LightType p_type); - virtual LightType light_get_type(RID p_light) const; - - virtual void light_set_color(RID p_light,LightColor p_type, const Color& p_color); - virtual Color light_get_color(RID p_light,LightColor p_type) const; - + virtual void light_set_color(RID p_light,const Color& p_color); + virtual void light_set_param(RID p_light,LightParam p_param,float p_value); virtual void light_set_shadow(RID p_light,bool p_enabled); - virtual bool light_has_shadow(RID p_light) const; - - virtual void light_set_volumetric(RID p_light,bool p_enabled); - virtual bool light_is_volumetric(RID p_light) const; - virtual void light_set_projector(RID p_light,RID p_texture); - virtual RID light_get_projector(RID p_light) const; - - virtual void light_set_param(RID p_light, LightParam p_var, float p_value); - virtual float light_get_param(RID p_light, LightParam p_var) const; + virtual void light_set_attenuation_texure(RID p_light,RID p_texture); + virtual void light_set_negative(RID p_light,bool p_enable); + virtual void light_set_cull_mask(RID p_light,uint32_t p_mask); + virtual void light_set_shader(RID p_light,RID p_shader); - virtual void light_set_operator(RID p_light,LightOp p_op); - virtual LightOp light_get_operator(RID p_light) const; - - virtual void light_omni_set_shadow_mode(RID p_light,LightOmniShadowMode p_mode); - virtual LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const; virtual void light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode); - virtual LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const; - virtual void light_directional_set_shadow_param(RID p_light,LightDirectionalShadowParam p_param, float p_value); - virtual float light_directional_get_shadow_param(RID p_light,LightDirectionalShadowParam p_param) const; + /* PROBE API */ - /* SKELETON API */ + virtual RID reflection_probe_create(); + + virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity); + virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far); + virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance); + virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents); + virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset); + virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable); + virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution); + virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide); + virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); - virtual RID skeleton_create(); - virtual void skeleton_resize(RID p_skeleton,int p_bones); - virtual int skeleton_get_bone_count(RID p_skeleton) const; - virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); /* ROOM API */ virtual RID room_create(); - virtual void room_set_bounds(RID p_room, const BSP_Tree& p_bounds); - virtual BSP_Tree room_get_bounds(RID p_room) const; + virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform); + virtual void room_clear_bounds(); /* PORTAL API */ + // portals are only (x/y) points, forming a convex shape, which its clockwise + // order points outside. (z is 0); + virtual RID portal_create(); virtual void portal_set_shape(RID p_portal, const Vector& p_shape); - virtual Vector portal_get_shape(RID p_portal) const; virtual void portal_set_enabled(RID p_portal, bool p_enabled); - virtual bool portal_is_enabled(RID p_portal) const; virtual void portal_set_disable_distance(RID p_portal, float p_distance); - virtual float portal_get_disable_distance(RID p_portal) const; virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); - virtual Color portal_get_disabled_color(RID p_portal) const; - virtual void portal_set_connect_range(RID p_portal, float p_range); - virtual float portal_get_connect_range(RID p_portal) const; - - /* BAKED LIGHT */ - - virtual RID baked_light_create(); - - virtual void baked_light_set_mode(RID p_baked_light,BakedLightMode p_mode); - virtual BakedLightMode baked_light_get_mode(RID p_baked_light) const; - - virtual void baked_light_set_octree(RID p_baked_light,const DVector p_octree); - virtual DVector baked_light_get_octree(RID p_baked_light) const; - - virtual void baked_light_set_light(RID p_baked_light,const DVector p_light); - virtual DVector baked_light_get_light(RID p_baked_light) const; - - virtual void baked_light_set_sampler_octree(RID p_baked_light,const DVector &p_sampler); - virtual DVector baked_light_get_sampler_octree(RID p_baked_light) const; - - virtual void baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier); - virtual float baked_light_get_lightmap_multiplier(RID p_baked_light) const; - - virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id); - virtual void baked_light_clear_lightmaps(RID p_baked_light); - - virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled); - virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const; - - virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color); - virtual Color baked_light_get_realtime_color(RID p_baked_light) const; - - virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy); - virtual float baked_light_get_realtime_energy(RID p_baked_light) const; - - /* BAKED LIGHT SAMPLER */ - - virtual RID baked_light_sampler_create(); - - virtual void baked_light_sampler_set_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param,float p_value); - virtual float baked_light_sampler_get_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param) const; - - virtual void baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution); - virtual int baked_light_sampler_get_resolution(RID p_baked_light_sampler) const; /* CAMERA API */ @@ -981,58 +769,44 @@ public: virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far); virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far); virtual void camera_set_transform(RID p_camera,const Transform& p_transform); - - virtual void camera_set_visible_layers(RID p_camera,uint32_t p_layers); - virtual uint32_t camera_get_visible_layers(RID p_camera) const; - + virtual void camera_set_cull_mask(RID p_camera,uint32_t p_layers); virtual void camera_set_environment(RID p_camera,RID p_env); - virtual RID camera_get_environment(RID p_camera) const; - virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable); - virtual bool camera_is_using_vertical_aspect(RID p_camera,bool p_enable) const; - /* VIEWPORT API */ + + /* VIEWPORT TARGET API */ virtual RID viewport_create(); - virtual void viewport_attach_to_screen(RID p_viewport,int p_screen=0); - virtual void viewport_detach(RID p_viewport); + virtual void viewport_set_size(RID p_viewport,int p_width,int p_height); + + virtual void viewport_set_active(RID p_viewport,bool p_active); - virtual void viewport_set_as_render_target(RID p_viewport,bool p_enable); - virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode); - virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const; - virtual RID viewport_get_render_target_texture(RID p_viewport) const; - virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable); - virtual bool viewport_get_render_target_vflip(RID p_viewport) const; - virtual void viewport_set_render_target_clear_on_new_frame(RID p_viewport,bool p_enable); - virtual bool viewport_get_render_target_clear_on_new_frame(RID p_viewport) const; - virtual void viewport_render_target_clear(RID p_viewport); - virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect); + virtual void viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode); + virtual void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0); + virtual void viewport_detach(RID p_viewport); + + virtual void viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode); + virtual void viewport_set_vflip(RID p_viewport,bool p_enable); - virtual void viewport_queue_screen_capture(RID p_viewport); - virtual Image viewport_get_screen_capture(RID p_viewport) const; - virtual void viewport_set_rect(RID p_viewport,const ViewportRect& p_rect); - virtual ViewportRect viewport_get_rect(RID p_viewport) const; + virtual RID viewport_get_texture(RID p_viewport) const; + virtual Image viewport_capture(RID p_viewport) const; virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide); virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide); virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable); + virtual void viewport_attach_camera(RID p_viewport,RID p_camera); virtual void viewport_set_scenario(RID p_viewport,RID p_scenario); - - virtual RID viewport_get_attached_camera(RID p_viewport) const; - virtual RID viewport_get_scenario(RID p_viewport) const; virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas); virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas); virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset); - virtual Matrix32 viewport_get_canvas_transform(RID p_viewport,RID p_canvas) const; + virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled); + virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); - virtual Matrix32 viewport_get_global_canvas_transform(RID p_viewport) const; virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); - virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled); - virtual bool viewport_has_transparent_background(RID p_viewport) const; /* ENVIRONMENT API */ @@ -1040,21 +814,24 @@ public: virtual RID environment_create(); virtual void environment_set_background(RID p_env,EnvironmentBG p_bg); - virtual EnvironmentBG environment_get_background(RID p_env) const; + virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0); + virtual void environment_set_bg_color(RID p_env,const Color& p_color); + virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0); - virtual void environment_set_background_param(RID p_env,EnvironmentBGParam p_param, const Variant& p_value); - virtual Variant environment_get_background_param(RID p_env,EnvironmentBGParam p_param) const; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode); + virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); - virtual void environment_set_enable_fx(RID p_env,EnvironmentFx p_effect,bool p_enabled); - virtual bool environment_is_fx_enabled(RID p_env,EnvironmentFx p_effect) const; - - - virtual void environment_fx_set_param(RID p_env,EnvironmentFxParam p_effect,const Variant& p_param); - virtual Variant environment_fx_get_param(RID p_env,EnvironmentFxParam p_effect) const; + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper); + virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); + virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); + virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); + virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); /* SCENARIO API */ + virtual RID scenario_create(); virtual void scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode); @@ -1063,137 +840,91 @@ public: virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment); - /* INSTANCING API */ + // from can be mesh, light, area and portal so far. + virtual RID instance_create(); // from can be mesh, light, poly, area and portal so far. - virtual RID instance_create(); - - virtual void instance_set_base(RID p_instance, RID p_base); - virtual RID instance_get_base(RID p_instance) const; - - virtual void instance_set_scenario(RID p_instance, RID p_scenario); - virtual RID instance_get_scenario(RID p_instance) const; - + virtual void instance_set_base(RID p_instance, RID p_base); // from can be mesh, light, poly, area and portal so far. + virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far. virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); - virtual uint32_t instance_get_layer_mask(RID p_instance) const; - - virtual AABB instance_get_base_aabb(RID p_instance) const; - - virtual void instance_attach_object_instance_ID(RID p_instance,uint32_t p_ID); - virtual uint32_t instance_get_object_instance_ID(RID p_instance) const; - - virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); - virtual RID instance_get_skeleton(RID p_instance) const; - + virtual void instance_set_transform(RID p_instance, const Transform& p_transform); + virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); - virtual float instance_get_morph_target_weight(RID p_instance,int p_shape) const; - virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); - - virtual void instance_set_transform(RID p_instance, const Transform& p_transform); - virtual Transform instance_get_transform(RID p_instance) const; - + virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); virtual void instance_set_exterior( RID p_instance, bool p_enabled ); - virtual bool instance_is_exterior( RID p_instance) const; - virtual void instance_set_room( RID p_instance, RID p_room ); - virtual RID instance_get_room( RID p_instance ) const ; virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ); - virtual real_t instance_get_extra_visibility_margin( RID p_instance ) const; - virtual Vector instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; - virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; - virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const; + // don't use these in a game! + virtual Vector instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; + virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; + virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const; - virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled); - virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const; - - virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting); - virtual VS::ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const; + virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled); + virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting); virtual void instance_geometry_set_material_override(RID p_instance, RID p_material); - virtual RID instance_geometry_get_material_override(RID p_instance) const; - - virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max); - virtual float instance_geometry_get_draw_range_max(RID p_instance) const; - virtual float instance_geometry_get_draw_range_min(RID p_instance) const; - virtual void instance_geometry_set_baked_light(RID p_instance,RID p_baked_light); - virtual RID instance_geometry_get_baked_light(RID p_instance) const; - virtual void instance_geometry_set_baked_light_sampler(RID p_instance,RID p_baked_light_sampler); - virtual RID instance_geometry_get_baked_light_sampler(RID p_instance) const; - - virtual void instance_geometry_set_baked_light_texture_index(RID p_instance,int p_tex_id); - virtual int instance_geometry_get_baked_light_texture_index(RID p_instance) const; - - virtual void instance_light_set_enabled(RID p_instance,bool p_enabled); - virtual bool instance_light_is_enabled(RID p_instance) const; + virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin); + virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance); /* CANVAS (2D) */ virtual RID canvas_create(); virtual void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring); - virtual Point2 canvas_get_item_mirroring(RID p_canvas,RID p_item) const; virtual void canvas_set_modulate(RID p_canvas,const Color& p_color); virtual RID canvas_item_create(); - - virtual void canvas_item_set_parent(RID p_item,RID p_parent_item); - virtual RID canvas_item_get_parent(RID p_canvas_item) const; + virtual void canvas_item_set_parent(RID p_item,RID p_parent); virtual void canvas_item_set_visible(RID p_item,bool p_visible); - virtual bool canvas_item_is_visible(RID p_item) const; + virtual void canvas_item_set_light_mask(RID p_item,int p_mask); - virtual void canvas_item_set_blend_mode(RID p_canvas_item,MaterialBlendMode p_blend); - virtual void canvas_item_set_light_mask(RID p_canvas_item,int p_mask); - - - - //virtual void canvas_item_set_rect(RID p_item, const Rect2& p_rect); virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform); virtual void canvas_item_set_clip(RID p_item, bool p_clip); virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2()); - virtual void canvas_item_set_opacity(RID p_item, float p_opacity); - virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const; - virtual void canvas_item_set_on_top(RID p_item, bool p_on_top); - virtual bool canvas_item_is_on_top(RID p_item) const; + virtual void canvas_item_set_modulate(RID p_item, const Color& p_color); + virtual void canvas_item_set_self_modulate(RID p_item, const Color& p_color); - virtual void canvas_item_set_self_opacity(RID p_item, float p_self_opacity); - virtual float canvas_item_get_self_opacity(RID p_item, float p_self_opacity) const; + virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); - virtual void canvas_item_attach_viewport(RID p_item, RID p_viewport); - virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to, const Color& p_color, float p_width=1.0, bool p_antialiased=false); + virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width=1.0,bool p_antialiased=false); virtual void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color); virtual void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color); virtual void canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile=false,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); - virtual void canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright, bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); + virtual void canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode=NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode=NINE_PATCH_STRETCH,bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); virtual void canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width=1.0); virtual void canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID()); virtual void canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID(), int p_count=-1); - virtual void canvas_item_add_triangle_array_ptr(RID p_item, int p_count, const int* p_indices, const Point2* p_points, const Color* p_colors,const Point2* p_uvs=NULL, RID p_texture=RID()); + virtual void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID()); + virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID()); virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform); - virtual void canvas_item_add_set_blend_mode(RID p_item, MaterialBlendMode p_blend); virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); virtual void canvas_item_set_z(RID p_item, int p_z); virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect); + virtual void canvas_item_clear(RID p_item); + virtual void canvas_item_set_draw_index(RID p_item,int p_index); + virtual void canvas_item_set_material(RID p_item, RID p_material); + virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable); virtual RID canvas_light_create(); virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas); virtual void canvas_light_set_enabled(RID p_light, bool p_enabled); - virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); virtual void canvas_light_set_scale(RID p_light, float p_scale); + virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); virtual void canvas_light_set_texture(RID p_light, RID p_texture); virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset); virtual void canvas_light_set_color(RID p_light, const Color& p_color); @@ -1201,13 +932,16 @@ public: virtual void canvas_light_set_energy(RID p_light, float p_energy); virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z); virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer); - virtual void canvas_light_set_item_mask(RID p_light, int p_mask); - virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask); + virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask); + virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask); virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode); + + virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled); virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size); - virtual void canvas_light_set_shadow_esm_multiplier(RID p_light, float p_multiplier); + virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length); + virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter); virtual void canvas_light_set_shadow_color(RID p_light, const Color& p_color); @@ -1219,72 +953,56 @@ public: virtual void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform); virtual void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask); - virtual RID canvas_occluder_polygon_create(); - virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_close); + virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed); virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape); - virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode); - - virtual void canvas_item_clear(RID p_item); - virtual void canvas_item_raise(RID p_item); - - /* CANVAS ITEM MATERIAL */ - - virtual RID canvas_item_material_create(); - virtual void canvas_item_material_set_shader(RID p_material, RID p_shader); - virtual void canvas_item_material_set_shader_param(RID p_material, const StringName& p_param, const Variant& p_value); - virtual Variant canvas_item_material_get_shader_param(RID p_material, const StringName& p_param) const; - virtual void canvas_item_material_set_shading_mode(RID p_material, CanvasItemShadingMode p_mode); - + virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode); /* CURSOR */ virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0); // radians - virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor=0, const Rect2 &p_region=Rect2()); + virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset = Point2(0, 0), int p_cursor=0, const Rect2 &p_region=Rect2()); virtual void cursor_set_visible(bool p_visible, int p_cursor = 0); virtual void cursor_set_pos(const Point2& p_pos, int p_cursor = 0); /* BLACK BARS */ + virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom); virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom); - /* FREE */ - - virtual void free( RID p_rid ); - /* CUSTOM SHADE MODEL */ + /* FREE */ - virtual void custom_shade_model_set_shader(int p_model, RID p_shader); - virtual RID custom_shade_model_get_shader(int p_model) const; - virtual void custom_shade_model_set_name(int p_model, const String& p_name); - virtual String custom_shade_model_get_name(int p_model) const; - virtual void custom_shade_model_set_param_info(int p_model, const List& p_info); - virtual void custom_shade_model_get_param_info(int p_model, List* p_info) const; + virtual void free( RID p_rid ); ///< free RIDs associated with the visual server /* EVENT QUEUING */ virtual void draw(); virtual void sync(); - + virtual bool has_changed() const; virtual void init(); virtual void finish(); - virtual bool has_changed() const; + /* STATUS INFORMATION */ - /* RENDER INFO */ virtual int get_render_info(RenderInfo p_info); - virtual bool has_feature(Features p_feature) const; - RID get_test_cube(); + virtual RID get_test_cube(); + + + /* TESTING */ - virtual void set_boot_image(const Image& p_image, const Color& p_color, bool p_scale); + virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale); virtual void set_default_clear_color(const Color& p_color); - VisualServerRaster(Rasterizer *p_rasterizer); + virtual bool has_feature(Features p_feature) const; + + + VisualServerRaster(); ~VisualServerRaster(); }; diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp new file mode 100644 index 0000000000..b30a57a5b8 --- /dev/null +++ b/servers/visual/visual_server_viewport.cpp @@ -0,0 +1,489 @@ +#include "visual_server_viewport.h" +#include "visual_server_global.h" +#include "visual_server_canvas.h" + +void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { + + /* Camera should always be BEFORE any other 3D */ +#if 0 + bool scenario_draw_canvas_bg=false; + int scenario_canvas_max_layer=0; + + if (!p_viewport->hide_canvas && !p_viewport->disable_environment && scenario_owner.owns(p_viewport->scenario)) { + + Scenario *scenario=scenario_owner.get(p_viewport->scenario); + if (scenario->environment.is_valid()) { + if (rasterizer->is_environment(scenario->environment)) { + scenario_draw_canvas_bg=rasterizer->environment_get_background(scenario->environment)==VS::ENV_BG_CANVAS; + scenario_canvas_max_layer=rasterizer->environment_get_background_param(scenario->environment,VS::ENV_BG_PARAM_CANVAS_MAX_LAYER); + } + } + } + + bool can_draw_3d=!p_viewport->hide_scenario && camera_owner.owns(p_viewport->camera) && scenario_owner.owns(p_viewport->scenario); + + + if (scenario_draw_canvas_bg) { + + rasterizer->begin_canvas_bg(); + } + + if (!scenario_draw_canvas_bg && can_draw_3d) { + + _draw_viewport_camera(p_viewport,false); + + } else if (true /*|| !p_viewport->canvas_list.empty()*/){ + + //clear the viewport black because of no camera? i seriously should.. + if (p_viewport->render_target_clear_on_new_frame || p_viewport->render_target_clear) { + if (p_viewport->transparent_bg) { + rasterizer->clear_viewport(Color(0,0,0,0)); + } + else { + Color cc=clear_color; + if (scenario_draw_canvas_bg) + cc.a=0; + rasterizer->clear_viewport(cc); + } + p_viewport->render_target_clear=false; + } + } +#endif + + VSG::rasterizer->clear_render_target(Color(0.5,0.5,0.5,1.0)); + + if (!p_viewport->hide_canvas) { + int i=0; + + Map canvas_map; + + Rect2 clip_rect(0,0,p_viewport->size.x,p_viewport->size.y); + RasterizerCanvas::Light *lights=NULL; + RasterizerCanvas::Light *lights_with_shadow=NULL; + RasterizerCanvas::Light *lights_with_mask=NULL; + Rect2 shadow_rect; + + int light_count=0; + + for (Map::Element *E=p_viewport->canvas_map.front();E;E=E->next()) { + + Matrix32 xf = p_viewport->global_transform * E->get().transform; + + VisualServerCanvas::Canvas *canvas = static_cast(E->get().canvas); + + //find lights in canvas + + + for(Set::Element *F=canvas->lights.front();F;F=F->next()) { + + + RasterizerCanvas::Light* cl=F->get(); + if (cl->enabled && cl->texture.is_valid()) { + //not super efficient.. + Size2 tsize(VSG::storage->texture_get_width(cl->texture),VSG::storage->texture_get_height(cl->texture)); + tsize*=cl->scale; + + Vector2 offset=tsize/2.0; + cl->rect_cache=Rect2(-offset+cl->texture_offset,tsize); + cl->xform_cache=xf * cl->xform; + + + if (clip_rect.intersects_transformed(cl->xform_cache,cl->rect_cache)) { + + cl->filter_next_ptr=lights; + lights=cl; + cl->texture_cache=NULL; + Matrix32 scale; + scale.scale(cl->rect_cache.size); + scale.elements[2]=cl->rect_cache.pos; + cl->light_shader_xform = (cl->xform_cache * scale).affine_inverse(); + cl->light_shader_pos=cl->xform_cache[2]; + if (cl->shadow_buffer.is_valid()) { + + cl->shadows_next_ptr=lights_with_shadow; + if (lights_with_shadow==NULL) { + shadow_rect = cl->xform_cache.xform(cl->rect_cache); + } else { + shadow_rect=shadow_rect.merge( cl->xform_cache.xform(cl->rect_cache) ); + } + lights_with_shadow=cl; + cl->radius_cache=cl->rect_cache.size.length(); + + } + if (cl->mode==VS::CANVAS_LIGHT_MODE_MASK) { + cl->mask_next_ptr=lights_with_mask; + lights_with_mask=cl; + } + + light_count++; + } + + VSG::canvas_render->light_internal_update(cl->light_internal,cl); + + } + } + + //print_line("lights: "+itos(light_count)); + canvas_map[ Viewport::CanvasKey( E->key(), E->get().layer) ]=&E->get(); + + } + + if (lights_with_shadow) { + //update shadows if any + + RasterizerCanvas::LightOccluderInstance * occluders=NULL; + + //make list of occluders + for (Map::Element *E=p_viewport->canvas_map.front();E;E=E->next()) { + + VisualServerCanvas::Canvas *canvas = static_cast(E->get().canvas); + Matrix32 xf = p_viewport->global_transform * E->get().transform; + + + for(Set::Element *F=canvas->occluders.front();F;F=F->next()) { + + if (!F->get()->enabled) + continue; + F->get()->xform_cache = xf * F->get()->xform; + if (shadow_rect.intersects_transformed(F->get()->xform_cache,F->get()->aabb_cache)) { + + F->get()->next=occluders; + occluders=F->get(); + + } + } + } + //update the light shadowmaps with them + RasterizerCanvas::Light *light=lights_with_shadow; + while(light) { + + VSG::canvas_render->canvas_light_shadow_buffer_update(light->shadow_buffer,light->xform_cache.affine_inverse(),light->item_mask,light->radius_cache/1000.0,light->radius_cache*1.1,occluders,&light->shadow_matrix_cache); + light=light->shadows_next_ptr; + } + + VSG::rasterizer->restore_render_target(); + // VSG::canvas_render->reset_canvas(); + } + + + +#if 0 + if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().layer>scenario_canvas_max_layer) { + + _draw_viewport_camera(p_viewport,!can_draw_3d); + scenario_draw_canvas_bg=false; + + } +#endif + for (Map::Element *E=canvas_map.front();E;E=E->next()) { + + VisualServerCanvas::Canvas *canvas = static_cast(E->get()->canvas); + + // print_line("canvas "+itos(i)+" size: "+itos(I->get()->canvas->child_items.size())); + //print_line("GT "+p_viewport->global_transform+". CT: "+E->get()->transform); + Matrix32 xform = p_viewport->global_transform * E->get()->transform; + + RasterizerCanvas::Light *canvas_lights=NULL; + + RasterizerCanvas::Light *ptr=lights; + while(ptr) { + if (E->get()->layer>=ptr->layer_min && E->get()->layer<=ptr->layer_max) { + ptr->next_ptr=canvas_lights; + canvas_lights=ptr; + } + ptr=ptr->filter_next_ptr; + } + + VSG::canvas->render_canvas( canvas,xform,canvas_lights,lights_with_mask,clip_rect ); + i++; +#if 0 + if (scenario_draw_canvas_bg && E->key().layer>=scenario_canvas_max_layer) { + _draw_viewport_camera(p_viewport,!can_draw_3d); + scenario_draw_canvas_bg=false; + } +#endif + + + } +#if 0 + if (scenario_draw_canvas_bg) { + _draw_viewport_camera(p_viewport,!can_draw_3d); + scenario_draw_canvas_bg=false; + } +#endif + + //VSG::canvas_render->canvas_debug_viewport_shadows(lights_with_shadow); + } + + + +} + +void VisualServerViewport::draw_viewports() { + + //sort viewports + + + //draw viewports + + + for(int i=0;iupdate_mode==VS::VIEWPORT_UPDATE_DISABLED) + continue; + + ERR_CONTINUE( !vp->render_target.is_valid() ); + + VSG::rasterizer->set_current_render_target(vp->render_target); + _draw_viewport(vp); + + if (vp->viewport_to_screen_rect!=Rect2()) { + //copy to screen if set as such + VSG::rasterizer->set_current_render_target(RID()); + VSG::rasterizer->blit_render_target_to_screen(vp->render_target,vp->viewport_to_screen_rect,vp->viewport_to_screen); + } + + if (vp->update_mode==VS::VIEWPORT_UPDATE_ONCE) { + vp->update_mode=VS::VIEWPORT_UPDATE_DISABLED; + } + } +} + + +RID VisualServerViewport::viewport_create() { + + Viewport * viewport = memnew( Viewport ); + + RID rid = viewport_owner.make_rid(viewport); + + viewport->self=rid; + viewport->hide_scenario=false; + viewport->hide_canvas=false; + viewport->render_target=VSG::storage->render_target_create(); + + return rid; + +} + +void VisualServerViewport::viewport_set_size(RID p_viewport,int p_width,int p_height){ + + ERR_FAIL_COND(p_width<0 && p_height<0); + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + + + viewport->size=Size2(p_width,p_height); + VSG::storage->render_target_set_size(viewport->render_target,p_width,p_height); + + +} + +void VisualServerViewport::viewport_set_active(RID p_viewport,bool p_active) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + if (p_active) { + ERR_FAIL_COND(active_viewports.find(viewport)!=-1);//already active + active_viewports.push_back(viewport); + } else { + active_viewports.erase(viewport); + } + + +} + +void VisualServerViewport::viewport_set_clear_mode(RID p_viewport,VS::ViewportClearMode p_clear_mode) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->clear_mode=p_clear_mode; + +} + + +void VisualServerViewport::viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect,int p_screen){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->viewport_to_screen_rect=p_rect; + viewport->viewport_to_screen=p_screen; +} +void VisualServerViewport::viewport_detach(RID p_viewport){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->viewport_to_screen_rect=Rect2(); + viewport->viewport_to_screen=0; + +} + +void VisualServerViewport::viewport_set_update_mode(RID p_viewport,VS::ViewportUpdateMode p_mode){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->update_mode=p_mode; + +} +void VisualServerViewport::viewport_set_vflip(RID p_viewport,bool p_enable){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VSG::storage->render_target_set_flag(viewport->render_target,RasterizerStorage::RENDER_TARGET_VFLIP,p_enable); + +} + +RID VisualServerViewport::viewport_get_texture(RID p_viewport) const{ + + const Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND_V(!viewport,RID()); + + return VSG::storage->render_target_get_texture(viewport->render_target); + +} +Image VisualServerViewport::viewport_capture(RID p_viewport) const{ + + const Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND_V(!viewport,Image()); + return VSG::storage->render_target_get_image(viewport->render_target); + +} + +void VisualServerViewport::viewport_set_hide_scenario(RID p_viewport,bool p_hide){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->hide_scenario=p_hide; +} +void VisualServerViewport::viewport_set_hide_canvas(RID p_viewport,bool p_hide){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->hide_canvas=p_hide; +} +void VisualServerViewport::viewport_set_disable_environment(RID p_viewport,bool p_disable){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + + viewport->disable_environment=p_disable; +} + +void VisualServerViewport::viewport_attach_camera(RID p_viewport,RID p_camera){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->camera=p_camera; +} +void VisualServerViewport::viewport_set_scenario(RID p_viewport,RID p_scenario){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->scenario=p_scenario; +} +void VisualServerViewport::viewport_attach_canvas(RID p_viewport,RID p_canvas){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + ERR_FAIL_COND(viewport->canvas_map.has(p_canvas)); + VisualServerCanvas::Canvas *canvas = VSG::canvas->canvas_owner.getornull(p_canvas); + ERR_FAIL_COND(!canvas); + + canvas->viewports.insert(p_viewport); + viewport->canvas_map[p_canvas]=Viewport::CanvasData(); + viewport->canvas_map[p_canvas].layer=0; + viewport->canvas_map[p_canvas].canvas=canvas; + +} + +void VisualServerViewport::viewport_remove_canvas(RID p_viewport,RID p_canvas){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VisualServerCanvas::Canvas *canvas = VSG::canvas->canvas_owner.getornull(p_canvas); + ERR_FAIL_COND(!canvas); + + viewport->canvas_map.erase(p_canvas); + canvas->viewports.erase(p_viewport); + +} +void VisualServerViewport::viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + ERR_FAIL_COND(!viewport->canvas_map.has(p_canvas)); + viewport->canvas_map[p_canvas].transform=p_offset; + +} +void VisualServerViewport::viewport_set_transparent_background(RID p_viewport,bool p_enabled){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VSG::storage->render_target_set_flag(viewport->render_target,RasterizerStorage::RENDER_TARGET_TRANSPARENT,p_enabled); + +} + +void VisualServerViewport::viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->global_transform=p_transform; + +} +void VisualServerViewport::viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + ERR_FAIL_COND(!viewport->canvas_map.has(p_canvas)); + viewport->canvas_map[p_canvas].layer=p_layer; + +} + +bool VisualServerViewport::free(RID p_rid) { + + Viewport * viewport = viewport_owner.getornull(p_rid); + if (!viewport) + return false; + + + VSG::storage->free( viewport->render_target ); + + while(viewport->canvas_map.front()) { + viewport_remove_canvas(p_rid,viewport->canvas_map.front()->key()); + } + + viewport_set_scenario(p_rid,RID()); + active_viewports.erase(viewport); + + viewport_owner.free(p_rid); + memdelete(viewport); + + + return true; + +} + +VisualServerViewport::VisualServerViewport() +{ + +} diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h new file mode 100644 index 0000000000..e5c888fbcb --- /dev/null +++ b/servers/visual/visual_server_viewport.h @@ -0,0 +1,118 @@ +#ifndef VISUALSERVERVIEWPORT_H +#define VISUALSERVERVIEWPORT_H + +#include "servers/visual_server.h" +#include "rasterizer.h" +#include "self_list.h" + +class VisualServerViewport { +public: + + struct CanvasBase : public RID_Data { + + + }; + + struct Viewport : public RID_Data { + + RID self; + RID parent; + + Size2i size; + RID camera; + RID scenario; + + VS::ViewportUpdateMode update_mode; + RID render_target; + RID render_target_texture; + + int viewport_to_screen; + Rect2 viewport_to_screen_rect; + + bool hide_scenario; + bool hide_canvas; + bool disable_environment; + + Image capture; + + VS::ViewportClearMode clear_mode; + + bool rendered_in_prev_frame; + + struct CanvasKey { + + int layer; + RID canvas; + bool operator<(const CanvasKey& p_canvas) const { if (layer==p_canvas.layer) return canvas < p_canvas.canvas; return layer canvas_map; + + Viewport() { + update_mode=VS::VIEWPORT_UPDATE_WHEN_VISIBLE; + clear_mode=VS::VIEWPORT_CLEAR_ALWAYS; + rendered_in_prev_frame=false; + disable_environment=false; + viewport_to_screen=0; + + } + }; + + mutable RID_Owner viewport_owner; + Vector active_viewports; +private: + void _draw_viewport(Viewport *p_viewport); +public: + + + RID viewport_create(); + + void viewport_set_size(RID p_viewport,int p_width,int p_height); + + void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0); + void viewport_detach(RID p_viewport); + + void viewport_set_active(RID p_viewport,bool p_active); + + void viewport_set_update_mode(RID p_viewport,VS::ViewportUpdateMode p_mode); + void viewport_set_vflip(RID p_viewport,bool p_enable); + + + void viewport_set_clear_mode(RID p_viewport,VS::ViewportClearMode p_clear_mode); + + RID viewport_get_texture(RID p_viewport) const; + Image viewport_capture(RID p_viewport) const; + + void viewport_set_hide_scenario(RID p_viewport,bool p_hide); + void viewport_set_hide_canvas(RID p_viewport,bool p_hide); + void viewport_set_disable_environment(RID p_viewport,bool p_disable); + + void viewport_attach_camera(RID p_viewport,RID p_camera); + void viewport_set_scenario(RID p_viewport,RID p_scenario); + void viewport_attach_canvas(RID p_viewport,RID p_canvas); + void viewport_remove_canvas(RID p_viewport,RID p_canvas); + void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset); + void viewport_set_transparent_background(RID p_viewport,bool p_enabled); + + void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); + void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); + + void draw_viewports(); + + bool free(RID p_rid); + + VisualServerViewport(); +}; + +#endif // VISUALSERVERVIEWPORT_H diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp deleted file mode 100644 index 5ea4145342..0000000000 --- a/servers/visual/visual_server_wrap_mt.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************/ -/* visual_server_wrap_mt.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "visual_server_wrap_mt.h" -#include "os/os.h" -#include "globals.h" -void VisualServerWrapMT::thread_exit() { - - exit=true; -} - -void VisualServerWrapMT::thread_draw() { - - - draw_mutex->lock(); - - draw_pending--; - bool draw=(draw_pending==0);// only draw when no more flushes are pending - - draw_mutex->unlock(); - - if (draw) { - - visual_server->draw(); - } - -} - -void VisualServerWrapMT::thread_flush() { - - - draw_mutex->lock(); - - draw_pending--; - - draw_mutex->unlock(); - -} - - - -void VisualServerWrapMT::_thread_callback(void *_instance) { - - VisualServerWrapMT *vsmt = reinterpret_cast(_instance); - - - vsmt->thread_loop(); -} - -void VisualServerWrapMT::thread_loop() { - - server_thread=Thread::get_caller_ID(); - - OS::get_singleton()->make_rendering_thread(); - - visual_server->init(); - - exit=false; - draw_thread_up=true; - while(!exit) { - // flush commands one by one, until exit is requested - command_queue.wait_and_flush_one(); - } - - command_queue.flush_all(); // flush all - - visual_server->finish(); - -} - - -/* EVENT QUEUING */ - -void VisualServerWrapMT::sync() { - - if (create_thread) { - - /* TODO: sync with the thread */ - - /* - ERR_FAIL_COND(!draw_mutex); - draw_mutex->lock(); - draw_pending++; //cambiar por un saferefcount - draw_mutex->unlock(); - */ - //command_queue.push( this, &VisualServerWrapMT::thread_flush); - } else { - - command_queue.flush_all(); //flush all pending from other threads - } - -} - -void VisualServerWrapMT::draw() { - - - if (create_thread) { - - /* TODO: Make it draw - ERR_FAIL_COND(!draw_mutex); - draw_mutex->lock(); - draw_pending++; //cambiar por un saferefcount - draw_mutex->unlock(); - - command_queue.push( this, &VisualServerWrapMT::thread_draw); - */ - } else { - - visual_server->draw(); - } -} - - -void VisualServerWrapMT::init() { - - if (create_thread) { - - draw_mutex = Mutex::create(); - print_line("CREATING RENDER THREAD"); - OS::get_singleton()->release_rendering_thread(); - if (create_thread) { - thread = Thread::create( _thread_callback, this ); - print_line("STARTING RENDER THREAD"); - } - while(!draw_thread_up) { - OS::get_singleton()->delay_usec(1000); - } - print_line("DONE RENDER THREAD"); - } else { - - visual_server->init(); - } - -} - -void VisualServerWrapMT::finish() { - - - if (thread) { - - command_queue.push( this, &VisualServerWrapMT::thread_exit); - Thread::wait_to_finish( thread ); - memdelete(thread); - - - texture_free_cached_ids(); - mesh_free_cached_ids(); - - thread=NULL; - } else { - visual_server->finish(); - } - - if (draw_mutex) - memdelete(draw_mutex); - -} - - -VisualServerWrapMT::VisualServerWrapMT(VisualServer* p_contained,bool p_create_thread) : command_queue(p_create_thread) { - - visual_server=p_contained; - create_thread=p_create_thread; - thread=NULL; - draw_mutex=NULL; - draw_pending=0; - draw_thread_up=false; - alloc_mutex=Mutex::create(); - texture_pool_max_size=GLOBAL_DEF("render/thread_textures_prealloc",5); - mesh_pool_max_size=GLOBAL_DEF("core/rid_pool_prealloc",20); - if (!p_create_thread) { - server_thread=Thread::get_caller_ID(); - } else { - server_thread=0; - } -} - - -VisualServerWrapMT::~VisualServerWrapMT() { - - memdelete(visual_server); - memdelete(alloc_mutex); - //finish(); - -} - - diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h deleted file mode 100644 index b4e374dd6f..0000000000 --- a/servers/visual/visual_server_wrap_mt.h +++ /dev/null @@ -1,739 +0,0 @@ -/*************************************************************************/ -/* visual_server_wrap_mt.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 VISUAL_SERVER_WRAP_MT_H -#define VISUAL_SERVER_WRAP_MT_H - - -#include "servers/visual_server.h" -#include "command_queue_mt.h" -#include "os/thread.h" - -/** - @author Juan Linietsky -*/ -class VisualServerWrapMT : public VisualServer { - - // the real visual server - mutable VisualServer *visual_server; - - mutable CommandQueueMT command_queue; - - static void _thread_callback(void *_instance); - void thread_loop(); - - Thread::ID server_thread; - volatile bool exit; - Thread *thread; - volatile bool draw_thread_up; - bool create_thread; - - Mutex *draw_mutex; - int draw_pending; - void thread_draw(); - void thread_flush(); - - void thread_exit(); - - Mutex*alloc_mutex; - - - int texture_pool_max_size; - List texture_id_pool; - - int mesh_pool_max_size; - List mesh_id_pool; - -//#define DEBUG_SYNC - -#ifdef DEBUG_SYNC -#define SYNC_DEBUG print_line("sync on: "+String(__FUNCTION__)); -#else -#define SYNC_DEBUG -#endif - -public: - -#define ServerName VisualServer -#define ServerNameWrapMT VisualServerWrapMT -#define server_name visual_server -#include "servers/server_wrap_mt_common.h" - - //FUNC0R(RID,texture_create); - FUNCRID(texture); - FUNC5(texture_allocate,RID,int,int,Image::Format,uint32_t); - FUNC3(texture_set_data,RID,const Image&,CubeMapSide); - FUNC2RC(Image,texture_get_data,RID,CubeMapSide); - FUNC2(texture_set_flags,RID,uint32_t); - FUNC1RC(Image::Format,texture_get_format,RID); - FUNC1RC(uint32_t,texture_get_flags,RID); - FUNC1RC(uint32_t,texture_get_width,RID); - FUNC1RC(uint32_t,texture_get_height,RID); - FUNC3(texture_set_size_override,RID,int,int); - FUNC1RC(bool,texture_can_stream,RID); - FUNC3C(texture_set_reload_hook,RID,ObjectID,const StringName&); - - FUNC2(texture_set_path,RID,const String&); - FUNC1RC(String,texture_get_path,RID); - - FUNC1(texture_set_shrink_all_x2_on_set_data,bool); - - virtual void texture_debug_usage(List *r_info) { - //pass directly, should lock the server anyway - visual_server->texture_debug_usage(r_info); - } - - - /* SHADER API */ - - FUNC1R(RID,shader_create,ShaderMode); - FUNC2(shader_set_mode,RID,ShaderMode); - FUNC1RC(ShaderMode,shader_get_mode,RID); - FUNC7(shader_set_code,RID,const String&,const String&,const String&,int,int,int); - FUNC1RC(String,shader_get_vertex_code,RID); - FUNC1RC(String,shader_get_fragment_code,RID); - FUNC1RC(String,shader_get_light_code,RID); - FUNC2SC(shader_get_param_list,RID,List*); - - FUNC3(shader_set_default_texture_param,RID,const StringName&,RID); - FUNC2RC(RID,shader_get_default_texture_param,RID,const StringName&); - - - /*virtual void shader_get_param_list(RID p_shader, List *p_param_list) { - if (Thread::get_caller_ID()!=server_thread) { - command_queue.push_and_sync( visual_server, &VisualServer::shader_get_param_list,p_shader,p_param_list); - } else { - visual_server->m_type(p1, p2, p3, p4, p5); - } - }*/ - -// virtual void shader_get_param_list(RID p_shader, List *p_param_list); - - - /* COMMON MATERIAL API */ - - FUNC0R(RID,material_create); - FUNC2(material_set_shader,RID,RID); - FUNC1RC(RID,material_get_shader,RID); - - FUNC3(material_set_param,RID,const StringName&,const Variant&); - FUNC2RC(Variant,material_get_param,RID,const StringName&); - - FUNC3(material_set_flag,RID,MaterialFlag,bool); - FUNC2RC(bool,material_get_flag,RID,MaterialFlag); - - FUNC2(material_set_depth_draw_mode,RID,MaterialDepthDrawMode); - FUNC1RC(MaterialDepthDrawMode,material_get_depth_draw_mode,RID); - - FUNC2(material_set_blend_mode,RID,MaterialBlendMode); - FUNC1RC(MaterialBlendMode,material_get_blend_mode,RID); - - FUNC2(material_set_line_width,RID,float); - FUNC1RC(float,material_get_line_width,RID); - - /* FIXED MATERIAL */ - - - FUNC0R(RID,fixed_material_create); - - FUNC3(fixed_material_set_flag,RID, FixedMaterialFlags , bool ); - FUNC2RC(bool, fixed_material_get_flag,RID, FixedMaterialFlags); - - FUNC3(fixed_material_set_param,RID, FixedMaterialParam, const Variant& ); - FUNC2RC(Variant, fixed_material_get_param,RID ,FixedMaterialParam); - - FUNC3(fixed_material_set_texture,RID ,FixedMaterialParam, RID ); - FUNC2RC(RID, fixed_material_get_texture,RID,FixedMaterialParam); - - - - FUNC3(fixed_material_set_texcoord_mode,RID,FixedMaterialParam, FixedMaterialTexCoordMode ); - FUNC2RC(FixedMaterialTexCoordMode, fixed_material_get_texcoord_mode,RID,FixedMaterialParam); - - FUNC2(fixed_material_set_light_shader,RID,FixedMaterialLightShader); - FUNC1RC(FixedMaterialLightShader, fixed_material_get_light_shader,RID); - - FUNC2(fixed_material_set_uv_transform,RID,const Transform&); - FUNC1RC(Transform, fixed_material_get_uv_transform,RID); - - FUNC2(fixed_material_set_point_size,RID ,float); - FUNC1RC(float,fixed_material_get_point_size,RID); - - /* SURFACE API */ - FUNCRID(mesh); - - FUNC2(mesh_set_morph_target_count,RID,int); - FUNC1RC(int,mesh_get_morph_target_count,RID); - - - FUNC2(mesh_set_morph_target_mode,RID,MorphTargetMode); - FUNC1RC(MorphTargetMode,mesh_get_morph_target_mode,RID); - - FUNC2(mesh_add_custom_surface,RID,const Variant&); //this is used by each platform in a different way - - FUNC5(mesh_add_surface,RID,PrimitiveType,const Array&,const Array&,bool); - FUNC2RC(Array,mesh_get_surface_arrays,RID,int); - FUNC2RC(Array,mesh_get_surface_morph_arrays,RID,int); - - FUNC4(mesh_surface_set_material,RID, int, RID,bool); - FUNC2RC(RID,mesh_surface_get_material,RID, int); - - FUNC2RC(int,mesh_surface_get_array_len,RID, int); - FUNC2RC(int,mesh_surface_get_array_index_len,RID, int); - FUNC2RC(uint32_t,mesh_surface_get_format,RID, int); - FUNC2RC(PrimitiveType,mesh_surface_get_primitive_type,RID, int); - - FUNC2(mesh_remove_surface,RID,int); - FUNC1RC(int,mesh_get_surface_count,RID); - FUNC1(mesh_clear,RID); - - - FUNC2(mesh_set_custom_aabb,RID,const AABB&); - FUNC1RC(AABB,mesh_get_custom_aabb,RID); - - - /* MULTIMESH API */ - - FUNC0R(RID,multimesh_create); - FUNC2(multimesh_set_instance_count,RID,int); - FUNC1RC(int,multimesh_get_instance_count,RID); - - FUNC2(multimesh_set_mesh,RID,RID); - FUNC2(multimesh_set_aabb,RID,const AABB&); - FUNC3(multimesh_instance_set_transform,RID,int,const Transform&); - FUNC3(multimesh_instance_set_color,RID,int,const Color&); - - FUNC1RC(RID,multimesh_get_mesh,RID); - FUNC2RC(AABB,multimesh_get_aabb,RID,const AABB&); - FUNC2RC(Transform,multimesh_instance_get_transform,RID,int); - FUNC2RC(Color,multimesh_instance_get_color,RID,int); - - FUNC2(multimesh_set_visible_instances,RID,int); - FUNC1RC(int,multimesh_get_visible_instances,RID); - - /* IMMEDIATE API */ - - - FUNC0R(RID,immediate_create); - FUNC3(immediate_begin,RID,PrimitiveType,RID); - FUNC2(immediate_vertex,RID,const Vector3&); - FUNC2(immediate_normal,RID,const Vector3&); - FUNC2(immediate_tangent,RID,const Plane&); - FUNC2(immediate_color,RID,const Color&); - FUNC2(immediate_uv,RID,const Vector2&); - FUNC2(immediate_uv2,RID,const Vector2&); - FUNC1(immediate_end,RID); - FUNC1(immediate_clear,RID); - FUNC2(immediate_set_material,RID,RID); - FUNC1RC(RID,immediate_get_material,RID); - - - /* PARTICLES API */ - - FUNC0R(RID,particles_create); - - FUNC2(particles_set_amount,RID, int ); - FUNC1RC(int,particles_get_amount,RID); - - FUNC2(particles_set_emitting,RID, bool ); - FUNC1RC(bool,particles_is_emitting,RID); - - FUNC2(particles_set_visibility_aabb,RID, const AABB&); - FUNC1RC(AABB,particles_get_visibility_aabb,RID); - - FUNC2(particles_set_emission_half_extents,RID, const Vector3&); - FUNC1RC(Vector3,particles_get_emission_half_extents,RID); - - FUNC2(particles_set_emission_base_velocity,RID, const Vector3&); - FUNC1RC(Vector3,particles_get_emission_base_velocity,RID); - - FUNC2(particles_set_emission_points,RID, const DVector& ); - FUNC1RC(DVector,particles_get_emission_points,RID); - - FUNC2(particles_set_gravity_normal,RID, const Vector3& ); - FUNC1RC(Vector3,particles_get_gravity_normal,RID); - - FUNC3(particles_set_variable,RID, ParticleVariable ,float); - FUNC2RC(float,particles_get_variable,RID, ParticleVariable ); - - FUNC3(particles_set_randomness,RID, ParticleVariable ,float); - FUNC2RC(float,particles_get_randomness,RID, ParticleVariable ); - - FUNC3(particles_set_color_phase_pos,RID, int , float); - FUNC2RC(float,particles_get_color_phase_pos,RID, int ); - - FUNC2(particles_set_color_phases,RID, int ); - FUNC1RC(int,particles_get_color_phases,RID); - - FUNC3(particles_set_color_phase_color,RID, int , const Color& ); - FUNC2RC(Color,particles_get_color_phase_color,RID, int ); - - FUNC2(particles_set_attractors,RID, int); - FUNC1RC(int,particles_get_attractors,RID); - - FUNC3(particles_set_attractor_pos,RID, int, const Vector3&); - FUNC2RC(Vector3,particles_get_attractor_pos,RID,int); - - FUNC3(particles_set_attractor_strength,RID, int, float); - FUNC2RC(float,particles_get_attractor_strength,RID,int); - - FUNC3(particles_set_material,RID, RID,bool); - FUNC1RC(RID,particles_get_material,RID); - - FUNC2(particles_set_height_from_velocity,RID, bool); - FUNC1RC(bool,particles_has_height_from_velocity,RID); - - FUNC2(particles_set_use_local_coordinates,RID, bool); - FUNC1RC(bool,particles_is_using_local_coordinates,RID); - - - /* Light API */ - - FUNC1R(RID,light_create,LightType); - FUNC1RC(LightType,light_get_type,RID); - - FUNC3(light_set_color,RID,LightColor , const Color& ); - FUNC2RC(Color,light_get_color,RID,LightColor ); - - - FUNC2(light_set_shadow,RID,bool ); - FUNC1RC(bool,light_has_shadow,RID); - - FUNC2(light_set_volumetric,RID,bool ); - FUNC1RC(bool,light_is_volumetric,RID); - - FUNC2(light_set_projector,RID,RID ); - FUNC1RC(RID,light_get_projector,RID); - - FUNC3(light_set_param,RID, LightParam , float ); - FUNC2RC(float,light_get_param,RID, LightParam ); - - FUNC2(light_set_operator,RID,LightOp); - FUNC1RC(LightOp,light_get_operator,RID); - - FUNC2(light_omni_set_shadow_mode,RID,LightOmniShadowMode); - FUNC1RC(LightOmniShadowMode,light_omni_get_shadow_mode,RID); - - FUNC2(light_directional_set_shadow_mode,RID,LightDirectionalShadowMode); - FUNC1RC(LightDirectionalShadowMode,light_directional_get_shadow_mode,RID); - FUNC3(light_directional_set_shadow_param,RID,LightDirectionalShadowParam, float ); - FUNC2RC(float,light_directional_get_shadow_param,RID,LightDirectionalShadowParam ); - - - /* SKELETON API */ - - FUNC0R(RID,skeleton_create); - FUNC2(skeleton_resize,RID,int ); - FUNC1RC(int,skeleton_get_bone_count,RID) ; - FUNC3(skeleton_bone_set_transform,RID,int, const Transform&); - FUNC2R(Transform,skeleton_bone_get_transform,RID,int ); - - /* ROOM API */ - - FUNC0R(RID,room_create); - FUNC2(room_set_bounds,RID, const BSP_Tree&); - FUNC1RC(BSP_Tree,room_get_bounds,RID); - - /* PORTAL API */ - - FUNC0R(RID,portal_create); - FUNC2(portal_set_shape,RID,const Vector&); - FUNC1RC(Vector,portal_get_shape,RID); - FUNC2(portal_set_enabled,RID, bool); - FUNC1RC(bool,portal_is_enabled,RID); - FUNC2(portal_set_disable_distance,RID, float); - FUNC1RC(float,portal_get_disable_distance,RID); - FUNC2(portal_set_disabled_color,RID, const Color&); - FUNC1RC(Color,portal_get_disabled_color,RID); - FUNC2(portal_set_connect_range,RID, float); - FUNC1RC(float,portal_get_connect_range,RID); - - - FUNC0R(RID,baked_light_create); - FUNC2(baked_light_set_mode,RID,BakedLightMode); - FUNC1RC(BakedLightMode,baked_light_get_mode,RID); - - FUNC2(baked_light_set_octree,RID,DVector); - FUNC1RC(DVector,baked_light_get_octree,RID); - - FUNC2(baked_light_set_light,RID,DVector); - FUNC1RC(DVector,baked_light_get_light,RID); - - FUNC2(baked_light_set_sampler_octree,RID,const DVector&); - FUNC1RC(DVector,baked_light_get_sampler_octree,RID); - - FUNC2(baked_light_set_lightmap_multiplier,RID,float); - FUNC1RC(float,baked_light_get_lightmap_multiplier,RID); - - FUNC3(baked_light_add_lightmap,RID,RID,int); - FUNC1(baked_light_clear_lightmaps,RID); - - FUNC2(baked_light_set_realtime_color_enabled, RID, const bool); - FUNC1RC(bool, baked_light_get_realtime_color_enabled, RID); - - FUNC2(baked_light_set_realtime_color, RID, const Color&); - FUNC1RC(Color, baked_light_get_realtime_color, RID); - - FUNC2(baked_light_set_realtime_energy, RID, const float); - FUNC1RC(float, baked_light_get_realtime_energy, RID); - - FUNC0R(RID,baked_light_sampler_create); - - FUNC3(baked_light_sampler_set_param,RID, BakedLightSamplerParam , float ); - FUNC2RC(float,baked_light_sampler_get_param,RID, BakedLightSamplerParam ); - - FUNC2(baked_light_sampler_set_resolution,RID,int); - FUNC1RC(int,baked_light_sampler_get_resolution,RID); - - /* CAMERA API */ - - FUNC0R(RID,camera_create); - FUNC4(camera_set_perspective,RID,float , float , float ); - FUNC4(camera_set_orthogonal,RID,float, float , float ); - FUNC2(camera_set_transform,RID,const Transform& ); - - FUNC2(camera_set_visible_layers,RID,uint32_t); - FUNC1RC(uint32_t,camera_get_visible_layers,RID); - - FUNC2(camera_set_environment,RID,RID); - FUNC1RC(RID,camera_get_environment,RID); - - - FUNC2(camera_set_use_vertical_aspect,RID,bool); - FUNC2RC(bool,camera_is_using_vertical_aspect,RID,bool); - - - /* VIEWPORT API */ - - FUNC0R(RID,viewport_create); - - FUNC2(viewport_attach_to_screen,RID,int ); - FUNC1(viewport_detach,RID); - - FUNC2(viewport_set_as_render_target,RID,bool); - FUNC2(viewport_set_render_target_update_mode,RID,RenderTargetUpdateMode); - FUNC1RC(RenderTargetUpdateMode,viewport_get_render_target_update_mode,RID); - FUNC1RC(RID,viewport_get_render_target_texture,RID); - - FUNC2(viewport_set_render_target_vflip,RID,bool); - FUNC1RC(bool,viewport_get_render_target_vflip,RID); - FUNC2(viewport_set_render_target_to_screen_rect,RID,const Rect2&); - - FUNC2(viewport_set_render_target_clear_on_new_frame,RID,bool); - FUNC1RC(bool,viewport_get_render_target_clear_on_new_frame,RID); - FUNC1(viewport_render_target_clear,RID); - - FUNC1(viewport_queue_screen_capture,RID); - FUNC1RC(Image,viewport_get_screen_capture,RID); - - FUNC2(viewport_set_rect,RID,const ViewportRect&); - FUNC1RC(ViewportRect,viewport_get_rect,RID); - - FUNC2(viewport_set_hide_scenario,RID,bool ); - FUNC2(viewport_set_hide_canvas,RID,bool ); - FUNC2(viewport_attach_camera,RID,RID ); - FUNC2(viewport_set_scenario,RID,RID ); - FUNC2(viewport_set_disable_environment,RID,bool ); - - FUNC1RC(RID,viewport_get_attached_camera,RID); - FUNC1RC(RID,viewport_get_scenario,RID ); - FUNC2(viewport_attach_canvas,RID,RID); - FUNC2(viewport_remove_canvas,RID,RID); - FUNC3(viewport_set_canvas_transform,RID,RID,const Matrix32&); - FUNC2RC(Matrix32,viewport_get_canvas_transform,RID,RID); - FUNC2(viewport_set_global_canvas_transform,RID,const Matrix32&); - FUNC1RC(Matrix32,viewport_get_global_canvas_transform,RID); - FUNC3(viewport_set_canvas_layer,RID,RID ,int); - FUNC2(viewport_set_transparent_background,RID,bool); - FUNC1RC(bool,viewport_has_transparent_background,RID); - - - /* ENVIRONMENT API */ - - FUNC0R(RID,environment_create); - - FUNC2(environment_set_background,RID,EnvironmentBG); - FUNC1RC(EnvironmentBG,environment_get_background,RID); - - FUNC3(environment_set_background_param,RID,EnvironmentBGParam, const Variant&); - FUNC2RC(Variant,environment_get_background_param,RID,EnvironmentBGParam ); - - FUNC3(environment_set_enable_fx,RID,EnvironmentFx,bool); - FUNC2RC(bool,environment_is_fx_enabled,RID,EnvironmentFx); - - - FUNC3(environment_fx_set_param,RID,EnvironmentFxParam,const Variant&); - FUNC2RC(Variant,environment_fx_get_param,RID,EnvironmentFxParam); - - - /* SCENARIO API */ - - FUNC0R(RID,scenario_create); - - FUNC2(scenario_set_debug,RID,ScenarioDebugMode); - FUNC2(scenario_set_environment,RID, RID); - FUNC2RC(RID,scenario_get_environment,RID, RID); - FUNC2(scenario_set_fallback_environment,RID, RID); - - - /* INSTANCING API */ - - FUNC0R(RID,instance_create); - - FUNC2(instance_set_base,RID, RID); - FUNC1RC(RID,instance_get_base,RID); - - FUNC2(instance_set_scenario,RID, RID); - FUNC1RC(RID,instance_get_scenario,RID); - - FUNC2(instance_set_layer_mask,RID, uint32_t); - FUNC1RC(uint32_t,instance_get_layer_mask,RID); - - FUNC1RC(AABB,instance_get_base_aabb,RID); - - FUNC2(instance_attach_object_instance_ID,RID,uint32_t); - FUNC1RC(uint32_t,instance_get_object_instance_ID,RID); - - FUNC2(instance_attach_skeleton,RID,RID); - FUNC1RC(RID,instance_get_skeleton,RID); - - FUNC3(instance_set_morph_target_weight,RID,int, float); - FUNC2RC(float,instance_get_morph_target_weight,RID,int); - - FUNC3(instance_set_surface_material,RID,int, RID); - - FUNC2(instance_set_transform,RID, const Transform&); - FUNC1RC(Transform,instance_get_transform,RID); - - FUNC2(instance_set_exterior,RID, bool ); - FUNC1RC(bool,instance_is_exterior,RID); - - FUNC2(instance_set_room,RID, RID ); - FUNC1RC(RID,instance_get_room,RID ) ; - - FUNC2(instance_set_extra_visibility_margin,RID, real_t ); - FUNC1RC(real_t,instance_get_extra_visibility_margin,RID ); - - FUNC2RC(Vector,instances_cull_aabb,const AABB& , RID ); - FUNC3RC(Vector,instances_cull_ray,const Vector3& ,const Vector3&, RID ); - FUNC2RC(Vector,instances_cull_convex,const Vector& , RID ); - - FUNC3(instance_geometry_set_flag,RID,InstanceFlags ,bool ); - FUNC2RC(bool,instance_geometry_get_flag,RID,InstanceFlags ); - - FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting); - FUNC1RC(ShadowCastingSetting, instance_geometry_get_cast_shadows_setting, RID); - - FUNC2(instance_geometry_set_material_override,RID, RID ); - FUNC1RC(RID,instance_geometry_get_material_override,RID); - - FUNC3(instance_geometry_set_draw_range,RID,float ,float); - FUNC1RC(float,instance_geometry_get_draw_range_max,RID); - FUNC1RC(float,instance_geometry_get_draw_range_min,RID); - - FUNC2(instance_geometry_set_baked_light,RID, RID ); - FUNC1RC(RID,instance_geometry_get_baked_light,RID); - - FUNC2(instance_geometry_set_baked_light_sampler,RID, RID ); - FUNC1RC(RID,instance_geometry_get_baked_light_sampler,RID); - - FUNC2(instance_geometry_set_baked_light_texture_index,RID, int); - FUNC1RC(int,instance_geometry_get_baked_light_texture_index,RID); - - FUNC2(instance_light_set_enabled,RID,bool); - FUNC1RC(bool,instance_light_is_enabled,RID); - - /* CANVAS (2D) */ - - FUNC0R(RID,canvas_create); - FUNC3(canvas_set_item_mirroring,RID,RID,const Point2&); - FUNC2RC(Point2,canvas_get_item_mirroring,RID,RID); - FUNC2(canvas_set_modulate,RID,const Color&); - - - FUNC0R(RID,canvas_item_create); - - FUNC2(canvas_item_set_parent,RID,RID ); - FUNC1RC(RID,canvas_item_get_parent,RID); - - FUNC2(canvas_item_set_visible,RID,bool ); - FUNC1RC(bool,canvas_item_is_visible,RID); - - FUNC2(canvas_item_set_blend_mode,RID,MaterialBlendMode ); - FUNC2(canvas_item_set_light_mask,RID,int ); - - //FUNC(canvas_item_set_rect,RID, const Rect2& p_rect); - FUNC2(canvas_item_set_transform,RID, const Matrix32& ); - FUNC2(canvas_item_set_clip,RID, bool ); - FUNC2(canvas_item_set_distance_field_mode,RID, bool ); - FUNC3(canvas_item_set_custom_rect,RID, bool ,const Rect2&); - FUNC2(canvas_item_set_opacity,RID, float ); - FUNC2RC(float,canvas_item_get_opacity,RID, float ); - FUNC2(canvas_item_set_on_top,RID, bool ); - FUNC1RC(bool,canvas_item_is_on_top,RID); - - FUNC2(canvas_item_set_self_opacity,RID, float ); - FUNC2RC(float,canvas_item_get_self_opacity,RID, float ); - - FUNC2(canvas_item_attach_viewport,RID, RID ); - - FUNC6(canvas_item_add_line,RID, const Point2& , const Point2& ,const Color& ,float,bool); - FUNC3(canvas_item_add_rect,RID, const Rect2& , const Color& ); - FUNC4(canvas_item_add_circle,RID, const Point2& , float ,const Color& ); - FUNC6(canvas_item_add_texture_rect,RID, const Rect2& , RID ,bool ,const Color&,bool ); - FUNC6(canvas_item_add_texture_rect_region,RID, const Rect2& , RID ,const Rect2& ,const Color&,bool ); - FUNC8(canvas_item_add_style_box,RID, const Rect2& , const Rect2&, RID ,const Vector2& ,const Vector2&, bool ,const Color& ); - FUNC6(canvas_item_add_primitive,RID, const Vector& , const Vector& ,const Vector& , RID ,float ); - FUNC5(canvas_item_add_polygon,RID, const Vector& , const Vector& ,const Vector& , RID ); - FUNC7(canvas_item_add_triangle_array,RID, const Vector& , const Vector& , const Vector& ,const Vector& , RID , int ); - FUNC7(canvas_item_add_triangle_array_ptr,RID, int , const int* , const Point2* , const Color* ,const Point2* , RID ); - - - FUNC2(canvas_item_add_set_transform,RID,const Matrix32& ); - FUNC2(canvas_item_add_set_blend_mode,RID, MaterialBlendMode ); - FUNC2(canvas_item_add_clip_ignore,RID, bool ); - - FUNC2(canvas_item_set_sort_children_by_y,RID,bool); - FUNC2(canvas_item_set_z,RID,int); - FUNC2(canvas_item_set_z_as_relative_to_parent,RID,bool); - FUNC3(canvas_item_set_copy_to_backbuffer,RID,bool,const Rect2&); - - - FUNC2(canvas_item_set_material,RID, RID ); - - FUNC2(canvas_item_set_use_parent_material,RID, bool ); - - FUNC1(canvas_item_clear,RID); - FUNC1(canvas_item_raise,RID); - - /* CANVAS LIGHT */ - FUNC0R(RID,canvas_light_create); - FUNC2(canvas_light_attach_to_canvas,RID,RID); - FUNC2(canvas_light_set_enabled,RID,bool); - FUNC2(canvas_light_set_transform,RID,const Matrix32&); - FUNC2(canvas_light_set_scale,RID,float); - FUNC2(canvas_light_set_texture,RID,RID); - FUNC2(canvas_light_set_texture_offset,RID,const Vector2&); - FUNC2(canvas_light_set_color,RID,const Color&); - FUNC2(canvas_light_set_height,RID,float); - FUNC2(canvas_light_set_energy,RID,float); - FUNC3(canvas_light_set_layer_range,RID,int,int); - FUNC3(canvas_light_set_z_range,RID,int,int); - FUNC2(canvas_light_set_item_mask,RID,int); - FUNC2(canvas_light_set_item_shadow_mask,RID,int); - - FUNC2(canvas_light_set_mode,RID,CanvasLightMode); - FUNC2(canvas_light_set_shadow_enabled,RID,bool); - FUNC2(canvas_light_set_shadow_buffer_size,RID,int); - FUNC2(canvas_light_set_shadow_esm_multiplier,RID,float); - FUNC2(canvas_light_set_shadow_color,RID,const Color&); - - - - /* CANVAS OCCLUDER */ - - FUNC0R(RID,canvas_light_occluder_create); - FUNC2(canvas_light_occluder_attach_to_canvas,RID,RID); - FUNC2(canvas_light_occluder_set_enabled,RID,bool); - FUNC2(canvas_light_occluder_set_polygon,RID,RID); - FUNC2(canvas_light_occluder_set_transform,RID,const Matrix32&); - FUNC2(canvas_light_occluder_set_light_mask,RID,int); - - - FUNC0R(RID,canvas_occluder_polygon_create); - FUNC3(canvas_occluder_polygon_set_shape,RID,const DVector&,bool); - FUNC2(canvas_occluder_polygon_set_shape_as_lines,RID,const DVector&); - FUNC2(canvas_occluder_polygon_set_cull_mode,RID,CanvasOccluderPolygonCullMode); - - /* CANVAS MATERIAL */ - - FUNC0R(RID,canvas_item_material_create); - FUNC2(canvas_item_material_set_shader,RID,RID); - FUNC3(canvas_item_material_set_shader_param,RID,const StringName&,const Variant&); - FUNC2RC(Variant,canvas_item_material_get_shader_param,RID,const StringName&); - FUNC2(canvas_item_material_set_shading_mode,RID,CanvasItemShadingMode); - - /* CURSOR */ - FUNC2(cursor_set_rotation,float , int ); // radians - FUNC4(cursor_set_texture,RID , const Point2 &, int, const Rect2 &); - FUNC2(cursor_set_visible,bool , int ); - FUNC2(cursor_set_pos,const Point2& , int ); - - /* BLACK BARS */ - - FUNC4(black_bars_set_margins,int , int , int , int ); - FUNC4(black_bars_set_images,RID , RID , RID , RID ); - - /* FREE */ - - FUNC1(free,RID); - - /* CUSTOM SHADE MODEL */ - - FUNC2(custom_shade_model_set_shader,int , RID ); - FUNC1RC(RID,custom_shade_model_get_shader,int ); - FUNC2(custom_shade_model_set_name,int , const String& ); - FUNC1RC(String,custom_shade_model_get_name,int ); - FUNC2(custom_shade_model_set_param_info,int , const List& ); - FUNC2SC(custom_shade_model_get_param_info,int , List* ); - - /* EVENT QUEUING */ - - - virtual void init(); - virtual void finish(); - virtual void draw(); - virtual void sync(); - FUNC0RC(bool,has_changed); - - /* RENDER INFO */ - - FUNC1R(int,get_render_info,RenderInfo ); - virtual bool has_feature(Features p_feature) const { return visual_server->has_feature(p_feature); } - - FUNC3(set_boot_image,const Image& , const Color&,bool ); - FUNC1(set_default_clear_color,const Color& ); - - FUNC0R(RID,get_test_cube ); - - - VisualServerWrapMT(VisualServer* p_contained,bool p_create_thread); - ~VisualServerWrapMT(); - -#undef ServerName -#undef ServerNameWrapMT -#undef server_name - -}; - -#ifdef DEBUG_SYNC -#undef DEBUG_SYNC -#endif -#undef SYNC_DEBUG - -#endif diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index f69580254c..175dfd47d1 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -39,16 +39,6 @@ VisualServer *VisualServer::get_singleton() { } -void VisualServer::set_mipmap_policy(MipMapPolicy p_policy) { - - mm_policy=p_policy; -} - -VisualServer::MipMapPolicy VisualServer::get_mipmap_policy() const { - - return (VisualServer::MipMapPolicy)mm_policy; -} - DVector VisualServer::_shader_get_param_list(RID p_shader) const { @@ -93,38 +83,48 @@ RID VisualServer::texture_create_from_image(const Image& p_image,uint32_t p_flag RID VisualServer::get_test_texture() { - if (test_texture) { + if (test_texture.is_valid()) { return test_texture; }; #define TEST_TEXTURE_SIZE 256 - Image data(TEST_TEXTURE_SIZE,TEST_TEXTURE_SIZE,0,Image::FORMAT_RGB); - for (int x=0;x test_data; + test_data.resize(TEST_TEXTURE_SIZE*TEST_TEXTURE_SIZE*3); - for (int y=0;y::Write w=test_data.write(); - Color c; - int r=255-(x+y)/2; + for (int x=0;x()),DEFVAL(RID())); - ObjectTypeDB::bind_method(_MD("canvas_item_add_circle"),&VisualServer::canvas_item_add_circle); - - ObjectTypeDB::bind_method(_MD("viewport_set_canvas_transform"),&VisualServer::viewport_set_canvas_transform); - - ObjectTypeDB::bind_method(_MD("canvas_item_clear"),&VisualServer::canvas_item_clear); - ObjectTypeDB::bind_method(_MD("canvas_item_raise"),&VisualServer::canvas_item_raise); - - - ObjectTypeDB::bind_method(_MD("cursor_set_rotation"),&VisualServer::cursor_set_rotation); - ObjectTypeDB::bind_method(_MD("cursor_set_texture"),&VisualServer::cursor_set_texture); - ObjectTypeDB::bind_method(_MD("cursor_set_visible"),&VisualServer::cursor_set_visible); - ObjectTypeDB::bind_method(_MD("cursor_set_pos"),&VisualServer::cursor_set_pos); - - ObjectTypeDB::bind_method(_MD("black_bars_set_margins","left","top","right","bottom"),&VisualServer::black_bars_set_margins); - ObjectTypeDB::bind_method(_MD("black_bars_set_images","left","top","right","bottom"),&VisualServer::black_bars_set_images); - - ObjectTypeDB::bind_method(_MD("make_sphere_mesh"),&VisualServer::make_sphere_mesh); - ObjectTypeDB::bind_method(_MD("mesh_add_surface_from_planes"),&VisualServer::mesh_add_surface_from_planes); - - ObjectTypeDB::bind_method(_MD("draw"),&VisualServer::draw); - ObjectTypeDB::bind_method(_MD("sync"),&VisualServer::sync); - ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free); - - ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color); - - ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info); - - BIND_CONSTANT( NO_INDEX_ARRAY ); - BIND_CONSTANT( CUSTOM_ARRAY_SIZE ); - BIND_CONSTANT( ARRAY_WEIGHTS_SIZE ); - BIND_CONSTANT( MAX_PARTICLE_COLOR_PHASES ); - BIND_CONSTANT( MAX_PARTICLE_ATTRACTORS ); - BIND_CONSTANT( MAX_CURSORS ); - - BIND_CONSTANT( TEXTURE_FLAG_MIPMAPS ); - BIND_CONSTANT( TEXTURE_FLAG_REPEAT ); - BIND_CONSTANT( TEXTURE_FLAG_FILTER ); - BIND_CONSTANT( TEXTURE_FLAG_CUBEMAP ); - BIND_CONSTANT( TEXTURE_FLAGS_DEFAULT ); - - BIND_CONSTANT( CUBEMAP_LEFT ); - BIND_CONSTANT( CUBEMAP_RIGHT ); - BIND_CONSTANT( CUBEMAP_BOTTOM ); - BIND_CONSTANT( CUBEMAP_TOP ); - BIND_CONSTANT( CUBEMAP_FRONT ); - BIND_CONSTANT( CUBEMAP_BACK ); - - BIND_CONSTANT( SHADER_MATERIAL ); ///< param 0: name - BIND_CONSTANT( SHADER_POST_PROCESS ); ///< param 0: name - - BIND_CONSTANT( MATERIAL_FLAG_VISIBLE ); - BIND_CONSTANT( MATERIAL_FLAG_DOUBLE_SIDED ); - BIND_CONSTANT( MATERIAL_FLAG_INVERT_FACES ); - BIND_CONSTANT( MATERIAL_FLAG_UNSHADED ); - BIND_CONSTANT( MATERIAL_FLAG_ONTOP ); - BIND_CONSTANT( MATERIAL_FLAG_MAX ); - - BIND_CONSTANT( MATERIAL_BLEND_MODE_MIX ); - BIND_CONSTANT( MATERIAL_BLEND_MODE_ADD ); - BIND_CONSTANT( MATERIAL_BLEND_MODE_SUB ); - BIND_CONSTANT( MATERIAL_BLEND_MODE_MUL ); - - BIND_CONSTANT( FIXED_MATERIAL_PARAM_DIFFUSE ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_DETAIL ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_EMISSION ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR_EXP ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_GLOW ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_NORMAL ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_SHADE_PARAM ); - BIND_CONSTANT( FIXED_MATERIAL_PARAM_MAX ); - - - - BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_SPHERE ); - BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV ); - BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM ); - BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV2 ); - - - BIND_CONSTANT( ARRAY_VERTEX ); - BIND_CONSTANT( ARRAY_NORMAL ); - BIND_CONSTANT( ARRAY_TANGENT ); - BIND_CONSTANT( ARRAY_COLOR ); - BIND_CONSTANT( ARRAY_TEX_UV ); - BIND_CONSTANT( ARRAY_BONES ); - BIND_CONSTANT( ARRAY_WEIGHTS ); - BIND_CONSTANT( ARRAY_INDEX ); - BIND_CONSTANT( ARRAY_MAX ); - - BIND_CONSTANT( ARRAY_FORMAT_VERTEX ); - BIND_CONSTANT( ARRAY_FORMAT_NORMAL ); - BIND_CONSTANT( ARRAY_FORMAT_TANGENT ); - BIND_CONSTANT( ARRAY_FORMAT_COLOR ); - BIND_CONSTANT( ARRAY_FORMAT_TEX_UV ); - BIND_CONSTANT( ARRAY_FORMAT_BONES ); - BIND_CONSTANT( ARRAY_FORMAT_WEIGHTS ); - BIND_CONSTANT( ARRAY_FORMAT_INDEX ); - - BIND_CONSTANT( PRIMITIVE_POINTS ); - BIND_CONSTANT( PRIMITIVE_LINES ); - BIND_CONSTANT( PRIMITIVE_LINE_STRIP ); - BIND_CONSTANT( PRIMITIVE_LINE_LOOP ); - BIND_CONSTANT( PRIMITIVE_TRIANGLES ); - BIND_CONSTANT( PRIMITIVE_TRIANGLE_STRIP ); - BIND_CONSTANT( PRIMITIVE_TRIANGLE_FAN ); - BIND_CONSTANT( PRIMITIVE_MAX ); - - BIND_CONSTANT( PARTICLE_LIFETIME ); - BIND_CONSTANT( PARTICLE_SPREAD ); - BIND_CONSTANT( PARTICLE_GRAVITY ); - BIND_CONSTANT( PARTICLE_LINEAR_VELOCITY ); - BIND_CONSTANT( PARTICLE_ANGULAR_VELOCITY ); - BIND_CONSTANT( PARTICLE_LINEAR_ACCELERATION ); - BIND_CONSTANT( PARTICLE_RADIAL_ACCELERATION ); - BIND_CONSTANT( PARTICLE_TANGENTIAL_ACCELERATION ); - BIND_CONSTANT( PARTICLE_INITIAL_SIZE ); - BIND_CONSTANT( PARTICLE_FINAL_SIZE ); - BIND_CONSTANT( PARTICLE_INITIAL_ANGLE ); - BIND_CONSTANT( PARTICLE_HEIGHT ); - BIND_CONSTANT( PARTICLE_HEIGHT_SPEED_SCALE ); - BIND_CONSTANT( PARTICLE_VAR_MAX ); - - BIND_CONSTANT( LIGHT_DIRECTIONAL ); - BIND_CONSTANT( LIGHT_OMNI ); - BIND_CONSTANT( LIGHT_SPOT ); - - - BIND_CONSTANT( LIGHT_COLOR_DIFFUSE ); - BIND_CONSTANT( LIGHT_COLOR_SPECULAR ); - - BIND_CONSTANT( LIGHT_PARAM_SPOT_ATTENUATION ); - BIND_CONSTANT( LIGHT_PARAM_SPOT_ANGLE ); - BIND_CONSTANT( LIGHT_PARAM_RADIUS ); - BIND_CONSTANT( LIGHT_PARAM_ENERGY ); - BIND_CONSTANT( LIGHT_PARAM_ATTENUATION ); - BIND_CONSTANT( LIGHT_PARAM_MAX ); - - BIND_CONSTANT( SCENARIO_DEBUG_DISABLED ); - BIND_CONSTANT( SCENARIO_DEBUG_WIREFRAME ); - BIND_CONSTANT( SCENARIO_DEBUG_OVERDRAW ); - - BIND_CONSTANT( INSTANCE_MESH ); - BIND_CONSTANT( INSTANCE_MULTIMESH ); - - BIND_CONSTANT( INSTANCE_PARTICLES ); - BIND_CONSTANT( INSTANCE_LIGHT ); - BIND_CONSTANT( INSTANCE_ROOM ); - BIND_CONSTANT( INSTANCE_PORTAL ); - BIND_CONSTANT( INSTANCE_GEOMETRY_MASK ); - - - BIND_CONSTANT( INFO_OBJECTS_IN_FRAME ); - BIND_CONSTANT( INFO_VERTICES_IN_FRAME ); - BIND_CONSTANT( INFO_MATERIAL_CHANGES_IN_FRAME ); - BIND_CONSTANT( INFO_SHADER_CHANGES_IN_FRAME ); - BIND_CONSTANT( INFO_SURFACE_CHANGES_IN_FRAME ); - BIND_CONSTANT( INFO_DRAW_CALLS_IN_FRAME ); - BIND_CONSTANT( INFO_USAGE_VIDEO_MEM_TOTAL ); - BIND_CONSTANT( INFO_VIDEO_MEM_USED ); - BIND_CONSTANT( INFO_TEXTURE_MEM_USED ); - BIND_CONSTANT( INFO_VERTEX_MEM_USED ); } @@ -708,7 +373,7 @@ void VisualServer::_bind_methods() { void VisualServer::_canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector& p_margins, const Color& p_modulate) { ERR_FAIL_COND(p_margins.size()!=4); - canvas_item_add_style_box(p_item,p_rect,p_source,p_texture,Vector2(p_margins[0],p_margins[1]),Vector2(p_margins[2],p_margins[3]),true,p_modulate); + //canvas_item_add_style_box(p_item,p_rect,p_source,p_texture,Vector2(p_margins[0],p_margins[1]),Vector2(p_margins[2],p_margins[3]),true,p_modulate); } void VisualServer::_camera_set_orthogonal(RID p_camera,float p_size,float p_z_near,float p_z_far) { @@ -716,21 +381,6 @@ void VisualServer::_camera_set_orthogonal(RID p_camera,float p_size,float p_z_ne camera_set_orthogonal(p_camera,p_size,p_z_near,p_z_far); } -void VisualServer::_viewport_set_rect(RID p_viewport,const Rect2& p_rect) { - - ViewportRect r; - r.x=p_rect.pos.x; - r.y=p_rect.pos.y; - r.width=p_rect.size.x; - r.height=p_rect.size.y; - viewport_set_rect(p_viewport,r); -} -Rect2 VisualServer::_viewport_get_rect(RID p_viewport) const { - - ViewportRect r=viewport_get_rect(p_viewport); - return Rect2(r.x,r.y,r.width,r.height); -} - @@ -761,7 +411,7 @@ void VisualServer::mesh_add_surface_from_mesh_data( RID p_mesh, const Geometry:: d.resize(VS::ARRAY_MAX); d[ARRAY_VERTEX]=vertices; d[ARRAY_NORMAL]=normals; - mesh_add_surface(p_mesh,PRIMITIVE_TRIANGLES, d); + mesh_add_surface_from_arrays(p_mesh,PRIMITIVE_TRIANGLES, d); #else @@ -810,9 +460,6 @@ VisualServer::VisualServer() { // ERR_FAIL_COND(singleton); singleton=this; - mm_policy=GLOBAL_DEF("render/mipmap_policy",0); - if (mm_policy<0 || mm_policy>2) - mm_policy=0; } diff --git a/servers/visual_server.h b/servers/visual_server.h index 2f3d8371f6..918b0b102e 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -50,8 +50,6 @@ class VisualServer : public Object { DVector _shader_get_param_list(RID p_shader) const; void _camera_set_orthogonal(RID p_camera,float p_size,float p_z_near,float p_z_far); - void _viewport_set_rect(RID p_viewport,const Rect2& p_rect); - Rect2 _viewport_get_rect(RID p_viewport) const; void _canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector& p_margins, const Color& p_modulate=Color(1,1,1)); protected: RID _make_test_cube(); @@ -68,26 +66,12 @@ public: static VisualServer *get_singleton(); static VisualServer *create(); - enum MipMapPolicy { - - MIPMAPS_ENABLED, - MIPMAPS_ENABLED_FOR_PO2, - MIPMAPS_DISABLED - }; - - - virtual void set_mipmap_policy(MipMapPolicy p_policy); - virtual MipMapPolicy get_mipmap_policy() const; - enum { NO_INDEX_ARRAY=-1, - CUSTOM_ARRAY_SIZE=8, ARRAY_WEIGHTS_SIZE=4, - MAX_PARTICLE_COLOR_PHASES=4, - MAX_PARTICLE_ATTRACTORS=4, CANVAS_ITEM_Z_MIN=-4096, CANVAS_ITEM_Z_MAX=4096, @@ -106,7 +90,7 @@ public: TEXTURE_FLAG_CONVERT_TO_LINEAR=16, TEXTURE_FLAG_MIRRORED_REPEAT=32, /// Repeat texture, with alternate sections mirrored TEXTURE_FLAG_CUBEMAP=2048, - TEXTURE_FLAG_VIDEO_SURFACE=4096, + TEXTURE_FLAG_USED_FOR_STREAMING=4096, TEXTURE_FLAGS_DEFAULT=TEXTURE_FLAG_REPEAT|TEXTURE_FLAG_MIPMAPS|TEXTURE_FLAG_FILTER }; @@ -132,8 +116,6 @@ public: virtual uint32_t texture_get_width(RID p_texture) const=0; virtual uint32_t texture_get_height(RID p_texture) const=0; virtual void texture_set_size_override(RID p_texture,int p_width, int p_height)=0; - virtual bool texture_can_stream(RID p_texture) const=0; - virtual void texture_set_reload_hook(RID p_texture,ObjectID p_owner,const StringName& p_function) const=0; virtual void texture_set_path(RID p_texture,const String& p_path)=0; virtual String texture_get_path(RID p_texture) const=0; @@ -155,21 +137,19 @@ public: enum ShaderMode { - SHADER_MATERIAL, + SHADER_SPATIAL, SHADER_CANVAS_ITEM, - SHADER_POST_PROCESS, + SHADER_LIGHT, }; - virtual RID shader_create(ShaderMode p_mode=SHADER_MATERIAL)=0; + virtual RID shader_create(ShaderMode p_mode=SHADER_SPATIAL)=0; virtual void shader_set_mode(RID p_shader,ShaderMode p_mode)=0; virtual ShaderMode shader_get_mode(RID p_shader) const=0; - virtual void shader_set_code(RID p_shader, const String& p_vertex, const String& p_fragment,const String& p_light, int p_vertex_ofs=0,int p_fragment_ofs=0,int p_light_ofs=0)=0; - virtual String shader_get_fragment_code(RID p_shader) const=0; - virtual String shader_get_vertex_code(RID p_shader) const=0; - virtual String shader_get_light_code(RID p_shader) const=0; + virtual void shader_set_code(RID p_shader, const String& p_code)=0; + virtual String shader_get_code(RID p_shader) const=0; virtual void shader_get_param_list(RID p_shader, List *p_param_list) const=0; virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture)=0; @@ -186,114 +166,6 @@ public: virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0; virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0; - enum MaterialFlag { - MATERIAL_FLAG_VISIBLE, - MATERIAL_FLAG_DOUBLE_SIDED, - MATERIAL_FLAG_INVERT_FACES, ///< Invert front/back of the object - MATERIAL_FLAG_UNSHADED, - MATERIAL_FLAG_ONTOP, - MATERIAL_FLAG_LIGHTMAP_ON_UV2, - MATERIAL_FLAG_COLOR_ARRAY_SRGB, - MATERIAL_FLAG_MAX, - }; - - virtual void material_set_flag(RID p_material, MaterialFlag p_flag,bool p_enabled)=0; - virtual bool material_get_flag(RID p_material,MaterialFlag p_flag) const=0; - - enum MaterialDepthDrawMode { - MATERIAL_DEPTH_DRAW_ALWAYS, - MATERIAL_DEPTH_DRAW_OPAQUE_ONLY, - MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA, - MATERIAL_DEPTH_DRAW_NEVER - }; - - virtual void material_set_depth_draw_mode(RID p_material, MaterialDepthDrawMode p_mode)=0; - virtual MaterialDepthDrawMode material_get_depth_draw_mode(RID p_material) const=0; - - enum MaterialBlendMode { - MATERIAL_BLEND_MODE_MIX, //default - MATERIAL_BLEND_MODE_ADD, - MATERIAL_BLEND_MODE_SUB, - MATERIAL_BLEND_MODE_MUL, - MATERIAL_BLEND_MODE_PREMULT_ALPHA - }; - - - virtual void material_set_blend_mode(RID p_material,MaterialBlendMode p_mode)=0; - virtual MaterialBlendMode material_get_blend_mode(RID p_material) const=0; - - virtual void material_set_line_width(RID p_material,float p_line_width)=0; - virtual float material_get_line_width(RID p_material) const=0; - - - //fixed material api - - virtual RID fixed_material_create()=0; - - enum FixedMaterialParam { - - FIXED_MATERIAL_PARAM_DIFFUSE, - FIXED_MATERIAL_PARAM_DETAIL, - FIXED_MATERIAL_PARAM_SPECULAR, - FIXED_MATERIAL_PARAM_EMISSION, - FIXED_MATERIAL_PARAM_SPECULAR_EXP, - FIXED_MATERIAL_PARAM_GLOW, - FIXED_MATERIAL_PARAM_NORMAL, - FIXED_MATERIAL_PARAM_SHADE_PARAM, - FIXED_MATERIAL_PARAM_MAX - }; - - enum FixedMaterialTexCoordMode { - - FIXED_MATERIAL_TEXCOORD_UV, - FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM, - FIXED_MATERIAL_TEXCOORD_UV2, - FIXED_MATERIAL_TEXCOORD_SPHERE - }; - - enum FixedMaterialFlags { - - FIXED_MATERIAL_FLAG_USE_ALPHA, - FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY, - FIXED_MATERIAL_FLAG_USE_POINT_SIZE, - FIXED_MATERIAL_FLAG_DISCARD_ALPHA, - FIXED_MATERIAL_FLAG_USE_XY_NORMALMAP, - FIXED_MATERIAL_FLAG_MAX, - }; - - - virtual void fixed_material_set_flag(RID p_material, FixedMaterialFlags p_flag, bool p_enabled)=0; - virtual bool fixed_material_get_flag(RID p_material, FixedMaterialFlags p_flag) const=0; - - virtual void fixed_material_set_param(RID p_material, FixedMaterialParam p_parameter, const Variant& p_value)=0; - virtual Variant fixed_material_get_param(RID p_material,FixedMaterialParam p_parameter) const=0; - - virtual void fixed_material_set_texture(RID p_material,FixedMaterialParam p_parameter, RID p_texture)=0; - virtual RID fixed_material_get_texture(RID p_material,FixedMaterialParam p_parameter) const=0; - - - enum FixedMaterialLightShader { - - FIXED_MATERIAL_LIGHT_SHADER_LAMBERT, - FIXED_MATERIAL_LIGHT_SHADER_WRAP, - FIXED_MATERIAL_LIGHT_SHADER_VELVET, - FIXED_MATERIAL_LIGHT_SHADER_TOON, - - }; - - - virtual void fixed_material_set_light_shader(RID p_material,FixedMaterialLightShader p_shader)=0; - virtual FixedMaterialLightShader fixed_material_get_light_shader(RID p_material) const=0; - - virtual void fixed_material_set_texcoord_mode(RID p_material,FixedMaterialParam p_parameter, FixedMaterialTexCoordMode p_mode)=0; - virtual FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,FixedMaterialParam p_parameter) const=0; - - virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform)=0; - virtual Transform fixed_material_get_uv_transform(RID p_material) const=0; - - virtual void fixed_material_set_point_size(RID p_material,float p_size)=0; - virtual float fixed_material_get_point_size(RID p_material) const=0; - /* MESH API */ enum ArrayType { @@ -321,8 +193,25 @@ public: ARRAY_FORMAT_BONES=1<& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >())=0; - virtual void mesh_add_custom_surface(RID p_mesh,const Variant& p_dat)=0; //this is used by each platform in a different way virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -353,11 +240,16 @@ public: virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode)=0; virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; - virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material,bool p_owned=false)=0; + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const=0; virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const=0; + + virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const=0; + virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; + + virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; @@ -371,30 +263,47 @@ public: /* MULTIMESH API */ + virtual RID multimesh_create()=0; - virtual void multimesh_set_instance_count(RID p_multimesh,int p_count)=0; + enum MultimeshTransformFormat { + MULTIMESH_TRANSFORM_NONE, + MULTIMESH_TRANSFORM_2D, + MULTIMESH_TRANSFORM_3D, + }; + + enum MultimeshColorFormat { + MULTIMESH_COLOR_NONE, + MULTIMESH_COLOR_8BIT, + MULTIMESH_COLOR_FLOAT, + }; + + virtual void multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb=true)=0; virtual int multimesh_get_instance_count(RID p_multimesh) const=0; virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0; - virtual void multimesh_set_aabb(RID p_multimesh,const AABB& p_aabb)=0; + virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb)=0; virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0; + virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0; virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; - virtual AABB multimesh_get_aabb(RID p_multimesh,const AABB& p_aabb) const=0;; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; + virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const=0; virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0; virtual int multimesh_get_visible_instances(RID p_multimesh) const=0; + /* IMMEDIATE API */ virtual RID immediate_create()=0; virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID())=0; virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0; + virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0; virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0; virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0; virtual void immediate_color(RID p_immediate,const Color& p_color)=0; @@ -405,82 +314,15 @@ public: virtual void immediate_set_material(RID p_immediate,RID p_material)=0; virtual RID immediate_get_material(RID p_immediate) const=0; + /* SKELETON API */ - /* PARTICLES API */ - - virtual RID particles_create()=0; - - enum ParticleVariable { - PARTICLE_LIFETIME, - PARTICLE_SPREAD, - PARTICLE_GRAVITY, - PARTICLE_LINEAR_VELOCITY, - PARTICLE_ANGULAR_VELOCITY, - PARTICLE_LINEAR_ACCELERATION, - PARTICLE_RADIAL_ACCELERATION, - PARTICLE_TANGENTIAL_ACCELERATION, - PARTICLE_DAMPING, - PARTICLE_INITIAL_SIZE, - PARTICLE_FINAL_SIZE, - PARTICLE_INITIAL_ANGLE, - PARTICLE_HEIGHT, - PARTICLE_HEIGHT_SPEED_SCALE, - PARTICLE_VAR_MAX - }; - - virtual void particles_set_amount(RID p_particles, int p_amount)=0; - virtual int particles_get_amount(RID p_particles) const=0; - - virtual void particles_set_emitting(RID p_particles, bool p_emitting)=0; - virtual bool particles_is_emitting(RID p_particles) const=0; - - virtual void particles_set_visibility_aabb(RID p_particles, const AABB& p_visibility)=0; - virtual AABB particles_get_visibility_aabb(RID p_particles) const=0; - - virtual void particles_set_emission_half_extents(RID p_particles, const Vector3& p_half_extents)=0; - virtual Vector3 particles_get_emission_half_extents(RID p_particles) const=0; - - virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity)=0; - virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const=0; - - virtual void particles_set_emission_points(RID p_particles, const DVector& p_points)=0; - virtual DVector particles_get_emission_points(RID p_particles) const=0; - - virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal)=0; - virtual Vector3 particles_get_gravity_normal(RID p_particles) const=0; - - virtual void particles_set_variable(RID p_particles, ParticleVariable p_variable,float p_value)=0; - virtual float particles_get_variable(RID p_particles, ParticleVariable p_variable) const=0; - - virtual void particles_set_randomness(RID p_particles, ParticleVariable p_variable,float p_randomness)=0; - virtual float particles_get_randomness(RID p_particles, ParticleVariable p_variable) const=0; - - virtual void particles_set_color_phases(RID p_particles, int p_phases)=0; - virtual int particles_get_color_phases(RID p_particles) const=0; - - virtual void particles_set_color_phase_pos(RID p_particles, int p_phase, float p_pos)=0; - virtual float particles_get_color_phase_pos(RID p_particles, int p_phase) const=0; - - virtual void particles_set_color_phase_color(RID p_particles, int p_phase, const Color& p_color)=0; - virtual Color particles_get_color_phase_color(RID p_particles, int p_phase) const=0; - - virtual void particles_set_attractors(RID p_particles, int p_attractors)=0; - virtual int particles_get_attractors(RID p_particles) const=0; - - virtual void particles_set_attractor_pos(RID p_particles, int p_attractor, const Vector3& p_pos)=0; - virtual Vector3 particles_get_attractor_pos(RID p_particles,int p_attractor) const=0; - - virtual void particles_set_attractor_strength(RID p_particles, int p_attractor, float p_force)=0; - virtual float particles_get_attractor_strength(RID p_particles,int p_attractor) const=0; - - virtual void particles_set_material(RID p_particles, RID p_material,bool p_owned=false)=0; - virtual RID particles_get_material(RID p_particles) const=0; - - virtual void particles_set_height_from_velocity(RID p_particles, bool p_enable)=0; - virtual bool particles_has_height_from_velocity(RID p_particles) const=0; - - virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable)=0; - virtual bool particles_is_using_local_coordinates(RID p_particles) const=0; + virtual RID skeleton_create()=0; + virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false)=0; + virtual int skeleton_get_bone_count(RID p_skeleton) const=0; + virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0; + virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)=0; /* Light API */ @@ -490,62 +332,36 @@ public: LIGHT_SPOT }; - enum LightColor { - LIGHT_COLOR_DIFFUSE, - LIGHT_COLOR_SPECULAR - }; - enum LightParam { - LIGHT_PARAM_SPOT_ATTENUATION, - LIGHT_PARAM_SPOT_ANGLE, - LIGHT_PARAM_RADIUS, LIGHT_PARAM_ENERGY, - LIGHT_PARAM_ATTENUATION, - LIGHT_PARAM_SHADOW_DARKENING, - LIGHT_PARAM_SHADOW_Z_OFFSET, - LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE, - LIGHT_PARAM_SHADOW_ESM_MULTIPLIER, - LIGHT_PARAM_SHADOW_BLUR_PASSES, + LIGHT_PARAM_SPECULAR, + LIGHT_PARAM_RANGE, + LIGHT_PARAM_SPOT_ANGLE, + LIGHT_PARAM_SHADOW_MAX_DISTANCE, + LIGHT_PARAM_SHADOW_DARKNESS, + LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, + LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, + LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, + LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET, + LIGHT_PARAM_SHADOW_NORMAL_BIAS, + LIGHT_PARAM_SHADOW_BIAS_1, + LIGHT_PARAM_SHADOW_BIAS_2, + LIGHT_PARAM_SHADOW_BIAS_3, + LIGHT_PARAM_SHADOW_BIAS_4, LIGHT_PARAM_MAX }; virtual RID light_create(LightType p_type)=0; - virtual LightType light_get_type(RID p_light) const=0; - - virtual void light_set_color(RID p_light,LightColor p_type, const Color& p_color)=0; - virtual Color light_get_color(RID p_light,LightColor p_type) const=0; + virtual void light_set_color(RID p_light,const Color& p_color)=0; + virtual void light_set_param(RID p_light,LightParam p_param,float p_value)=0; virtual void light_set_shadow(RID p_light,bool p_enabled)=0; - virtual bool light_has_shadow(RID p_light) const=0; - - virtual void light_set_volumetric(RID p_light,bool p_enabled)=0; - virtual bool light_is_volumetric(RID p_light) const=0; - virtual void light_set_projector(RID p_light,RID p_texture)=0; - virtual RID light_get_projector(RID p_light) const=0; - - virtual void light_set_param(RID p_light, LightParam p_var, float p_value)=0; - virtual float light_get_param(RID p_light, LightParam p_var) const=0; - - enum LightOp { - - LIGHT_OPERATOR_ADD, - LIGHT_OPERATOR_SUB - }; - - virtual void light_set_operator(RID p_light,LightOp p_op)=0; - virtual LightOp light_get_operator(RID p_light) const=0; - - // omni light - enum LightOmniShadowMode { - LIGHT_OMNI_SHADOW_DEFAULT, - LIGHT_OMNI_SHADOW_DUAL_PARABOLOID, - LIGHT_OMNI_SHADOW_CUBEMAP - }; - - virtual void light_omni_set_shadow_mode(RID p_light,LightOmniShadowMode p_mode)=0; - virtual LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) const=0; + virtual void light_set_attenuation_texure(RID p_light,RID p_texture)=0; + virtual void light_set_negative(RID p_light,bool p_enable)=0; + virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; + virtual void light_set_shader(RID p_light,RID p_shader)=0; // directional light enum LightDirectionalShadowMode { @@ -556,33 +372,27 @@ public: }; virtual void light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode)=0; - virtual LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) const=0; - - enum LightDirectionalShadowParam { - - LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE, - LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_SPLIT_WEIGHT, - LIGHT_DIRECTIONAL_SHADOW_PARAM_PSSM_ZOFFSET_SCALE, - }; - virtual void light_directional_set_shadow_param(RID p_light,LightDirectionalShadowParam p_param, float p_value)=0; - virtual float light_directional_get_shadow_param(RID p_light,LightDirectionalShadowParam p_param) const=0; + /* PROBE API */ - //@TODO fallof model and all that stuff + virtual RID reflection_probe_create()=0; - /* SKELETON API */ + virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity)=0; + virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far)=0; + virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance)=0; + virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents)=0; + virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset)=0; + virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution)=0; + virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide)=0; + virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0; - virtual RID skeleton_create()=0; - virtual void skeleton_resize(RID p_skeleton,int p_bones)=0; - virtual int skeleton_get_bone_count(RID p_skeleton) const=0; - virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0; /* ROOM API */ virtual RID room_create()=0; - virtual void room_set_bounds(RID p_room, const BSP_Tree& p_bounds)=0; - virtual BSP_Tree room_get_bounds(RID p_room) const=0; + virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform)=0; + virtual void room_clear_bounds()=0; /* PORTAL API */ @@ -591,144 +401,55 @@ public: virtual RID portal_create()=0; virtual void portal_set_shape(RID p_portal, const Vector& p_shape)=0; - virtual Vector portal_get_shape(RID p_portal) const=0; virtual void portal_set_enabled(RID p_portal, bool p_enabled)=0; - virtual bool portal_is_enabled(RID p_portal) const=0; virtual void portal_set_disable_distance(RID p_portal, float p_distance)=0; - virtual float portal_get_disable_distance(RID p_portal) const=0; virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0; - virtual Color portal_get_disabled_color(RID p_portal) const=0; - virtual void portal_set_connect_range(RID p_portal, float p_range) =0; - virtual float portal_get_connect_range(RID p_portal) const =0; - /* BAKED LIGHT API */ - virtual RID baked_light_create()=0; - enum BakedLightMode { - BAKED_LIGHT_OCTREE, - BAKED_LIGHT_LIGHTMAPS - }; - - virtual void baked_light_set_mode(RID p_baked_light,BakedLightMode p_mode)=0; - virtual BakedLightMode baked_light_get_mode(RID p_baked_light) const=0; - - virtual void baked_light_set_octree(RID p_baked_light,const DVector p_octree)=0; - virtual DVector baked_light_get_octree(RID p_baked_light) const=0; - - virtual void baked_light_set_light(RID p_baked_light,const DVector p_light)=0; - virtual DVector baked_light_get_light(RID p_baked_light) const=0; - - virtual void baked_light_set_sampler_octree(RID p_baked_light,const DVector &p_sampler)=0; - virtual DVector baked_light_get_sampler_octree(RID p_baked_light) const=0; - - virtual void baked_light_set_lightmap_multiplier(RID p_baked_light,float p_multiplier)=0; - virtual float baked_light_get_lightmap_multiplier(RID p_baked_light) const=0; - - virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id)=0; - virtual void baked_light_clear_lightmaps(RID p_baked_light)=0; - - virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled)=0; - virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const=0; - - virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color)=0; - virtual Color baked_light_get_realtime_color(RID p_baked_light) const=0; - - virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) = 0; - virtual float baked_light_get_realtime_energy(RID p_baked_light) const = 0; - - /* BAKED LIGHT SAMPLER */ - - virtual RID baked_light_sampler_create()=0; - - enum BakedLightSamplerParam { - BAKED_LIGHT_SAMPLER_RADIUS, - BAKED_LIGHT_SAMPLER_STRENGTH, - BAKED_LIGHT_SAMPLER_ATTENUATION, - BAKED_LIGHT_SAMPLER_DETAIL_RATIO, - BAKED_LIGHT_SAMPLER_MAX - }; - - virtual void baked_light_sampler_set_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param,float p_value)=0; - virtual float baked_light_sampler_get_param(RID p_baked_light_sampler,BakedLightSamplerParam p_param) const=0; - - virtual void baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution)=0; - virtual int baked_light_sampler_get_resolution(RID p_baked_light_sampler) const=0; - /* CAMERA API */ virtual RID camera_create()=0; virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far)=0; virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far)=0; virtual void camera_set_transform(RID p_camera,const Transform& p_transform)=0; - - virtual void camera_set_visible_layers(RID p_camera,uint32_t p_layers)=0; - virtual uint32_t camera_get_visible_layers(RID p_camera) const=0; - + virtual void camera_set_cull_mask(RID p_camera,uint32_t p_layers)=0; virtual void camera_set_environment(RID p_camera,RID p_env)=0; - virtual RID camera_get_environment(RID p_camera) const=0; - virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable)=0; - virtual bool camera_is_using_vertical_aspect(RID p_camera,bool p_enable) const=0; -/* - virtual void camera_add_layer(RID p_camera); - virtual void camera_layer_move_up(RID p_camera,int p_layer); - virtual void camera_layer_move_down(RID p_camera,int p_layer); - virtual void camera_layer_set_mask(RID p_camera,int p_layer,int p_mask); - virtual int camera_layer_get_mask(RID p_camera,int p_layer) const; - enum CameraLayerFlag { - - FLAG_CLEAR_DEPTH, - FLAG_CLEAR_COLOR, - FLAG_IGNORE_FOG, - }; - virtual void camera_layer_set_flag(RID p_camera,int p_layer,bool p_enable); - virtual bool camera_layer_get_flag(RID p_camera,int p_layer) const; - -*/ - - - /* VIEWPORT API */ + /* VIEWPORT TARGET API */ virtual RID viewport_create()=0; - virtual void viewport_attach_to_screen(RID p_viewport,int p_screen=0)=0; + virtual void viewport_set_size(RID p_viewport,int p_width,int p_height)=0; + virtual void viewport_set_active(RID p_viewport,bool p_active)=0; + + virtual void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0)=0; virtual void viewport_detach(RID p_viewport)=0; - virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect)=0; - enum RenderTargetUpdateMode { - RENDER_TARGET_UPDATE_DISABLED, - RENDER_TARGET_UPDATE_ONCE, //then goes to disabled - RENDER_TARGET_UPDATE_WHEN_VISIBLE, // default - RENDER_TARGET_UPDATE_ALWAYS + enum ViewportUpdateMode { + VIEWPORT_UPDATE_DISABLED, + VIEWPORT_UPDATE_ONCE, //then goes to disabled, must be manually updated + VIEWPORT_UPDATE_WHEN_VISIBLE, // default + VIEWPORT_UPDATE_ALWAYS }; - virtual void viewport_set_as_render_target(RID p_viewport,bool p_enable)=0; - virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode)=0; - virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const=0; - virtual RID viewport_get_render_target_texture(RID p_viewport) const=0; - virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable)=0; - virtual bool viewport_get_render_target_vflip(RID p_viewport) const=0; - virtual void viewport_set_render_target_clear_on_new_frame(RID p_viewport,bool p_enable)=0; - virtual bool viewport_get_render_target_clear_on_new_frame(RID p_viewport) const=0; - virtual void viewport_render_target_clear(RID p_viewport)=0; - - virtual void viewport_queue_screen_capture(RID p_viewport)=0; - virtual Image viewport_get_screen_capture(RID p_viewport) const=0; - + virtual void viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode)=0; + virtual void viewport_set_vflip(RID p_viewport,bool p_enable)=0; + enum ViewportClearMode { - struct ViewportRect { - - int x,y,width,height; - ViewportRect() { x=y=width=height=0; } + VIEWPORT_CLEAR_ALWAYS, + VIWEPORT_CLEAR_NEVER, + VIEWPORT_CLEAR_ONLY_NEXT_FRAME }; - virtual void viewport_set_rect(RID p_viewport,const ViewportRect& p_rect)=0; - virtual ViewportRect viewport_get_rect(RID p_viewport) const=0; + virtual void viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode)=0; + + virtual RID viewport_get_texture(RID p_viewport) const=0; + virtual Image viewport_capture(RID p_viewport) const=0; virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide)=0; virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide)=0; @@ -736,22 +457,15 @@ public: virtual void viewport_attach_camera(RID p_viewport,RID p_camera)=0; virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0; - virtual RID viewport_get_attached_camera(RID p_viewport) const=0; - virtual RID viewport_get_scenario(RID p_viewport) const=0; virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas)=0; virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas)=0; virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset)=0; - virtual Matrix32 viewport_get_canvas_transform(RID p_viewport,RID p_canvas) const=0; virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled)=0; - virtual bool viewport_has_transparent_background(RID p_viewport) const=0; - virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform)=0; - virtual Matrix32 viewport_get_global_canvas_transform(RID p_viewport) const=0; virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer)=0; - /* ENVIRONMENT API */ virtual RID environment_create()=0; @@ -759,103 +473,48 @@ public: enum EnvironmentBG { ENV_BG_KEEP, - ENV_BG_DEFAULT_COLOR, ENV_BG_COLOR, - ENV_BG_TEXTURE, - ENV_BG_CUBEMAP, + ENV_BG_SKYBOX, ENV_BG_CANVAS, ENV_BG_MAX }; virtual void environment_set_background(RID p_env,EnvironmentBG p_bg)=0; - virtual EnvironmentBG environment_get_background(RID p_env) const=0; - - enum EnvironmentBGParam { - - ENV_BG_PARAM_CANVAS_MAX_LAYER, - ENV_BG_PARAM_COLOR, - ENV_BG_PARAM_TEXTURE, - ENV_BG_PARAM_CUBEMAP, - ENV_BG_PARAM_ENERGY, - ENV_BG_PARAM_SCALE, - ENV_BG_PARAM_GLOW, - ENV_BG_PARAM_MAX - }; + virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0)=0; + virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; + virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0)=0; + //set default SSAO options + //set default SSR options + //set default SSSSS options - virtual void environment_set_background_param(RID p_env,EnvironmentBGParam p_param, const Variant& p_value)=0; - virtual Variant environment_get_background_param(RID p_env,EnvironmentBGParam p_param) const=0; - - enum EnvironmentFx { - ENV_FX_AMBIENT_LIGHT, - ENV_FX_FXAA, - ENV_FX_GLOW, - ENV_FX_DOF_BLUR, - ENV_FX_HDR, - ENV_FX_FOG, - ENV_FX_BCS, - ENV_FX_SRGB, - ENV_FX_MAX - }; - - - - virtual void environment_set_enable_fx(RID p_env,EnvironmentFx p_effect,bool p_enabled)=0; - virtual bool environment_is_fx_enabled(RID p_env,EnvironmentFx p_mode) const=0; - - enum EnvironmentFxBlurBlendMode { - ENV_FX_BLUR_BLEND_MODE_ADDITIVE, - ENV_FX_BLUR_BLEND_MODE_SCREEN, - ENV_FX_BLUR_BLEND_MODE_SOFTLIGHT, + enum EnvironmentGlowBlendMode { + GLOW_BLEND_MODE_ADDITIVE, + GLOW_BLEND_MODE_SCREEN, + GLOW_BLEND_MODE_SOFTLIGHT, + GLOW_BLEND_MODE_DISABLED, }; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode)=0; + virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; - enum EnvironmentFxHDRToneMapper { - ENV_FX_HDR_TONE_MAPPER_LINEAR, - ENV_FX_HDR_TONE_MAPPER_LOG, - ENV_FX_HDR_TONE_MAPPER_REINHARDT, - ENV_FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE, - }; - enum EnvironmentFxParam { - ENV_FX_PARAM_AMBIENT_LIGHT_COLOR, - ENV_FX_PARAM_AMBIENT_LIGHT_ENERGY, - ENV_FX_PARAM_GLOW_BLUR_PASSES, - ENV_FX_PARAM_GLOW_BLUR_SCALE, - ENV_FX_PARAM_GLOW_BLUR_STRENGTH, - ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE, - ENV_FX_PARAM_GLOW_BLOOM, - ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD, - ENV_FX_PARAM_DOF_BLUR_PASSES, - ENV_FX_PARAM_DOF_BLUR_BEGIN, - ENV_FX_PARAM_DOF_BLUR_RANGE, - ENV_FX_PARAM_HDR_TONEMAPPER, - ENV_FX_PARAM_HDR_EXPOSURE, - ENV_FX_PARAM_HDR_WHITE, - ENV_FX_PARAM_HDR_GLOW_TRESHOLD, - ENV_FX_PARAM_HDR_GLOW_SCALE, - ENV_FX_PARAM_HDR_MIN_LUMINANCE, - ENV_FX_PARAM_HDR_MAX_LUMINANCE, - ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED, - ENV_FX_PARAM_FOG_BEGIN, - ENV_FX_PARAM_FOG_BEGIN_COLOR, - ENV_FX_PARAM_FOG_END_COLOR, - ENV_FX_PARAM_FOG_ATTENUATION, - ENV_FX_PARAM_FOG_BG, - ENV_FX_PARAM_BCS_BRIGHTNESS, - ENV_FX_PARAM_BCS_CONTRAST, - ENV_FX_PARAM_BCS_SATURATION, - ENV_FX_PARAM_MAX + enum EnvironmentToneMapper { + ENV_TONE_MAPPER_LINEAR, + ENV_TONE_MAPPER_REINHARDT, + ENV_TONE_MAPPER_FILMIC }; - virtual void environment_fx_set_param(RID p_env,EnvironmentFxParam p_effect,const Variant& p_param)=0; - virtual Variant environment_fx_get_param(RID p_env,EnvironmentFxParam p_effect) const=0; + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0; + virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0; + virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0; + virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0; /* SCENARIO API */ - - virtual RID scenario_create()=0; enum ScenarioDebugMode { @@ -881,14 +540,14 @@ public: INSTANCE_MESH, INSTANCE_MULTIMESH, INSTANCE_IMMEDIATE, - INSTANCE_PARTICLES, INSTANCE_LIGHT, + INSTANCE_REFLECTION_PROBE, INSTANCE_ROOM, INSTANCE_PORTAL, - INSTANCE_BAKED_LIGHT, - INSTANCE_BAKED_LIGHT_SAMPLER, + /*INSTANCE_BAKED_LIGHT, + INSTANCE_BAKED_LIGHT_SAMPLER,*/ - INSTANCE_GEOMETRY_MASK=(1< instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const=0; - virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const=0; - virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const=0; + virtual Vector instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const=0; + virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const=0; + virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const=0; enum InstanceFlags { INSTANCE_FLAG_VISIBLE, INSTANCE_FLAG_BILLBOARD, INSTANCE_FLAG_BILLBOARD_FIX_Y, INSTANCE_FLAG_CAST_SHADOW, - INSTANCE_FLAG_RECEIVE_SHADOWS, INSTANCE_FLAG_DEPH_SCALE, INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, INSTANCE_FLAG_USE_BAKED_LIGHT, @@ -958,80 +595,53 @@ public: }; virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled)=0; - virtual bool instance_geometry_get_flag(RID p_instance,InstanceFlags p_flags) const=0; - virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0; - virtual ShadowCastingSetting instance_geometry_get_cast_shadows_setting(RID p_instance) const = 0; - virtual void instance_geometry_set_material_override(RID p_instance, RID p_material)=0; - virtual RID instance_geometry_get_material_override(RID p_instance) const=0; - - virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max)=0; - virtual float instance_geometry_get_draw_range_max(RID p_instance) const=0; - virtual float instance_geometry_get_draw_range_min(RID p_instance) const=0; - - virtual void instance_geometry_set_baked_light(RID p_instance,RID p_baked_light)=0; - virtual RID instance_geometry_get_baked_light(RID p_instance) const=0; - virtual void instance_geometry_set_baked_light_sampler(RID p_instance,RID p_baked_light_sampler)=0; - virtual RID instance_geometry_get_baked_light_sampler(RID p_instance) const=0; - virtual void instance_geometry_set_baked_light_texture_index(RID p_instance,int p_tex_id)=0; - virtual int instance_geometry_get_baked_light_texture_index(RID p_instance) const=0; - - - virtual void instance_light_set_enabled(RID p_instance,bool p_enabled)=0; - virtual bool instance_light_is_enabled(RID p_instance) const=0; + virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin)=0; + virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance)=0; /* CANVAS (2D) */ virtual RID canvas_create()=0; virtual void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring)=0; - virtual Point2 canvas_get_item_mirroring(RID p_canvas,RID p_item) const=0; virtual void canvas_set_modulate(RID p_canvas,const Color& p_color)=0; - virtual RID canvas_item_create()=0; virtual void canvas_item_set_parent(RID p_item,RID p_parent)=0; - virtual RID canvas_item_get_parent(RID p_canvas_item) const=0; virtual void canvas_item_set_visible(RID p_item,bool p_visible)=0; - virtual bool canvas_item_is_visible(RID p_item) const=0; - virtual void canvas_item_set_light_mask(RID p_item,int p_mask)=0; - virtual void canvas_item_set_blend_mode(RID p_canvas_item,MaterialBlendMode p_blend)=0; - - virtual void canvas_item_attach_viewport(RID p_item, RID p_viewport)=0; - - //virtual void canvas_item_set_rect(RID p_item, const Rect2& p_rect)=0; - virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform)=0; virtual void canvas_item_set_clip(RID p_item, bool p_clip)=0; virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable)=0; virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2())=0; - virtual void canvas_item_set_opacity(RID p_item, float p_opacity)=0; - virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const=0; + virtual void canvas_item_set_modulate(RID p_item, const Color& p_color)=0; + virtual void canvas_item_set_self_modulate(RID p_item, const Color& p_color)=0; - virtual void canvas_item_set_self_opacity(RID p_item, float p_self_opacity)=0; - virtual float canvas_item_get_self_opacity(RID p_item, float p_self_opacity) const=0; + virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable)=0; - virtual void canvas_item_set_on_top(RID p_item, bool p_on_top)=0; - virtual bool canvas_item_is_on_top(RID p_item) const=0; + enum NinePatchAxisMode { + NINE_PATCH_STRETCH, + NINE_PATCH_TILE, + NINE_PATCH_TILE_FIT, + }; virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width=1.0,bool p_antialiased=false)=0; virtual void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color)=0; virtual void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color)=0; virtual void canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile=false,const Color& p_modulate=Color(1,1,1),bool p_transpose=false)=0; virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1),bool p_transpose=false)=0; - virtual void canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright, bool p_draw_center=true,const Color& p_modulate=Color(1,1,1))=0; + virtual void canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode=NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode=NINE_PATCH_STRETCH,bool p_draw_center=true,const Color& p_modulate=Color(1,1,1))=0; virtual void canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width=1.0)=0; virtual void canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID())=0; virtual void canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID(), int p_count=-1)=0; - virtual void canvas_item_add_triangle_array_ptr(RID p_item, int p_count, const int* p_indices, const Point2* p_points, const Color* p_colors,const Point2* p_uvs=NULL, RID p_texture=RID())=0; + virtual void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID())=0; + virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID())=0; virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform)=0; - virtual void canvas_item_add_set_blend_mode(RID p_item, MaterialBlendMode p_blend)=0; virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore)=0; virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable)=0; virtual void canvas_item_set_z(RID p_item, int p_z)=0; @@ -1039,7 +649,7 @@ public: virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect)=0; virtual void canvas_item_clear(RID p_item)=0; - virtual void canvas_item_raise(RID p_item)=0; + virtual void canvas_item_set_draw_index(RID p_item,int p_index)=0; virtual void canvas_item_set_material(RID p_item, RID p_material)=0; @@ -1057,8 +667,8 @@ public: virtual void canvas_light_set_energy(RID p_light, float p_energy)=0; virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z)=0; virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer)=0; - virtual void canvas_light_set_item_mask(RID p_light, int p_mask)=0; - virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask)=0; + virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask)=0; + virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask)=0; enum CanvasLightMode { CANVAS_LIGHT_MODE_ADD, @@ -1068,9 +678,20 @@ public: }; virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode)=0; + + + enum CanvasLightShadowFilter { + CANVAS_LIGHT_FILTER_NONE, + CANVAS_LIGHT_FILTER_PCF3, + CANVAS_LIGHT_FILTER_PCF5, + CANVAS_LIGHT_FILTER_PCF9, + CANVAS_LIGHT_FILTER_PCF13, + }; + virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled)=0; virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size)=0; - virtual void canvas_light_set_shadow_esm_multiplier(RID p_light, float p_multiplier)=0; + virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length)=0; + virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter)=0; virtual void canvas_light_set_shadow_color(RID p_light, const Color& p_color)=0; @@ -1085,6 +706,7 @@ public: virtual RID canvas_occluder_polygon_create()=0; virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed)=0; virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape)=0; + enum CanvasOccluderPolygonCullMode { CANVAS_OCCLUDER_POLYGON_CULL_DISABLED, CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE, @@ -1092,21 +714,6 @@ public: }; virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode)=0; - /* CANVAS ITEM MATERIAL */ - - virtual RID canvas_item_material_create()=0; - virtual void canvas_item_material_set_shader(RID p_material, RID p_shader)=0; - virtual void canvas_item_material_set_shader_param(RID p_material, const StringName& p_param, const Variant& p_value)=0; - virtual Variant canvas_item_material_get_shader_param(RID p_material, const StringName& p_param) const=0; - - - enum CanvasItemShadingMode { - CANVAS_ITEM_SHADING_NORMAL, - CANVAS_ITEM_SHADING_UNSHADED, - CANVAS_ITEM_SHADING_ONLY_LIGHT, - }; - - virtual void canvas_item_material_set_shading_mode(RID p_material, CanvasItemShadingMode p_mode)=0; /* CURSOR */ virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0)=0; // radians @@ -1125,15 +732,6 @@ public: virtual void free( RID p_rid )=0; ///< free RIDs associated with the visual server - /* CUSTOM SHADING */ - - virtual void custom_shade_model_set_shader(int p_model, RID p_shader)=0; - virtual RID custom_shade_model_get_shader(int p_model) const=0; - virtual void custom_shade_model_set_name(int p_model, const String& p_name)=0; - virtual String custom_shade_model_get_name(int p_model) const=0; - virtual void custom_shade_model_set_param_info(int p_model, const List& p_info)=0; - virtual void custom_shade_model_get_param_info(int p_model, List* p_info) const=0; - /* EVENT QUEUING */ virtual void draw()=0; @@ -1166,7 +764,6 @@ public: RID material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_alpha,bool p_opaque_prepass); - /* TESTING */ virtual RID get_test_cube()=0; @@ -1185,7 +782,6 @@ public: enum Features { FEATURE_SHADERS, FEATURE_MULTITHREADED, - FEATURE_NEEDS_RELOAD_HOOK, }; virtual bool has_feature(Features p_feature) const=0; @@ -1200,19 +796,15 @@ public: VARIANT_ENUM_CAST( VisualServer::CubeMapSide ); VARIANT_ENUM_CAST( VisualServer::TextureFlags ); VARIANT_ENUM_CAST( VisualServer::ShaderMode ); -VARIANT_ENUM_CAST( VisualServer::MaterialFlag ); -VARIANT_ENUM_CAST( VisualServer::MaterialBlendMode ); -VARIANT_ENUM_CAST( VisualServer::ParticleVariable ); VARIANT_ENUM_CAST( VisualServer::ArrayType ); VARIANT_ENUM_CAST( VisualServer::ArrayFormat ); VARIANT_ENUM_CAST( VisualServer::PrimitiveType ); VARIANT_ENUM_CAST( VisualServer::LightType ); -VARIANT_ENUM_CAST( VisualServer::LightColor ); VARIANT_ENUM_CAST( VisualServer::LightParam ); VARIANT_ENUM_CAST( VisualServer::ScenarioDebugMode ); VARIANT_ENUM_CAST( VisualServer::InstanceType ); VARIANT_ENUM_CAST( VisualServer::RenderInfo ); -VARIANT_ENUM_CAST( VisualServer::MipMapPolicy ); + //typedef VisualServer VS; // makes it easier to use #define VS VisualServer diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 9240e3527c..6fb796ae6a 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -895,7 +895,7 @@ void FindReplaceDialog::_bind_methods() { FindReplaceDialog::FindReplaceDialog() { - set_self_opacity(0.8); + set_self_modulate(Color(1,1,1,0.8)); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); diff --git a/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index 97062b1480..bf8a891247 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -399,7 +399,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2& p_point, Control for (int i = 0; i < max_size; i++) { Label *label = memnew( Label(autoloads[i]) ); - label->set_self_opacity(Math::lerp(1, 0, float(i)/PREVIEW_LIST_MAX_SIZE)); + label->set_self_modulate(Color(1,1,1,Math::lerp(1, 0, float(i)/PREVIEW_LIST_MAX_SIZE))); preview->add_child(label); } diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 4f83dc2f66..628870c70f 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -1710,7 +1710,7 @@ EditorHelp::EditorHelp() { search_dialog->get_ok()->set_text(TTR("Find")); search_dialog->connect("confirmed",this,"_search_cbk"); search_dialog->set_hide_on_ok(false); - search_dialog->set_self_opacity(0.8); + search_dialog->set_self_modulate(Color(1,1,1,0.8)); /*class_search = memnew( EditorHelpSearch(editor) ); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 8274272a7e..7f02624107 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -907,10 +907,11 @@ void EditorNode::_save_scene_with_preview(String p_file) { _editor_select(is2d?EDITOR_2D:EDITOR_3D); - VS::get_singleton()->viewport_queue_screen_capture(viewport); + save.step(TTR("Creating Thumbnail"),2); save.step(TTR("Creating Thumbnail"),3); - Image img = VS::get_singleton()->viewport_get_screen_capture(viewport); +#if 0 + Image img = VS::get_singleton()->viewport_texture(scree_capture(viewport); int preview_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");; preview_size*=EDSCALE; int width,height; @@ -928,7 +929,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { height=img.get_height(); } - img.convert(Image::FORMAT_RGB); + img.convert(Image::FORMAT_RGB8); img.resize(width,height); String pfile = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/last_scene_preview.png"); @@ -940,7 +941,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { if (editor_data.get_edited_scene_import_metadata().is_null()) editor_data.set_edited_scene_import_metadata(Ref( memnew( ResourceImportMetadata ) ) ); editor_data.get_edited_scene_import_metadata()->set_option("thumbnail",imgdata); - +#endif //tamanio tel thumbnail if (screen!=-1) { _editor_select(screen); @@ -1243,7 +1244,7 @@ void EditorNode::_dialog_action(String p_file) { ml = Ref( memnew( MeshLibrary )); } - MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); +// MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true); Error err = ResourceSaver::save(p_file,ml); if (err) { @@ -4145,7 +4146,7 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); +// ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -6537,10 +6538,10 @@ EditorNode::EditorNode() { //more visually meaningful to have this later raise_bottom_panel_item(AnimationPlayerEditor::singleton); - add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) ); +/* add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) ); add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) ); add_editor_plugin( memnew( ShaderEditorPlugin(this,true) ) ); - add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) ); + add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) );*/ add_editor_plugin( memnew( CameraEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleLibraryEditorPlugin(this) ) ); @@ -6549,14 +6550,14 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( MeshInstanceEditorPlugin(this) ) ); add_editor_plugin( memnew( AnimationTreeEditorPlugin(this) ) ); //add_editor_plugin( memnew( SamplePlayerEditorPlugin(this) ) ); - this is kind of useless at this point - add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) ); //add_editor_plugin( memnew( StreamEditorPlugin(this) ) ); add_editor_plugin( memnew( StyleBoxEditorPlugin(this) ) ); - add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) ); + //add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) ); add_editor_plugin( memnew( ResourcePreloaderEditorPlugin(this) ) ); add_editor_plugin( memnew( ItemListEditorPlugin(this) ) ); //add_editor_plugin( memnew( RichTextEditorPlugin(this) ) ); - add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); +// add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionPolygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TileSetEditorPlugin(this) ) ); add_editor_plugin( memnew( TileMapEditorPlugin(this) ) ); @@ -6564,16 +6565,16 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( TextureRegionEditorPlugin(this) ) ); add_editor_plugin( memnew( Particles2DEditorPlugin(this) ) ); add_editor_plugin( memnew( Path2DEditorPlugin(this) ) ); - add_editor_plugin( memnew( PathEditorPlugin(this) ) ); - add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); +// add_editor_plugin( memnew( PathEditorPlugin(this) ) ); + //add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( LightOccluder2DEditorPlugin(this) ) ); add_editor_plugin( memnew( NavigationPolygonEditorPlugin(this) ) ); add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) ); add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) ); add_editor_plugin( memnew( TextureEditorPlugin(this) ) ); - add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); - add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MaterialEditorPlugin(this) ) ); +// add_editor_plugin( memnew( MeshEditorPlugin(this) ) ); for(int i=0;iadd_preview_generator( Ref( memnew(EditorTexturePreviewPlugin ))); + /*resource_preview->add_preview_generator( Ref( memnew(EditorTexturePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorPackedScenePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorMaterialPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorScriptPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorSamplePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorMeshPreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorBitmapPreviewPlugin ))); - +*/ circle_step_msec=OS::get_singleton()->get_ticks_msec(); diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp index 13327f0be9..435ad78b89 100644 --- a/tools/editor/editor_profiler.cpp +++ b/tools/editor/editor_profiler.cpp @@ -338,7 +338,7 @@ void EditorProfiler::_update_plot() { wr = DVector::Write(); - Image img(w,h,0,Image::FORMAT_RGBA,graph_image); + Image img(w,h,0,Image::FORMAT_RGBA8,graph_image); if (reset_texture) { diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 44e28f49e6..e9054f30d9 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -63,7 +63,7 @@ def make_editor_icons_action(target, source, env): s.write("\tRef texture( memnew( ImageTexture ) );\n") s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n") s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n") - s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") + s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA8); img.expand_x2_hq2x(); use_hidpi_image=true;}\n") s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n") s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n") s.write("\treturn texture;\n") diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index df3741f0d4..0a3b0d4917 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1330,7 +1330,7 @@ Ref EditorFontImportPlugin::generate_font(const Ref EditorFontImportPlugin::generate_font(const Ref::Write(); - Image img(s.width,s.height,0,Image::FORMAT_RGBA,pixels); + Image img(s.width,s.height,0,Image::FORMAT_RGBA8,pixels); font_data_list[i]->blit=img; font_data_list[i]->blit_ofs=o; @@ -1537,7 +1537,7 @@ Ref EditorFontImportPlugin::generate_font(const Ref EditorFontImportPlugin::generate_font(const Refhas_option("color/monochrome") && bool(from->get_option("color/monochrome"))) { - atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA); + atlas.convert(Image::FORMAT_LA8); } diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 1130e2be30..6b1873d49a 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -237,8 +237,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { //well, it's an ambient light.. Light *l = memnew( DirectionalLight ); // l->set_color(Light::COLOR_AMBIENT,ld.color); - l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); - l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); +// l->set_color(Light::COLOR_DIFFUSE,Color(0,0,0)); +// l->set_color(Light::COLOR_SPECULAR,Color(0,0,0)); node = l; } else if (ld.mode==Collada::LightData::MODE_DIRECTIONAL) { @@ -248,8 +248,8 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { //if (found_ambient) //use it here // l->set_color(Light::COLOR_AMBIENT,ambient); - l->set_color(Light::COLOR_DIFFUSE,ld.color); - l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); +// l->set_color(Light::COLOR_DIFFUSE,ld.color); +// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); node = l; } else { @@ -259,14 +259,14 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) { l=memnew( OmniLight ); else { l=memnew( SpotLight ); - l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); - l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); +// l->set_parameter(Light::PARAM_SPOT_ANGLE,ld.spot_angle); +// l->set_parameter(Light::PARAM_SPOT_ATTENUATION,ld.spot_exp); } // - l->set_color(Light::COLOR_DIFFUSE,ld.color); - l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); - l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); +// l->set_color(Light::COLOR_DIFFUSE,ld.color); +// l->set_color(Light::COLOR_SPECULAR,Color(1,1,1)); +// l->approximate_opengl_attenuation(ld.constant_att,ld.linear_att,ld.quad_att); node=l; } @@ -394,14 +394,14 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture); - material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); +// material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture); +// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color); +// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color); } // SPECULAR @@ -414,15 +414,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); - material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1)); +// material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); +// material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color); +// material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color); } // EMISSION @@ -435,15 +435,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_EMISSION,texture); - material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1)); +// material->set_texture(FixedMaterial::PARAM_EMISSION,texture); +// material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { - missing_textures.push_back(texfile.get_file()); +// missing_textures.push_back(texfile.get_file()); } } } else { - material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color); +// material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color); } // NORMAL @@ -456,18 +456,18 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - material->set_texture(FixedMaterial::PARAM_NORMAL,texture); + // material->set_texture(FixedMaterial::PARAM_NORMAL,texture); }else { - missing_textures.push_back(texfile.get_file()); +// missing_textures.push_back(texfile.get_file()); } } } - material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); - material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); - material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); +// material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); +// material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); +// material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); @@ -1196,7 +1196,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con tarrayw = DVector::Write(); final_tangent_array=tarray; - } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid() && material->get_texture(FixedMaterial::PARAM_NORMAL).is_valid()))){ + } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid()))){ //if this uses triangles, there are uvs and the material is using a normalmap, generate tangents and binormals, because they WILL be needed //generate binormals/tangents _generate_tangents_and_binormals(index_array,final_vertex_array,final_uv_array,final_normal_array,final_tangent_array); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 190b56faba..9d68807c46 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1406,9 +1406,9 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Mapcast_to()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); - } + //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) + // res->cast_to()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); + }// } else { @@ -1516,10 +1516,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref fm = m->surface_get_material(i); if (fm.is_valid()) { - fm->set_flag(Material::FLAG_UNSHADED,true); - fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_flag(Material::FLAG_UNSHADED,true); + // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); } } } @@ -1543,17 +1543,17 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) { - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_name(_fixstr(mat->get_name(),"alpha")); + // mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // mat->set_name(_fixstr(mat->get_name(),"alpha")); } if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) { - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_name(_fixstr(mat->get_name(),"vcol")); + //mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + //mat->set_name(_fixstr(mat->get_name(),"vcol")); } if (p_flags&SCENE_FLAG_SET_LIGHTMAP_TO_UV2_IF_EXISTS && m->surface_get_format(i)&Mesh::ARRAY_FORMAT_TEX_UV2) { - mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true); + //mat->set_flag(Material::FLAG_LIGHTMAP_ON_UV2,true); } } @@ -1612,11 +1612,11 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map float dist = d.to_double(); mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true); mi->set_flag(GeometryInstance::FLAG_BILLBOARD_FIX_Y,true); - mi->set_draw_range_begin(dist); - mi->set_draw_range_end(100000); + //mi->set_draw_range_begin(dist); + //mi->set_draw_range_end(100000); - mip->set_draw_range_begin(0); - mip->set_draw_range_end(dist); + //mip->set_draw_range_begin(0); + //mip->set_draw_range_end(dist); if (mi->get_mesh().is_valid()) { @@ -1625,10 +1625,10 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref fm = m->surface_get_material(i); if (fm.is_valid()) { - fm->set_flag(Material::FLAG_UNSHADED,true); - fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); - fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_flag(Material::FLAG_UNSHADED,true); + // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); } } } @@ -1660,11 +1660,11 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map d=d.substr(1,d.length()); if (d.length() && d[0]>='0' && d[0]<='9') { float dist = d.to_double(); - mi->set_draw_range_begin(dist); - mi->set_draw_range_end(100000); + /// mi->set_draw_range_begin(dist); + // mi->set_draw_range_end(100000); - mip->set_draw_range_begin(0); - mip->set_draw_range_end(dist); + // mip->set_draw_range_begin(0); + // mip->set_draw_range_end(dist); /*if (mi->get_mesh().is_valid()) { @@ -1888,8 +1888,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map BSP_Tree bsptree(faces); Ref area = memnew( RoomBounds ); - area->set_bounds(faces); - area->set_geometry_hint(faces); + //area->set_bounds(faces); + //area->set_geometry_hint(faces); Room * room = memnew( Room ); @@ -1917,7 +1917,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map memdelete(p_node); p_node=room; - room->compute_room_from_subtree(); + //room->compute_room_from_subtree(); } else if (p_flags&SCENE_FLAG_CREATE_PORTALS &&_teststr(name,"portal") && p_node->cast_to()) { @@ -2047,7 +2047,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref fm = mesh->surface_get_material(i); if (fm.is_valid()) { String name = fm->get_name(); - if (_teststr(name,"alpha")) { + /* if (_teststr(name,"alpha")) { fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); name=_fixstr(name,"alpha"); } @@ -2055,7 +2055,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map if (_teststr(name,"vcol")) { fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); name=_fixstr(name,"vcol"); - } + }*/ fm->set_name(name); } } diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index ac3c4637c2..f117182365 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -33,7 +33,7 @@ #include "scene/3d/mesh_instance.h" #include "scene/animation/animation_player.h" - +#if 0 String EditorSceneImporterFBXConv::_id(const String& p_id) const { return p_id.replace(":","_").replace("/","_"); @@ -1132,3 +1132,4 @@ EditorSceneImporterFBXConv::EditorSceneImporterFBXConv() { #endif } +#endif diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h index b0cbc07ba3..e23c0e2faa 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h @@ -32,6 +32,7 @@ #include "tools/editor/io_plugins/editor_scene_import_plugin.h" #include "scene/3d/skeleton.h" +#if 0 class EditorSceneImporterFBXConv : public EditorSceneImporter { @@ -107,3 +108,4 @@ public: }; #endif // EDITOR_SCENE_IMPORTER_FBXCONV_H +#endif diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 2935ea8fe2..4397956be7 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -843,33 +843,27 @@ void EditorTextureImportPlugin::compress_image(EditorExportPlatform::ImageCompre //do absolutely nothing - } break; - case EditorExportPlatform::IMAGE_COMPRESSION_INDEXED: { - - //quantize - image.quantize(); - - } break; + } break; case EditorExportPlatform::IMAGE_COMPRESSION_BC: { // for maximum compatibility, BC shall always use mipmaps and be PO2 image.resize_to_po2(); - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); - image.compress(Image::COMPRESS_BC); + image.compress(Image::COMPRESS_S3TC); /* if (has_alpha) { if (flags&IMAGE_FLAG_ALPHA_BIT) { - image.convert(Image::FORMAT_BC3); + image.convert(Image::FORMAT_DXT5); } else { - image.convert(Image::FORMAT_BC2); + image.convert(Image::FORMAT_DXT3); } } else { - image.convert(Image::FORMAT_BC1); + image.convert(Image::FORMAT_DXT1); }*/ @@ -880,24 +874,24 @@ void EditorTextureImportPlugin::compress_image(EditorExportPlatform::ImageCompre // for maximum compatibility (hi apple!), PVRT shall always // use mipmaps, be PO2 and square - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); image.resize_to_po2(true); if (p_smaller) { image.compress(Image::COMPRESS_PVRTC2); - //image.convert(has_alpha ? Image::FORMAT_PVRTC2_ALPHA : Image::FORMAT_PVRTC2); + //image.convert(has_alpha ? Image::FORMAT_PVRTC2A : Image::FORMAT_PVRTC2); } else { image.compress(Image::COMPRESS_PVRTC4); - //image.convert(has_alpha ? Image::FORMAT_PVRTC4_ALPHA : Image::FORMAT_PVRTC4); + //image.convert(has_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4); } } break; case EditorExportPlatform::IMAGE_COMPRESSION_ETC1: { image.resize_to_po2(); //square or not? - if (image.get_mipmaps()==0) + if (!image.has_mipmaps()) image.generate_mipmaps(); if (!image.detect_alpha()) { //ETC1 is only opaque @@ -930,18 +924,18 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA); bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -950,7 +944,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // image.srgb_to_linear(); //} @@ -989,18 +983,18 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur bool has_alpha=image.detect_alpha(); - if (!has_alpha && image.get_format()==Image::FORMAT_RGBA) { + if (!has_alpha && image.get_format()==Image::FORMAT_RGBA8) { - image.convert(Image::FORMAT_RGB); + image.convert(Image::FORMAT_RGB8); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_FIX_BORDER_ALPHA) { image.fix_alpha_edges(); } - if (image.get_format()==Image::FORMAT_RGBA && flags&IMAGE_FLAG_PREMULT_ALPHA) { + if (image.get_format()==Image::FORMAT_RGBA8 && flags&IMAGE_FLAG_PREMULT_ALPHA) { image.premultiply_alpha(); } @@ -1009,7 +1003,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur image.normalmap_to_xy(); } - //if ((image.get_format()==Image::FORMAT_RGB || image.get_format()==Image::FORMAT_RGBA) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { + //if ((image.get_format()==Image::FORMAT_RGB8 || image.get_format()==Image::FORMAT_RGBA8) && flags&IMAGE_FLAG_CONVERT_TO_LINEAR) { // // print_line("CONVERT BECAUSE: "+itos(flags)); // image.srgb_to_linear(); @@ -1200,9 +1194,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref data = src.get_data(); @@ -1280,7 +1274,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_source_count()); @@ -1411,18 +1405,18 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref& if (image.empty()) return NULL; - if (image.get_format()!=Image::FORMAT_RGBA) { + if (image.get_format()!=Image::FORMAT_RGBA8) { if (image.get_format()>Image::FORMAT_INDEXED_ALPHA) { Error err = image.decompress(); if (err) return NULL; } - if (image.get_format()!=Image::FORMAT_RGBA) - image.convert(Image::FORMAT_RGBA); + if (image.get_format()!=Image::FORMAT_RGBA8) + image.convert(Image::FORMAT_RGBA8); } if (imgtex->get_flags()&Texture::FLAG_CONVERT_TO_LINEAR) { @@ -2619,7 +2619,7 @@ Error BakedLightBaker::transfer_to_lightmaps() { copymem(w.ptr(),baked_textures[i].data.ptr(),baked_textures[i].data.size()); } - Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA,dv); + Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA8,dv); Ref tex = memnew( ImageTexture ); tex->create_from_image(img); baked_light->set_lightmap_texture(i,tex); @@ -2720,3 +2720,4 @@ BakedLightBaker::~BakedLightBaker() { clear(); } +#endif diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index d0fddf5563..99340fcbe8 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -34,6 +34,8 @@ #include "scene/3d/mesh_instance.h" #include "os/thread.h" +#if 0 + class BakedLightBaker { public: @@ -375,3 +377,4 @@ public: }; #endif // BAKED_LIGHT_BAKER_H +#endif diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index a58a0c25e2..ed5aafeba0 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -33,7 +33,7 @@ #include "io/resource_saver.h" - +#if 0 void BakedLightEditor::_end_baking() { @@ -145,7 +145,7 @@ void BakedLightEditor::_notification(int p_option) { #if 1 //debug - Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA,octree_texture); + Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA8,octree_texture); Ref it = memnew( ImageTexture ); it->create_from_image(img); ResourceSaver::save("baked_octree.png",it); @@ -373,3 +373,4 @@ BakedLightEditorPlugin::~BakedLightEditorPlugin() } +#endif diff --git a/tools/editor/plugins/baked_light_editor_plugin.h b/tools/editor/plugins/baked_light_editor_plugin.h index 4985d7513e..a556bd447a 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.h +++ b/tools/editor/plugins/baked_light_editor_plugin.h @@ -40,7 +40,7 @@ @author Juan Linietsky */ - +#if 0 class MeshInstance; @@ -116,5 +116,5 @@ public: }; #endif // MULTIMESH_EDITOR_PLUGIN_H - +#endif diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 0b06b3ba21..ccec7eaed1 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -33,6 +33,8 @@ #include "scene/3d/camera.h" #include "canvas_item_editor_plugin.h" +#if 0 + void CollisionPolygonEditor::_notification(int p_what) { switch(p_what) { @@ -642,3 +644,4 @@ CollisionPolygonEditorPlugin::~CollisionPolygonEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.h b/tools/editor/plugins/collision_polygon_editor_plugin.h index 45e287ef00..4c1f45eca9 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_editor_plugin.h @@ -40,6 +40,8 @@ /** @author Juan Linietsky */ + +#if 0 class CanvasItemEditor; class CollisionPolygonEditor : public HBoxContainer { @@ -117,5 +119,5 @@ public: ~CollisionPolygonEditorPlugin(); }; - +#endif #endif // COLLISION_POLYGON_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index b6f3db73f7..9bc624ef65 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -28,6 +28,7 @@ /*************************************************************************/ #include "cube_grid_theme_editor_plugin.h" +#if 0 #include "scene/3d/mesh_instance.h" #include "scene/3d/physics_body.h" #include "scene/main/viewport.h" @@ -353,4 +354,4 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { theme_editor->hide(); } - +#endif diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.h b/tools/editor/plugins/cube_grid_theme_editor_plugin.h index 72ee171e19..a2875d24c2 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.h +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.h @@ -32,7 +32,7 @@ #include "scene/resources/mesh_library.h" #include "tools/editor/editor_node.h" - +#if 0 class MeshLibraryEditor : public Control { OBJ_TYPE( MeshLibraryEditor, Control ); @@ -93,3 +93,4 @@ public: #endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index b1bce60484..66f766a0be 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -37,6 +37,7 @@ #include "scene/resources/bit_mask.h" #include "tools/editor/editor_scale.h" +#if 0 bool EditorTexturePreviewPlugin::handles(const String& p_type) const { return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture")); @@ -69,8 +70,8 @@ Ref EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { - img.convert(Image::FORMAT_RGBA); + } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) { + img.convert(Image::FORMAT_RGBA8); } int width,height; @@ -138,15 +139,15 @@ Ref EditorBitmapPreviewPlugin::generate(const RES& p_from) { } - Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_GRAYSCALE,data); + Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_L8,data); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { - img.convert(Image::FORMAT_RGBA); + } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) { + img.convert(Image::FORMAT_RGBA8); } int width,height; @@ -434,7 +435,7 @@ Ref EditorScriptPreviewPlugin::generate(const RES& p_from) { int col=0; int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; - Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA); + Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA8); @@ -778,7 +779,7 @@ Ref EditorSamplePreviewPlugin::generate(const RES& p_from) { imgdata = DVector::Write(); Ref ptex = Ref( memnew( ImageTexture)); - ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB,img),0); + ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0); return ptex; } @@ -888,6 +889,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() { } + EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { //VS::get_singleton()->free(sphere); @@ -901,3 +903,4 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { VS::get_singleton()->free(scenario); } +#endif diff --git a/tools/editor/plugins/editor_preview_plugins.h b/tools/editor/plugins/editor_preview_plugins.h index b33aefaa23..9807d835a2 100644 --- a/tools/editor/plugins/editor_preview_plugins.h +++ b/tools/editor/plugins/editor_preview_plugins.h @@ -31,6 +31,7 @@ #include "tools/editor/editor_resource_preview.h" +#if 0 class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator { public: @@ -123,5 +124,5 @@ public: ~EditorMeshPreviewPlugin(); }; - +#endif #endif // EDITORPREVIEWPLUGINS_H diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp index 876fab0d6e..1036016194 100644 --- a/tools/editor/plugins/material_editor_plugin.cpp +++ b/tools/editor/plugins/material_editor_plugin.cpp @@ -1,6 +1,8 @@ #include "material_editor_plugin.h" #include "scene/main/viewport.h" +#if 0 + void MaterialEditor::_input_event(InputEvent p_event) { @@ -379,3 +381,4 @@ MaterialEditorPlugin::~MaterialEditorPlugin() } +#endif diff --git a/tools/editor/plugins/material_editor_plugin.h b/tools/editor/plugins/material_editor_plugin.h index 49e92493b3..68b3b3b1a7 100644 --- a/tools/editor/plugins/material_editor_plugin.h +++ b/tools/editor/plugins/material_editor_plugin.h @@ -8,7 +8,7 @@ #include "scene/3d/mesh_instance.h" #include "scene/3d/camera.h" - +#if 0 class MaterialEditor : public Control { OBJ_TYPE(MaterialEditor, Control); @@ -69,3 +69,4 @@ public: }; #endif // MATERIAL_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index b70cbad25f..cd7860bcab 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -28,6 +28,7 @@ /*************************************************************************/ #include "mesh_editor_plugin.h" +#if 0 void MeshEditor::_input_event(InputEvent p_event) { @@ -241,3 +242,4 @@ MeshEditorPlugin::MeshEditorPlugin(EditorNode *p_node) { MeshEditorPlugin::~MeshEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/mesh_editor_plugin.h b/tools/editor/plugins/mesh_editor_plugin.h index 0715a96e74..97fd9ae771 100644 --- a/tools/editor/plugins/mesh_editor_plugin.h +++ b/tools/editor/plugins/mesh_editor_plugin.h @@ -29,6 +29,8 @@ #ifndef MESH_EDITOR_PLUGIN_H #define MESH_EDITOR_PLUGIN_H +#if 0 + #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" #include "scene/resources/material.h" @@ -93,3 +95,4 @@ public: }; #endif // MESH_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index ce25f34c1f..4d93f2019e 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -69,8 +69,8 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) { ERR_EXPLAIN(TTR("Error loading image:")+" "+p_file); ERR_FAIL_COND(err!=OK); - img.convert(Image::FORMAT_GRAYSCALE_ALPHA); - ERR_FAIL_COND(img.get_format()!=Image::FORMAT_GRAYSCALE_ALPHA); + img.convert(Image::FORMAT_LA8); + ERR_FAIL_COND(img.get_format()!=Image::FORMAT_LA8); Size2i s = Size2(img.get_width(),img.get_height()); ERR_FAIL_COND(s.width==0 || s.height==0); diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 7e20cc3f54..d8330c4b0c 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -26,6 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + +#if 0 #include "particles_editor_plugin.h" #include "io/resource_loader.h" #include "servers/visual/particle_system_sw.h" @@ -456,3 +458,4 @@ ParticlesEditorPlugin::~ParticlesEditorPlugin() } +#endif diff --git a/tools/editor/plugins/particles_editor_plugin.h b/tools/editor/plugins/particles_editor_plugin.h index ff80bffc29..eec01d03a1 100644 --- a/tools/editor/plugins/particles_editor_plugin.h +++ b/tools/editor/plugins/particles_editor_plugin.h @@ -37,7 +37,7 @@ /** @author Juan Linietsky */ - +#if 0 class ParticlesEditor : public Control { OBJ_TYPE(ParticlesEditor, Control ); @@ -113,3 +113,4 @@ public: }; #endif // PARTICLES_EDITOR_PLUGIN_H +#endif diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index 33ef71efab..aa7071298a 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -31,6 +31,7 @@ #include "scene/resources/curve.h" #include "os/keyboard.h" +#if 0 String PathSpatialGizmo::get_handle_name(int p_idx) const { Ref c = path->get_curve(); @@ -593,3 +594,4 @@ PathEditorPlugin::~PathEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index 0afd957af7..ee2196b47f 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -32,6 +32,7 @@ #include "tools/editor/spatial_editor_gizmos.h" #include "scene/3d/path.h" +# if 0 class PathSpatialGizmo : public EditorSpatialGizmo { OBJ_TYPE(PathSpatialGizmo,EditorSpatialGizmo); @@ -95,5 +96,5 @@ public: }; - +#endif #endif // PATH_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 19d1ccc06f..cd19a908a8 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -850,7 +850,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { uv_edit = memnew( AcceptDialog ); add_child(uv_edit); uv_edit->set_title(TTR("Polygon 2D UV Editor")); - uv_edit->set_self_opacity(0.9); + uv_edit->set_self_modulate(Color(1,1,1,0.9)); VBoxContainer *uv_main_vb = memnew( VBoxContainer ); uv_edit->add_child(uv_main_vb); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index 7965fa54ae..5bdd7c4e61 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -311,7 +311,7 @@ void SampleEditor::generate_preview_texture(const Ref& p_sample,Ref::Write(); - p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB,img)); + p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB8,img)); } @@ -392,7 +392,7 @@ SampleEditor::SampleEditor() { add_child(stop); peakdisplay=Ref( memnew( ImageTexture) ); - peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB); + peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB8); sample_texframe->set_expand(true); sample_texframe->set_texture(peakdisplay); diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 2a6940332c..ade0c475e1 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -236,7 +236,7 @@ void SampleLibraryEditor::_update_library() { // Preview/edit Ref preview( memnew( ImageTexture )); - preview->create(128,16,Image::FORMAT_RGB); + preview->create(128,16,Image::FORMAT_RGB8); SampleEditor::generate_preview_texture(smp,preview); ti->set_cell_mode(1,TreeItem::CELL_MODE_ICON); ti->set_selectable(1,false); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index b3317e8313..5541ae987f 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -38,7 +38,7 @@ #include "tools/editor/property_editor.h" #include "os/os.h" - +#if 0 /*** SETTINGS EDITOR ****/ @@ -654,3 +654,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { ShaderEditorPlugin::~ShaderEditorPlugin() { } +#endif diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index 9219a1fbc2..ef7cc6772e 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -38,7 +38,7 @@ #include "scene/resources/shader.h" #include "servers/visual/shader_language.h" - +#if 0 class ShaderTextEditor : public CodeTextEditor { OBJ_TYPE( ShaderTextEditor, CodeTextEditor ); @@ -154,4 +154,6 @@ public: ~ShaderEditorPlugin(); }; + +#endif #endif diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 3ab906f84e..f864c6885f 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -28,6 +28,7 @@ /*************************************************************************/ #include "shader_graph_editor_plugin.h" +#if 0 #include "scene/gui/check_box.h" #include "scene/gui/menu_button.h" @@ -1377,7 +1378,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons")); break; case Variant::COLOR: { - Image icon_color = Image(15,15,false,Image::FORMAT_RGB); + Image icon_color = Image(15,15,false,Image::FORMAT_RGB8); Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) for (int y=1;y<14;y++) @@ -2945,3 +2946,4 @@ ShaderGraphEditorPlugin::~ShaderGraphEditorPlugin() +#endif diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h index 67ee5e2d45..dafafdd1c8 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -43,7 +43,7 @@ @author Juan Linietsky */ - +#if 0 class GraphColorRampEdit : public Control { OBJ_TYPE(GraphColorRampEdit,Control); @@ -239,4 +239,4 @@ public: }; #endif - +#endif diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 9701b8030d..afea6f93dd 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -274,7 +274,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b Vector3 ray=_get_ray(p_pos); Vector3 pos=_get_ray_pos(p_pos); - Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set > found_gizmos; //uint32_t closest=0; @@ -286,8 +286,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b for (int i=0;iinstance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); if (!obj) continue; @@ -405,15 +404,15 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2& p_pos,bool &r_inclu Vector3 ray=_get_ray(p_pos); Vector3 pos=_get_ray_pos(p_pos); - Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); + Vector instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set > found_gizmos; r_includes_current=false; for (int i=0;iinstance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); + if (!obj) continue; @@ -534,14 +533,12 @@ void SpatialEditorViewport::_select_region() { frustum.push_back( far ); - Vector instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); + Vector instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario()); for (int i=0;iinstance_get_object_instance_ID(instances[i]); - - Object *obj=ObjectDB::get_instance(id); + Object *obj=ObjectDB::get_instance(instances[i]); if (!obj) continue; Spatial *sp = obj->cast_to(); @@ -877,7 +874,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.mod.control) { - Vector instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); + Vector instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() ); Plane p(ray_origin,_get_camera_normal()); @@ -886,8 +883,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { for (int i=0;iinstance_get_object_instance_ID(instances[i]); - Object *obj=ObjectDB::get_instance(id); + + Object *obj=ObjectDB::get_instance(instances[i]); + if (!obj) continue; @@ -2061,9 +2059,9 @@ void SpatialEditorViewport::_menu_option(int p_option) { bool current = view_menu->get_popup()->is_item_checked( idx ); current=!current; if (current) - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<get_popup()->set_item_checked( idx, current ); } break; @@ -2361,7 +2359,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed surface->set_area_as_parent_rect(); camera = memnew(Camera); camera->set_disable_gizmo(true); - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<set_environment(SpatialEditor::get_singleton()->get_viewport_environment()); viewport->add_child(camera); camera->make_current(); @@ -2370,7 +2368,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu = memnew( MenuButton ); surface->add_child(view_menu); view_menu->set_pos( Point2(4,4)); - view_menu->set_self_opacity(0.5); + view_menu->set_self_modulate(Color(1,1,1,0.5)); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT); @@ -2550,10 +2548,10 @@ void SpatialEditor::_generate_selection_box() { } Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); + /*mat->set_flag(Material::FLAG_UNSHADED,true); mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);*/ st->set_material(mat); selection_box = st->commit(); } @@ -2685,14 +2683,14 @@ void SpatialEditor::set_state(const Dictionary& p_state) { } if (d.has("ambient_light_color")) { settings_ambient_color->set_color(d["ambient_light_color"]); - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]); + //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]); } if (d.has("default_srgb")) { bool use = d["default_srgb"]; - viewport_environment->set_enable_fx(Environment::FX_SRGB,use); - view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use ); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,use); + //view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use ); } if (d.has("show_grid")) { bool use = d["show_grid"]; @@ -2892,9 +2890,9 @@ void SpatialEditor::_menu_item_pressed(int p_option) { bool is_checked = view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(p_option) ); if (is_checked) { - viewport_environment->set_enable_fx(Environment::FX_SRGB,false); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,false); } else { - viewport_environment->set_enable_fx(Environment::FX_SRGB,true); + //viewport_environment->set_enable_fx(Environment::FX_SRGB,true); } is_checked = ! is_checked; @@ -3140,11 +3138,11 @@ void SpatialEditor::_init_indicators() { { - indicator_mat = VisualServer::get_singleton()->fixed_material_create(); - VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true ); + indicator_mat = VisualServer::get_singleton()->material_create(); + /*VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true ); VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false ); VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); + VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);*/ DVector grid_colors[3]; DVector grid_points[3]; @@ -3186,7 +3184,7 @@ void SpatialEditor::_init_indicators() { d.resize(VS::ARRAY_MAX); d[VisualServer::ARRAY_VERTEX]=grid_points[i]; d[VisualServer::ARRAY_COLOR]=grid_colors[i]; - VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); @@ -3205,7 +3203,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_VERTEX]=origin_points; d[VisualServer::ARRAY_COLOR]=origin_colors; - VisualServer::get_singleton()->mesh_add_surface(origin,VisualServer::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat); @@ -3237,16 +3235,16 @@ void SpatialEditor::_init_indicators() { cursor_points.push_back(Vector3(0,-cs,0)); cursor_points.push_back(Vector3(0,0,+cs)); cursor_points.push_back(Vector3(0,0,-cs)); - cursor_material=VisualServer::get_singleton()->fixed_material_create(); - VisualServer::get_singleton()->fixed_material_set_param(cursor_material,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0,1,1)); + cursor_material=VisualServer::get_singleton()->material_create(); + /*VisualServer::get_singleton()->fixed_material_set_param(cursor_material,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0,1,1)); VisualServer::get_singleton()->material_set_flag( cursor_material, VisualServer::MATERIAL_FLAG_UNSHADED, true ); VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true); + VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);*/ Array d; d.resize(VS::ARRAY_MAX); d[VS::ARRAY_VERTEX]=cursor_points; - VisualServer::get_singleton()->mesh_add_surface(cursor_mesh,VS::PRIMITIVE_LINES,d); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material); cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); @@ -3266,10 +3264,10 @@ void SpatialEditor::_init_indicators() { float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity"); gizmo_hl = Ref( memnew( FixedMaterial ) ); - gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); + /* gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); gizmo_hl->set_flag(Material::FLAG_ONTOP, true); gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f)); + gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f));*/ for(int i=0;i<3;i++) { @@ -3278,13 +3276,13 @@ void SpatialEditor::_init_indicators() { Ref mat = memnew( FixedMaterial ); - mat->set_flag(Material::FLAG_UNSHADED, true); + /* mat->set_flag(Material::FLAG_UNSHADED, true); mat->set_flag(Material::FLAG_ONTOP, true); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); Color col; col[i]=1.0; col.a= gizmo_alph; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col); + mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col);*/ gizmo_color[i]=mat; @@ -3548,7 +3546,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - gizmos = memnew( SpatialEditorGizmos ); + //gizmos = memnew( SpatialEditorGizmos ); _init_indicators(); _update_default_light_angle(); } @@ -3556,7 +3554,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_EXIT_TREE) { _finish_indicators(); - memdelete( gizmos ); +// memdelete( gizmos ); } } @@ -3602,7 +3600,7 @@ void SpatialEditor::_request_gizmo(Object* p_obj) { } if (!seg.is_valid()) { - seg = gizmos->get_gizmo(sp); + // seg = gizmos->get_gizmo(sp); } if (seg.is_valid()) { @@ -3724,7 +3722,7 @@ void SpatialEditor::clear() { settings_default_light_rot_x=Math_PI*0.3; settings_default_light_rot_y=Math_PI*0.2; - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); + //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); settings_ambient_color->set_color(Color(0.15,0.15,0.15)); if (!light_instance.is_valid()) _menu_item_pressed(MENU_VIEW_USE_DEFAULT_LIGHT); @@ -3737,7 +3735,7 @@ void SpatialEditor::clear() { void SpatialEditor::_update_ambient_light_color(const Color& p_color) { - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); +// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color()); } @@ -4006,8 +4004,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { settings_vbc->add_margin_child(TTR("Ambient Light Color:"),settings_ambient_color); settings_ambient_color->connect("color_changed",this,"_update_ambient_light_color"); - viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true); - viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); +// viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true); +// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15)); settings_ambient_color->set_color(Color(0.15,0.15,0.15)); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 975092a01d..2a52eab777 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -467,7 +467,7 @@ private: static SpatialEditor *singleton; void _node_removed(Node* p_node); - SpatialEditorGizmos *gizmos; + //SpatialEditorGizmos *gizmos; SpatialEditor(); void _update_ambient_light_color(const Color& p_color); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 18a4e845a0..4f6f624b1e 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -870,7 +870,7 @@ void ProjectManager::_load_recent_projects() { TextureButton *favorite = memnew( TextureButton ); favorite->set_normal_texture(favorite_icon); if (!is_favorite) - favorite->set_opacity(0.2); + favorite->set_modulate(Color(1,1,1,0.2)); favorite->set_v_size_flags(SIZE_EXPAND); favorite->connect("pressed",this,"_favorite_pressed",varray(hb)); favorite_box->add_child(favorite); @@ -891,7 +891,7 @@ void ProjectManager::_load_recent_projects() { vb->add_child(title); Label *fpath = memnew( Label(path) ); vb->add_child(fpath); - fpath->set_opacity(0.5); + fpath->set_modulate(Color(1,1,1,0.5)); fpath->add_color_override("font_color",font_color); scroll_childs->add_child(hb); diff --git a/tools/editor/pvrtc_compress.cpp b/tools/editor/pvrtc_compress.cpp index 75b5c69bc2..bda06e1706 100644 --- a/tools/editor/pvrtc_compress.cpp +++ b/tools/editor/pvrtc_compress.cpp @@ -85,7 +85,7 @@ static void _compress_image(Image::CompressMode p_mode,Image *p_image) { if (EditorSettings::get_singleton()->get("PVRTC/fast_conversion").operator bool()) { args.push_back("-pvrtcfast"); } - if (p_image->get_mipmaps()>0) + if (p_image->has_mipmaps()) args.push_back("-m"); Ref t = memnew( ImageTexture ); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 53bfe8cc57..fdcced2fa6 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -953,7 +953,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) Label *label = memnew( Label( selected[i]->get_name() ) ); hb->add_child(label); vb->add_child(hb); - hb->set_opacity(opacity_item); + hb->set_modulate(Color(1,1,1,opacity_item)); opacity_item -= opacity_step; } NodePath p = selected[i]->get_path(); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 84803eb6db..716b03b7b7 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -41,6 +41,8 @@ // Keep small children away from this file. // It's so ugly it will eat them alive +#if 0 + #define HANDLE_HALF_SIZE 0.05 void EditorSpatialGizmo::clear() { @@ -3198,3 +3200,4 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } +#endif diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 3d7272f522..a7a6af4b18 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -52,7 +52,7 @@ class Camera; - +#if 0 class EditorSpatialGizmo : public SpatialEditorGizmo { OBJ_TYPE(EditorSpatialGizmo,SpatialGizmo); @@ -505,5 +505,5 @@ public: SpatialEditorGizmos(); }; - +#endif #endif // SPATIAL_EDITOR_GIZMOS_H -- cgit v1.2.3 From a6e9dc615346f44b68b418483dd218d11ba4a674 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 3 Oct 2016 23:46:24 -0300 Subject: make editor update by tracking changes in visualserverraster --- drivers/gles3/rasterizer_storage_gles3.cpp | 8 +- drivers/gles3/rasterizer_storage_gles3.h | 8 +- servers/visual/rasterizer.h | 8 +- servers/visual/visual_server_raster.cpp | 989 +---------------------------- servers/visual/visual_server_raster.h | 453 +++++++------ servers/visual_server.h | 8 +- 6 files changed, 279 insertions(+), 1195 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b29de876a4..515db39098 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1199,7 +1199,7 @@ RID RasterizerStorageGLES3::multimesh_get_mesh(RID p_multimesh) const{ return RID(); } -AABB RasterizerStorageGLES3::multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const{ +AABB RasterizerStorageGLES3::multimesh_get_custom_aabb(RID p_multimesh) const{ return AABB(); } @@ -1305,7 +1305,7 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton,int p_bo } -Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int p_bone){ +Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int p_bone) const{ return Transform(); } @@ -1313,7 +1313,7 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p } -Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone){ +Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const{ return Matrix32(); } @@ -1419,7 +1419,7 @@ void RasterizerStorageGLES3::room_add_bounds(RID p_room, const DVector& } -void RasterizerStorageGLES3::room_clear_bounds(){ +void RasterizerStorageGLES3::room_clear_bounds(RID p_room){ } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 3b2d7d752c..eb6cd0bd92 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -249,7 +249,7 @@ public: virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh) const; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; @@ -282,9 +282,9 @@ public: virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false); virtual int skeleton_get_bone_count(RID p_skeleton) const; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const; virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform); - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone); + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const; /* Light API */ @@ -321,7 +321,7 @@ public: virtual RID room_create(); virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform); - virtual void room_clear_bounds(); + virtual void room_clear_bounds(RID p_room); /* PORTAL API */ diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index df18dd1679..6a6eb7ad20 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -134,7 +134,7 @@ public: virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const=0; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; @@ -167,9 +167,9 @@ public: virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false)=0; virtual int skeleton_get_bone_count(RID p_skeleton) const=0; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0; + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const =0; virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)=0; + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const=0; /* Light API */ @@ -206,7 +206,7 @@ public: virtual RID room_create()=0; virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform)=0; - virtual void room_clear_bounds()=0; + virtual void room_clear_bounds(RID p_room)=0; /* PORTAL API */ diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 168afac77f..d6e057bb52 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -37,654 +37,30 @@ // careful, these may run in different threads than the visual server -RID VisualServerRaster::texture_create(){ - return VSG::storage->texture_create(); -} -void VisualServerRaster::texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags){ - - VSG::storage->texture_allocate(p_texture,p_width,p_height,p_format,p_flags); -} -void VisualServerRaster::texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side){ - - VSG::storage->texture_set_data(p_texture,p_image,p_cube_side); -} -Image VisualServerRaster::texture_get_data(RID p_texture,CubeMapSide p_cube_side) const{ - - return VSG::storage->texture_get_data(p_texture,p_cube_side); -} -void VisualServerRaster::texture_set_flags(RID p_texture,uint32_t p_flags) { - - VSG::storage->texture_set_flags(p_texture,p_flags); -} -uint32_t VisualServerRaster::texture_get_flags(RID p_texture) const{ - - return VSG::storage->texture_get_flags(p_texture); -} -Image::Format VisualServerRaster::texture_get_format(RID p_texture) const{ - - return VSG::storage->texture_get_format(p_texture); -} -uint32_t VisualServerRaster::texture_get_width(RID p_texture) const{ - - return VSG::storage->texture_get_width(p_texture); -} -uint32_t VisualServerRaster::texture_get_height(RID p_texture) const{ - - return VSG::storage->texture_get_height(p_texture); -} -void VisualServerRaster::texture_set_size_override(RID p_texture,int p_width, int p_height){ - VSG::storage->texture_set_size_override(p_texture,p_width,p_height); - -} - -void VisualServerRaster::texture_set_path(RID p_texture,const String& p_path){ - - VSG::storage->texture_set_path(p_texture,p_path); -} - -String VisualServerRaster::texture_get_path(RID p_texture) const{ - - return VSG::storage->texture_get_path(p_texture); -} - -void VisualServerRaster::texture_set_shrink_all_x2_on_set_data(bool p_enable){ - - VSG::storage->texture_set_shrink_all_x2_on_set_data(p_enable); -} - -void VisualServerRaster::texture_debug_usage(List *r_info){ - - VSG::storage->texture_debug_usage(r_info); -} - - -/* SHADER API */ - - -RID VisualServerRaster::shader_create(ShaderMode p_mode){ - - return VSG::storage->shader_create(p_mode); -} - -void VisualServerRaster::shader_set_mode(RID p_shader,ShaderMode p_mode){ - - VSG::storage->shader_set_mode(p_shader,p_mode); -} -VisualServerRaster::ShaderMode VisualServerRaster::shader_get_mode(RID p_shader) const{ - - return VSG::storage->shader_get_mode(p_shader); -} - -void VisualServerRaster::shader_set_code(RID p_shader, const String& p_code){ - - VSG::storage->shader_set_code(p_shader,p_code); -} -String VisualServerRaster::shader_get_code(RID p_shader) const{ - - return VSG::storage->shader_get_code(p_shader); -} -void VisualServerRaster::shader_get_param_list(RID p_shader, List *p_param_list) const{ - - VSG::storage->shader_get_param_list(p_shader,p_param_list); -} - -void VisualServerRaster::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture){ - - VSG::storage->shader_set_default_texture_param(p_shader,p_name,p_texture); -} -RID VisualServerRaster::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{ - - return VSG::storage->shader_get_default_texture_param(p_shader,p_name); -} - - -/* COMMON MATERIAL API */ - -RID VisualServerRaster::material_create(){ - - return VSG::storage->material_create(); -} - -void VisualServerRaster::material_set_shader(RID p_shader_material, RID p_shader){ - - VSG::storage->material_set_shader(p_shader_material,p_shader); -} -RID VisualServerRaster::material_get_shader(RID p_shader_material) const{ - - return VSG::storage->material_get_shader(p_shader_material); -} - -void VisualServerRaster::material_set_param(RID p_material, const StringName& p_param, const Variant& p_value){ - - VSG::storage->material_set_param(p_material,p_param,p_value); -} -Variant VisualServerRaster::material_get_param(RID p_material, const StringName& p_param) const{ - - return VSG::storage->material_get_param(p_material,p_param); -} - -/* MESH API */ - -RID VisualServerRaster::mesh_create(){ - - return VSG::storage->mesh_create(); -} - -void VisualServerRaster::mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes){ - - VSG::storage->mesh_add_surface(p_mesh,p_format,p_primitive,p_array,p_vertex_count,p_index_array,p_index_count,p_blend_shapes); -} - -void VisualServerRaster::mesh_set_morph_target_count(RID p_mesh,int p_amount){ - - VSG::storage->mesh_set_morph_target_count(p_mesh,p_amount); -} -int VisualServerRaster::mesh_get_morph_target_count(RID p_mesh) const{ - - return VSG::storage->mesh_get_morph_target_count(p_mesh); -} - - -void VisualServerRaster::mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode){ - - VSG::storage->mesh_set_morph_target_mode(p_mesh,p_mode); -} -VisualServerRaster::MorphTargetMode VisualServerRaster::mesh_get_morph_target_mode(RID p_mesh) const{ - - return VSG::storage->mesh_get_morph_target_mode(p_mesh); -} - -void VisualServerRaster::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ - - VSG::storage->mesh_surface_set_material(p_mesh,p_surface,p_material); -} -RID VisualServerRaster::mesh_surface_get_material(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_material(p_mesh,p_surface); -} - -int VisualServerRaster::mesh_surface_get_array_len(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_array_len(p_mesh,p_surface); -} -int VisualServerRaster::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_array_index_len(p_mesh,p_surface); -} - -DVector VisualServerRaster::mesh_surface_get_array(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_array(p_mesh,p_surface); -} -DVector VisualServerRaster::mesh_surface_get_index_array(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_index_array(p_mesh,p_surface); -} - - -uint32_t VisualServerRaster::mesh_surface_get_format(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_format(p_mesh,p_surface); -} -VisualServerRaster::PrimitiveType VisualServerRaster::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const{ - - return VSG::storage->mesh_surface_get_primitive_type(p_mesh,p_surface); -} - -void VisualServerRaster::mesh_remove_surface(RID p_mesh,int p_index){ - - VSG::storage->mesh_remove_surface(p_mesh,p_index); -} -int VisualServerRaster::mesh_get_surface_count(RID p_mesh) const{ - - return VSG::storage->mesh_get_surface_count(p_mesh); -} - -void VisualServerRaster::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb){ - - VSG::storage->mesh_set_custom_aabb(p_mesh,p_aabb); -} -AABB VisualServerRaster::mesh_get_custom_aabb(RID p_mesh) const{ - - return VSG::storage->mesh_get_custom_aabb(p_mesh); -} - -void VisualServerRaster::mesh_clear(RID p_mesh){ - - VSG::storage->mesh_clear(p_mesh); -} - -/* MULTIMESH API */ - - -RID VisualServerRaster::multimesh_create() { - - return VSG::storage->multimesh_create(); -} - -void VisualServerRaster::multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb){ - - VSG::storage->multimesh_allocate(p_multimesh,p_instances,p_transform_format,p_color_format,p_gen_aabb); -} -int VisualServerRaster::multimesh_get_instance_count(RID p_multimesh) const{ - - return VSG::storage->multimesh_get_instance_count(p_multimesh); -} - -void VisualServerRaster::multimesh_set_mesh(RID p_multimesh,RID p_mesh){ - - VSG::storage->multimesh_set_mesh(p_multimesh,p_mesh); -} -void VisualServerRaster::multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb){ - - VSG::storage->multimesh_set_custom_aabb(p_multimesh,p_aabb); -} -void VisualServerRaster::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform){ - - VSG::storage->multimesh_instance_set_transform(p_multimesh,p_index,p_transform); -} -void VisualServerRaster::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform){ - - VSG::storage->multimesh_instance_set_transform_2d(p_multimesh,p_index,p_transform); -} -void VisualServerRaster::multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color){ - - VSG::storage->multimesh_instance_set_color(p_multimesh,p_index,p_color); -} - -RID VisualServerRaster::multimesh_get_mesh(RID p_multimesh) const{ - - return VSG::storage->multimesh_get_mesh(p_multimesh); -} -AABB VisualServerRaster::multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const{ - - return VSG::storage->multimesh_get_custom_aabb(p_multimesh,p_aabb); -} - -Transform VisualServerRaster::multimesh_instance_get_transform(RID p_multimesh,int p_index) const{ - - return VSG::storage->multimesh_instance_get_transform(p_multimesh,p_index); -} -Matrix32 VisualServerRaster::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ - - return VSG::storage->multimesh_instance_get_transform_2d(p_multimesh,p_index); -} -Color VisualServerRaster::multimesh_instance_get_color(RID p_multimesh,int p_index) const{ - - return VSG::storage->multimesh_instance_get_color(p_multimesh,p_index); -} - -void VisualServerRaster::multimesh_set_visible_instances(RID p_multimesh,int p_visible){ - - VSG::storage->multimesh_set_visible_instances(p_multimesh,p_visible); -} -int VisualServerRaster::multimesh_get_visible_instances(RID p_multimesh) const{ - - return VSG::storage->multimesh_get_visible_instances(p_multimesh); -} - - -/* IMMEDIATE API */ - -RID VisualServerRaster::immediate_create(){ - - return VSG::storage->immediate_create(); -} -void VisualServerRaster::immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture){ - - VSG::storage->immediate_begin(p_immediate,p_rimitive,p_texture); -} -void VisualServerRaster::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ - - VSG::storage->immediate_vertex(p_immediate,p_vertex); -} -void VisualServerRaster::immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex){ - - VSG::storage->immediate_vertex_2d(p_immediate,p_vertex); - -} -void VisualServerRaster::immediate_normal(RID p_immediate,const Vector3& p_normal){ - - VSG::storage->immediate_normal(p_immediate,p_normal); - -} -void VisualServerRaster::immediate_tangent(RID p_immediate,const Plane& p_tangent){ - - VSG::storage->immediate_tangent(p_immediate,p_tangent); -} -void VisualServerRaster::immediate_color(RID p_immediate,const Color& p_color){ - - VSG::storage->immediate_color(p_immediate,p_color); - -} -void VisualServerRaster::immediate_uv(RID p_immediate,const Vector2& tex_uv){ - - VSG::storage->immediate_uv(p_immediate,tex_uv); - -} -void VisualServerRaster::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ - - VSG::storage->immediate_uv2(p_immediate,tex_uv); - -} -void VisualServerRaster::immediate_end(RID p_immediate){ - - VSG::storage->immediate_end(p_immediate); - -} -void VisualServerRaster::immediate_clear(RID p_immediate){ - - VSG::storage->immediate_clear(p_immediate); - -} -void VisualServerRaster::immediate_set_material(RID p_immediate,RID p_material){ - - VSG::storage->immediate_set_material(p_immediate,p_material); - -} -RID VisualServerRaster::immediate_get_material(RID p_immediate) const{ - - return VSG::storage->immediate_get_material(p_immediate); -} - -/* SKELETON API */ - -RID VisualServerRaster::skeleton_create(){ - - return VSG::storage->skeleton_create(); -} -void VisualServerRaster::skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton){ - - VSG::storage->skeleton_allocate(p_skeleton,p_bones,p_2d_skeleton); -} -int VisualServerRaster::skeleton_get_bone_count(RID p_skeleton) const{ - - return VSG::storage->skeleton_get_bone_count(p_skeleton); -} -void VisualServerRaster::skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform){ - - VSG::storage->skeleton_bone_set_transform(p_skeleton,p_bone,p_transform); -} -Transform VisualServerRaster::skeleton_bone_get_transform(RID p_skeleton,int p_bone){ - - return VSG::storage->skeleton_bone_get_transform(p_skeleton,p_bone); -} -void VisualServerRaster::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform){ - - VSG::storage->skeleton_bone_set_transform_2d(p_skeleton,p_bone,p_transform); -} -Matrix32 VisualServerRaster::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone){ - - return VSG::storage->skeleton_bone_get_transform_2d(p_skeleton,p_bone); -} - -/* Light API */ - -RID VisualServerRaster::light_create(LightType p_type){ - - return VSG::storage->light_create(p_type); -} - -void VisualServerRaster::light_set_color(RID p_light,const Color& p_color){ - - VSG::storage->light_set_color(p_light,p_color); -} -void VisualServerRaster::light_set_param(RID p_light,LightParam p_param,float p_value){ - - VSG::storage->light_set_param(p_light,p_param,p_value); -} -void VisualServerRaster::light_set_shadow(RID p_light,bool p_enabled){ - - VSG::storage->light_set_shadow(p_light,p_enabled); -} -void VisualServerRaster::light_set_projector(RID p_light,RID p_texture){ - - VSG::storage->light_set_projector(p_light,p_texture); -} -void VisualServerRaster::light_set_attenuation_texure(RID p_light,RID p_texture){ - - VSG::storage->light_set_attenuation_texure(p_light,p_texture); -} -void VisualServerRaster::light_set_negative(RID p_light,bool p_enable){ - - VSG::storage->light_set_negative(p_light,p_enable); -} -void VisualServerRaster::light_set_cull_mask(RID p_light,uint32_t p_mask){ - - VSG::storage->light_set_cull_mask(p_light,p_mask); -} -void VisualServerRaster::light_set_shader(RID p_light,RID p_shader){ - - VSG::storage->light_set_shader(p_light,p_shader); -} - - -void VisualServerRaster::light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode){ - - VSG::storage->light_directional_set_shadow_mode(p_light,p_mode); -} - -/* PROBE API */ - -RID VisualServerRaster::reflection_probe_create(){ - - return VSG::storage->reflection_probe_create(); -} - -void VisualServerRaster::reflection_probe_set_intensity(RID p_probe, float p_intensity){ - - VSG::storage->reflection_probe_set_intensity(p_probe,p_intensity); -} -void VisualServerRaster::reflection_probe_set_clip(RID p_probe, float p_near, float p_far){ - - VSG::storage->reflection_probe_set_clip(p_probe,p_near,p_far); -} -void VisualServerRaster::reflection_probe_set_min_blend_distance(RID p_probe, float p_distance){ - - VSG::storage->reflection_probe_set_min_blend_distance(p_probe,p_distance); -} -void VisualServerRaster::reflection_probe_set_extents(RID p_probe, const Vector3& p_extents){ - - VSG::storage->reflection_probe_set_extents(p_probe,p_extents); -} -void VisualServerRaster::reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset){ - - VSG::storage->reflection_probe_set_origin_offset(p_probe,p_offset); -} -void VisualServerRaster::reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable){ - - VSG::storage->reflection_probe_set_enable_parallax_correction(p_probe,p_enable); -} -void VisualServerRaster::reflection_probe_set_resolution(RID p_probe, int p_resolution){ - - VSG::storage->reflection_probe_set_resolution(p_probe,p_resolution); -} -void VisualServerRaster::reflection_probe_set_hide_skybox(RID p_probe, bool p_hide){ - - VSG::storage->reflection_probe_set_hide_skybox(p_probe,p_hide); -} -void VisualServerRaster::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers){ - - VSG::storage->reflection_probe_set_cull_mask(p_probe,p_layers); -} - - -/* ROOM API */ - -RID VisualServerRaster::room_create(){ - - return VSG::storage->room_create(); -} -void VisualServerRaster::room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform){ - - VSG::storage->room_add_bounds(p_room,p_convex_polygon,p_height,p_transform); -} -void VisualServerRaster::room_clear_bounds(){ - - VSG::storage->room_clear_bounds(); -} - -/* PORTAL API */ - -// portals are only (x/y) points, forming a convex shape, which its clockwise -// order points outside. (z is 0); - -RID VisualServerRaster::portal_create(){ - - return VSG::storage->portal_create(); -} -void VisualServerRaster::portal_set_shape(RID p_portal, const Vector& p_shape){ - - VSG::storage->portal_set_shape(p_portal,p_shape); -} -void VisualServerRaster::portal_set_enabled(RID p_portal, bool p_enabled) { - - VSG::storage->portal_set_enabled(p_portal,p_enabled); -} -void VisualServerRaster::portal_set_disable_distance(RID p_portal, float p_distance){ - - VSG::storage->portal_set_disable_distance(p_portal,p_distance); -} -void VisualServerRaster::portal_set_disabled_color(RID p_portal, const Color& p_color){ - - VSG::storage->portal_set_disabled_color(p_portal,p_color); -} - -/* CAMERA API */ - -RID VisualServerRaster::camera_create() { - - return RID(); -} -void VisualServerRaster::camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far) { - -} -void VisualServerRaster::camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far){ - -} -void VisualServerRaster::camera_set_transform(RID p_camera,const Transform& p_transform) { - -} -void VisualServerRaster::camera_set_cull_mask(RID p_camera,uint32_t p_layers){ - -} -void VisualServerRaster::camera_set_environment(RID p_camera,RID p_env){ - -} -void VisualServerRaster::camera_set_use_vertical_aspect(RID p_camera,bool p_enable){ - -} - - -/* VIEWPORT TARGET API */ - -RID VisualServerRaster::viewport_create(){ - - return VSG::viewport->viewport_create(); -} - -void VisualServerRaster::viewport_set_size(RID p_viewport,int p_width,int p_height){ - - VSG::viewport->viewport_set_size(p_viewport,p_width,p_height); -} - -void VisualServerRaster::viewport_set_active(RID p_viewport,bool p_active) { - - VSG::viewport->viewport_set_active(p_viewport,p_active); -} - -void VisualServerRaster::viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode) { - - VSG::viewport->viewport_set_clear_mode(p_viewport,p_clear_mode); -} - -void VisualServerRaster::viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect,int p_screen){ - - VSG::viewport->viewport_attach_to_screen(p_viewport,p_rect,p_screen); - -} -void VisualServerRaster::viewport_detach(RID p_viewport){ - - VSG::viewport->viewport_detach(p_viewport); - -} - -void VisualServerRaster::viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode){ - - VSG::viewport->viewport_set_update_mode(p_viewport,p_mode); - -} -void VisualServerRaster::viewport_set_vflip(RID p_viewport,bool p_enable){ - - VSG::viewport->viewport_set_vflip(p_viewport,p_enable); - -} - -RID VisualServerRaster::viewport_get_texture(RID p_viewport) const{ - - return VSG::viewport->viewport_get_texture(p_viewport); - -} -Image VisualServerRaster::viewport_capture(RID p_viewport) const{ - return VSG::viewport->viewport_capture(p_viewport); -} - -void VisualServerRaster::viewport_set_hide_scenario(RID p_viewport,bool p_hide){ - - return VSG::viewport->viewport_set_hide_scenario(p_viewport,p_hide); -} -void VisualServerRaster::viewport_set_hide_canvas(RID p_viewport,bool p_hide){ - - return VSG::viewport->viewport_set_hide_canvas(p_viewport,p_hide); - -} -void VisualServerRaster::viewport_set_disable_environment(RID p_viewport,bool p_disable){ - - return VSG::viewport->viewport_set_disable_environment(p_viewport,p_disable); - -} - -void VisualServerRaster::viewport_attach_camera(RID p_viewport,RID p_camera){ - - return VSG::viewport->viewport_attach_camera(p_viewport,p_camera); - -} -void VisualServerRaster::viewport_set_scenario(RID p_viewport,RID p_scenario){ +/* CAMERA API */ - return VSG::viewport->viewport_set_scenario(p_viewport,p_scenario); +RID VisualServerRaster::camera_create() { + return RID(); } -void VisualServerRaster::viewport_attach_canvas(RID p_viewport,RID p_canvas){ - - return VSG::viewport->viewport_attach_canvas(p_viewport,p_canvas); +void VisualServerRaster::camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far) { } -void VisualServerRaster::viewport_remove_canvas(RID p_viewport,RID p_canvas){ - - return VSG::viewport->viewport_remove_canvas(p_viewport,p_canvas); +void VisualServerRaster::camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far){ } -void VisualServerRaster::viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset){ - - return VSG::viewport->viewport_set_canvas_transform(p_viewport,p_canvas,p_offset); +void VisualServerRaster::camera_set_transform(RID p_camera,const Transform& p_transform) { } -void VisualServerRaster::viewport_set_transparent_background(RID p_viewport,bool p_enabled){ - - return VSG::viewport->viewport_set_transparent_background(p_viewport,p_enabled); +void VisualServerRaster::camera_set_cull_mask(RID p_camera,uint32_t p_layers){ } - -void VisualServerRaster::viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform){ - - return VSG::viewport->viewport_set_global_canvas_transform(p_viewport,p_transform); +void VisualServerRaster::camera_set_environment(RID p_camera,RID p_env){ } -void VisualServerRaster::viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer){ - - return VSG::viewport->viewport_set_canvas_layer(p_viewport,p_canvas,p_layer); +void VisualServerRaster::camera_set_use_vertical_aspect(RID p_camera,bool p_enable){ } @@ -836,349 +212,6 @@ void VisualServerRaster::instance_geometry_set_as_instance_lod(RID p_instance,RI } -/* CANVAS (2D) */ - -RID VisualServerRaster::canvas_create(){ - - return VSG::canvas->canvas_create(); - -} -void VisualServerRaster::canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring){ - - VSG::canvas->canvas_set_item_mirroring(p_canvas,p_item,p_mirroring); -} -void VisualServerRaster::canvas_set_modulate(RID p_canvas,const Color& p_color){ - - VSG::canvas->canvas_set_modulate(p_canvas,p_color); -} - - -RID VisualServerRaster::canvas_item_create(){ - - return VSG::canvas->canvas_item_create(); -} -void VisualServerRaster::canvas_item_set_parent(RID p_item,RID p_parent){ - - VSG::canvas->canvas_item_set_parent(p_item,p_parent); - -} - -void VisualServerRaster::canvas_item_set_visible(RID p_item,bool p_visible){ - - VSG::canvas->canvas_item_set_visible(p_item,p_visible); - -} -void VisualServerRaster::canvas_item_set_light_mask(RID p_item,int p_mask){ - - VSG::canvas->canvas_item_set_light_mask(p_item,p_mask); - -} - -void VisualServerRaster::canvas_item_set_transform(RID p_item, const Matrix32& p_transform){ - - VSG::canvas->canvas_item_set_transform(p_item,p_transform); - -} -void VisualServerRaster::canvas_item_set_clip(RID p_item, bool p_clip){ - - VSG::canvas->canvas_item_set_clip(p_item,p_clip); - -} -void VisualServerRaster::canvas_item_set_distance_field_mode(RID p_item, bool p_enable){ - - VSG::canvas->canvas_item_set_distance_field_mode(p_item,p_enable); - -} -void VisualServerRaster::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect){ - - VSG::canvas->canvas_item_set_custom_rect(p_item,p_custom_rect,p_rect); - -} -void VisualServerRaster::canvas_item_set_modulate(RID p_item, const Color& p_color){ - - VSG::canvas->canvas_item_set_modulate(p_item,p_color); - -} -void VisualServerRaster::canvas_item_set_self_modulate(RID p_item, const Color& p_color){ - - VSG::canvas->canvas_item_set_self_modulate(p_item,p_color); - -} - -void VisualServerRaster::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable){ - - VSG::canvas->canvas_item_set_draw_behind_parent(p_item,p_enable); - -} - - -void VisualServerRaster::canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased){ - - VSG::canvas->canvas_item_add_line(p_item,p_from,p_to,p_color,p_width,p_antialiased); - -} -void VisualServerRaster::canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color){ - - VSG::canvas->canvas_item_add_rect(p_item,p_rect,p_color); - -} -void VisualServerRaster::canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color){ - - VSG::canvas->canvas_item_add_circle(p_item,p_pos,p_radius,p_color); - -} -void VisualServerRaster::canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile,const Color& p_modulate,bool p_transpose){ - - VSG::canvas->canvas_item_add_texture_rect(p_item,p_rect,p_texture,p_tile,p_modulate,p_transpose); - -} -void VisualServerRaster::canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate,bool p_transpose){ - - VSG::canvas->canvas_item_add_texture_rect_region(p_item,p_rect,p_texture,p_src_rect,p_modulate,p_transpose); - -} -void VisualServerRaster::canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode, NinePatchAxisMode p_y_axis_mode,bool p_draw_center,const Color& p_modulate){ - - VSG::canvas->canvas_item_add_nine_patch(p_item,p_rect,p_source,p_texture,p_topleft,p_bottomright,p_x_axis_mode,p_y_axis_mode,p_draw_center,p_modulate); - -} -void VisualServerRaster::canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width){ - - VSG::canvas->canvas_item_add_primitive(p_item,p_points,p_colors,p_uvs,p_texture,p_width); - -} -void VisualServerRaster::canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture){ - - VSG::canvas->canvas_item_add_polygon(p_item,p_points,p_colors,p_uvs,p_texture); - -} -void VisualServerRaster::canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture, int p_count){ - - VSG::canvas->canvas_item_add_triangle_array(p_item,p_indices,p_points,p_colors,p_uvs,p_texture,p_count); - -} -void VisualServerRaster::canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton){ - - VSG::canvas->canvas_item_add_mesh(p_item,p_mesh,p_skeleton); - -} -void VisualServerRaster::canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton){ - - VSG::canvas->canvas_item_add_multimesh(p_item,p_mesh,p_skeleton); - -} -void VisualServerRaster::canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform){ - - VSG::canvas->canvas_item_add_set_transform(p_item,p_transform); - -} -void VisualServerRaster::canvas_item_add_clip_ignore(RID p_item, bool p_ignore){ - - VSG::canvas->canvas_item_add_clip_ignore(p_item,p_ignore); - -} -void VisualServerRaster::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable){ - - VSG::canvas->canvas_item_set_sort_children_by_y(p_item,p_enable); - -} -void VisualServerRaster::canvas_item_set_z(RID p_item, int p_z){ - - VSG::canvas->canvas_item_set_z(p_item,p_z); - -} -void VisualServerRaster::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable){ - - VSG::canvas->canvas_item_set_z_as_relative_to_parent(p_item,p_enable); - -} -void VisualServerRaster::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect){ - - VSG::canvas->canvas_item_set_copy_to_backbuffer(p_item,p_enable,p_rect); - -} - -void VisualServerRaster::canvas_item_clear(RID p_item){ - - VSG::canvas->canvas_item_clear(p_item); - -} -void VisualServerRaster::canvas_item_set_draw_index(RID p_item,int p_index){ - - VSG::canvas->canvas_item_set_draw_index(p_item,p_index); - -} - -void VisualServerRaster::canvas_item_set_material(RID p_item, RID p_material){ - - VSG::canvas->canvas_item_set_material(p_item,p_material); - -} - -void VisualServerRaster::canvas_item_set_use_parent_material(RID p_item, bool p_enable) { - - VSG::canvas->canvas_item_set_use_parent_material(p_item,p_enable); -} - -RID VisualServerRaster::canvas_light_create(){ - - return VSG::canvas->canvas_light_create(); -} - -void VisualServerRaster::canvas_light_attach_to_canvas(RID p_light,RID p_canvas){ - - VSG::canvas->canvas_light_attach_to_canvas(p_light,p_canvas); - -} -void VisualServerRaster::canvas_light_set_enabled(RID p_light, bool p_enabled){ - - VSG::canvas->canvas_light_set_enabled(p_light,p_enabled); - -} -void VisualServerRaster::canvas_light_set_scale(RID p_light, float p_scale){ - - VSG::canvas->canvas_light_set_scale(p_light,p_scale); - -} -void VisualServerRaster::canvas_light_set_transform(RID p_light, const Matrix32& p_transform){ - - VSG::canvas->canvas_light_set_transform(p_light,p_transform); - -} -void VisualServerRaster::canvas_light_set_texture(RID p_light, RID p_texture){ - - VSG::canvas->canvas_light_set_texture(p_light,p_texture); - -} -void VisualServerRaster::canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset){ - - VSG::canvas->canvas_light_set_texture_offset(p_light,p_offset); - -} -void VisualServerRaster::canvas_light_set_color(RID p_light, const Color& p_color){ - - VSG::canvas->canvas_light_set_color(p_light,p_color); - -} -void VisualServerRaster::canvas_light_set_height(RID p_light, float p_height){ - - VSG::canvas->canvas_light_set_height(p_light,p_height); - -} -void VisualServerRaster::canvas_light_set_energy(RID p_light, float p_energy){ - - VSG::canvas->canvas_light_set_energy(p_light,p_energy); - -} -void VisualServerRaster::canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z){ - - VSG::canvas->canvas_light_set_z_range(p_light,p_min_z,p_max_z); - -} -void VisualServerRaster::canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer){ - - VSG::canvas->canvas_light_set_layer_range(p_light,p_min_layer,p_max_layer); - -} -void VisualServerRaster::canvas_light_set_item_cull_mask(RID p_light, int p_mask){ - - VSG::canvas->canvas_light_set_item_cull_mask(p_light,p_mask); - -} -void VisualServerRaster::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask){ - - VSG::canvas->canvas_light_set_item_shadow_cull_mask(p_light,p_mask); - -} - -void VisualServerRaster::canvas_light_set_mode(RID p_light, CanvasLightMode p_mode){ - - VSG::canvas->canvas_light_set_mode(p_light,p_mode); - -} - - -void VisualServerRaster::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) { - - VSG::canvas->canvas_light_set_shadow_enabled(p_light,p_enabled); - -} -void VisualServerRaster::canvas_light_set_shadow_buffer_size(RID p_light, int p_size) { - - VSG::canvas->canvas_light_set_shadow_buffer_size(p_light,p_size); - -} -void VisualServerRaster::canvas_light_set_shadow_gradient_length(RID p_light, float p_length) { - - VSG::canvas->canvas_light_set_shadow_gradient_length(p_light,p_length); - -} -void VisualServerRaster::canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter){ - - VSG::canvas->canvas_light_set_shadow_filter(p_light,p_filter); - -} -void VisualServerRaster::canvas_light_set_shadow_color(RID p_light, const Color& p_color){ - - VSG::canvas->canvas_light_set_shadow_color(p_light,p_color); - -} - - - -RID VisualServerRaster::canvas_light_occluder_create() { - - return VSG::canvas->canvas_light_occluder_create(); -} - -void VisualServerRaster::canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas){ - - VSG::canvas->canvas_light_occluder_attach_to_canvas(p_occluder,p_canvas); - -} -void VisualServerRaster::canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled) { - - VSG::canvas->canvas_light_occluder_set_enabled(p_occluder,p_enabled); - -} -void VisualServerRaster::canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon){ - - VSG::canvas->canvas_light_occluder_set_polygon(p_occluder,p_polygon); - -} -void VisualServerRaster::canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform){ - - VSG::canvas->canvas_light_occluder_set_transform(p_occluder,p_xform); - -} -void VisualServerRaster::canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask){ - - VSG::canvas->canvas_light_occluder_set_light_mask(p_occluder,p_mask); - -} - -RID VisualServerRaster::canvas_occluder_polygon_create() { - - return VSG::canvas->canvas_occluder_polygon_create(); -} -void VisualServerRaster::canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed){ - - VSG::canvas->canvas_occluder_polygon_set_shape(p_occluder_polygon,p_shape,p_closed); -} -void VisualServerRaster::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape){ - - VSG::canvas->canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,p_shape); - -} - - -void VisualServerRaster::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode){ - - VSG::canvas->canvas_occluder_polygon_set_cull_mode(p_occluder_polygon,p_mode); - -} - - /* CURSOR */ void VisualServerRaster::cursor_set_rotation(float p_rotation, int p_cursor ){ @@ -1224,7 +257,7 @@ void VisualServerRaster::draw(){ //if (changes) // print_line("changes: "+itos(changes)); -// changes=0; + changes=0; VSG::rasterizer->begin_frame(); VSG::viewport->draw_viewports(); //_draw_cursors_and_margins(); @@ -1236,7 +269,7 @@ void VisualServerRaster::sync(){ } bool VisualServerRaster::has_changed() const{ - return false; + return changes>0; } void VisualServerRaster::init(){ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 4cad03928b..cd6d7b38d3 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -34,7 +34,9 @@ #include "servers/visual/rasterizer.h" #include "allocators.h" #include "octree.h" - +#include "visual_server_global.h" +#include "visual_server_viewport.h" +#include "visual_server_canvas.h" /** @author Juan Linietsky */ @@ -139,7 +141,7 @@ class VisualServerRaster : public VisualServer { Transform transform; - Camera() { + Camera() { visible_layers=0xFFFFFFFF; fov=60; @@ -148,8 +150,8 @@ class VisualServerRaster : public VisualServer { size=1.0; vaspect=false; - } - }; + } + }; struct Instance; @@ -580,188 +582,209 @@ class VisualServerRaster : public VisualServer { public: +#define DISPLAY_CHANGED changes++; + +#define BIND0R(m_r,m_name) m_r m_name() { return BINDBASE->m_name(); } +#define BIND1R(m_r,m_name,m_type1) m_r m_name(m_type1 arg1) { return BINDBASE->m_name(arg1); } +#define BIND1RC(m_r,m_name,m_type1) m_r m_name(m_type1 arg1) const { return BINDBASE->m_name(arg1); } +#define BIND2RC(m_r,m_name,m_type1,m_type2) m_r m_name(m_type1 arg1,m_type2 arg2) const { return BINDBASE->m_name(arg1,arg2); } +#define BIND3RC(m_r,m_name,m_type1,m_type2,m_type3) m_r m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3) const { return BINDBASE->m_name(arg1,arg2,arg3); } +#define BIND4RC(m_r,m_name,m_type1,m_type2,m_type3,m_type4) m_r m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4) const { return BINDBASE->m_name(arg1,arg2,arg3,arg4); } + +#define BIND1(m_name,m_type1) void m_name(m_type1 arg1) { DISPLAY_CHANGED BINDBASE->m_name(arg1); } +#define BIND2(m_name,m_type1,m_type2) void m_name(m_type1 arg1,m_type2 arg2) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2); } +#define BIND2C(m_name,m_type1,m_type2) void m_name(m_type1 arg1,m_type2 arg2) const { BINDBASE->m_name(arg1,arg2); } +#define BIND3(m_name,m_type1,m_type2,m_type3) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3); } +#define BIND4(m_name,m_type1,m_type2,m_type3,m_type4) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4); } +#define BIND5(m_name,m_type1,m_type2,m_type3,m_type4,m_type5) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5); } +#define BIND6(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6); } +#define BIND7(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7); } +#define BIND8(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7,m_type8 arg8) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); } +#define BIND10(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8,m_type9,m_type10) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7,m_type8 arg8,m_type9 arg9,m_type10 arg10) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); } + +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::storage /* TEXTURE API */ - virtual RID texture_create(); - virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=TEXTURE_FLAGS_DEFAULT); - virtual void texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side=CUBEMAP_LEFT); - virtual Image texture_get_data(RID p_texture,CubeMapSide p_cube_side=CUBEMAP_LEFT) const; - virtual void texture_set_flags(RID p_texture,uint32_t p_flags) ; - virtual uint32_t texture_get_flags(RID p_texture) const; - virtual Image::Format texture_get_format(RID p_texture) const; - virtual uint32_t texture_get_width(RID p_texture) const; - virtual uint32_t texture_get_height(RID p_texture) const; - virtual void texture_set_size_override(RID p_texture,int p_width, int p_height); + BIND0R(RID,texture_create) + BIND5(texture_allocate,RID,int,int,Image::Format,uint32_t) + BIND3(texture_set_data,RID,const Image&,CubeMapSide) + BIND2RC(Image,texture_get_data,RID,CubeMapSide) + BIND2(texture_set_flags,RID,uint32_t) + BIND1RC(uint32_t,texture_get_flags,RID) + BIND1RC(Image::Format,texture_get_format,RID) + BIND1RC(uint32_t,texture_get_width,RID) + BIND1RC(uint32_t,texture_get_height,RID) + BIND3(texture_set_size_override,RID,int,int) - virtual void texture_set_path(RID p_texture,const String& p_path); - virtual String texture_get_path(RID p_texture) const; - virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable); + BIND2(texture_set_path,RID,const String&) + BIND1RC(String,texture_get_path,RID) + BIND1(texture_set_shrink_all_x2_on_set_data,bool) + BIND1(texture_debug_usage,List*) - virtual void texture_debug_usage(List *r_info); /* SHADER API */ + BIND1R(RID,shader_create,ShaderMode) - virtual RID shader_create(ShaderMode p_mode=SHADER_SPATIAL); - virtual void shader_set_mode(RID p_shader,ShaderMode p_mode); - virtual ShaderMode shader_get_mode(RID p_shader) const; + BIND2(shader_set_mode,RID,ShaderMode) + BIND1RC(ShaderMode,shader_get_mode,RID) - virtual void shader_set_code(RID p_shader, const String& p_code); - virtual String shader_get_code(RID p_shader) const; - virtual void shader_get_param_list(RID p_shader, List *p_param_list) const; + BIND2(shader_set_code,RID,const String&) + BIND1RC(String,shader_get_code,RID) - virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); - virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const; + BIND2C(shader_get_param_list,RID, List *) + + BIND3(shader_set_default_texture_param,RID,const StringName&,RID) + BIND2RC(RID,shader_get_default_texture_param,RID,const StringName&) /* COMMON MATERIAL API */ - virtual RID material_create(); + BIND0R(RID,material_create) - virtual void material_set_shader(RID p_shader_material, RID p_shader); - virtual RID material_get_shader(RID p_shader_material) const; + BIND2(material_set_shader,RID,RID) + BIND1RC(RID,material_get_shader,RID) - virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); - virtual Variant material_get_param(RID p_material, const StringName& p_param) const; + BIND3(material_set_param,RID, const StringName&, const Variant& ) + BIND2RC(Variant,material_get_param,RID, const StringName& ) /* MESH API */ - virtual RID mesh_create(); - - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >()); + BIND0R(RID,mesh_create) - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); - virtual int mesh_get_morph_target_count(RID p_mesh) const; + BIND8(mesh_add_surface,RID,uint32_t,PrimitiveType,const DVector&,int ,const DVector& ,int ,const Vector >& ) + BIND2(mesh_set_morph_target_count,RID,int) + BIND1RC(int,mesh_get_morph_target_count,RID) - virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode); - virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; - virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); - virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; + BIND2(mesh_set_morph_target_mode,RID,MorphTargetMode) + BIND1RC(MorphTargetMode, mesh_get_morph_target_mode,RID ) - virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; - virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; + BIND3(mesh_surface_set_material,RID, int , RID ) + BIND2RC(RID,mesh_surface_get_material,RID, int ) - virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const; - virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const; + BIND2RC(int,mesh_surface_get_array_len,RID,int) + BIND2RC(int,mesh_surface_get_array_index_len,RID,int) + BIND2RC(DVector,mesh_surface_get_array,RID,int) + BIND2RC(DVector,mesh_surface_get_index_array,RID, int) - virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; - virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; + BIND2RC(uint32_t,mesh_surface_get_format,RID,int) + BIND2RC(PrimitiveType,mesh_surface_get_primitive_type,RID,int) - virtual void mesh_remove_surface(RID p_mesh,int p_index); - virtual int mesh_get_surface_count(RID p_mesh) const; + BIND2(mesh_remove_surface,RID,int) + BIND1RC(int,mesh_get_surface_count,RID) - virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); - virtual AABB mesh_get_custom_aabb(RID p_mesh) const; + BIND2(mesh_set_custom_aabb,RID,const AABB&) + BIND1RC(AABB,mesh_get_custom_aabb,RID) - virtual void mesh_clear(RID p_mesh); + BIND1(mesh_clear,RID) /* MULTIMESH API */ - virtual RID multimesh_create(); + BIND0R(RID,multimesh_create) - virtual void multimesh_allocate(RID p_multimesh,int p_instances,MultimeshTransformFormat p_transform_format,MultimeshColorFormat p_color_format,bool p_gen_aabb=true); - virtual int multimesh_get_instance_count(RID p_multimesh) const; + BIND5(multimesh_allocate,RID,int,MultimeshTransformFormat,MultimeshColorFormat,bool) + BIND1RC(int,multimesh_get_instance_count,RID) - virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); - virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb); - virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); - virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform); - virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); + BIND2(multimesh_set_mesh,RID,RID) + BIND2(multimesh_set_custom_aabb,RID,const AABB&) + BIND3(multimesh_instance_set_transform,RID,int,const Transform&) + BIND3(multimesh_instance_set_transform_2d,RID,int,const Matrix32& ) + BIND3(multimesh_instance_set_color,RID,int,const Color&) - virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const; + BIND1RC(RID,multimesh_get_mesh,RID) + BIND1RC(AABB,multimesh_get_custom_aabb,RID) - virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; - virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; - virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const; + BIND2RC(Transform,multimesh_instance_get_transform,RID,int ) + BIND2RC(Matrix32,multimesh_instance_get_transform_2d,RID,int) + BIND2RC(Color,multimesh_instance_get_color,RID,int) - virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); - virtual int multimesh_get_visible_instances(RID p_multimesh) const; + BIND2(multimesh_set_visible_instances,RID,int) + BIND1RC(int,multimesh_get_visible_instances,RID) /* IMMEDIATE API */ - virtual RID immediate_create(); - virtual void immediate_begin(RID p_immediate,PrimitiveType p_rimitive,RID p_texture=RID()); - virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); - virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex); - virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); - virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); - virtual void immediate_color(RID p_immediate,const Color& p_color); - virtual void immediate_uv(RID p_immediate,const Vector2& tex_uv); - virtual void immediate_uv2(RID p_immediate,const Vector2& tex_uv); - virtual void immediate_end(RID p_immediate); - virtual void immediate_clear(RID p_immediate); - virtual void immediate_set_material(RID p_immediate,RID p_material); - virtual RID immediate_get_material(RID p_immediate) const; + BIND0R(RID,immediate_create) + BIND3(immediate_begin,RID,PrimitiveType,RID) + BIND2(immediate_vertex,RID,const Vector3&) + BIND2(immediate_vertex_2d,RID,const Vector3&) + BIND2(immediate_normal,RID,const Vector3&) + BIND2(immediate_tangent,RID,const Plane&) + BIND2(immediate_color,RID,const Color&) + BIND2(immediate_uv,RID,const Vector2& ) + BIND2(immediate_uv2,RID,const Vector2&) + BIND1(immediate_end,RID) + BIND1(immediate_clear,RID) + BIND2(immediate_set_material,RID ,RID ) + BIND1RC(RID,immediate_get_material,RID) /* SKELETON API */ - virtual RID skeleton_create(); - virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false); - virtual int skeleton_get_bone_count(RID p_skeleton) const; - virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform); - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone); - virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform); - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone); + BIND0R(RID,skeleton_create) + BIND3(skeleton_allocate,RID,int,bool) + BIND1RC(int,skeleton_get_bone_count,RID) + BIND3(skeleton_bone_set_transform,RID,int,const Transform&) + BIND2RC(Transform,skeleton_bone_get_transform,RID,int) + BIND3(skeleton_bone_set_transform_2d,RID,int, const Matrix32& ) + BIND2RC(Matrix32,skeleton_bone_get_transform_2d,RID,int) /* Light API */ - virtual RID light_create(LightType p_type); - - virtual void light_set_color(RID p_light,const Color& p_color); - virtual void light_set_param(RID p_light,LightParam p_param,float p_value); - virtual void light_set_shadow(RID p_light,bool p_enabled); - virtual void light_set_projector(RID p_light,RID p_texture); - virtual void light_set_attenuation_texure(RID p_light,RID p_texture); - virtual void light_set_negative(RID p_light,bool p_enable); - virtual void light_set_cull_mask(RID p_light,uint32_t p_mask); - virtual void light_set_shader(RID p_light,RID p_shader); + BIND1R(RID,light_create,LightType) + BIND2(light_set_color,RID,const Color&) + BIND3(light_set_param,RID ,LightParam ,float ) + BIND2(light_set_shadow,RID ,bool ) + BIND2(light_set_projector,RID,RID ) + BIND2(light_set_attenuation_texure,RID,RID ) + BIND2(light_set_negative,RID,bool ) + BIND2(light_set_cull_mask,RID ,uint32_t ) + BIND2(light_set_shader,RID ,RID ) - virtual void light_directional_set_shadow_mode(RID p_light,LightDirectionalShadowMode p_mode); + BIND2(light_directional_set_shadow_mode,RID,LightDirectionalShadowMode) /* PROBE API */ - virtual RID reflection_probe_create(); + BIND0R(RID,reflection_probe_create) - virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity); - virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far); - virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance); - virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents); - virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset); - virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable); - virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution); - virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide); - virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); + BIND2(reflection_probe_set_intensity,RID, float ) + BIND3(reflection_probe_set_clip,RID, float , float ) + BIND2(reflection_probe_set_min_blend_distance,RID, float ) + BIND2(reflection_probe_set_extents,RID, const Vector3& ) + BIND2(reflection_probe_set_origin_offset,RID, const Vector3& ) + BIND2(reflection_probe_set_enable_parallax_correction,RID, bool ) + BIND2(reflection_probe_set_resolution,RID, int ) + BIND2(reflection_probe_set_hide_skybox,RID, bool ) + BIND2(reflection_probe_set_cull_mask,RID, uint32_t ) /* ROOM API */ - virtual RID room_create(); - virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform); - virtual void room_clear_bounds(); + BIND0R(RID,room_create) + BIND4(room_add_bounds,RID, const DVector& ,float ,const Transform& ) + BIND1(room_clear_bounds,RID) /* PORTAL API */ // portals are only (x/y) points, forming a convex shape, which its clockwise // order points outside. (z is 0); - virtual RID portal_create(); - virtual void portal_set_shape(RID p_portal, const Vector& p_shape); - virtual void portal_set_enabled(RID p_portal, bool p_enabled); - virtual void portal_set_disable_distance(RID p_portal, float p_distance); - virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); + BIND0R(RID,portal_create) + BIND2(portal_set_shape,RID , const Vector& ) + BIND2(portal_set_enabled,RID , bool ) + BIND2(portal_set_disable_distance,RID , float ) + BIND2(portal_set_disabled_color,RID , const Color& ) /* CAMERA API */ @@ -773,40 +796,44 @@ public: virtual void camera_set_environment(RID p_camera,RID p_env); virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable); +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::viewport /* VIEWPORT TARGET API */ - virtual RID viewport_create(); + BIND0R(RID,viewport_create) - virtual void viewport_set_size(RID p_viewport,int p_width,int p_height); + BIND3(viewport_set_size,RID,int ,int ) - virtual void viewport_set_active(RID p_viewport,bool p_active); + BIND2(viewport_set_active,RID ,bool ) - virtual void viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode); + BIND2(viewport_set_clear_mode,RID,ViewportClearMode ) - virtual void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0); - virtual void viewport_detach(RID p_viewport); + BIND3(viewport_attach_to_screen,RID ,const Rect2& ,int ) + BIND1(viewport_detach,RID) - virtual void viewport_set_update_mode(RID p_viewport,ViewportUpdateMode p_mode); - virtual void viewport_set_vflip(RID p_viewport,bool p_enable); + BIND2(viewport_set_update_mode,RID,ViewportUpdateMode ) + BIND2(viewport_set_vflip,RID,bool) - virtual RID viewport_get_texture(RID p_viewport) const; - virtual Image viewport_capture(RID p_viewport) const; + BIND1RC(RID,viewport_get_texture,RID ) + BIND1RC(Image,viewport_capture,RID ) - virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide); - virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide); - virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable); + BIND2(viewport_set_hide_scenario,RID,bool ) + BIND2(viewport_set_hide_canvas,RID,bool ) + BIND2(viewport_set_disable_environment,RID,bool ) - virtual void viewport_attach_camera(RID p_viewport,RID p_camera); - virtual void viewport_set_scenario(RID p_viewport,RID p_scenario); - virtual void viewport_attach_canvas(RID p_viewport,RID p_canvas); - virtual void viewport_remove_canvas(RID p_viewport,RID p_canvas); - virtual void viewport_set_canvas_transform(RID p_viewport,RID p_canvas,const Matrix32& p_offset); - virtual void viewport_set_transparent_background(RID p_viewport,bool p_enabled); + BIND2(viewport_attach_camera,RID,RID ) + BIND2(viewport_set_scenario,RID,RID ) + BIND2(viewport_attach_canvas,RID,RID ) - virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); - virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); + BIND2(viewport_remove_canvas,RID,RID ) + BIND3(viewport_set_canvas_transform,RID ,RID ,const Matrix32& ) + BIND2(viewport_set_transparent_background,RID ,bool ) + + BIND2(viewport_set_global_canvas_transform,RID,const Matrix32& ) + BIND3(viewport_set_canvas_layer,RID ,RID ,int ) /* ENVIRONMENT API */ @@ -872,93 +899,99 @@ public: virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin); virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance); + +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::canvas + /* CANVAS (2D) */ - virtual RID canvas_create(); - virtual void canvas_set_item_mirroring(RID p_canvas,RID p_item,const Point2& p_mirroring); - virtual void canvas_set_modulate(RID p_canvas,const Color& p_color); + BIND0R(RID,canvas_create) + BIND3(canvas_set_item_mirroring,RID ,RID ,const Point2& ) + BIND2(canvas_set_modulate,RID,const Color&) - virtual RID canvas_item_create(); - virtual void canvas_item_set_parent(RID p_item,RID p_parent); + BIND0R(RID,canvas_item_create) + BIND2(canvas_item_set_parent,RID ,RID) - virtual void canvas_item_set_visible(RID p_item,bool p_visible); - virtual void canvas_item_set_light_mask(RID p_item,int p_mask); + BIND2(canvas_item_set_visible,RID,bool ) + BIND2(canvas_item_set_light_mask,RID,int ) - virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform); - virtual void canvas_item_set_clip(RID p_item, bool p_clip); - virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); - virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2()); - virtual void canvas_item_set_modulate(RID p_item, const Color& p_color); - virtual void canvas_item_set_self_modulate(RID p_item, const Color& p_color); + BIND2(canvas_item_set_transform,RID, const Matrix32& ) + BIND2(canvas_item_set_clip,RID, bool ) + BIND2(canvas_item_set_distance_field_mode,RID, bool ) + BIND3(canvas_item_set_custom_rect,RID, bool ,const Rect2& ) + BIND2(canvas_item_set_modulate,RID, const Color& ) + BIND2(canvas_item_set_self_modulate,RID, const Color& ) - virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); + BIND2(canvas_item_set_draw_behind_parent,RID, bool ) - virtual void canvas_item_add_line(RID p_item, const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width=1.0,bool p_antialiased=false); - virtual void canvas_item_add_rect(RID p_item, const Rect2& p_rect, const Color& p_color); - virtual void canvas_item_add_circle(RID p_item, const Point2& p_pos, float p_radius,const Color& p_color); - virtual void canvas_item_add_texture_rect(RID p_item, const Rect2& p_rect, RID p_texture,bool p_tile=false,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); - virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2& p_rect, RID p_texture,const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1),bool p_transpose=false); - virtual void canvas_item_add_nine_patch(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector2& p_topleft, const Vector2& p_bottomright,NinePatchAxisMode p_x_axis_mode=NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode=NINE_PATCH_STRETCH,bool p_draw_center=true,const Color& p_modulate=Color(1,1,1)); - virtual void canvas_item_add_primitive(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs, RID p_texture,float p_width=1.0); - virtual void canvas_item_add_polygon(RID p_item, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID()); - virtual void canvas_item_add_triangle_array(RID p_item, const Vector& p_indices, const Vector& p_points, const Vector& p_colors,const Vector& p_uvs=Vector(), RID p_texture=RID(), int p_count=-1); - virtual void canvas_item_add_mesh(RID p_item, const RID& p_mesh,RID p_skeleton=RID()); - virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh,RID p_skeleton=RID()); - virtual void canvas_item_add_set_transform(RID p_item,const Matrix32& p_transform); - virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); - virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); - virtual void canvas_item_set_z(RID p_item, int p_z); - virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); - virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect); + BIND6(canvas_item_add_line,RID, const Point2& , const Point2& ,const Color& ,float ,bool ) + BIND3(canvas_item_add_rect,RID, const Rect2& , const Color& ) + BIND4(canvas_item_add_circle,RID, const Point2& , float ,const Color& ) + BIND6(canvas_item_add_texture_rect,RID, const Rect2& , RID ,bool ,const Color& ,bool ) + BIND6(canvas_item_add_texture_rect_region,RID, const Rect2& , RID ,const Rect2& ,const Color& ,bool ) + BIND10(canvas_item_add_nine_patch,RID, const Rect2& , const Rect2& , RID ,const Vector2& , const Vector2& ,NinePatchAxisMode , NinePatchAxisMode,bool ,const Color& ) + BIND6(canvas_item_add_primitive,RID, const Vector& , const Vector& ,const Vector& , RID ,float ) + BIND5(canvas_item_add_polygon,RID, const Vector& , const Vector& ,const Vector& , RID ) + BIND7(canvas_item_add_triangle_array,RID, const Vector& , const Vector& , const Vector& ,const Vector& , RID , int) + BIND3(canvas_item_add_mesh,RID, const RID& ,RID ) + BIND3(canvas_item_add_multimesh,RID, RID ,RID ) + BIND2(canvas_item_add_set_transform,RID,const Matrix32& ) + BIND2(canvas_item_add_clip_ignore,RID, bool ) + BIND2(canvas_item_set_sort_children_by_y,RID, bool ) + BIND2(canvas_item_set_z,RID, int ) + BIND2(canvas_item_set_z_as_relative_to_parent,RID, bool ) + BIND3(canvas_item_set_copy_to_backbuffer,RID, bool ,const Rect2& ) - virtual void canvas_item_clear(RID p_item); - virtual void canvas_item_set_draw_index(RID p_item,int p_index); + BIND1(canvas_item_clear,RID ) + BIND2(canvas_item_set_draw_index,RID,int) - virtual void canvas_item_set_material(RID p_item, RID p_material); + BIND2(canvas_item_set_material,RID, RID ) - virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable); + BIND2(canvas_item_set_use_parent_material,RID, bool ) - virtual RID canvas_light_create(); - virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas); - virtual void canvas_light_set_enabled(RID p_light, bool p_enabled); - virtual void canvas_light_set_scale(RID p_light, float p_scale); - virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform); - virtual void canvas_light_set_texture(RID p_light, RID p_texture); - virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset); - virtual void canvas_light_set_color(RID p_light, const Color& p_color); - virtual void canvas_light_set_height(RID p_light, float p_height); - virtual void canvas_light_set_energy(RID p_light, float p_energy); - virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z); - virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer); - virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask); - virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask); - virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode); + BIND0R(RID,canvas_light_create) + BIND2(canvas_light_attach_to_canvas,RID,RID ) + BIND2(canvas_light_set_enabled,RID, bool ) + BIND2(canvas_light_set_scale,RID, float ) + BIND2(canvas_light_set_transform,RID, const Matrix32& ) + BIND2(canvas_light_set_texture,RID, RID ) + BIND2(canvas_light_set_texture_offset,RID, const Vector2& ) + BIND2(canvas_light_set_color,RID, const Color& ) + BIND2(canvas_light_set_height,RID, float ) + BIND2(canvas_light_set_energy,RID, float ) + BIND3(canvas_light_set_z_range,RID, int ,int ) + BIND3(canvas_light_set_layer_range,RID, int ,int ) + BIND2(canvas_light_set_item_cull_mask,RID, int ) + BIND2(canvas_light_set_item_shadow_cull_mask,RID, int ) + BIND2(canvas_light_set_mode,RID, CanvasLightMode ) - virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled); - virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size); - virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length); - virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter); - virtual void canvas_light_set_shadow_color(RID p_light, const Color& p_color); + BIND2(canvas_light_set_shadow_enabled,RID, bool ) + BIND2(canvas_light_set_shadow_buffer_size,RID, int ) + BIND2(canvas_light_set_shadow_gradient_length,RID, float ) + BIND2(canvas_light_set_shadow_filter,RID, CanvasLightShadowFilter ) + BIND2(canvas_light_set_shadow_color,RID, const Color& ) - virtual RID canvas_light_occluder_create(); - virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder,RID p_canvas); - virtual void canvas_light_occluder_set_enabled(RID p_occluder,bool p_enabled); - virtual void canvas_light_occluder_set_polygon(RID p_occluder,RID p_polygon); - virtual void canvas_light_occluder_set_transform(RID p_occluder,const Matrix32& p_xform); - virtual void canvas_light_occluder_set_light_mask(RID p_occluder,int p_mask); + BIND0R(RID,canvas_light_occluder_create) + BIND2(canvas_light_occluder_attach_to_canvas,RID,RID ) + BIND2(canvas_light_occluder_set_enabled,RID,bool ) + BIND2(canvas_light_occluder_set_polygon,RID,RID ) + BIND2(canvas_light_occluder_set_transform,RID,const Matrix32& ) + BIND2(canvas_light_occluder_set_light_mask,RID,int ) - virtual RID canvas_occluder_polygon_create(); - virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const DVector& p_shape,bool p_closed); - virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector& p_shape); + BIND0R(RID,canvas_occluder_polygon_create) + BIND3(canvas_occluder_polygon_set_shape,RID,const DVector& ,bool) + BIND2(canvas_occluder_polygon_set_shape_as_lines,RID ,const DVector&) - virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon,CanvasOccluderPolygonCullMode p_mode); + + BIND2(canvas_occluder_polygon_set_cull_mode,RID,CanvasOccluderPolygonCullMode) /* CURSOR */ @@ -1005,6 +1038,24 @@ public: VisualServerRaster(); ~VisualServerRaster(); +#undef DISPLAY_CHANGED + +#undef BIND0R +#undef BIND1RC +#undef BIND2RC +#undef BIND3RC +#undef BIND4RC + +#undef BIND1 +#undef BIND2 +#undef BIND3 +#undef BIND4 +#undef BIND5 +#undef BIND6 +#undef BIND7 +#undef BIND8 +#undef BIND10 + }; #endif diff --git a/servers/visual_server.h b/servers/visual_server.h index 918b0b102e..4eb2b2a5fa 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -288,7 +288,7 @@ public: virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh,const AABB& p_aabb) const=0; + virtual AABB multimesh_get_custom_aabb(RID p_multimesh) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; @@ -320,9 +320,9 @@ public: virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false)=0; virtual int skeleton_get_bone_count(RID p_skeleton) const=0; virtual void skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform)=0; - virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone)=0; + virtual Transform skeleton_bone_get_transform(RID p_skeleton,int p_bone) const=0; virtual void skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform)=0; - virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)=0; + virtual Matrix32 skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)const =0; /* Light API */ @@ -392,7 +392,7 @@ public: virtual RID room_create()=0; virtual void room_add_bounds(RID p_room, const DVector& p_convex_polygon,float p_height,const Transform& p_transform)=0; - virtual void room_clear_bounds()=0; + virtual void room_clear_bounds(RID p_room)=0; /* PORTAL API */ -- cgit v1.2.3 From cf5778e51a883936ffc896231da8259e5ebabc0a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 5 Oct 2016 01:26:35 -0300 Subject: -Added ViewportContainer, this is the only way to make viewports show up in GUI now -2D editing now seems to work -Added some functions and refactoring to Viewport --- drivers/gles2/shaders/canvas.glsl | 1 + drivers/gles3/rasterizer_canvas_gles3.cpp | 18 +-- drivers/gles3/rasterizer_gles3.cpp | 4 +- drivers/gles3/rasterizer_storage_gles3.cpp | 64 ++++++++++- drivers/gles3/rasterizer_storage_gles3.h | 5 +- scene/gui/viewport_container.cpp | 103 +++++++++++++++++ scene/gui/viewport_container.h | 25 +++++ scene/main/viewport.cpp | 125 ++++++++------------- scene/main/viewport.h | 24 ++-- scene/register_scene_types.cpp | 4 +- servers/visual/rasterizer.h | 1 - servers/visual/visual_server_raster.h | 3 +- servers/visual/visual_server_viewport.cpp | 41 +++++-- servers/visual/visual_server_viewport.h | 27 ++++- servers/visual_server.h | 5 +- tools/editor/editor_node.cpp | 13 ++- tools/editor/editor_node.h | 4 +- tools/editor/plugins/canvas_item_editor_plugin.cpp | 3 +- tools/editor/plugins/spatial_editor_plugin.cpp | 4 +- tools/editor/plugins/spatial_editor_plugin.h | 2 +- 20 files changed, 340 insertions(+), 136 deletions(-) create mode 100644 scene/gui/viewport_container.cpp create mode 100644 scene/gui/viewport_container.h diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 38c579c15c..eeab42ee64 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -395,5 +395,6 @@ LIGHT_SHADER_CODE // color.rgb*=color.a; gl_FragColor = color; + } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index f24560763f..a1e755cb4a 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -111,6 +111,15 @@ void RasterizerCanvasGLES3::light_internal_free(RID p_rid) { void RasterizerCanvasGLES3::canvas_begin(){ + if (storage->frame.current_rt && storage->frame.clear_request) { + // a clear request may be pending, so do it + + glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); + glClear(GL_COLOR_BUFFER_BIT); + storage->frame.clear_request=false; + + } + /*canvas_shader.unbind(); canvas_shader.set_custom_shader(0); canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,false); @@ -504,7 +513,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr } if (rect->flags&CANVAS_RECT_FLIP_V) { - src_rect.size.x*=-1; + src_rect.size.y*=-1; } if (rect->flags&CANVAS_RECT_TRANSPOSE) { @@ -769,14 +778,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const Color& p_modulate,Light *p_light) { - if (storage->frame.clear_request) { - // a clear request may be pending, so do it - glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); - glClear(GL_COLOR_BUFFER_BIT); - storage->frame.clear_request=false; - - } Item *current_clip=NULL; RasterizerStorageGLES3::Shader *shader_cache=NULL; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index ba83a572e5..27b0690645 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -141,7 +141,7 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target){ storage->frame.current_rt=rt; storage->frame.clear_request=false; - glViewport(0,0,rt->width,rt->height); + glViewport(0,0,rt->width,rt->height); } else { storage->frame.current_rt=NULL; @@ -155,6 +155,7 @@ void RasterizerGLES3::restore_render_target() { ERR_FAIL_COND(storage->frame.current_rt==NULL); RasterizerStorageGLES3::RenderTarget * rt = storage->frame.current_rt; + glBindFramebuffer(GL_FRAMEBUFFER,rt->front.fbo); glViewport(0,0,rt->width,rt->height); } @@ -176,6 +177,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target,const Rec ERR_FAIL_COND(!rt); canvas->canvas_begin(); + glDisable(GL_BLEND); glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,rt->front.color); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 515db39098..b4d65080a4 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1483,6 +1483,12 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->depth=0; } + Texture *tex = texture_owner.get(rt->texture); + tex->alloc_height=0; + tex->alloc_width=0; + tex->width=0; + tex->height=0; + } void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ @@ -1490,6 +1496,8 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ if (rt->width<=0 || rt->height<=0) return; + glActiveTexture(GL_TEXTURE0); + glGenFramebuffers(1, &rt->front.fbo); glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo); @@ -1512,6 +1520,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ GLuint color_internal_format; GLuint color_format; GLuint color_type; + Image::Format image_format; if (config.fbo_format==FBO_FORMAT_16_BITS) { @@ -1520,28 +1529,33 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ color_internal_format=GL_RGB5_A1; color_format=GL_RGBA; color_type=GL_UNSIGNED_SHORT_5_5_5_1; + image_format=Image::FORMAT_RGBA5551; } else { color_internal_format=GL_RGB565; color_format=GL_RGB; color_type=GL_UNSIGNED_SHORT_5_6_5; + image_format=Image::FORMAT_RGB565; } - } else if (config.fbo_format==FBO_FORMAT_32_BITS) { + } else if (config.fbo_format==FBO_FORMAT_32_BITS || (config.fbo_format==FBO_FORMAT_FLOAT && rt->flags[RENDER_TARGET_NO_3D])) { if (rt->flags[RENDER_TARGET_TRANSPARENT]) { color_internal_format=GL_RGBA8; color_format=GL_RGBA; color_type=GL_UNSIGNED_BYTE; + image_format=Image::FORMAT_RGBA8; } else { color_internal_format=GL_RGB10_A2; color_format=GL_RGBA; color_type=GL_UNSIGNED_INT_2_10_10_10_REV; + image_format=Image::FORMAT_RGBA8;//todo } } else if (config.fbo_format==FBO_FORMAT_FLOAT) { color_internal_format=GL_RGBA16F; color_format=GL_RGBA; color_type=GL_HALF_FLOAT; + image_format=Image::FORMAT_RGBAH; } glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); @@ -1559,6 +1573,19 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); } + Texture *tex = texture_owner.get(rt->texture); + tex->format=image_format; + tex->gl_format_cache=color_format; + tex->gl_type_cache=color_type; + tex->gl_internal_format_cache=color_internal_format; + tex->tex_id=rt->front.color; + tex->width=rt->width; + tex->alloc_width=rt->width; + tex->height=rt->height; + tex->alloc_height=rt->height; + + + texture_set_flags(rt->texture,tex->flags); if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) { @@ -1662,6 +1689,31 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ RID RasterizerStorageGLES3::render_target_create(){ RenderTarget *rt = memnew( RenderTarget ); + + Texture * t = memnew( Texture ); + + t->flags=0; + t->width=0; + t->height=0; + t->alloc_height=0; + t->alloc_width=0; + t->format=Image::FORMAT_R8; + t->target=GL_TEXTURE_2D; + t->gl_format_cache=0; + t->gl_internal_format_cache=0; + t->gl_type_cache=0; + t->data_size=0; + t->compressed=false; + t->srgb=false; + t->total_data_size=0; + t->ignore_mipmaps=false; + t->mipmaps=0; + t->active=true; + t->tex_id=0; + + + rt->texture=texture_owner.make_rid(t); + return render_target_owner.make_rid(rt); } @@ -1686,13 +1738,9 @@ RID RasterizerStorageGLES3::render_target_get_texture(RID p_render_target) const RenderTarget *rt = render_target_owner.getornull(p_render_target); ERR_FAIL_COND_V(!rt,RID()); - - return RID(); + return rt->texture; } -Image RasterizerStorageGLES3::render_target_get_image(RID p_render_target) const{ - return Image(); -} void RasterizerStorageGLES3::render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value) { RenderTarget *rt = render_target_owner.getornull(p_render_target); @@ -1889,12 +1937,16 @@ bool RasterizerStorageGLES3::free(RID p_rid){ RenderTarget *rt = render_target_owner.getornull(p_rid); _render_target_clear(rt); + Texture *t=texture_owner.get(rt->texture); + texture_owner.free(rt->texture); + memdelete(t); render_target_owner.free(p_rid); memdelete(rt); } else if (texture_owner.owns(p_rid)) { // delete the texture Texture *texture = texture_owner.get(p_rid); + ERR_FAIL_COND_V(texture->render_target,true); //cant free the render target texture, dude info.texture_mem-=texture->total_data_size; texture_owner.free(p_rid); memdelete(texture); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index eb6cd0bd92..9820fbc941 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -117,7 +117,6 @@ public: bool active; GLuint tex_id; - RenderTarget *render_target; Texture() { @@ -361,6 +360,8 @@ public: bool used_in_frame; + RID texture; + RenderTarget() { width=0; @@ -387,7 +388,7 @@ public: virtual RID render_target_create(); virtual void render_target_set_size(RID p_render_target,int p_width, int p_height); virtual RID render_target_get_texture(RID p_render_target) const; - virtual Image render_target_get_image(RID p_render_target) const; + virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value); virtual bool render_target_renedered_in_frame(RID p_render_target); diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp new file mode 100644 index 0000000000..3418a495e9 --- /dev/null +++ b/scene/gui/viewport_container.cpp @@ -0,0 +1,103 @@ +#include "viewport_container.h" +#include "scene/main/viewport.h" +Size2 ViewportContainer::get_minimum_size() const { + + + if (stretch) + return Size2(); + Size2 ms; + for(int i=0;icast_to(); + if (!c) + continue; + + Size2 minsize = c->get_size(); + ms.width = MAX(ms.width , minsize.width); + ms.height = MAX(ms.height , minsize.height); + } + + return ms; + +} + + +void ViewportContainer::set_stretch(bool p_enable) { + + stretch=p_enable; + queue_sort(); + update(); + +} + +bool ViewportContainer::is_stretch_enabled() const { + + return stretch; +} + + +void ViewportContainer::_notification(int p_what) { + + + if (p_what==NOTIFICATION_RESIZED) { + + if (!stretch) + return; + + for(int i=0;icast_to(); + if (!c) + continue; + + c->set_size(get_size()); + } + } + + if (p_what==NOTIFICATION_ENTER_TREE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { + + for(int i=0;icast_to(); + if (!c) + continue; + + + if (is_visible()) + c->set_update_mode(Viewport::UPDATE_ALWAYS); + else + c->set_update_mode(Viewport::UPDATE_DISABLED); + } + + } + + if (p_what==NOTIFICATION_DRAW) { + + for(int i=0;icast_to(); + if (!c) + continue; + + if (stretch) + draw_texture_rect(c->get_texture(),Rect2(Vector2(),get_size()*Size2(1,-1))); + else + draw_texture_rect(c->get_texture(),Rect2(Vector2(),c->get_size()*Size2(1,-1))); + } + } + +} + +void ViewportContainer::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_stretch","enable"),&ViewportContainer::set_stretch); + ObjectTypeDB::bind_method(_MD("is_stretch_enabled"),&ViewportContainer::is_stretch_enabled); + + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"stretch"),_SCS("set_stretch"),_SCS("is_stretch_enabled")); +} + +ViewportContainer::ViewportContainer() { + + stretch=false; +} diff --git a/scene/gui/viewport_container.h b/scene/gui/viewport_container.h new file mode 100644 index 0000000000..cfc58f7d6e --- /dev/null +++ b/scene/gui/viewport_container.h @@ -0,0 +1,25 @@ +#ifndef VIEWPORTCONTAINER_H +#define VIEWPORTCONTAINER_H + +#include "scene/gui/container.h" + +class ViewportContainer : public Container { + + OBJ_TYPE( ViewportContainer, Container ); + + bool stretch; +protected: + + void _notification(int p_what); + static void _bind_methods(); +public: + + void set_stretch(bool p_enable); + bool is_stretch_enabled() const; + + virtual Size2 get_minimum_size() const; + + ViewportContainer(); +}; + +#endif // VIEWPORTCONTAINER_H diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 44a3f41a4a..e93a16371d 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -51,35 +51,37 @@ #include "globals.h" -int RenderTargetTexture::get_width() const { +int ViewportTexture::get_width() const { ERR_FAIL_COND_V(!vp,0); return vp->size.width; } -int RenderTargetTexture::get_height() const{ +int ViewportTexture::get_height() const{ ERR_FAIL_COND_V(!vp,0); return vp->size.height; } -Size2 RenderTargetTexture::get_size() const{ +Size2 ViewportTexture::get_size() const{ ERR_FAIL_COND_V(!vp,Size2()); return vp->size; } -RID RenderTargetTexture::get_rid() const{ +RID ViewportTexture::get_rid() const{ ERR_FAIL_COND_V(!vp,RID()); return vp->texture_rid; } -bool RenderTargetTexture::has_alpha() const{ +bool ViewportTexture::has_alpha() const{ return false; } -void RenderTargetTexture::set_flags(uint32_t p_flags){ +void ViewportTexture::set_flags(uint32_t p_flags){ + + if (!vp) + return; - ERR_FAIL_COND(!vp); if (p_flags&FLAG_FILTER) flags=FLAG_FILTER; else @@ -89,12 +91,12 @@ void RenderTargetTexture::set_flags(uint32_t p_flags){ } -uint32_t RenderTargetTexture::get_flags() const{ +uint32_t ViewportTexture::get_flags() const{ return flags; } -RenderTargetTexture::RenderTargetTexture(Viewport *p_vp){ +ViewportTexture::ViewportTexture(Viewport *p_vp){ vp=p_vp; flags=0; @@ -207,7 +209,7 @@ void Viewport::_parent_draw() { void Viewport::_parent_visibility_changed() { - +/* if (parent_control) { Control *c = parent_control; @@ -216,14 +218,14 @@ void Viewport::_parent_visibility_changed() { _update_listener(); _update_listener_2d(); } - +*/ } void Viewport::_vp_enter_tree() { - if (parent_control) { +/* if (parent_control) { Control *cparent=parent_control; RID parent_ci = cparent->get_canvas_item(); @@ -240,7 +242,7 @@ void Viewport::_vp_enter_tree() { // VisualServer::get_singleton()->viewport_attach_to_screen(viewport,0); } - +*/ } @@ -327,24 +329,10 @@ void Viewport::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (get_parent()) { - Node *parent=get_parent(); - if (parent) { - parent_control=parent->cast_to(); - } - } - - - parent=NULL; - Node *parent_node=get_parent(); - - - while(parent_node) { - - parent = parent_node->cast_to(); - if (parent) - break; - - parent_node=parent_node->get_parent(); + parent = get_parent()->get_viewport(); + VisualServer::get_singleton()->viewport_set_parent_viewport(viewport,parent->get_viewport()); + } else { + parent=NULL; } current_canvas=find_world_2d()->get_canvas(); @@ -434,7 +422,7 @@ void Viewport::_notification(int p_what) { } remove_from_group("_viewports"); - parent_control=NULL; + VS::get_singleton()->viewport_set_active(viewport,false); @@ -1263,7 +1251,7 @@ bool Viewport::is_set_as_render_target() const{ void Viewport::set_update_mode(UpdateMode p_mode){ update_mode=p_mode; -// VS::get_singleton()->viewport_set_update_mode(viewport,VS::RenderTargetUpdateMode(p_mode)); + VS::get_singleton()->viewport_set_update_mode(viewport,VS::ViewportUpdateMode(p_mode)); } Viewport::UpdateMode Viewport::get_update_mode() const{ @@ -1282,7 +1270,7 @@ Image Viewport::get_screen_capture() const { return Image(); } -Ref Viewport::get_texture() const { +Ref Viewport::get_texture() const { return texture; } @@ -1290,7 +1278,7 @@ Ref Viewport::get_texture() const { void Viewport::set_vflip(bool p_enable) { vflip=p_enable; -// VisualServer::get_singleton()->viewport_set_vflip(viewport,p_enable); + VisualServer::get_singleton()->viewport_set_vflip(viewport,p_enable); } bool Viewport::get_vflip() const{ @@ -1315,30 +1303,6 @@ void Viewport::clear() { // VisualServer::get_singleton()->viewport_clear(viewport); } -void Viewport::set_filter(bool p_enable) { - - texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); - -} - -bool Viewport::get_filter() const{ - - return (texture->get_flags()&Texture::FLAG_FILTER)!=0; -} - -void Viewport::set_gen_mipmaps(bool p_enable) { - - //texture->set_flags(p_enable?int(Texture::FLAG_FILTER):int(0)); - gen_mipmaps=p_enable; - -} - -bool Viewport::get_gen_mipmaps() const{ - - //return (texture->get_flags()&Texture::FLAG_FILTER)!=0; - return gen_mipmaps; -} - Matrix32 Viewport::_get_input_pre_xform() const { @@ -1356,9 +1320,9 @@ Matrix32 Viewport::_get_input_pre_xform() const { Vector2 Viewport::_get_window_offset() const { - if (parent_control) { - return (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); - } +// if (parent_control) { +// return (parent_control->get_viewport()->get_final_transform() * parent_control->get_global_transform_with_canvas()).get_origin(); +// } return Vector2(); } @@ -1454,8 +1418,6 @@ void Viewport::_vp_input(const InputEvent& p_ev) { } #endif - if (parent_control && !parent_control->is_visible()) - return; if (to_screen_rect==Rect2()) return; //if render target, can't get input events @@ -1480,8 +1442,8 @@ void Viewport::_vp_unhandled_input(const InputEvent& p_ev) { } #endif - if (parent_control && !parent_control->is_visible()) - return; +// if (parent_control && !parent_control->is_visible()) +// return; if (to_screen_rect==Rect2()) return; //if render target, can't get input events @@ -2575,6 +2537,16 @@ bool Viewport::is_input_disabled() const { return disable_input; } +void Viewport::set_disable_3d(bool p_disable) { + disable_3d=p_disable; + VS::get_singleton()->viewport_set_disable_3d(viewport,p_disable); +} + +bool Viewport::is_3d_disabled() const { + + return disable_3d; +} + Variant Viewport::gui_get_drag_data() const { return gui.drag_data; } @@ -2648,17 +2620,10 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_clear_on_new_frame"), &Viewport::get_clear_on_new_frame); ObjectTypeDB::bind_method(_MD("clear"), &Viewport::clear); - - ObjectTypeDB::bind_method(_MD("set_filter","enable"), &Viewport::set_filter); - ObjectTypeDB::bind_method(_MD("get_filter"), &Viewport::get_filter); - - ObjectTypeDB::bind_method(_MD("set_gen_mipmaps","enable"), &Viewport::set_gen_mipmaps); - ObjectTypeDB::bind_method(_MD("get_gen_mipmaps"), &Viewport::get_gen_mipmaps); - ObjectTypeDB::bind_method(_MD("set_update_mode","mode"), &Viewport::set_update_mode); ObjectTypeDB::bind_method(_MD("get_update_mode"), &Viewport::get_update_mode); - ObjectTypeDB::bind_method(_MD("get_texture:RenderTargetTexture"), &Viewport::get_texture); + ObjectTypeDB::bind_method(_MD("get_texture:ViewportTexture"), &Viewport::get_texture); ObjectTypeDB::bind_method(_MD("set_physics_object_picking","enable"), &Viewport::set_physics_object_picking); ObjectTypeDB::bind_method(_MD("get_physics_object_picking"), &Viewport::get_physics_object_picking); @@ -2690,6 +2655,9 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_disable_input","disable"), &Viewport::set_disable_input); ObjectTypeDB::bind_method(_MD("is_input_disabled"), &Viewport::is_input_disabled); + ObjectTypeDB::bind_method(_MD("set_disable_3d","disable"), &Viewport::set_disable_3d); + ObjectTypeDB::bind_method(_MD("is_3d_disabled"), &Viewport::is_3d_disabled); + ObjectTypeDB::bind_method(_MD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip); ObjectTypeDB::bind_method(_MD("_gui_remove_focus"), &Viewport::_gui_remove_focus); @@ -2700,13 +2668,12 @@ void Viewport::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/v_flip"), _SCS("set_vflip"), _SCS("get_vflip") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/clear_on_new_frame"), _SCS("set_clear_on_new_frame"), _SCS("get_clear_on_new_frame") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/filter"), _SCS("set_filter"), _SCS("get_filter") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/gen_mipmaps"), _SCS("set_gen_mipmaps"), _SCS("get_gen_mipmaps") ); ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_update_mode"), _SCS("get_update_mode") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_2d"), _SCS("set_as_audio_listener_2d"), _SCS("is_audio_listener_2d") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_3d"), _SCS("set_as_audio_listener"), _SCS("is_audio_listener") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"physics/object_picking"), _SCS("set_physics_object_picking"), _SCS("get_physics_object_picking") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gui/disable_input"), _SCS("set_disable_input"), _SCS("is_input_disabled") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"3d/disable_3d"), _SCS("set_disable_3d"), _SCS("is_3d_disabled") ); ADD_SIGNAL(MethodInfo("size_changed")); @@ -2727,6 +2694,7 @@ Viewport::Viewport() { world_2d = Ref( memnew( World2D )); viewport = VisualServer::get_singleton()->viewport_create(); + texture_rid=VisualServer::get_singleton()->viewport_get_texture(viewport); internal_listener = SpatialSoundServer::get_singleton()->listener_create(); audio_listener=false; internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create(); @@ -2744,7 +2712,7 @@ Viewport::Viewport() { clear_on_new_frame=true; //clear=true; update_mode=UPDATE_WHEN_VISIBLE; - texture = Ref( memnew( RenderTargetTexture(this) ) ); + texture = Ref( memnew( ViewportTexture(this) ) ); physics_object_picking=false; physics_object_capture=0; @@ -2759,6 +2727,7 @@ Viewport::Viewport() { unhandled_key_input_group = "_vp_unhandled_key_input"+id; disable_input=false; + disable_3d=false; //window tooltip gui.tooltip_timer = -1; @@ -2773,7 +2742,7 @@ Viewport::Viewport() { gui.canvas_sort_index=0; - parent_control=NULL; + } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index d610237bec..c5d61469dd 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -48,9 +48,9 @@ class Label; class Timer; class Viewport; -class RenderTargetTexture : public Texture { +class ViewportTexture : public Texture { - OBJ_TYPE( RenderTargetTexture, Texture ); + OBJ_TYPE( ViewportTexture, Texture ); int flags; friend class Viewport; @@ -70,7 +70,7 @@ public: virtual void set_flags(uint32_t p_flags); virtual uint32_t get_flags() const; - RenderTargetTexture(Viewport *p_vp=NULL); + ViewportTexture(Viewport *p_vp=NULL); }; @@ -88,10 +88,10 @@ public: private: -friend class RenderTargetTexture; +friend class ViewportTexture; + - Control *parent_control; Viewport *parent; Listener *listener; @@ -101,7 +101,6 @@ friend class RenderTargetTexture; Set cameras; RID viewport; - RID canvas_item; RID current_canvas; bool audio_listener; @@ -171,9 +170,10 @@ friend class RenderTargetTexture; void _update_global_transform(); + bool disable_3d; UpdateMode update_mode; RID texture_rid; - Ref texture; + Ref texture; struct GUI { @@ -342,15 +342,10 @@ public: bool get_clear_on_new_frame() const; void clear(); - void set_filter(bool p_enable); - bool get_filter() const; - - void set_gen_mipmaps(bool p_enable); - bool get_gen_mipmaps() const; void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; - Ref get_texture() const; + Ref get_texture() const; Vector2 get_camera_coords(const Vector2& p_viewport_coords) const; @@ -368,6 +363,9 @@ public: void set_disable_input(bool p_disable); bool is_input_disabled() const; + void set_disable_3d(bool p_disable); + bool is_3d_disabled() const; + void set_attach_to_screen_rect(const Rect2& p_rect); Rect2 get_attach_to_screen_rect() const; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index dcb2edf872..1bff6801fe 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -66,6 +66,7 @@ #include "scene/gui/center_container.h" #include "scene/gui/scroll_container.h" #include "scene/gui/margin_container.h" +#include "scene/gui/viewport_container.h" #include "scene/gui/panel.h" #include "scene/gui/spin_box.h" #include "scene/gui/file_dialog.h" @@ -300,7 +301,7 @@ void register_scene_types() { ObjectTypeDB::register_virtual_type(); ObjectTypeDB::register_type(); - ObjectTypeDB::register_virtual_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -390,6 +391,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); OS::get_singleton()->yield(); //may take time to init diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 6a6eb7ad20..865298f64e 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -233,7 +233,6 @@ public: virtual RID render_target_create()=0; virtual void render_target_set_size(RID p_render_target,int p_width, int p_height)=0; virtual RID render_target_get_texture(RID p_render_target) const=0; - virtual Image render_target_get_image(RID p_render_target) const=0; virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value)=0; virtual bool render_target_renedered_in_frame(RID p_render_target)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index cd6d7b38d3..2171998f3f 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -807,6 +807,7 @@ public: BIND3(viewport_set_size,RID,int ,int ) BIND2(viewport_set_active,RID ,bool ) + BIND2(viewport_set_parent_viewport,RID,RID) BIND2(viewport_set_clear_mode,RID,ViewportClearMode ) @@ -818,11 +819,11 @@ public: BIND1RC(RID,viewport_get_texture,RID ) - BIND1RC(Image,viewport_capture,RID ) BIND2(viewport_set_hide_scenario,RID,bool ) BIND2(viewport_set_hide_canvas,RID,bool ) BIND2(viewport_set_disable_environment,RID,bool ) + BIND2(viewport_set_disable_3d,RID,bool ) BIND2(viewport_attach_camera,RID,RID ) BIND2(viewport_set_scenario,RID,RID ) diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index b30a57a5b8..baf18b7a56 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -1,6 +1,7 @@ #include "visual_server_viewport.h" #include "visual_server_global.h" #include "visual_server_canvas.h" +#include "globals.h" void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { @@ -50,7 +51,12 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { } #endif - VSG::rasterizer->clear_render_target(Color(0.5,0.5,0.5,1.0)); + if (p_viewport->clear_mode!=VS::VIEWPORT_CLEAR_NEVER) { + VSG::rasterizer->clear_render_target(clear_color); + if (p_viewport->clear_mode==VS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) { + p_viewport->clear_mode=VS::VIEWPORT_CLEAR_NEVER; + } + } if (!p_viewport->hide_canvas) { int i=0; @@ -161,10 +167,10 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { light=light->shadows_next_ptr; } - VSG::rasterizer->restore_render_target(); // VSG::canvas_render->reset_canvas(); } + VSG::rasterizer->restore_render_target(); #if 0 @@ -175,6 +181,8 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { } #endif + + for (Map::Element *E=canvas_map.front();E;E=E->next()) { VisualServerCanvas::Canvas *canvas = static_cast(E->get()->canvas); @@ -226,6 +234,10 @@ void VisualServerViewport::draw_viewports() { //draw viewports + clear_color=GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.5,0.5,0.5)); + + + active_viewports.sort_custom(); for(int i=0;iparent=p_parent_viewport; +} + void VisualServerViewport::viewport_set_clear_mode(RID p_viewport,VS::ViewportClearMode p_clear_mode) { Viewport * viewport = viewport_owner.getornull(p_viewport); @@ -349,13 +369,6 @@ RID VisualServerViewport::viewport_get_texture(RID p_viewport) const{ return VSG::storage->render_target_get_texture(viewport->render_target); -} -Image VisualServerViewport::viewport_capture(RID p_viewport) const{ - - const Viewport * viewport = viewport_owner.getornull(p_viewport); - ERR_FAIL_COND_V(!viewport,Image()); - return VSG::storage->render_target_get_image(viewport->render_target); - } void VisualServerViewport::viewport_set_hide_scenario(RID p_viewport,bool p_hide){ @@ -381,6 +394,16 @@ void VisualServerViewport::viewport_set_disable_environment(RID p_viewport,bool viewport->disable_environment=p_disable; } +void VisualServerViewport::viewport_set_disable_3d(RID p_viewport,bool p_disable){ + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + + viewport->disable_3d=p_disable; + VSG::storage->render_target_set_flag(viewport->render_target,RasterizerStorage::RENDER_TARGET_NO_3D,p_disable); +} + void VisualServerViewport::viewport_attach_camera(RID p_viewport,RID p_camera){ Viewport * viewport = viewport_owner.getornull(p_viewport); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index e5c888fbcb..cba33a3b2d 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -13,6 +13,8 @@ public: }; + + struct Viewport : public RID_Data { RID self; @@ -32,8 +34,8 @@ public: bool hide_scenario; bool hide_canvas; bool disable_environment; + bool disable_3d; - Image capture; VS::ViewportClearMode clear_mode; @@ -70,8 +72,27 @@ public: }; mutable RID_Owner viewport_owner; + + + struct ViewportSort { + _FORCE_INLINE_ bool operator()(const Viewport*p_left,const Viewport* p_right) const { + + bool left_to_screen = p_left->viewport_to_screen_rect.size!=Size2(); + bool right_to_screen = p_right->viewport_to_screen_rect.size!=Size2(); + + if (left_to_screen==right_to_screen) { + + return p_left->parent==p_right->self; + } else { + return right_to_screen; + } + } + }; + + Vector active_viewports; private: + Color clear_color; void _draw_viewport(Viewport *p_viewport); public: @@ -84,7 +105,7 @@ public: void viewport_detach(RID p_viewport); void viewport_set_active(RID p_viewport,bool p_active); - + void viewport_set_parent_viewport(RID p_viewport,RID p_parent_viewport); void viewport_set_update_mode(RID p_viewport,VS::ViewportUpdateMode p_mode); void viewport_set_vflip(RID p_viewport,bool p_enable); @@ -92,11 +113,11 @@ public: void viewport_set_clear_mode(RID p_viewport,VS::ViewportClearMode p_clear_mode); RID viewport_get_texture(RID p_viewport) const; - Image viewport_capture(RID p_viewport) const; void viewport_set_hide_scenario(RID p_viewport,bool p_hide); void viewport_set_hide_canvas(RID p_viewport,bool p_hide); void viewport_set_disable_environment(RID p_viewport,bool p_disable); + void viewport_set_disable_3d(RID p_viewport,bool p_disable); void viewport_attach_camera(RID p_viewport,RID p_camera); void viewport_set_scenario(RID p_viewport,RID p_scenario); diff --git a/servers/visual_server.h b/servers/visual_server.h index 4eb2b2a5fa..238bcc216d 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -424,6 +424,7 @@ public: virtual void viewport_set_size(RID p_viewport,int p_width,int p_height)=0; virtual void viewport_set_active(RID p_viewport,bool p_active)=0; + virtual void viewport_set_parent_viewport(RID p_viewport,RID p_parent_viewport)=0; virtual void viewport_attach_to_screen(RID p_viewport,const Rect2& p_rect=Rect2(),int p_screen=0)=0; virtual void viewport_detach(RID p_viewport)=0; @@ -442,18 +443,18 @@ public: enum ViewportClearMode { VIEWPORT_CLEAR_ALWAYS, - VIWEPORT_CLEAR_NEVER, + VIEWPORT_CLEAR_NEVER, VIEWPORT_CLEAR_ONLY_NEXT_FRAME }; virtual void viewport_set_clear_mode(RID p_viewport,ViewportClearMode p_clear_mode)=0; virtual RID viewport_get_texture(RID p_viewport) const=0; - virtual Image viewport_capture(RID p_viewport) const=0; virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide)=0; virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide)=0; virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable)=0; + virtual void viewport_set_disable_3d(RID p_viewport,bool p_disable)=0; virtual void viewport_attach_camera(RID p_viewport,RID p_camera)=0; virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 7f02624107..9b5ed422c5 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -266,14 +266,12 @@ void EditorNode::_notification(int p_what) { circle_step=0; circle_step_msec=tick; - circle_step_frame=frame+1; + circle_step_frame=frame+1; update_menu->set_icon(gui_base->get_icon("Progress"+itos(circle_step+1),"EditorIcons")); } - scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); - editor_selection->update(); { @@ -300,7 +298,7 @@ void EditorNode::_notification(int p_what) { } if (p_what==NOTIFICATION_ENTER_TREE) { - + get_tree()->get_root()->set_disable_3d(true); //MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata"); get_tree()->set_editor_hint(true); get_tree()->get_root()->set_as_audio_listener(false); @@ -5663,6 +5661,7 @@ EditorNode::EditorNode() { scene_root_parent->set_custom_minimum_size(Size2(0,80)*EDSCALE); + //Ref sp = scene_root_parent->get_stylebox("panel","TabContainer"); //scene_root_parent->add_style_override("panel",sp); @@ -5676,6 +5675,8 @@ EditorNode::EditorNode() { scene_root = memnew( Viewport ); + scene_root->set_disable_3d(true); + //scene_root_base->add_child(scene_root); @@ -5683,7 +5684,7 @@ EditorNode::EditorNode() { VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true); scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); - scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); + //scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); // scene_root->set_world_2d( Ref( memnew( World2D )) ); @@ -5696,6 +5697,7 @@ EditorNode::EditorNode() { scene_root_parent->add_child(viewport); + PanelContainer *top_region = memnew( PanelContainer ); top_region->add_style_override("panel",gui_base->get_stylebox("hover","Button")); HBoxContainer *left_menu_hb = memnew( HBoxContainer ); @@ -6673,6 +6675,7 @@ EditorNode::EditorNode() { load_error_dialog->set_child_rect(load_errors); gui_base->add_child(load_error_dialog); + //EditorImport::add_importer( Ref( memnew(EditorImporterCollada ))); EditorFileSystem::get_singleton()->connect("sources_changed",this,"_sources_changed"); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 0393cd19a9..c5271860eb 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -79,7 +79,7 @@ #include "fileserver/editor_file_server.h" #include "editor_resource_preview.h" - +#include "scene/gui/viewport_container.h" #include "progress_dialog.h" @@ -207,7 +207,7 @@ private: //Ref scene_import_metadata; - Control* scene_root_parent; + PanelContainer* scene_root_parent; Control *gui_base; VBoxContainer *main_vbox; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index b0e002ba44..2025fe825e 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3320,7 +3320,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { vp_base->set_v_size_flags(SIZE_EXPAND_FILL); palette_split->add_child(vp_base); - Control *vp = memnew (Control); + ViewportContainer *vp = memnew (ViewportContainer); + vp->set_stretch(true); vp_base->add_child(vp); vp->set_area_as_parent_rect(); vp->add_child(p_editor->get_scene_root()); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index afea6f93dd..55a4c6c934 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2348,7 +2348,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed message_time=0; spatial_editor=p_spatial_editor; - Control *c=memnew(Control); + ViewportContainer *c=memnew(ViewportContainer); add_child(c); c->set_area_as_parent_rect(); viewport = memnew( Viewport ); @@ -3973,7 +3973,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { - settings_light_base = memnew( Control ); + settings_light_base = memnew( ViewportContainer ); settings_light_base->set_custom_minimum_size(Size2(128,128)); settings_light_base->connect("input_event",this,"_default_light_angle_input"); settings_vbc->add_margin_child(TTR("Default Light Normal:"),settings_light_base); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 2a52eab777..4751cf7071 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -430,7 +430,7 @@ private: float settings_default_light_rot_x; float settings_default_light_rot_y; - Control *settings_light_base; + ViewportContainer *settings_light_base; Viewport *settings_light_vp; ColorPickerButton *settings_ambient_color; Image settings_light_dir_image; -- cgit v1.2.3 From 850eaf7ed796d2f2d9a35c6bc4ba9a4e69f5ca1d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 7 Oct 2016 11:31:18 -0300 Subject: -the new shader language seems to work -shader editor plugin can edit shaders -code completion in shader editor plugin --- bin/tests/test_shader_lang.cpp | 261 +++--- scene/register_scene_types.cpp | 2 +- scene/resources/shader.cpp | 2 +- scene/resources/shader.h | 8 +- servers/register_server_types.cpp | 8 +- servers/visual/shader_language.cpp | 1051 ++++++++++++++++++++----- servers/visual/shader_language.h | 88 ++- servers/visual/shader_types.cpp | 99 +++ servers/visual/shader_types.h | 27 + tools/editor/editor_node.cpp | 3 +- tools/editor/plugins/shader_editor_plugin.cpp | 238 ++---- tools/editor/plugins/shader_editor_plugin.h | 25 +- 12 files changed, 1315 insertions(+), 497 deletions(-) create mode 100644 servers/visual/shader_types.cpp create mode 100644 servers/visual/shader_types.h diff --git a/bin/tests/test_shader_lang.cpp b/bin/tests/test_shader_lang.cpp index 6c8132122c..1a677bcbe2 100644 --- a/bin/tests/test_shader_lang.cpp +++ b/bin/tests/test_shader_lang.cpp @@ -39,7 +39,7 @@ #include "servers/visual/shader_language.h" //#include "drivers/gles2/shader_compiler_gles2.h" -#if 0 + typedef ShaderLanguage SL; namespace TestShaderLang { @@ -57,50 +57,54 @@ static String _mktab(int p_level) { static String _typestr(SL::DataType p_type) { - switch(p_type) { + return ShaderLanguage::get_datatype_name(p_type); + + return ""; +} + + +static String _prestr(SL::DataPrecision p_pres) { - case SL::TYPE_VOID: return "void"; - case SL::TYPE_BOOL: return "bool"; - case SL::TYPE_FLOAT: return "float"; - case SL::TYPE_VEC2: return "vec2"; - case SL::TYPE_VEC3: return "vec3"; - case SL::TYPE_VEC4: return "vec4"; - case SL::TYPE_MAT3: return "mat3"; - case SL::TYPE_MAT4: return "mat4"; - case SL::TYPE_TEXTURE: return "texture"; - case SL::TYPE_CUBEMAP: return "cubemap"; - default: {} - } + switch(p_pres) { + case SL::PRECISION_LOWP: return "lowp "; + case SL::PRECISION_MEDIUMP: return "mediump "; + case SL::PRECISION_HIGHP: return "highp "; + case SL::PRECISION_DEFAULT: return ""; + } return ""; } + static String _opstr(SL::Operator p_op) { - switch(p_op) { - case SL::OP_ASSIGN: return "="; - case SL::OP_ADD: return "+"; - case SL::OP_SUB: return "-"; - case SL::OP_MUL: return "*"; - case SL::OP_DIV: return "/"; - case SL::OP_ASSIGN_ADD: return "+="; - case SL::OP_ASSIGN_SUB: return "-="; - case SL::OP_ASSIGN_MUL: return "*="; - case SL::OP_ASSIGN_DIV: return "/="; - case SL::OP_NEG: return "-"; - case SL::OP_NOT: return "!"; - case SL::OP_CMP_EQ: return "=="; - case SL::OP_CMP_NEQ: return "!="; - case SL::OP_CMP_LEQ: return "<="; - case SL::OP_CMP_GEQ: return ">="; - case SL::OP_CMP_LESS: return "<"; - case SL::OP_CMP_GREATER: return ">"; - case SL::OP_CMP_OR: return "||"; - case SL::OP_CMP_AND: return "&&"; - default: return ""; - } + return ShaderLanguage::get_operator_text(p_op); - return ""; + +} + + +static String get_constant_text(SL::DataType p_type, const Vector& p_values) { + + switch(p_type) { + case SL::TYPE_BOOL: return p_values[0].boolean?"true":"false"; + case SL::TYPE_BVEC2: return String()+"bvec2("+(p_values[0].boolean?"true":"false")+(p_values[1].boolean?"true":"false")+")"; + case SL::TYPE_BVEC3: return String()+"bvec3("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+")"; + case SL::TYPE_BVEC4: return String()+"bvec4("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+","+(p_values[3].boolean?"true":"false")+")"; + case SL::TYPE_INT: return rtos(p_values[0].sint); + case SL::TYPE_IVEC2: return String()+"ivec2("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+")"; + case SL::TYPE_IVEC3: return String()+"ivec3("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+")"; + case SL::TYPE_IVEC4: return String()+"ivec4("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+","+rtos(p_values[3].sint)+")"; + case SL::TYPE_UINT: return rtos(p_values[0].real); + case SL::TYPE_UVEC2: return String()+"uvec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; + case SL::TYPE_UVEC3: return String()+"uvec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; + case SL::TYPE_UVEC4: return String()+"uvec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; + case SL::TYPE_FLOAT: return rtos(p_values[0].real); + case SL::TYPE_VEC2: return String()+"vec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; + case SL::TYPE_VEC3: return String()+"vec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; + case SL::TYPE_VEC4: return String()+"vec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; + default: ERR_FAIL_V(String()); + } } static String dump_node_code(SL::Node *p_node,int p_level) { @@ -109,18 +113,48 @@ static String dump_node_code(SL::Node *p_node,int p_level) { switch(p_node->type) { - case SL::Node::TYPE_PROGRAM: { + case SL::Node::TYPE_SHADER: { - SL::ProgramNode *pnode=(SL::ProgramNode*)p_node; + SL::ShaderNode *pnode=(SL::ShaderNode*)p_node; - for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { + for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { String ucode="uniform "; - ucode+=_typestr(E->get().type)+"="+String(E->get().default_value)+"\n"; - code+=ucode; + ucode+=_prestr(E->get().precission); + ucode+=_typestr(E->get().type); + ucode+=" "+String(E->key()); + + if (E->get().default_value.size()) { + ucode+=" = "+get_constant_text(E->get().type,E->get().default_value); + } + + static const char*hint_name[SL::ShaderNode::Uniform::HINT_MAX]={ + "", + "color", + "range", + "albedo", + "normal", + "black", + "white" + }; + + if (E->get().hint) + ucode+=" : "+String(hint_name[E->get().hint]); + + code+=ucode+"\n"; } + for(Map::Element *E=pnode->varyings.front();E;E=E->next()) { + + String vcode="varying "; + vcode+=_prestr(E->get().precission); + vcode+=_typestr(E->get().type); + vcode+=" "+String(E->key()); + + code+=vcode+"\n"; + + } for(int i=0;ifunctions.size();i++) { SL::FunctionNode *fnode=pnode->functions[i].function; @@ -131,16 +165,15 @@ static String dump_node_code(SL::Node *p_node,int p_level) { if (i>0) header+=", "; - header+=_typestr(fnode->arguments[i].type)+" "+fnode->arguments[i].name; + header+=_prestr(fnode->arguments[i].precision)+_typestr(fnode->arguments[i].type)+" "+fnode->arguments[i].name; } - header+=") {\n"; + header+=")\n"; code+=header; code+=dump_node_code(fnode->body,p_level+1); - code+="}\n"; } - code+=dump_node_code(pnode->body,p_level); + //code+=dump_node_code(pnode->body,p_level); } break; case SL::Node::TYPE_FUNCTION: { @@ -149,15 +182,23 @@ static String dump_node_code(SL::Node *p_node,int p_level) { SL::BlockNode *bnode=(SL::BlockNode*)p_node; //variables - for(Map::Element *E=bnode->variables.front();E;E=E->next()) { + code+=_mktab(p_level-1)+"{\n"; + for(Map::Element *E=bnode->variables.front();E;E=E->next()) { - code+=_mktab(p_level)+_typestr(E->value())+" "+E->key()+";\n"; + code+=_mktab(p_level)+_prestr(E->get().precision)+_typestr(E->get().type)+" "+E->key()+";\n"; } for(int i=0;istatements.size();i++) { - code+=_mktab(p_level)+dump_node_code(bnode->statements[i],p_level)+";\n"; + String scode = dump_node_code(bnode->statements[i],p_level); + + if (bnode->statements[i]->type==SL::Node::TYPE_CONTROL_FLOW || bnode->statements[i]->type==SL::Node::TYPE_CONTROL_FLOW) { + code+=scode; //use directly + } else { + code+=_mktab(p_level)+scode+";\n"; + } } + code+=_mktab(p_level-1)+"}\n"; } break; @@ -168,18 +209,7 @@ static String dump_node_code(SL::Node *p_node,int p_level) { } break; case SL::Node::TYPE_CONSTANT: { SL::ConstantNode *cnode=(SL::ConstantNode*)p_node; - switch(cnode->datatype) { - - - case SL::TYPE_BOOL: code=cnode->value.operator bool()?"true":"false"; break; - case SL::TYPE_FLOAT: code=cnode->value; break; - case SL::TYPE_VEC2: { Vector2 v = cnode->value; code="vec2("+rtos(v.x)+", "+rtos(v.y)+")"; } break; - case SL::TYPE_VEC3: { Vector3 v = cnode->value; code="vec3("+rtos(v.x)+", "+rtos(v.y)+", "+rtos(v.z)+")"; } break; - case SL::TYPE_VEC4: { Plane v = cnode->value; code="vec4("+rtos(v.normal.x)+", "+rtos(v.normal.y)+", "+rtos(v.normal.z)+", "+rtos(v.d)+")"; } break; - case SL::TYPE_MAT3: { Matrix3 x = cnode->value; code="mat3( vec3("+rtos(x.get_axis(0).x)+", "+rtos(x.get_axis(0).y)+", "+rtos(x.get_axis(0).z)+"), vec3("+rtos(x.get_axis(1).x)+", "+rtos(x.get_axis(1).y)+", "+rtos(x.get_axis(1).z)+"), vec3("+rtos(x.get_axis(2).x)+", "+rtos(x.get_axis(2).y)+", "+rtos(x.get_axis(2).z)+"))"; } break; - case SL::TYPE_MAT4: { Transform x = cnode->value; code="mat4( vec3("+rtos(x.basis.get_axis(0).x)+", "+rtos(x.basis.get_axis(0).y)+", "+rtos(x.basis.get_axis(0).z)+"), vec3("+rtos(x.basis.get_axis(1).x)+", "+rtos(x.basis.get_axis(1).y)+", "+rtos(x.basis.get_axis(1).z)+"), vec3("+rtos(x.basis.get_axis(2).x)+", "+rtos(x.basis.get_axis(2).y)+", "+rtos(x.basis.get_axis(2).z)+"), vec3("+rtos(x.origin.x)+", "+rtos(x.origin.y)+", "+rtos(x.origin.z)+"))"; } break; - default: code="value.get_type())+" ("+itos(cnode->datatype)+">"; - } + return get_constant_text(cnode->datatype,cnode->values); } break; case SL::Node::TYPE_OPERATOR: { @@ -193,28 +223,25 @@ static String dump_node_code(SL::Node *p_node,int p_level) { case SL::OP_ASSIGN_SUB: case SL::OP_ASSIGN_MUL: case SL::OP_ASSIGN_DIV: + case SL::OP_ASSIGN_SHIFT_LEFT: + case SL::OP_ASSIGN_SHIFT_RIGHT: + case SL::OP_ASSIGN_MOD: + case SL::OP_ASSIGN_BIT_AND: + case SL::OP_ASSIGN_BIT_OR: + case SL::OP_ASSIGN_BIT_XOR: code=dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op)+dump_node_code(onode->arguments[1],p_level); break; - - case SL::OP_ADD: - case SL::OP_SUB: - case SL::OP_MUL: - case SL::OP_DIV: - case SL::OP_CMP_EQ: - case SL::OP_CMP_NEQ: - case SL::OP_CMP_LEQ: - case SL::OP_CMP_GEQ: - case SL::OP_CMP_LESS: - case SL::OP_CMP_GREATER: - case SL::OP_CMP_OR: - case SL::OP_CMP_AND: - - code="("+dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op)+dump_node_code(onode->arguments[1],p_level)+")"; - break; - case SL::OP_NEG: + case SL::OP_BIT_INVERT: + case SL::OP_NEGATE: case SL::OP_NOT: + case SL::OP_DECREMENT: + case SL::OP_INCREMENT: code=_opstr(onode->op)+dump_node_code(onode->arguments[0],p_level); break; + case SL::OP_POST_DECREMENT: + case SL::OP_POST_INCREMENT: + code=dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op); + break; case SL::OP_CALL: case SL::OP_CONSTRUCT: code=dump_node_code(onode->arguments[0],p_level)+"("; @@ -225,7 +252,12 @@ static String dump_node_code(SL::Node *p_node,int p_level) { } code+=")"; break; - default: {} + default: { + + code="("+dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op)+dump_node_code(onode->arguments[1],p_level)+")"; + break; + + } } } break; @@ -233,20 +265,19 @@ static String dump_node_code(SL::Node *p_node,int p_level) { SL::ControlFlowNode *cfnode=(SL::ControlFlowNode*)p_node; if (cfnode->flow_op==SL::FLOW_OP_IF) { - code+="if ("+dump_node_code(cfnode->statements[0],p_level)+") {\n"; - code+=dump_node_code(cfnode->statements[1],p_level+1); - if (cfnode->statements.size()==3) { + code+=_mktab(p_level)+"if ("+dump_node_code(cfnode->expressions[0],p_level)+")\n"; + code+=dump_node_code(cfnode->blocks[0],p_level+1); + if (cfnode->blocks.size()==2) { - code+="} else {\n"; - code+=dump_node_code(cfnode->statements[2],p_level+1); + code+=_mktab(p_level)+"else\n"; + code+=dump_node_code(cfnode->blocks[1],p_level+1); } - code+="}\n"; } else if (cfnode->flow_op==SL::FLOW_OP_RETURN) { - if (cfnode->statements.size()) { - code="return "+dump_node_code(cfnode->statements[0],p_level); + if (cfnode->blocks.size()) { + code="return "+dump_node_code(cfnode->blocks[0],p_level); } else { code="return"; } @@ -264,16 +295,14 @@ static String dump_node_code(SL::Node *p_node,int p_level) { } -static Error recreate_code(void *p_str,SL::ProgramNode *p_program) { +static Error recreate_code(void *p_str,SL::ShaderNode *p_program) { + - print_line("recr"); String *str=(String*)p_str; *str=dump_node_code(p_program,0); return OK; - - } @@ -283,6 +312,7 @@ MainLoop* test() { if (cmdlargs.empty()) { //try editor! + print_line("usage: godot -test shader_lang "); return NULL; } @@ -303,50 +333,29 @@ MainLoop* test() { code+=c; } - int errline; - int errcol; - String error; - print_line(SL::lex_debug(code)); - Error err = SL::compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,NULL,NULL,&error,&errline,&errcol); + SL sl; + print_line("tokens:\n\n"+sl.token_debug(code)); - if (err) { + Map > dt; + dt["fragment"]["ALBEDO"]=SL::TYPE_VEC3; - print_line("Error: "+itos(errline)+":"+itos(errcol)+" "+error); - return NULL; - } + Set rm; + rm.insert("popo"); - print_line("Compile OK! - pretty printing"); + Error err = sl.compile(code,dt,rm); - String rcode; - err = SL::compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,recreate_code,&rcode,&error,&errline,&errcol); + if (err) { - if (!err) { - print_line(rcode); + print_line("Error at line: "+rtos(sl.get_error_line())+": "+sl.get_error_text()); + return NULL; + } else { + String code; + recreate_code(&code,sl.get_shader()); + print_line("code:\n\n"+code); } -#if 0 - ShaderCompilerGLES2 comp; - String codeline,globalsline; - SL::VarInfo vi; - vi.name="mongs"; - vi.type=SL::TYPE_VEC3; - - ShaderCompilerGLES2::Flags fl; - comp.compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,codeline,globalsline,fl); -#endif return NULL; } -} -#endif - -typedef ShaderLanguage SL; - -namespace TestShaderLang { - -MainLoop* test() { - - return NULL; -} } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 1bff6801fe..ad845555a4 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -548,7 +548,7 @@ void register_scene_types() { // ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); // ObjectTypeDB::register_type(); - ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::add_compatibility_type("Shader","MaterialShader"); ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedMaterial"); ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedMaterial"); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index b6c8fcf7a1..8889d1b6f8 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -131,7 +131,7 @@ void Shader::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::STRING, "code",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("set_code"), _SCS("get_code") ); - BIND_CONSTANT( MODE_MATERIAL ); + BIND_CONSTANT( MODE_SPATIAL); BIND_CONSTANT( MODE_CANVAS_ITEM ); BIND_CONSTANT( MODE_POST_PROCESS ); diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 988305b654..eddb98333d 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -42,7 +42,7 @@ class Shader : public Resource { public: enum Mode { - MODE_MATERIAL, + MODE_SPATIAL, MODE_CANVAS_ITEM, MODE_POST_PROCESS, MODE_MAX @@ -100,13 +100,13 @@ public: VARIANT_ENUM_CAST( Shader::Mode ); -class MaterialShader : public Shader { +class SpatialShader : public Shader { - OBJ_TYPE(MaterialShader,Shader); + OBJ_TYPE(SpatialShader,Shader); public: - MaterialShader() : Shader(MODE_MATERIAL) {}; + SpatialShader() : Shader(MODE_SPATIAL) {}; }; class CanvasItemShader : public Shader { diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 06eaa4d122..19ee3a48c7 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -36,7 +36,7 @@ #include "spatial_sound_server.h" #include "spatial_sound_2d_server.h" #include "script_debugger_remote.h" - +#include "visual/shader_types.h" static void _debugger_get_resource_usage(List* r_usage) { List tinfo; @@ -55,6 +55,8 @@ static void _debugger_get_resource_usage(Listadd_singleton( Globals::Singleton("VisualServer",VisualServer::get_singleton()) ); @@ -70,6 +72,8 @@ void register_server_types() { Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSound2DServer",SpatialSound2DServer::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("SS2D",SpatialSound2DServer::get_singleton()) ); + shader_types = memnew( ShaderTypes ); + ObjectTypeDB::register_virtual_type(); ObjectTypeDB::register_virtual_type(); @@ -87,5 +91,5 @@ void register_server_types() { void unregister_server_types(){ - + memdelete( shader_types ); } diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 287293a437..1a9912e3fb 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -44,14 +44,71 @@ static bool _is_hex(CharType c) { return (c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'); } + +String ShaderLanguage::get_operator_text(Operator p_op) { + + static const char* op_names[OP_MAX]={"==", + "!=", + "<", + "<=", + ">", + ">=", + "&&", + "||", + "!", + "-", + "+", + "-", + "*", + "/", + "%", + "<<", + ">>", + "=", + "+=", + "-=", + "*=", + "/=", + "%=", + "<<=", + ">>=", + "&=", + "|=", + "^=", + "&", + "|", + "^", + "~", + "++" + "--", + "()", + "construct"}; + + return op_names[p_op]; + +} + + const char * ShaderLanguage::token_names[TK_MAX]={ "EMPTY", "IDENTIFIER", "TRUE", "FALSE", "REAL_CONSTANT", + "INT_CONSTANT", "TYPE_VOID", "TYPE_BOOL", + "TYPE_BVEC2", + "TYPE_BVEC3", + "TYPE_BVEC4", + "TYPE_INT", + "TYPE_IVEC2", + "TYPE_IVEC3", + "TYPE_IVEC4", + "TYPE_UINT", + "TYPE_UVEC2", + "TYPE_UVEC3", + "TYPE_UVEC4", "TYPE_FLOAT", "TYPE_VEC2", "TYPE_VEC3", @@ -59,9 +116,13 @@ const char * ShaderLanguage::token_names[TK_MAX]={ "TYPE_MAT2", "TYPE_MAT3", "TYPE_MAT4", - "TYPE_TEXTURE", - "TYPE_CUBEMAP", - "TYPE_COLOR", + "TYPE_SAMPLER2D", + "TYPE_ISAMPLER2D", + "TYPE_USAMPLER2D", + "TYPE_SAMPLERCUBE", + "PRECISION_LOW", + "PRECISION_MID", + "PRECISION_HIGH", "OP_EQUAL", "OP_NOT_EQUAL", "OP_LESS", @@ -75,14 +136,35 @@ const char * ShaderLanguage::token_names[TK_MAX]={ "OP_SUB", "OP_MUL", "OP_DIV", - "OP_NEG", + "OP_MOD", + "OP_SHIFT_LEFT", + "OP_SHIFT_RIGHT", "OP_ASSIGN", "OP_ASSIGN_ADD", "OP_ASSIGN_SUB", "OP_ASSIGN_MUL", "OP_ASSIGN_DIV", + "OP_ASSIGN_MOD", + "OP_ASSIGN_SHIFT_LEFT", + "OP_ASSIGN_SHIFT_RIGHT", + "OP_ASSIGN_BIT_AND", + "OP_ASSIGN_BIT_OR", + "OP_ASSIGN_BIT_XOR", + "OP_BIT_AND", + "OP_BIT_OR", + "OP_BIT_XOR", + "OP_BIT_INVERT", + "OP_INCREMENT", + "OP_DECREMENT", "CF_IF", "CF_ELSE", + "CF_FOR", + "CF_WHILE", + "CF_DO", + "CF_SWITCH", + "CF_CASE", + "CF_BREAK", + "CF_CONTINUE", "CF_RETURN", "BRACKET_OPEN", "BRACKET_CLOSE", @@ -90,11 +172,23 @@ const char * ShaderLanguage::token_names[TK_MAX]={ "CURLY_BRACKET_CLOSE", "PARENTHESIS_OPEN", "PARENTHESIS_CLOSE", + "QUESTION", "COMMA", + "COLON", "SEMICOLON", "PERIOD", "UNIFORM", + "VARYING", + "RENDER_MODE", + "HINT_WHITE_TEXTURE", + "HINT_BLACK_TEXTURE", + "HINT_NORMAL_TEXTURE", + "HINT_ALBEDO_TEXTURE", + "HINT_COLOR", + "HINT_RANGE", + "CURSOR", "ERROR", + "EOF", }; String ShaderLanguage::get_token_text(Token p_token) { @@ -104,6 +198,8 @@ String ShaderLanguage::get_token_text(Token p_token) { name+="("+rtos(p_token.constant)+")"; } else if (p_token.type==TK_IDENTIFIER) { name+="("+String(p_token.text)+")"; + } else if (p_token.type==TK_ERROR) { + name+="("+String(p_token.text)+")"; } return name; @@ -115,18 +211,79 @@ ShaderLanguage::Token ShaderLanguage::_make_token(TokenType p_type,const StringN tk.type=p_type; tk.text=p_text; tk.line=tk_line; + if (tk.type==TK_ERROR) { + _set_error(p_text); + } return tk; } +const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[]={ + {TK_TRUE,"true"}, + {TK_FALSE,"false"}, + {TK_TYPE_VOID,"void"}, + {TK_TYPE_BOOL,"bool"}, + {TK_TYPE_BVEC2,"bvec2"}, + {TK_TYPE_BVEC3,"bvec3"}, + {TK_TYPE_BVEC4,"bvec4"}, + {TK_TYPE_INT,"int"}, + {TK_TYPE_IVEC2,"ivec2"}, + {TK_TYPE_IVEC3,"ivec3"}, + {TK_TYPE_IVEC4,"ivec4"}, + {TK_TYPE_UINT,"uint"}, + {TK_TYPE_UVEC2,"uvec2"}, + {TK_TYPE_UVEC3,"uvec3"}, + {TK_TYPE_UVEC4,"uvec4"}, + {TK_TYPE_FLOAT,"float"}, + {TK_TYPE_VEC2,"vec2"}, + {TK_TYPE_VEC3,"vec3"}, + {TK_TYPE_VEC4,"vec4"}, + {TK_TYPE_MAT2,"mat2"}, + {TK_TYPE_MAT3,"mat3"}, + {TK_TYPE_MAT4,"mat4"}, + {TK_TYPE_SAMPLER2D,"sampler2D"}, + {TK_TYPE_ISAMPLER2D,"isampler2D"}, + {TK_TYPE_USAMPLER2D,"usampler2D"}, + {TK_TYPE_SAMPLERCUBE,"samplerCube"}, + {TK_PRECISION_LOW,"lowp"}, + {TK_PRECISION_MID,"mediump"}, + {TK_PRECISION_HIGH,"highp"}, + {TK_CF_IF,"if"}, + {TK_CF_ELSE,"else"}, + {TK_CF_FOR,"for"}, + {TK_CF_WHILE,"while"}, + {TK_CF_DO,"do"}, + {TK_CF_SWITCH,"switch"}, + {TK_CF_CASE,"case"}, + {TK_CF_BREAK,"break"}, + {TK_CF_CONTINUE,"continue"}, + {TK_CF_RETURN,"return"}, + {TK_UNIFORM,"uniform"}, + {TK_VARYING,"varying"}, + {TK_RENDER_MODE,"render_mode"}, + {TK_HINT_WHITE_TEXTURE,"white"}, + {TK_HINT_BLACK_TEXTURE,"black"}, + {TK_HINT_NORMAL_TEXTURE,"normal"}, + {TK_HINT_ALBEDO_TEXTURE,"albedo"}, + {TK_HINT_COLOR,"color"}, + {TK_HINT_RANGE,"hint_range"}, + + {TK_ERROR,NULL} +}; + + ShaderLanguage::Token ShaderLanguage::_get_token() { -#define GETCHAR(m_idx) ((char_idx tokens; - String error; - int errline,errcol; - if (tokenize(p_code,&tokens,&error,&errline,&errcol)!=OK) - return error; - String ret; - for(int i=0;iarguments[i+1]->type==Node::TYPE_CONSTANT && convert_constant(static_cast(p_func->arguments[i+1]),builtin_func_defs[idx].args[i])) { + //all good + } else if (args[i]!=builtin_func_defs[idx].args[i]) { fail=true; break; } } - if (!fail && argcount<4 && intrinsic_func_defs[idx].args[argcount]!=TYPE_VOID) + if (!fail && argcount<4 && builtin_func_defs[idx].args[argcount]!=TYPE_VOID) fail=true; //make sure the number of arguments matches if (!fail) { - found_intrinsic=true; + if (r_ret_type) - *r_ret_type=intrinsic_func_defs[idx].rettype; + *r_ret_type=builtin_func_defs[idx].rettype; return true; } @@ -1700,8 +1821,24 @@ bool ShaderLanguage::_validate_function_call(BlockNode* p_block, OperatorNode *p } } + if (failed_builtin) { + String err ="Invalid arguments for built-in function: "+String(name)+"("; + for(int i=0;i0) + err+=","; + + if (p_func->arguments[i+1]->type==Node::TYPE_CONSTANT && p_func->arguments[i+1]->get_datatype()==TYPE_INT && static_cast(p_func->arguments[i+1])->values[0].sint<0) { + err+="-"; + } + err+=get_datatype_name(args[i]); + } + err+=")"; + _set_error(err); + return false; + } + #if 0 - if (found_intrinsic) { + if (found_builtin) { if (p_func->op==OP_CONSTRUCT && all_const) { @@ -1769,22 +1906,22 @@ bool ShaderLanguage::_validate_function_call(BlockNode* p_block, OperatorNode *p block=block->parent_block; } + if (name==exclude_function) { + _set_error("Recursion is not allowed"); + return false; + } for(int i=0;ifunctions.size();i++) { - if (shader->functions[i].name==exclude_function) { - _set_error("Recursion is not allowed"); - return false; - } + + if (name != shader->functions[i].name) + continue; if (!shader->functions[i].callable) { _set_error("Function '"+String(name)+" can't be called from source code."); return false; } - if (name != shader->functions[i].name) - continue; - FunctionNode *pfunc = shader->functions[i].function; @@ -1795,7 +1932,10 @@ bool ShaderLanguage::_validate_function_call(BlockNode* p_block, OperatorNode *p for(int i=0;iarguments[i].type) { + + if (get_scalar_type(args[i])==args[i] && p_func->arguments[i+1]->type==Node::TYPE_CONSTANT && convert_constant(static_cast(p_func->arguments[i+1]),pfunc->arguments[i].type)) { + //all good + } else if (args[i]!=pfunc->arguments[i].type) { fail=true; break; } @@ -1811,35 +1951,57 @@ bool ShaderLanguage::_validate_function_call(BlockNode* p_block, OperatorNode *p } -bool ShaderLanguage::_parse_function_arguments(BlockNode* p_block,const Map &p_builtin_types,OperatorNode* p_func) { +bool ShaderLanguage::_parse_function_arguments(BlockNode* p_block,const Map &p_builtin_types,OperatorNode* p_func,int *r_complete_arg) { + TkPos pos = _get_tkpos(); Token tk = _get_token(); + if (tk.type==TK_PARENTHESIS_CLOSE) { + return true; + } + + _set_tkpos(pos);; + while(true) { - if (tk.type==TK_PARENTHESIS_CLOSE) { - return true; + + if (r_complete_arg) { + pos = _get_tkpos(); + tk = _get_token(); + + if (tk.type==TK_CURSOR) { + + *r_complete_arg=p_func->arguments.size()-1; + } else { + + _set_tkpos(pos); + } } - Node *arg= _parse_expression(p_block,p_builtin_types); - if (!arg) + Node *arg= _parse_and_reduce_expression(p_block,p_builtin_types); + + if (!arg) { + return false; + } + p_func->arguments.push_back(arg); tk = _get_token(); + if (tk.type==TK_PARENTHESIS_CLOSE) { - //none - } else if (tk.type==TK_COMMA) { - tk = _get_token(); //next - } else { + + return true; + } else if (tk.type!=TK_COMMA) { // something is broken _set_error("Expected ',' or ')' after argument"); return false; } + } return true; @@ -1886,6 +2048,149 @@ bool ShaderLanguage::is_token_operator(TokenType p_type) { } +bool ShaderLanguage::convert_constant(ConstantNode* p_constant, DataType p_to_type,ConstantNode::Value *p_value) { + + if (p_constant->datatype==p_to_type) { + if (p_value) { + for(int i=0;ivalues.size();i++) { + p_value[i]=p_constant->values[i]; + } + } + return true; + } else if (p_constant->datatype==TYPE_INT && p_to_type==TYPE_FLOAT) { + + if (p_value) { + p_value->real=p_constant->values[0].sint; + } + return true; + } else if (p_constant->datatype==TYPE_UINT && p_to_type==TYPE_FLOAT) { + + if (p_value) { + p_value->real=p_constant->values[0].uint; + } + return true; + } else if (p_constant->datatype==TYPE_INT && p_to_type==TYPE_UINT) { + if (p_constant->values[0].sint<0) { + return false; + } + if (p_value) { + p_value->uint=p_constant->values[0].sint; + } + return true; + } else if (p_constant->datatype==TYPE_UINT && p_to_type==TYPE_INT) { + + if (p_constant->values[0].uint>0x7FFFFFFF) { + return false; + } + if (p_value) { + p_value->sint=p_constant->values[0].uint; + } + return true; + } else + return false; + +} + +bool ShaderLanguage::is_scalar_type(DataType p_type) { + + return p_type==TYPE_BOOL || p_type==TYPE_INT || p_type==TYPE_UINT || p_type==TYPE_FLOAT; +} + +void ShaderLanguage::get_keyword_list(List *r_keywords) { + + Set kws; + + int idx=0; + + while(keyword_list[idx].text) { + + kws.insert(keyword_list[idx].text); + idx++; + } + + idx=0; + + while (builtin_func_defs[idx].name) { + + kws.insert(builtin_func_defs[idx].name); + + idx++; + } + + for(Set::Element *E=kws.front();E;E=E->next()) { + r_keywords->push_back(E->get()); + } +} + +ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) { + + static const DataType scalar_types[]={ + TYPE_VOID, + TYPE_BOOL, + TYPE_BOOL, + TYPE_BOOL, + TYPE_BOOL, + TYPE_INT, + TYPE_INT, + TYPE_INT, + TYPE_INT, + TYPE_UINT, + TYPE_UINT, + TYPE_UINT, + TYPE_UINT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_FLOAT, + TYPE_INT, + TYPE_UINT, + TYPE_FLOAT, + }; + + return scalar_types[p_type]; +} + + +bool ShaderLanguage::_get_completable_identifier(BlockNode *p_block,CompletionType p_type,StringName& identifier) { + + identifier=StringName(); + + TkPos pos; + + Token tk = _get_token(); + + if (tk.type==TK_IDENTIFIER) { + identifier=tk.text; + pos = _get_tkpos(); + tk = _get_token(); + } + + if (tk.type==TK_CURSOR) { + + completion_type=p_type; + completion_line=tk_line; + completion_block=p_block; + + pos = _get_tkpos(); + tk = _get_token(); + + if (tk.type==TK_IDENTIFIER) { + identifier=identifier.operator String() + tk.text.operator String(); + } else { + _set_tkpos(pos); + } + return true; + } else if (identifier!=StringName()){ + _set_tkpos(pos); + } + + return false; +} + ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const Map &p_builtin_types) { @@ -1896,14 +2201,17 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const while(true) { Node *expr=NULL; - int pos = char_idx; + TkPos prepos = _get_tkpos(); Token tk = _get_token(); + TkPos pos = _get_tkpos(); + + print_line("in expr: "+get_token_text(tk)); if (tk.type==TK_PARENTHESIS_OPEN) { //handle subexpression - expr = _parse_expression(p_block,p_builtin_types); + expr = _parse_and_reduce_expression(p_block,p_builtin_types); if (!expr) return NULL; @@ -1919,15 +2227,19 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const ConstantNode *constant = alloc_node(); - constant->value=tk.constant; + ConstantNode::Value v; + v.real=tk.constant; + constant->values.push_back(v); constant->datatype=TYPE_FLOAT; expr=constant; - } else if (tk.type==TK_REAL_CONSTANT) { + } else if (tk.type==TK_INT_CONSTANT) { ConstantNode *constant = alloc_node(); - constant->value=int(tk.constant); + ConstantNode::Value v; + v.sint=tk.constant; + constant->values.push_back(v); constant->datatype=TYPE_INT; expr=constant; @@ -1936,7 +2248,9 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const //handle true constant ConstantNode *constant = alloc_node(); - constant->value=true; + ConstantNode::Value v; + v.boolean=true; + constant->values.push_back(v); constant->datatype=TYPE_BOOL; expr=constant; @@ -1944,7 +2258,9 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const //handle false constant ConstantNode *constant = alloc_node(); - constant->value=false; + ConstantNode::Value v; + v.boolean=false; + constant->values.push_back(v); constant->datatype=TYPE_BOOL; expr=constant; @@ -1953,9 +2269,11 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const //make sure void is not used in expression _set_error("Void value not allowed in Expression"); return NULL; - } else if (is_token_precision(tk.type) || is_token_nonvoid_datatype(tk.type)) { + } else if (is_token_nonvoid_datatype(tk.type)) { //basic type constructor + print_line("parse constructor"); + OperatorNode *func = alloc_node(); func->op=OP_CONSTRUCT; @@ -1976,9 +2294,20 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const return NULL; } - if (!_parse_function_arguments(p_block,p_builtin_types,func)) - return NULL; + int carg=-1; + bool ok = _parse_function_arguments(p_block,p_builtin_types,func,&carg); + + if (carg>=0) { + completion_type=COMPLETION_CALL_ARGUMENTS; + completion_line=tk_line; + completion_block=p_block; + completion_function=funcname->name; + completion_argument=carg; + } + + if (!ok) + return NULL; if (!_validate_function_call(p_block,func,&func->return_cache)) { _set_error("No matching constructor found for: '"+String(funcname->name)+"'"); @@ -1986,16 +2315,22 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const } //validate_Function_call() - expr=func; + expr=_reduce_expression(p_block,func); } else if (tk.type==TK_IDENTIFIER) { + _set_tkpos(prepos); + + StringName identifier; + + _get_completable_identifier(p_block,COMPLETION_IDENTIFIER,identifier); + tk=_get_token(); if (tk.type==TK_PARENTHESIS_OPEN) { //a function - StringName name = tk.text; + StringName name = identifier; OperatorNode *func = alloc_node(); func->op=OP_CALL; @@ -2003,10 +2338,23 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const funcname->name=name; func->arguments.push_back(funcname); - if (!_parse_function_arguments(p_block,p_builtin_types,func)) - return NULL; + int carg=-1; + + bool ok =_parse_function_arguments(p_block,p_builtin_types,func,&carg); + + if (carg>=0) { + completion_type=COMPLETION_CALL_ARGUMENTS; + completion_line=tk_line; + completion_block=p_block; + completion_function=funcname->name; + completion_argument=carg; + } + + if (!ok) + return NULL; + if (!_validate_function_call(p_block,func,&func->return_cache)) { _set_error("No matching function found for: '"+String(funcname->name)+"'"); return NULL; @@ -2016,9 +2364,8 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const } else { //an identifier - char_idx=pos; //rollback - StringName identifier = tk.text; + _set_tkpos(pos); DataType data_type; IdentifierType ident_type; @@ -2044,7 +2391,7 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const } else if (tk.type==TK_OP_ADD) { continue; //this one does nothing - } if (tk.type==TK_OP_SUB || tk.type==TK_OP_NOT || tk.type==TK_OP_BIT_INVERT || tk.type==TK_OP_INCREMENT || tk.type==TK_OP_DECREMENT) { + } else if (tk.type==TK_OP_SUB || tk.type==TK_OP_NOT || tk.type==TK_OP_BIT_INVERT || tk.type==TK_OP_INCREMENT || tk.type==TK_OP_DECREMENT) { Expression e; @@ -2077,19 +2424,23 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const /* OK now see what's NEXT to the operator.. */ while(true) { - int pos = char_idx; + TkPos pos = _get_tkpos(); tk=_get_token(); if (tk.type==TK_PERIOD) { - tk=_get_token(); - if (tk.type!=TK_IDENTIFIER) { + StringName identifier; + if (_get_completable_identifier(p_block,COMPLETION_INDEX,identifier)) { + completion_base=expr->get_datatype(); + } + + if (identifier==StringName()) { _set_error("Expected identifier as member"); return NULL; } DataType dt = expr->get_datatype(); - String ident = tk.text; + String ident = identifier; bool ok=true; DataType member_type; @@ -2242,7 +2593,8 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const } expr=op; } else { - char_idx=pos; //rollback + + _set_tkpos(pos); break; } } @@ -2252,7 +2604,7 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const e.node=expr; expression.push_back(e); - pos = char_idx; + pos = _get_tkpos(); tk = _get_token(); if (is_token_operator(tk.type)) { @@ -2297,12 +2649,12 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const _set_error("Invalid token for operator: "+get_token_text(tk)); return NULL; } - } break; + } expression.push_back(o); } else { - char_idx=pos; //something else, so rollback and end + _set_tkpos(pos); //something else, so rollback and end break; } } @@ -2419,7 +2771,7 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const at+=get_datatype_name(op->arguments[i]->get_datatype()); } - _set_error("Invalid argument to unary operator: "+at); + _set_error("Invalid arguments to unary operator '"+get_operator_text(op->op)+"' :" +at); return NULL; } expression.remove(i+1); @@ -2506,7 +2858,7 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const at+=get_datatype_name(op->arguments[i]->get_datatype()); } - _set_error("Invalid arguments to operator: "+at); + _set_error("Invalid arguments to operator '"+get_operator_text(op->op)+"' :" +at); return NULL; } @@ -2530,45 +2882,88 @@ ShaderLanguage::Node* ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha if (op->op==OP_CONSTRUCT) { + ERR_FAIL_COND_V(op->arguments[0]->type!=Node::TYPE_VARIABLE,p_node); VariableNode *vn = static_cast(op->arguments[0]); - StringName name=vn->name; + // StringName name=vn->name; + + DataType base=get_scalar_type(op->get_datatype()); + + Vector values; + - if (name=="vec2" || name=="vec3" || name=="vec4") { - Vector values; + for(int i=1;iarguments.size();i++) { - for(int i=1;iarguments.size();i++) { - op->arguments[i]=_reduce_expression(p_block,op->arguments[i]); - if (op->arguments[i]->type==Node::TYPE_CONSTANT) { - ConstantNode *cn = static_cast(op->arguments[i]); - values.push_back(cn->value); + op->arguments[i]=_reduce_expression(p_block,op->arguments[i]); + if (op->arguments[i]->type==Node::TYPE_CONSTANT) { + ConstantNode *cn = static_cast(op->arguments[i]); + if (get_scalar_type(cn->datatype)==base) { + + for(int j=0;jvalues.size();j++) { + values.push_back(cn->values[j]); + } + } else if (get_scalar_type(cn->datatype)==cn->datatype) { + + ConstantNode::Value v; + if (!convert_constant(cn,base,&v)) { + return p_node; + } + values.push_back(v); } else { - return p_node; //do not bother, not reducible + return p_node; } + + } else { + return p_node; } + } - ConstantNode *cn=alloc_node(); - if (name=="vec2") { - cn->datatype=TYPE_VEC2; - cn->value=Vector2(values[0],values[1]); - } else if (name=="vec3") { - cn->datatype=TYPE_VEC3; - cn->value=Vector3(values[0],values[1],values[2]); - } else if (name=="vec4") { - cn->datatype=TYPE_VEC4; - cn->value=Plane(values[0],values[1],values[2],values[3]); - } else { - ERR_FAIL_V(p_node); + ConstantNode *cn=alloc_node(); + cn->datatype=op->get_datatype(); + cn->values=values; + return cn; + } else if (op->op==OP_NEGATE) { + + op->arguments[0]=_reduce_expression(p_block,op->arguments[0]); + if (op->arguments[0]->type==Node::TYPE_CONSTANT) { + + ConstantNode *cn = static_cast(op->arguments[0]); + + DataType base=get_scalar_type(cn->datatype); + + Vector values; + + for(int i=0;ivalues.size();i++) { + + ConstantNode::Value nv; + switch(base) { + case TYPE_BOOL: { + nv.boolean=!cn->values[i].boolean; + } break; + case TYPE_INT: { + nv.sint=-cn->values[i].sint; + } break; + case TYPE_UINT: { + nv.uint=-cn->values[i].uint; + } break; + case TYPE_FLOAT: { + nv.real=-cn->values[i].real; + } break; + default: {} + } + + values.push_back(nv); } + + cn->values=values; return cn; } } - return p_node; @@ -2579,6 +2974,8 @@ ShaderLanguage::Node* ShaderLanguage::_parse_and_reduce_expression(BlockNode *p_ ShaderLanguage::Node* expr = _parse_expression(p_block,p_builtin_types); + if (!expr) //errored + return NULL; expr = _reduce_expression(p_block,expr); @@ -2592,7 +2989,7 @@ Error ShaderLanguage::_parse_block(BlockNode* p_block,const Mapvariables[name]=var; tk = _get_token(); @@ -2670,6 +3068,7 @@ Error ShaderLanguage::_parse_block(BlockNode* p_block,const Map(); block->parent_block=p_block; _parse_block(block,p_builtin_types,false,p_can_break,p_can_continue); + p_block->statements.push_back(block); } else if (tk.type==TK_CF_IF) { //if () {} tk = _get_token(); @@ -2692,29 +3091,34 @@ Error ShaderLanguage::_parse_block(BlockNode* p_block,const Map(); block->parent_block=p_block; + cf->expressions.push_back(n); cf->blocks.push_back(block); + p_block->statements.push_back(cf); - Error err=_parse_block(p_block,p_builtin_types,true,p_can_break,p_can_continue); + Error err=_parse_block(block,p_builtin_types,true,p_can_break,p_can_continue); - pos=char_idx; + pos=_get_tkpos(); tk = _get_token(); if (tk.type==TK_CF_ELSE) { block = alloc_node(); block->parent_block=p_block; cf->blocks.push_back(block); - err=_parse_block(p_block,p_builtin_types,true,p_can_break,p_can_continue); + err=_parse_block(block,p_builtin_types,true,p_can_break,p_can_continue); } else { - char_idx=pos; //rollback + _set_tkpos(pos); //rollback } } else { //nothng else, so expression - char_idx=pos; //rollback - _parse_and_reduce_expression(p_block,p_builtin_types); + _set_tkpos(pos); //rollback + Node*expr = _parse_and_reduce_expression(p_block,p_builtin_types); + if (!expr) + return ERR_PARSE_ERROR; + p_block->statements.push_back(expr); tk = _get_token(); if (tk.type!=TK_SEMICOLON) { @@ -2742,8 +3146,11 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Mapuniforms[name]=uniform; //todo parse default value tk = _get_token(); @@ -2835,19 +3241,35 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map(expr)->value; + ConstantNode* cn = static_cast(expr); + + uniform.default_value.resize(cn->values.size()); + + if (!convert_constant(cn,uniform.type,uniform.default_value.ptr())) { + _set_error("Can't convert constant to "+get_datatype_name(uniform.type)); + return ERR_PARSE_ERROR; + } tk = _get_token(); } if (tk.type==TK_COLON) { //hint + tk = _get_token(); if (tk.type==TK_HINT_WHITE_TEXTURE) { - uniform.hint=ShaderNode::Uniform::HINT_WHITE_TEXTURE; + uniform.hint=ShaderNode::Uniform::HINT_WHITE; } else if (tk.type==TK_HINT_BLACK_TEXTURE) { - uniform.hint=ShaderNode::Uniform::HINT_BLACK_TEXTURE; + uniform.hint=ShaderNode::Uniform::HINT_BLACK; } else if (tk.type==TK_HINT_NORMAL_TEXTURE) { - uniform.hint=ShaderNode::Uniform::HINT_NORMAL_TEXTURE; + uniform.hint=ShaderNode::Uniform::HINT_NORMAL; + } else if (tk.type==TK_HINT_ALBEDO_TEXTURE) { + uniform.hint=ShaderNode::Uniform::HINT_ALBEDO; + } else if (tk.type==TK_HINT_COLOR) { + if (type!=TYPE_VEC4) { + _set_error("Color hint is for vec4 only"); + return ERR_PARSE_ERROR; + } + uniform.hint=ShaderNode::Uniform::HINT_COLOR; } else if (tk.type==TK_HINT_RANGE) { uniform.hint=ShaderNode::Uniform::HINT_RANGE; @@ -2913,17 +3335,23 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Mapuniforms[name]=uniform; + if (tk.type!=TK_SEMICOLON) { _set_error("Expected ';'"); return ERR_PARSE_ERROR; @@ -2965,15 +3393,14 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map(),name)) { _set_error("Redefinition of '"+String(name)+"'"); @@ -3113,7 +3540,6 @@ Error ShaderLanguage::compile(const String& p_code, const Map< StringName, Map(); Error err = _parse_shader(p_functions,p_render_modes); @@ -3122,6 +3548,268 @@ Error ShaderLanguage::compile(const String& p_code, const Map< StringName, Map > &p_functions,const Set& p_render_modes,List* r_options,String& r_call_hint) { + + clear(); + + code=p_code; + + nodes=NULL; + + shader = alloc_node(); + Error err = _parse_shader(p_functions,p_render_modes); + + switch(completion_type) { + + case COMPLETION_NONE: { + //do none + return ERR_PARSE_ERROR; + } break; + case COMPLETION_RENDER_MODE: { + for(const Set::Element *E=p_render_modes.front();E;E=E->next()) { + + r_options->push_back(E->get()); + } + + return OK; + } break; + case COMPLETION_MAIN_FUNCTION: { + print_line("complete main func"); + for(const Map< StringName, Map >::Element *E=p_functions.front();E;E=E->next()) { + + r_options->push_back(E->key()); + } + + return OK; + } break; + case COMPLETION_IDENTIFIER: + case COMPLETION_FUNCTION_CALL: { + + print_line("complete identifier"); + bool comp_ident=completion_type==COMPLETION_IDENTIFIER; + Set matches; + + StringName skip_function; + + BlockNode *block=completion_block; + + + while(block) { + + if (comp_ident) { + for (const Map::Element *E=block->variables.front();E;E=E->next()) { + + if (E->get().linekey()); + } + } + } + + + if (block->parent_function) { + if (comp_ident) { + for(int i=0;iparent_function->arguments.size();i++) { + matches.insert(block->parent_function->arguments[i].name); + } + } + skip_function=block->parent_function->name; + } + block=block->parent_block; + } + + if (comp_ident && skip_function!=StringName() && p_functions.has(skip_function)) { + + for (Map::Element *E=p_functions[skip_function].front();E;E=E->next()) { + matches.insert(E->key()); + } + } + + if (comp_ident) { + for (const Map::Element *E=shader->varyings.front();E;E=E->next()) { + matches.insert(E->key()); + + } + for (const Map::Element *E=shader->uniforms.front();E;E=E->next()) { + matches.insert(E->key()); + } + + + } + + for(int i=0;ifunctions.size();i++) { + if (!shader->functions[i].callable || shader->functions[i].name==skip_function) + continue; + matches.insert(String(shader->functions[i].name)+"("); + } + + int idx=0; + + while (builtin_func_defs[idx].name) { + + matches.insert(String(builtin_func_defs[idx].name)+"("); + idx++; + } + + for(Set::Element *E=matches.front();E;E=E->next()) { + r_options->push_back(E->get()); + } + + return OK; + + } break; + case COMPLETION_CALL_ARGUMENTS: { + + print_line("complete callargs"); + for(int i=0;ifunctions.size();i++) { + if (!shader->functions[i].callable) + continue; + if (shader->functions[i].name==completion_function) { + + String calltip; + + calltip+=get_datatype_name( shader->functions[i].function->return_type ); + calltip+=" "; + calltip+=shader->functions[i].name; + calltip+="("; + + for(int j=0;jfunctions[i].function->arguments.size();j++) { + + if (j>0) + calltip+=", "; + else + calltip+=" "; + + if (j==completion_argument) { + calltip+=CharType(0xFFFF); + } + + calltip+=get_datatype_name(shader->functions[i].function->arguments[j].type); + calltip+=" "; + calltip+=shader->functions[i].function->arguments[j].name; + + if (j==completion_argument) { + calltip+=CharType(0xFFFF); + } + + } + + if (shader->functions[i].function->arguments.size()) + calltip+=" "; + calltip+=")"; + + r_call_hint=calltip; + return OK; + } + + } + + int idx=0; + + String calltip; + + while (builtin_func_defs[idx].name) { + + if (completion_function==builtin_func_defs[idx].name) { + + if (calltip.length()) + calltip+="\n"; + + calltip+=get_datatype_name( builtin_func_defs[idx].rettype ); + calltip+=" "; + calltip+=builtin_func_defs[idx].name; + calltip+="("; + + bool found_arg=false; + for(int i=0;i<4;i++) { + + if (builtin_func_defs[idx].args[i]==TYPE_VOID) + break; + + if (i>0) + calltip+=", "; + else + calltip+=" "; + + if (i==completion_argument) { + calltip+=CharType(0xFFFF); + } + + calltip+=get_datatype_name(builtin_func_defs[idx].args[i]); + + if (i==completion_argument) { + calltip+=CharType(0xFFFF); + } + + found_arg=true; + + } + + if (found_arg) + calltip+=" "; + calltip+=")"; + + + } + idx++; + } + + r_call_hint=calltip; + + return OK; + + } break; + case COMPLETION_INDEX: { + + const char colv[4]={'r','g','b','a'}; + const char coordv[4]={'x','y','z','w'}; + + + int limit=0; + + switch(completion_base) { + case TYPE_BVEC2: + case TYPE_IVEC2: + case TYPE_UVEC2: + case TYPE_VEC2: { + limit=2; + + } break; + case TYPE_BVEC3: + case TYPE_IVEC3: + case TYPE_UVEC3: + case TYPE_VEC3: { + + limit=3; + + } break; + case TYPE_BVEC4: + case TYPE_IVEC4: + case TYPE_UVEC4: + case TYPE_VEC4: { + + limit=4; + + } break; + case TYPE_MAT2: limit=2; break; + case TYPE_MAT3: limit=3; break; + case TYPE_MAT4: limit=4; break; + default: {} + } + + for(int i=0;ipush_back(String::chr(colv[i])); + r_options->push_back(String::chr(coordv[i])); + } + + } break; + + + } + + return ERR_PARSE_ERROR; +} + String ShaderLanguage::get_error_text() { return error_str; @@ -3132,6 +3820,11 @@ int ShaderLanguage::get_error_line() { return error_line; } +ShaderLanguage::ShaderNode *ShaderLanguage::get_shader() { + + return shader; +} + ShaderLanguage::ShaderLanguage() { nodes=NULL; diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index b37853c77e..45dc556115 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -138,7 +138,10 @@ public: TK_HINT_WHITE_TEXTURE, TK_HINT_BLACK_TEXTURE, TK_HINT_NORMAL_TEXTURE, + TK_HINT_ALBEDO_TEXTURE, + TK_HINT_COLOR, TK_HINT_RANGE, + TK_CURSOR, TK_ERROR, TK_EOF, TK_MAX @@ -291,7 +294,15 @@ public: struct ConstantNode : public Node { DataType datatype; - Variant value; + + union Value { + bool boolean; + float real; + int32_t sint; + uint32_t uint; + }; + + Vector values; virtual DataType get_datatype() const { return datatype; } ConstantNode() { type=TYPE_CONSTANT; } @@ -306,6 +317,7 @@ public: struct Variable { DataType type; DataPrecision precision; + int line; //for completion }; Map variables; @@ -316,6 +328,7 @@ public: struct ControlFlowNode : public Node { FlowOperation flow_op; + Vector expressions; Vector blocks; ControlFlowNode() { type=TYPE_CONTROL_FLOW; flow_op=FLOW_OP_IF;} }; @@ -368,16 +381,19 @@ public: struct Uniform { enum Hint { HINT_NONE, - HINT_WHITE_TEXTURE, - HINT_BLACK_TEXTURE, - HINT_NORMAL_TEXTURE, + HINT_COLOR, HINT_RANGE, + HINT_ALBEDO, + HINT_NORMAL, + HINT_BLACK, + HINT_WHITE, + HINT_MAX }; int order; DataType type; DataPrecision precission; - Variant default_value; + Vector default_value; Hint hint; float hint_range[3]; @@ -414,15 +430,12 @@ public: enum CompletionType { COMPLETION_NONE, - COMPLETION_BUILT_IN_TYPE_CONSTANT, - COMPLETION_FUNCTION, + COMPLETION_RENDER_MODE, + COMPLETION_MAIN_FUNCTION, COMPLETION_IDENTIFIER, - COMPLETION_PARENT_FUNCTION, - COMPLETION_METHOD, + COMPLETION_FUNCTION_CALL, COMPLETION_CALL_ARGUMENTS, COMPLETION_INDEX, - COMPLETION_VIRTUAL_FUNC, - COMPLETION_YIELD, }; struct Token { @@ -433,7 +446,10 @@ public: uint16_t line; }; + + static String get_operator_text(Operator p_op); static String get_token_text(Token p_token); + static bool is_token_datatype(TokenType p_type); static DataType get_token_datatype(TokenType p_type); static bool is_token_precision(TokenType p_type); @@ -442,8 +458,16 @@ public: static bool is_token_nonvoid_datatype(TokenType p_type); static bool is_token_operator(TokenType p_type); + static bool convert_constant(ConstantNode* p_constant, DataType p_to_type,ConstantNode::Value *p_value=NULL); + static DataType get_scalar_type(DataType p_type); + static bool is_scalar_type(DataType p_type); + + static void get_keyword_list(List *r_keywords); private: + struct KeyWord { TokenType token; const char *text;}; + static const KeyWord keyword_list[]; + bool error_set; String error_str; int error_line; @@ -452,10 +476,29 @@ private: int char_idx; int tk_line; + struct TkPos { + int char_idx; + int tk_line; + }; + + TkPos _get_tkpos() { + TkPos tkp; + tkp.char_idx=char_idx; + tkp.tk_line=tk_line; + return tkp; + } + + + void _set_tkpos(TkPos p_pos) { + char_idx=p_pos.char_idx; + tk_line=p_pos.tk_line; + } void _set_error(const String& p_str) { if (error_set) return; + + error_line=tk_line; error_set=true; error_str=p_str; } @@ -485,7 +528,7 @@ private: bool _validate_operator(OperatorNode *p_op,DataType *r_ret_type=NULL); - struct IntrinsicFuncDef { + struct BuiltinFuncDef { enum { MAX_ARGS=5 }; const char* name; @@ -494,11 +537,20 @@ private: }; + CompletionType completion_type; + int completion_line; + BlockNode *completion_block; + DataType completion_base; + StringName completion_function; + int completion_argument; + - static const IntrinsicFuncDef intrinsic_func_defs[]; + bool _get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName& identifier); + + static const BuiltinFuncDef builtin_func_defs[]; bool _validate_function_call(BlockNode* p_block, OperatorNode *p_func,DataType *r_ret_type); - bool _parse_function_arguments(BlockNode *p_block, const Map &p_builtin_types, OperatorNode* p_func); + bool _parse_function_arguments(BlockNode *p_block, const Map &p_builtin_types, OperatorNode* p_func, int *r_complete_arg=NULL); Node* _parse_expression(BlockNode *p_block, const Map &p_builtin_types); @@ -516,10 +568,16 @@ public: void clear(); Error compile(const String& p_code,const Map< StringName, Map > &p_functions,const Set& p_render_modes); + Error complete(const String& p_code,const Map< StringName, Map > &p_functions,const Set& p_render_modes,List* r_options,String& r_call_hint); + + + String get_error_text(); int get_error_line(); - static String lex_debug(const String& p_code); + ShaderNode *get_shader(); + + String token_debug(const String& p_code); ShaderLanguage(); ~ShaderLanguage(); diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp new file mode 100644 index 0000000000..675be3458c --- /dev/null +++ b/servers/visual/shader_types.cpp @@ -0,0 +1,99 @@ +#include "shader_types.h" + + +const Map< StringName, Map >& ShaderTypes::get_functions(VS::ShaderMode p_mode) { + + return shader_modes[p_mode].functions; +} + +const Set& ShaderTypes::get_modes(VS::ShaderMode p_mode) { + + return shader_modes[p_mode].modes; +} + + +ShaderTypes *ShaderTypes::singleton=NULL; + +ShaderTypes::ShaderTypes() +{ + singleton=this; + + + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_VERTEX"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_TANGENT"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_BONES"]=ShaderLanguage::TYPE_IVEC4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_WEIGHTS"]=ShaderLanguage::TYPE_VEC4; + + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["POSITION"]=ShaderLanguage::TYPE_VEC4 ; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["VERTEX"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["TANGENT"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["BINORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["UV2"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["POINT_SIZE"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["INSTANCE_ID"]=ShaderLanguage::TYPE_INT; + + //builtins + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["WORLD_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["INV_CAMERA_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["PROJECTION_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["VIEWPORT_SIZE"]=ShaderLanguage::TYPE_VEC2; + + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["VERTEX"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["FRAGCOORD"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["FRONT_FACING"]=ShaderLanguage::TYPE_BOOL; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["TANGENT"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["BINORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["NORMALMAP"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["NORMALMAP_DEPTH"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["UV2"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALBEDO"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALPHA"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["METAL"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ROUGH"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["EMISSION"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECIAL"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["DISCARD"]=ShaderLanguage::TYPE_BOOL; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["POINT_COORD"]=ShaderLanguage::TYPE_VEC2; + + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["WORLD_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["INV_CAMERA_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["PROJECTION_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["VIEWPORT_SIZE"]=ShaderLanguage::TYPE_VEC2; + + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mix"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_add"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_sub"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mul"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("special_glow"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("special_subsurf"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("special_specular"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_opaque"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_always"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_never"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_alpha_prepass"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_front"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_back"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disable"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("lightmap_on_uv2"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("ontop"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_model_space"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_camera_space"); + +} diff --git a/servers/visual/shader_types.h b/servers/visual/shader_types.h new file mode 100644 index 0000000000..411d5790a9 --- /dev/null +++ b/servers/visual/shader_types.h @@ -0,0 +1,27 @@ +#ifndef SHADERTYPES_H +#define SHADERTYPES_H + +#include "shader_language.h" +#include "servers/visual_server.h" +class ShaderTypes { + + + struct Type { + + Map< StringName, Map > functions; + Set modes; + }; + + Map shader_modes; + + static ShaderTypes *singleton; +public: + static ShaderTypes *get_singleton() { return singleton; } + + const Map< StringName, Map >& get_functions(VS::ShaderMode p_mode); + const Set& get_modes(VS::ShaderMode p_mode); + + ShaderTypes(); +}; + +#endif // SHADERTYPES_H diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9b5ed422c5..a4ee102aed 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -6540,9 +6540,10 @@ EditorNode::EditorNode() { //more visually meaningful to have this later raise_bottom_panel_item(AnimationPlayerEditor::singleton); + add_editor_plugin( memnew( ShaderEditorPlugin(this) ) ); /* add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) ); add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) ); - add_editor_plugin( memnew( ShaderEditorPlugin(this,true) ) ); + add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) );*/ add_editor_plugin( memnew( CameraEditorPlugin(this) ) ); add_editor_plugin( memnew( SampleEditorPlugin(this) ) ); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 5541ae987f..9c8aa3c85d 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -37,8 +37,8 @@ #include "tools/editor/editor_node.h" #include "tools/editor/property_editor.h" #include "os/os.h" +#include "servers/visual/shader_types.h" -#if 0 /*** SETTINGS EDITOR ****/ @@ -51,19 +51,14 @@ Ref ShaderTextEditor::get_edited_shader() const { return shader; } -void ShaderTextEditor::set_edited_shader(const Ref& p_shader,ShaderLanguage::ShaderType p_type) { +void ShaderTextEditor::set_edited_shader(const Ref& p_shader) { shader=p_shader; - type=p_type; + _load_theme_settings(); - if (p_type==ShaderLanguage::SHADER_MATERIAL_LIGHT || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT) - get_text_edit()->set_text(shader->get_light_code()); - else if (p_type==ShaderLanguage::SHADER_MATERIAL_VERTEX || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX) - get_text_edit()->set_text(shader->get_vertex_code()); - else - get_text_edit()->set_text(shader->get_fragment_code()); + get_text_edit()->set_text(p_shader->get_code()); _line_col_changed(); @@ -104,7 +99,25 @@ void ShaderTextEditor::_load_theme_settings() { List keywords; - ShaderLanguage::get_keyword_list(type,&keywords); + ShaderLanguage::get_keyword_list(&keywords); + + if (shader.is_valid()) { + + + for(const Map< StringName, Map >::Element *E=ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + for (const Map::Element *F=E->get().front();F;F=F->next()) { + keywords.push_back(F->key()); + } + + } + + for(const Set::Element *E =ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) { + + keywords.push_back(E->get()); + + } + } for(List::Element *E=keywords.front();E;E=E->next()) { @@ -142,22 +155,34 @@ void ShaderTextEditor::_load_theme_settings() { } +void ShaderTextEditor::_code_complete_script(const String& p_code, List* r_options) { -void ShaderTextEditor::_validate_script() { + print_line("code complete"); - String errortxt; - int line,col; + ShaderLanguage sl; + String calltip; + + Error err = sl.complete(p_code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())),r_options,calltip); + + if (calltip!="") { + get_text_edit()->set_code_hint(calltip); + } +} + +void ShaderTextEditor::_validate_script() { String code=get_text_edit()->get_text(); //List params; //shader->get_param_list(¶ms); - Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col); + ShaderLanguage sl; + + Error err = sl.compile(code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode()))); if (err!=OK) { - String error_text="error("+itos(line+1)+","+itos(col)+"): "+errortxt; + String error_text="error("+itos(sl.get_error_line())+"): "+sl.get_error_text(); set_error(error_text); - get_text_edit()->set_line_as_marked(line,true); + get_text_edit()->set_line_as_marked(sl.get_error_line(),true); } else { for(int i=0;iget_line_count();i++) @@ -187,9 +212,7 @@ ShaderTextEditor::ShaderTextEditor() { void ShaderEditor::_menu_option(int p_option) { - ShaderTextEditor *current = tab_container->get_current_tab_control()->cast_to(); - if (!current) - return; + ShaderTextEditor *current = shader_editor; switch(p_option) { case EDIT_UNDO: { @@ -245,24 +268,11 @@ void ShaderEditor::_menu_option(int p_option) { } } -void ShaderEditor::_tab_changed(int p_which) { - - ShaderTextEditor *shader_editor = tab_container->get_tab_control(p_which)->cast_to(); - - if (shader_editor && is_inside_tree()) - shader_editor->get_text_edit()->grab_focus(); - - ensure_select_current(); -} void ShaderEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - close->set_normal_texture( get_icon("Close","EditorIcons")); - close->set_hover_texture( get_icon("CloseHover","EditorIcons")); - close->set_pressed_texture( get_icon("Close","EditorIcons")); - close->connect("pressed",this,"_close_callback"); } if (p_what==NOTIFICATION_DRAW) { @@ -365,57 +375,31 @@ void ShaderEditor::clear() { void ShaderEditor::_params_changed() { - fragment_editor->_validate_script(); - vertex_editor->_validate_script(); - light_editor->_validate_script(); + shader_editor->_validate_script(); } void ShaderEditor::_editor_settings_changed() { - vertex_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - vertex_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - vertex_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - vertex_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - vertex_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - vertex_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - vertex_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - vertex_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - vertex_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - vertex_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - vertex_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); - - fragment_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - fragment_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - fragment_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - fragment_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - fragment_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - fragment_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - fragment_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - fragment_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - fragment_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - fragment_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - fragment_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); - - light_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - light_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - light_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - light_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - light_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - light_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - light_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - light_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - light_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - light_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - light_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); + shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); + shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); + shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); + shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); + shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); + shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); + shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); + shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); + } void ShaderEditor::_bind_methods() { ObjectTypeDB::bind_method("_editor_settings_changed",&ShaderEditor::_editor_settings_changed); - ObjectTypeDB::bind_method("_tab_changed",&ShaderEditor::_tab_changed); + ObjectTypeDB::bind_method("_menu_option",&ShaderEditor::_menu_option); ObjectTypeDB::bind_method("_params_changed",&ShaderEditor::_params_changed); - ObjectTypeDB::bind_method("_close_callback",&ShaderEditor::_close_callback); ObjectTypeDB::bind_method("apply_shaders",&ShaderEditor::apply_shaders); // ObjectTypeDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab); } @@ -441,16 +425,7 @@ void ShaderEditor::edit(const Ref& p_shader) { shader=p_shader; - if (shader->get_mode()==Shader::MODE_MATERIAL) { - vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_VERTEX); - fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_FRAGMENT); - light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_LIGHT); - } else if (shader->get_mode()==Shader::MODE_CANVAS_ITEM) { - - vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX); - fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_FRAGMENT); - light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT); - } + shader_editor->set_edited_shader(p_shader); //vertex_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_VERTEX); // see if already has it @@ -474,35 +449,21 @@ void ShaderEditor::apply_shaders() { if (shader.is_valid()) { - shader->set_code(vertex_editor->get_text_edit()->get_text(),fragment_editor->get_text_edit()->get_text(),light_editor->get_text_edit()->get_text(),0,0); + shader->set_code(shader_editor->get_text_edit()->get_text()); shader->set_edited(true); } } -void ShaderEditor::_close_callback() { - - hide(); -} - ShaderEditor::ShaderEditor() { - tab_container = memnew( TabContainer ); - add_child(tab_container); - tab_container->set_area_as_parent_rect(); - tab_container->set_begin(Point2(0,0)); - //tab_container->set_begin(Point2(0,0)); - - close = memnew( TextureButton ); - close->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,20); - close->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,4); - close->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,2); - add_child(close); + HBoxContainer *hbc = memnew( HBoxContainer); + add_child(hbc); edit_menu = memnew( MenuButton ); - add_child(edit_menu); + hbc->add_child(edit_menu); edit_menu->set_pos(Point2(5,-1)); edit_menu->set_text(TTR("Edit")); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO); @@ -517,7 +478,7 @@ ShaderEditor::ShaderEditor() { search_menu = memnew( MenuButton ); - add_child(search_menu); + hbc->add_child(search_menu); search_menu->set_pos(Point2(38,-1)); search_menu->set_text(TTR("Search")); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND); @@ -530,34 +491,15 @@ ShaderEditor::ShaderEditor() { search_menu->get_popup()->connect("item_pressed", this,"_menu_option"); - tab_container->connect("tab_changed", this,"_tab_changed"); - - erase_tab_confirm = memnew( ConfirmationDialog ); - add_child(erase_tab_confirm); - erase_tab_confirm->connect("confirmed", this,"_close_current_tab"); - - goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); - vertex_editor = memnew( ShaderTextEditor ); - tab_container->add_child(vertex_editor); - vertex_editor->set_name(TTR("Vertex")); - - fragment_editor = memnew( ShaderTextEditor ); - tab_container->add_child(fragment_editor); - fragment_editor->set_name(TTR("Fragment")); + shader_editor = memnew( ShaderTextEditor ); + add_child(shader_editor); + shader_editor->set_v_size_flags(SIZE_EXPAND_FILL); - light_editor = memnew( ShaderTextEditor ); - tab_container->add_child(light_editor); - light_editor->set_name(TTR("Lighting")); - tab_container->set_current_tab(1); - - - vertex_editor->connect("script_changed", this,"apply_shaders"); - fragment_editor->connect("script_changed", this,"apply_shaders"); - light_editor->connect("script_changed", this,"apply_shaders"); + shader_editor->connect("script_changed", this,"apply_shaders"); EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); _editor_settings_changed(); @@ -567,15 +509,7 @@ ShaderEditor::ShaderEditor() { void ShaderEditorPlugin::edit(Object *p_object) { Shader* s = p_object->cast_to(); - if (!s || s->cast_to()) { - shader_editor->hide(); //Dont edit ShaderGraph - return; - } - - if (_2d && s->get_mode()==Shader::MODE_CANVAS_ITEM) - shader_editor->edit(s); - else if (!_2d && s->get_mode()==Shader::MODE_MATERIAL) - shader_editor->edit(s); + shader_editor->edit(s); } @@ -583,24 +517,25 @@ bool ShaderEditorPlugin::handles(Object *p_object) const { bool handles = true; Shader *shader=p_object->cast_to(); - if (!shader || shader->cast_to()) // Dont handle ShaderGraph's - handles = false; - if (handles && _2d) - handles = shader->get_mode()==Shader::MODE_CANVAS_ITEM; - else if (handles && !_2d) - return shader->get_mode()==Shader::MODE_MATERIAL; - - if (!handles) - shader_editor->hide(); - return handles; + //if (!shader || shader->cast_to()) // Dont handle ShaderGraph's + // handles = false; + + return shader!=NULL; } void ShaderEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - shader_editor->show(); + button->show(); + editor->make_bottom_panel_item_visible(shader_editor); + } else { + + button->hide(); + if (shader_editor->is_visible()) + editor->hide_bottom_panel(); shader_editor->apply_shaders(); + } } @@ -634,19 +569,14 @@ void ShaderEditorPlugin::apply_changes() { shader_editor->apply_shaders(); } -ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { +ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node) { + editor=p_node; shader_editor = memnew( ShaderEditor ); - _2d=p_2d; - if (p_2d) - add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,shader_editor); - else - add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,shader_editor); -// editor->get_viewport()->add_child(shader_editor); -// shader_editor->set_area_as_parent_rect(); - shader_editor->hide(); + shader_editor->set_custom_minimum_size(Size2(0,300)); + button=editor->add_bottom_panel_item("Shader",shader_editor); } @@ -654,4 +584,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) { ShaderEditorPlugin::~ShaderEditorPlugin() { } -#endif + diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h index ef7cc6772e..ffe6a42e88 100644 --- a/tools/editor/plugins/shader_editor_plugin.h +++ b/tools/editor/plugins/shader_editor_plugin.h @@ -38,33 +38,34 @@ #include "scene/resources/shader.h" #include "servers/visual/shader_language.h" -#if 0 class ShaderTextEditor : public CodeTextEditor { OBJ_TYPE( ShaderTextEditor, CodeTextEditor ); Ref shader; - ShaderLanguage::ShaderType type; protected: static void _bind_methods(); virtual void _load_theme_settings(); + + virtual void _code_complete_script(const String& p_code, List* r_options); + public: virtual void _validate_script(); Ref get_edited_shader() const; - void set_edited_shader(const Ref& p_shader,ShaderLanguage::ShaderType p_type); + void set_edited_shader(const Ref& p_shader); ShaderTextEditor(); }; -class ShaderEditor : public Control { +class ShaderEditor : public VBoxContainer { - OBJ_TYPE(ShaderEditor, Control ); + OBJ_TYPE(ShaderEditor, VBoxContainer ); enum { @@ -88,22 +89,17 @@ class ShaderEditor : public Control { MenuButton *settings_menu; uint64_t idle; - TabContainer *tab_container; GotoLineDialog *goto_line_dialog; ConfirmationDialog *erase_tab_confirm; - TextureButton *close; - ShaderTextEditor *vertex_editor; - ShaderTextEditor *fragment_editor; - ShaderTextEditor *light_editor; + ShaderTextEditor *shader_editor; + - void _tab_changed(int p_which); void _menu_option(int p_optin); void _params_changed(); mutable Ref shader; - void _close_callback(); void _editor_settings_changed(); @@ -134,6 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin { bool _2d; ShaderEditor *shader_editor; EditorNode *editor; + Button *button; + public: virtual String get_name() const { return "Shader"; } @@ -150,10 +148,9 @@ public: virtual void save_external_data(); virtual void apply_changes(); - ShaderEditorPlugin(EditorNode *p_node,bool p_2d); + ShaderEditorPlugin(EditorNode *p_node); ~ShaderEditorPlugin(); }; #endif -#endif -- cgit v1.2.3 From 1527cf8c0d17891dd0ebf99d484f83daa46eba3c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 10 Oct 2016 18:31:01 -0300 Subject: 2D Shaders are working again using the new syntax, though all is buggy in general --- core/error_macros.h | 3 +- core/os/os.cpp | 1 + core/os/os.h | 3 +- core/pair.h | 3 + drivers/gles3/rasterizer_canvas_gles3.cpp | 143 +++-- drivers/gles3/rasterizer_canvas_gles3.h | 2 + drivers/gles3/rasterizer_gles3.cpp | 10 + drivers/gles3/rasterizer_storage_gles3.cpp | 899 ++++++++++++++++++++++++++++- drivers/gles3/rasterizer_storage_gles3.h | 109 +++- drivers/gles3/shader_compiler_gles3.cpp | 528 +++++++++++++++++ drivers/gles3/shader_compiler_gles3.h | 67 +++ drivers/gles3/shader_gles3.cpp | 83 ++- drivers/gles3/shader_gles3.h | 27 +- drivers/gles3/shaders/canvas.glsl | 72 ++- drivers/unix/os_unix.cpp | 4 + platform/windows/os_windows.cpp | 9 + scene/2d/canvas_item.cpp | 14 +- scene/2d/canvas_item.h | 4 +- scene/gui/color_picker.cpp | 37 -- scene/gui/color_picker.h | 2 - scene/resources/material.h | 3 + servers/visual/shader_language.cpp | 53 +- servers/visual/shader_language.h | 8 +- servers/visual/shader_types.cpp | 62 ++ servers/visual_server.h | 1 + tools/editor/editor_log.cpp | 4 + 26 files changed, 1979 insertions(+), 172 deletions(-) create mode 100644 drivers/gles3/shader_compiler_gles3.cpp create mode 100644 drivers/gles3/shader_compiler_gles3.h diff --git a/core/error_macros.h b/core/error_macros.h index 6d931e899e..b656827463 100644 --- a/core/error_macros.h +++ b/core/error_macros.h @@ -49,7 +49,8 @@ enum ErrorHandlerType { ERR_HANDLER_ERROR, ERR_HANDLER_WARNING, - ERR_HANDLER_SCRIPT + ERR_HANDLER_SCRIPT, + ERR_HANDLER_SHADER, }; typedef void (*ErrorHandlerFunc)(void*,const char*,const char*,int p_line,const char *, const char *,ErrorHandlerType p_type); diff --git a/core/os/os.cpp b/core/os/os.cpp index ee32476234..43956809e2 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -68,6 +68,7 @@ void OS::print_error(const char* p_function,const char* p_file,int p_line,const case ERR_ERROR: err_type="**ERROR**"; break; case ERR_WARNING: err_type="**WARNING**"; break; case ERR_SCRIPT: err_type="**SCRIPT ERROR**"; break; + case ERR_SHADER: err_type="**SHADER ERROR**"; break; } if (p_rationale && *p_rationale) diff --git a/core/os/os.h b/core/os/os.h index c2b46a5420..d939198bfb 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -120,7 +120,8 @@ public: enum ErrorType { ERR_ERROR, ERR_WARNING, - ERR_SCRIPT + ERR_SCRIPT, + ERR_SHADER }; virtual void print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type=ERR_ERROR); diff --git a/core/pair.h b/core/pair.h index 9bffc37f49..b5208016eb 100644 --- a/core/pair.h +++ b/core/pair.h @@ -34,6 +34,9 @@ struct Pair { F first; S second; + + Pair() {} + Pair( F p_first, S p_second) { first=p_first; second=p_second; } }; #endif // PAIR_H diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index a1e755cb4a..b2228a6cfa 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -138,6 +138,7 @@ void RasterizerCanvasGLES3::canvas_begin(){ state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD,false); + state.canvas_shader.set_custom_shader(0); state.canvas_shader.bind(); state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,Color(1,1,1,1)); state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,Matrix32()); @@ -520,6 +521,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr //err.. } + state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE,texpixel_size); + glVertexAttrib4f(1,rect->rect.pos.x,rect->rect.pos.y,rect->rect.size.x,rect->rect.size.y); glVertexAttrib4f(2,src_rect.pos.x,src_rect.pos.y,src_rect.size.x,src_rect.size.y); @@ -567,6 +570,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr Size2 texpixel_size( 1.0/texture->width, 1.0/texture->height ); + state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE,texpixel_size); + #define DSTRECT(m_x,m_y,m_w,m_h) glVertexAttrib4f(1,m_x,m_y,m_w,m_h) #define SRCRECT(m_x,m_y,m_w,m_h) glVertexAttrib4f(2,(m_x)*texpixel_size.x,(m_y)*texpixel_size.y,(m_w)*texpixel_size.x,(m_h)*texpixel_size.y) @@ -634,8 +639,13 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr ERR_CONTINUE( primitive->points.size()<1); - _bind_canvas_texture(primitive->texture); + RasterizerStorageGLES3::Texture* texture = _bind_canvas_texture(primitive->texture); + + if (texture ) { + Size2 texpixel_size( 1.0/texture->width, 1.0/texture->height ); + state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE,texpixel_size); + } if (primitive->colors.size()==1 && primitive->points.size()>1) { Color c = primitive->colors[0]; @@ -652,6 +662,14 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr Item::CommandPolygon* polygon = static_cast(c); _set_texture_rect_mode(false); + + RasterizerStorageGLES3::Texture* texture = _bind_canvas_texture(polygon->texture); + + if (texture ) { + Size2 texpixel_size( 1.0/texture->width, 1.0/texture->height ); + state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE,texpixel_size); + + } _draw_polygon(polygon->count,polygon->indices.ptr(),polygon->points.ptr(),polygon->uvs.ptr(),polygon->colors.ptr(),polygon->texture,polygon->colors.size()==1); } break; @@ -800,10 +818,14 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + int last_blend_mode=-1; + RID canvas_last_material; bool prev_distance_field=false; + + while(p_item_list) { Item *ci=p_item_list; @@ -878,53 +900,71 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const RID material = material_owner->material; if (material!=canvas_last_material || rebind_shader) { -#if 0 - Shader *shader = NULL; - if (material && material->shader.is_valid()) { - shader = shader_owner.get(material->shader); - if (shader && !shader->valid) { - shader=NULL; + + RasterizerStorageGLES3::Material *material_ptr = storage->material_owner.getornull(material); + RasterizerStorageGLES3::Shader *shader_ptr = NULL; + + if (material_ptr) { + + shader_ptr = material_ptr->shader; + + if (shader_ptr && shader_ptr->mode!=VS::SHADER_CANVAS_ITEM) { + shader_ptr=NULL; //do not use non canvasitem shader } } - shader_cache=shader; - if (shader) { - canvas_shader.set_custom_shader(shader->custom_code_id); - _canvas_item_setup_shader_params(material,shader); - } else { - shader_cache=NULL; - canvas_shader.set_custom_shader(0); - canvas_shader.bind(); - uses_texpixel_size=false; + if (shader_ptr && shader_ptr!=shader_cache) { + + state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id); + state.canvas_shader.bind(); + + if (material_ptr->ubo_id) { + glBindBufferBase(GL_UNIFORM_BUFFER,2,material_ptr->ubo_id); + } + + int tc = material_ptr->textures.size(); + RID* textures = material_ptr->textures.ptr(); + + for(int i=0;itexture_owner.getornull( textures[i] ); + if (!t) { + //check hints + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + continue; + } + + glBindTexture(t->target,t->tex_id); + } + + + } else if (!shader_ptr) { + state.canvas_shader.set_custom_shader(0); + state.canvas_shader.bind(); } + shader_cache=shader_ptr; - canvas_shader.set_uniform(CanvasShaderGLES3::PROJECTION_MATRIX,canvas_transform); - if (canvas_use_modulate) - reset_modulate=true; canvas_last_material=material; rebind_shader=false; -#endif - } - if (material.is_valid() && shader_cache) { -#if 0 - _canvas_item_setup_shader_uniforms(material,shader_cache); -#endif } - bool unshaded = false; //(material && material->shading_mode==VS::CANVAS_ITEM_SHADING_UNSHADED) || ci->blend_mode!=VS::MATERIAL_BLEND_MODE_MIX; + int blend_mode = shader_cache ? shader_cache->canvas_item.blend_mode : RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX; + bool unshaded = shader_cache && (shader_cache->canvas_item.light_mode==RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_UNSHADED || blend_mode!=RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX); bool reclip=false; -#if 0 - if (ci==p_item_list || ci->blend_mode!=canvas_blend_mode) { - switch(ci->blend_mode) { + if (last_blend_mode!=blend_mode) { + + switch(blend_mode) { - case VS::MATERIAL_BLEND_MODE_MIX: { + case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX: { glBlendEquation(GL_FUNC_ADD); - if (current_rt && current_rt_transparent) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { @@ -932,33 +972,30 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const } } break; - case VS::MATERIAL_BLEND_MODE_ADD: { + case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_ADD: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA,GL_ONE); } break; - case VS::MATERIAL_BLEND_MODE_SUB: { + case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_SUB: { glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); glBlendFunc(GL_SRC_ALPHA,GL_ONE); } break; - case VS::MATERIAL_BLEND_MODE_MUL: { + case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MUL: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_DST_COLOR,GL_ZERO); } break; - case VS::MATERIAL_BLEND_MODE_PREMULT_ALPHA: { + case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_PMALPHA: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA); } break; } - canvas_blend_mode=ci->blend_mode; + last_blend_mode=blend_mode; } -#endif - -// canvas_shader.set_uniform(CanvasShaderGLES3::CANVAS_MODULATE,unshaded ? Color(1,1,1,1) : p_modulate); state.canvas_item_modulate = unshaded ? ci->final_modulate : Color( ci->final_modulate.r * p_modulate.r, @@ -974,10 +1011,10 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,state.extra_matrix); - if (unshaded || (state.canvas_item_modulate.a>0.001 && (!material.is_valid() /*|| material->shading_mode!=VS::CANVAS_ITEM_SHADING_ONLY_LIGHT*/) && !ci->light_masked )) + if (unshaded || (state.canvas_item_modulate.a>0.001 && (!shader_cache || shader_cache->canvas_item.light_mode!=RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY) && !ci->light_masked )) _canvas_item_render_commands(ci,current_clip,reclip); - if (/*canvas_blend_mode==VS::MATERIAL_BLEND_MODE_MIX &&*/ p_light && !unshaded) { + if ((blend_mode==RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX || RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_PMALPHA) && p_light && !unshaded) { Light *light = p_light; bool light_used=false; @@ -1046,12 +1083,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const bool light_rebind = state.canvas_shader.bind(); if (light_rebind) { -#if 0 - if (material && shader_cache) { - _canvas_item_setup_shader_params(material,shader_cache); - _canvas_item_setup_shader_uniforms(material,shader_cache); - } -#endif + state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX,state.final_transform); state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); @@ -1100,15 +1132,12 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF9,false); state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF13,false); - state.canvas_shader.bind(); -#if 0 - if (material && shader_cache) { - _canvas_item_setup_shader_params(material,shader_cache); - _canvas_item_setup_shader_uniforms(material,shader_cache); - } -#endif + last_blend_mode=-1; + + /* + //this is set again, so it should not be needed anyway? state.canvas_item_modulate = unshaded ? ci->final_modulate : Color( ci->final_modulate.r * p_modulate.r, ci->final_modulate.g * p_modulate.g, @@ -1120,7 +1149,6 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX,Matrix32()); state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE,state.canvas_item_modulate); - glBlendEquation(GL_FUNC_ADD); if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { @@ -1130,6 +1158,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const } //@TODO RESET canvas_blend_mode + */ } @@ -1380,6 +1409,9 @@ void RasterizerCanvasGLES3::reset_canvas() { state.vp=canvas_transform; store_transform(canvas_transform,state.canvas_item_ubo_data.projection_matrix); + for(int i=0;i<4;i++) { + state.canvas_item_ubo_data.time[i]=storage->frame.time[i]; + } glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data); @@ -1442,6 +1474,7 @@ void RasterizerCanvasGLES3::initialize() { glBindBuffer(GL_UNIFORM_BUFFER, 0); state.canvas_shader.init(); + state.canvas_shader.set_base_material_tex_index(1); state.canvas_shadow_shader.init(); state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_RGBA_SHADOWS,storage->config.use_rgba_2d_shadows); diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 1f72a8dbcf..8f34f07d06 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -5,12 +5,14 @@ #include "rasterizer_storage_gles3.h" #include "shaders/canvas_shadow.glsl.h" + class RasterizerCanvasGLES3 : public RasterizerCanvas { public: struct CanvasItemUBO { float projection_matrix[16]; + float time[4]; }; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 27b0690645..eaa9825605 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -115,8 +115,17 @@ void RasterizerGLES3::initialize() { void RasterizerGLES3::begin_frame(){ + double time_total = double(OS::get_singleton()->get_ticks_usec())/1000000.0; + storage->frame.time[0]=time_total; + storage->frame.time[1]=Math::fmod(time_total,3600); + storage->frame.time[2]=Math::fmod(time_total,900); + storage->frame.time[3]=Math::fmod(time_total,60); + + storage->update_dirty_shaders(); + storage->update_dirty_materials(); } + void RasterizerGLES3::set_current_render_target(RID p_render_target){ if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) { @@ -257,6 +266,7 @@ RasterizerGLES3::RasterizerGLES3() storage = memnew( RasterizerStorageGLES3 ); canvas = memnew( RasterizerCanvasGLES3 ); canvas->storage=storage; + storage->canvas=canvas; } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b4d65080a4..74b7d72652 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1,4 +1,5 @@ #include "rasterizer_storage_gles3.h" +#include "rasterizer_canvas_gles3.h" #include "globals.h" /* TEXTURE API */ @@ -1000,65 +1001,906 @@ void RasterizerStorageGLES3::texture_set_shrink_all_x2_on_set_data(bool p_enable RID RasterizerStorageGLES3::shader_create(VS::ShaderMode p_mode){ - return RID(); + Shader *shader = memnew( Shader ); + shader->mode=p_mode; + RID rid = shader_owner.make_rid(shader); + shader_set_mode(rid,p_mode); + _shader_make_dirty(shader); + shader->self=rid; + + return rid; +} + +void RasterizerStorageGLES3::_shader_make_dirty(Shader* p_shader) { + + if (p_shader->dirty_list.in_list()) + return; + + _shader_dirty_list.add(&p_shader->dirty_list); } void RasterizerStorageGLES3::shader_set_mode(RID p_shader,VS::ShaderMode p_mode){ + ERR_FAIL_INDEX(p_mode,VS::SHADER_MAX); + Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND(!shader); + + if (shader->custom_code_id && p_mode==shader->mode) + return; + + + if (shader->custom_code_id) { + + shader->shader->free_custom_shader(shader->custom_code_id); + shader->custom_code_id=0; + } + + shader->mode=p_mode; + + ShaderGLES3* shaders[VS::SHADER_MAX]={ + &canvas->state.canvas_shader, + &canvas->state.canvas_shader, + &canvas->state.canvas_shader, + + }; + + shader->shader=shaders[p_mode]; + + shader->custom_code_id = shader->shader->create_custom_shader(); + + _shader_make_dirty(shader); } VS::ShaderMode RasterizerStorageGLES3::shader_get_mode(RID p_shader) const { - return VS::SHADER_SPATIAL; + const Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND_V(!shader,VS::SHADER_MAX); + + return shader->mode; } void RasterizerStorageGLES3::shader_set_code(RID p_shader, const String& p_code){ + Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND(!shader); + shader->code=p_code; + _shader_make_dirty(shader); } String RasterizerStorageGLES3::shader_get_code(RID p_shader) const{ - return String(); + const Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND_V(!shader,String()); + + + return shader->code; } + +void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { + + + _shader_dirty_list.remove( &p_shader->dirty_list ); + + p_shader->valid=false; + + p_shader->uniforms.clear(); + + ShaderCompilerGLES3::GeneratedCode gen_code; + ShaderCompilerGLES3::IdentifierActions *actions=NULL; + + + + switch(p_shader->mode) { + case VS::SHADER_CANVAS_ITEM: { + + p_shader->canvas_item.light_mode=Shader::CanvasItem::LIGHT_MODE_NORMAL; + p_shader->canvas_item.blend_mode=Shader::CanvasItem::BLEND_MODE_MIX; + + shaders.actions_canvas.render_mode_values["blend_add"]=Pair(&p_shader->canvas_item.blend_mode,Shader::CanvasItem::BLEND_MODE_ADD); + shaders.actions_canvas.render_mode_values["blend_mix"]=Pair(&p_shader->canvas_item.blend_mode,Shader::CanvasItem::BLEND_MODE_MIX); + shaders.actions_canvas.render_mode_values["blend_sub"]=Pair(&p_shader->canvas_item.blend_mode,Shader::CanvasItem::BLEND_MODE_SUB); + shaders.actions_canvas.render_mode_values["blend_mul"]=Pair(&p_shader->canvas_item.blend_mode,Shader::CanvasItem::BLEND_MODE_MUL); + shaders.actions_canvas.render_mode_values["blend_premul_alpha"]=Pair(&p_shader->canvas_item.blend_mode,Shader::CanvasItem::BLEND_MODE_PMALPHA); + + shaders.actions_canvas.render_mode_values["unshaded"]=Pair(&p_shader->canvas_item.light_mode,Shader::CanvasItem::LIGHT_MODE_UNSHADED); + shaders.actions_canvas.render_mode_values["light_only"]=Pair(&p_shader->canvas_item.light_mode,Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY); + + actions=&shaders.actions_canvas; + actions->uniforms=&p_shader->uniforms; + + } break; + } + + + Error err = shaders.compiler.compile(p_shader->mode,p_shader->code,actions,p_shader->path,gen_code); + + ERR_FAIL_COND(err!=OK); + + p_shader->shader->set_custom_shader_code(p_shader->custom_code_id,gen_code.vertex,gen_code.vertex_global,gen_code.fragment,gen_code.light,gen_code.fragment_global,gen_code.uniforms,gen_code.texture_uniforms,gen_code.defines); + + p_shader->ubo_size=gen_code.uniform_total_size; + p_shader->ubo_offsets=gen_code.uniform_offsets; + p_shader->texture_count=gen_code.texture_uniforms.size(); + + //all materials using this shader will have to be invalidated, unfortunately + + for (SelfList* E = p_shader->materials.first();E;E=E->next() ) { + + _material_make_dirty(E->self()); + } + + p_shader->valid=true; + p_shader->version++; + +} + +void RasterizerStorageGLES3::update_dirty_shaders() { + + while( _shader_dirty_list.first() ) { + _update_shader(_shader_dirty_list.first()->self() ); + } +} + void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List *p_param_list) const{ + Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND(!shader); + + + if (shader->dirty_list.in_list()) + _update_shader(shader); // ok should be not anymore dirty + + + Map order; + + for(Map::Element *E=shader->uniforms.front();E;E=E->next()) { + + + order[E->get().order]=E->key(); + } + + + for(Map::Element *E=order.front();E;E=E->next()) { + + PropertyInfo pi; + ShaderLanguage::ShaderNode::Uniform &u=shader->uniforms[E->get()]; + pi.name=E->get(); + switch(u.type) { + case ShaderLanguage::TYPE_VOID: pi.type=Variant::NIL; break; + case ShaderLanguage::TYPE_BOOL: pi.type=Variant::BOOL; break; + case ShaderLanguage::TYPE_BVEC2: pi.type=Variant::INT; pi.hint=PROPERTY_HINT_FLAGS; pi.hint_string="x,y"; break; + case ShaderLanguage::TYPE_BVEC3: pi.type=Variant::INT; pi.hint=PROPERTY_HINT_FLAGS; pi.hint_string="x,y,z"; break; + case ShaderLanguage::TYPE_BVEC4: pi.type=Variant::INT; pi.hint=PROPERTY_HINT_FLAGS; pi.hint_string="x,y,z,w"; break; + case ShaderLanguage::TYPE_UINT: + case ShaderLanguage::TYPE_INT: { + pi.type=Variant::INT; + if (u.hint==ShaderLanguage::ShaderNode::Uniform::HINT_RANGE) { + pi.hint=PROPERTY_HINT_RANGE; + pi.hint_string=rtos(u.hint_range[0])+","+rtos(u.hint_range[1]); + } + + } break; + case ShaderLanguage::TYPE_IVEC2: + case ShaderLanguage::TYPE_IVEC3: + case ShaderLanguage::TYPE_IVEC4: + case ShaderLanguage::TYPE_UVEC2: + case ShaderLanguage::TYPE_UVEC3: + case ShaderLanguage::TYPE_UVEC4: { + + pi.type=Variant::INT_ARRAY; + } break; + case ShaderLanguage::TYPE_FLOAT: { + pi.type=Variant::REAL; + if (u.hint==ShaderLanguage::ShaderNode::Uniform::HINT_RANGE) { + pi.hint=PROPERTY_HINT_RANGE; + pi.hint_string=rtos(u.hint_range[0])+","+rtos(u.hint_range[1])+","+rtos(u.hint_range[2]); + } + + } break; + case ShaderLanguage::TYPE_VEC2: pi.type=Variant::VECTOR2; break; + case ShaderLanguage::TYPE_VEC3: pi.type=Variant::VECTOR3; break; + case ShaderLanguage::TYPE_VEC4: { + if (u.hint==ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) { + pi.type=Variant::COLOR; + } else { + pi.type=Variant::PLANE; + } + } break; + case ShaderLanguage::TYPE_MAT2: pi.type=Variant::MATRIX32; break; + case ShaderLanguage::TYPE_MAT3: pi.type=Variant::MATRIX3; break; + case ShaderLanguage::TYPE_MAT4: pi.type=Variant::TRANSFORM; break; + case ShaderLanguage::TYPE_SAMPLER2D: + case ShaderLanguage::TYPE_ISAMPLER2D: + case ShaderLanguage::TYPE_USAMPLER2D: { + + pi.type=Variant::OBJECT; + pi.hint=PROPERTY_HINT_RESOURCE_TYPE; + pi.hint_string="Texture"; + } break; + case ShaderLanguage::TYPE_SAMPLERCUBE: { + + pi.type=Variant::OBJECT; + pi.hint=PROPERTY_HINT_RESOURCE_TYPE; + pi.hint_string="CubeMap"; + } break; + }; + + p_param_list->push_back(pi); + + } } void RasterizerStorageGLES3::shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture){ + Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND(!shader); + ERR_FAIL_COND(p_texture.is_valid() && !texture_owner.owns(p_texture)); + + if (p_texture.is_valid()) + shader->default_textures[p_name]=p_texture; + else + shader->default_textures.erase(p_name); + _shader_make_dirty(shader); } RID RasterizerStorageGLES3::shader_get_default_texture_param(RID p_shader, const StringName& p_name) const{ - return RID(); + const Shader *shader=shader_owner.get(p_shader); + ERR_FAIL_COND_V(!shader,RID()); + + const Map::Element *E=shader->default_textures.find(p_name); + if (!E) + return RID(); + return E->get(); } /* COMMON MATERIAL API */ +void RasterizerStorageGLES3::_material_make_dirty(Material* p_material) const { + + if (p_material->dirty_list.in_list()) + return; + + _material_dirty_list.add(&p_material->dirty_list); +} + RID RasterizerStorageGLES3::material_create(){ - return RID(); + Material *material = memnew( Material ); + + return material_owner.make_rid(material); } -void RasterizerStorageGLES3::material_set_shader(RID p_shader_material, RID p_shader){ +void RasterizerStorageGLES3::material_set_shader(RID p_material, RID p_shader){ + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND(!material); + + Shader *shader=shader_owner.getornull(p_shader); + + if (material->shader) { + //if shader, remove from previous shader material list + material->shader->materials.remove( &material->list ); + } + material->shader=shader; + + if (shader) { + shader->materials.add(&material->list); + } + _material_make_dirty(material); } -RID RasterizerStorageGLES3::material_get_shader(RID p_shader_material) const{ + +RID RasterizerStorageGLES3::material_get_shader(RID p_material) const{ + + const Material *material = material_owner.get( p_material ); + ERR_FAIL_COND_V(!material,RID()); + + if (material->shader) + return material->shader->self; return RID(); } void RasterizerStorageGLES3::material_set_param(RID p_material, const StringName& p_param, const Variant& p_value){ + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND(!material); + + if (p_value.get_type()==Variant::NIL) + material->params.erase(p_param); + else + material->params[p_param]=p_value; + + _material_make_dirty(material); } Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringName& p_param) const{ + const Material *material = material_owner.get( p_material ); + ERR_FAIL_COND_V(!material,RID()); + + if (material->params.has(p_param)) + return material->params[p_param]; + return Variant(); } +_FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataType type, const Variant& value, uint8_t *data) { + switch(type) { + case ShaderLanguage::TYPE_BOOL: { + + bool v = value; + + GLuint *gui = (GLuint*)data; + *gui = v ? GL_TRUE : GL_FALSE; + } break; + case ShaderLanguage::TYPE_BVEC2: { + + int v = value; + GLuint *gui = (GLuint*)data; + gui[0]=v&1 ? GL_TRUE : GL_FALSE; + gui[1]=v&2 ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_BVEC3: { + + int v = value; + GLuint *gui = (GLuint*)data; + gui[0]=v&1 ? GL_TRUE : GL_FALSE; + gui[1]=v&2 ? GL_TRUE : GL_FALSE; + gui[2]=v&4 ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_BVEC4: { + + int v = value; + GLuint *gui = (GLuint*)data; + gui[0]=v&1 ? GL_TRUE : GL_FALSE; + gui[1]=v&2 ? GL_TRUE : GL_FALSE; + gui[2]=v&4 ? GL_TRUE : GL_FALSE; + gui[3]=v&8 ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_INT: { + + int v = value; + GLint *gui = (GLint*)data; + gui[0]=v; + + } break; + case ShaderLanguage::TYPE_IVEC2: { + + DVector iv = value; + int s = iv.size(); + GLint *gui = (GLint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<2;i++) { + if (i iv = value; + int s = iv.size(); + GLint *gui = (GLint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<3;i++) { + if (i iv = value; + int s = iv.size(); + GLint *gui = (GLint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<4;i++) { + if (i iv = value; + int s = iv.size(); + GLuint *gui = (GLuint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<2;i++) { + if (i iv = value; + int s = iv.size(); + GLuint *gui = (GLuint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<3;i++) { + if (i iv = value; + int s = iv.size(); + GLuint *gui = (GLuint*)data; + + DVector::Read r = iv.read(); + + for(int i=0;i<4;i++) { + if (i& value, uint8_t *data) { + + switch(type) { + case ShaderLanguage::TYPE_BOOL: { + + GLuint *gui = (GLuint*)data; + *gui = value[0].boolean ? GL_TRUE : GL_FALSE; + } break; + case ShaderLanguage::TYPE_BVEC2: { + + GLuint *gui = (GLuint*)data; + gui[0]=value[0].boolean ? GL_TRUE : GL_FALSE; + gui[1]=value[1].boolean ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_BVEC3: { + + GLuint *gui = (GLuint*)data; + gui[0]=value[0].boolean ? GL_TRUE : GL_FALSE; + gui[1]=value[1].boolean ? GL_TRUE : GL_FALSE; + gui[2]=value[2].boolean ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_BVEC4: { + + GLuint *gui = (GLuint*)data; + gui[0]=value[0].boolean ? GL_TRUE : GL_FALSE; + gui[1]=value[1].boolean ? GL_TRUE : GL_FALSE; + gui[2]=value[2].boolean ? GL_TRUE : GL_FALSE; + gui[3]=value[3].boolean ? GL_TRUE : GL_FALSE; + + } break; + case ShaderLanguage::TYPE_INT: { + + GLint *gui = (GLint*)data; + gui[0]=value[0].sint; + + } break; + case ShaderLanguage::TYPE_IVEC2: { + + GLint *gui = (GLint*)data; + + for(int i=0;i<2;i++) { + gui[i]=value[i].sint; + + } + + } break; + case ShaderLanguage::TYPE_IVEC3: { + + GLint *gui = (GLint*)data; + + for(int i=0;i<3;i++) { + gui[i]=value[i].sint; + + } + + } break; + case ShaderLanguage::TYPE_IVEC4: { + + GLint *gui = (GLint*)data; + + for(int i=0;i<4;i++) { + gui[i]=value[i].sint; + + } + + } break; + case ShaderLanguage::TYPE_UINT: { + + + GLuint *gui = (GLuint*)data; + gui[0]=value[0].uint; + + } break; + case ShaderLanguage::TYPE_UVEC2: { + + GLint *gui = (GLint*)data; + + for(int i=0;i<2;i++) { + gui[i]=value[i].uint; + } + } break; + case ShaderLanguage::TYPE_UVEC3: { + GLint *gui = (GLint*)data; + + for(int i=0;i<3;i++) { + gui[i]=value[i].uint; + } + + } break; + case ShaderLanguage::TYPE_UVEC4: { + GLint *gui = (GLint*)data; + + for(int i=0;i<4;i++) { + gui[i]=value[i].uint; + } + } break; + case ShaderLanguage::TYPE_FLOAT: { + + GLfloat *gui = (GLfloat*)data; + gui[0]=value[0].real; + + } break; + case ShaderLanguage::TYPE_VEC2: { + + GLfloat *gui = (GLfloat*)data; + + for(int i=0;i<2;i++) { + gui[i]=value[i].real; + } + + } break; + case ShaderLanguage::TYPE_VEC3: { + + GLfloat *gui = (GLfloat*)data; + + for(int i=0;i<3;i++) { + gui[i]=value[i].real; + } + + } break; + case ShaderLanguage::TYPE_VEC4: { + + GLfloat *gui = (GLfloat*)data; + + for(int i=0;i<4;i++) { + gui[i]=value[i].real; + } + } break; + case ShaderLanguage::TYPE_MAT2: { + GLfloat *gui = (GLfloat*)data; + + for(int i=0;i<2;i++) { + gui[i]=value[i].real; + } + } break; + case ShaderLanguage::TYPE_MAT3: { + + + + GLfloat *gui = (GLfloat*)data; + + gui[ 0]=value[0].real; + gui[ 1]=value[1].real; + gui[ 2]=value[2].real; + gui[ 3]=0; + gui[ 4]=value[3].real; + gui[ 5]=value[4].real; + gui[ 6]=value[5].real; + gui[ 7]=0; + gui[ 8]=value[6].real; + gui[ 9]=value[7].real; + gui[10]=value[8].real; + gui[11]=0; + } break; + case ShaderLanguage::TYPE_MAT4: { + + GLfloat *gui = (GLfloat*)data; + + for(int i=0;i<16;i++) { + gui[i]=value[i].real; + } + } break; + default: {} + } + +} + + +_FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type, uint8_t *data) { + + switch(type) { + + case ShaderLanguage::TYPE_BOOL: + case ShaderLanguage::TYPE_INT: + case ShaderLanguage::TYPE_UINT: + case ShaderLanguage::TYPE_FLOAT: { + zeromem(data,4); + } break; + case ShaderLanguage::TYPE_BVEC2: + case ShaderLanguage::TYPE_IVEC2: + case ShaderLanguage::TYPE_UVEC2: + case ShaderLanguage::TYPE_VEC2: { + zeromem(data,8); + } break; + case ShaderLanguage::TYPE_BVEC3: + case ShaderLanguage::TYPE_IVEC3: + case ShaderLanguage::TYPE_UVEC3: + case ShaderLanguage::TYPE_VEC3: + case ShaderLanguage::TYPE_BVEC4: + case ShaderLanguage::TYPE_IVEC4: + case ShaderLanguage::TYPE_UVEC4: + case ShaderLanguage::TYPE_VEC4: + case ShaderLanguage::TYPE_MAT2:{ + + zeromem(data,16); + } break; + case ShaderLanguage::TYPE_MAT3:{ + + zeromem(data,48); + } break; + case ShaderLanguage::TYPE_MAT4:{ + zeromem(data,64); + } break; + + default: {} + } + +} + +void RasterizerStorageGLES3::_update_material(Material* material) { + + if (material->dirty_list.in_list()) + _material_dirty_list.remove( &material->dirty_list ); + + //clear ubo if it needs to be cleared + if (material->ubo_size) { + + if (!material->shader || material->shader->ubo_size!=material->ubo_size) { + //by by ubo + glDeleteBuffers(1,&material->ubo_id); + material->ubo_id=0; + material->ubo_size=0; + } + } + + //create ubo if it needs to be created + if (material->ubo_size==0 && material->shader && material->shader->ubo_size) { + + glGenBuffers(1, &material->ubo_id); + glBindBuffer(GL_UNIFORM_BUFFER, material->ubo_id); + glBufferData(GL_UNIFORM_BUFFER, material->shader->ubo_size, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + material->ubo_size=material->shader->ubo_size; + } + + //fill up the UBO if it needs to be filled + if (material->shader && material->ubo_size) { + uint8_t* local_ubo = (uint8_t*)alloca(material->ubo_size); + + for(Map::Element *E=material->shader->uniforms.front();E;E=E->next()) { + + if (E->get().order<0) + continue; // texture, does not go here + + //regular uniform + uint8_t *data = &local_ubo[ material->shader->ubo_offsets[E->get().order] ]; + + Map::Element *V = material->params.find(E->key()); + + if (V) { + //user provided + _fill_std140_variant_ubo_value(E->get().type,V->get(),data); + } else if (E->get().default_value.size()){ + //default value + _fill_std140_ubo_value(E->get().type,E->get().default_value,data); + //value=E->get().default_value; + } else { + //zero because it was not provided + _fill_std140_ubo_empty(E->get().type,data); + } + + + } + + glBindBuffer(GL_UNIFORM_BUFFER,material->ubo_id); + glBufferSubData(GL_UNIFORM_BUFFER, 0, material->ubo_size, local_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + } + + //set up the texture array, for easy access when it needs to be drawn + if (material->shader && material->shader->texture_count) { + + material->textures.resize(material->shader->texture_count); + + for(Map::Element *E=material->shader->uniforms.front();E;E=E->next()) { + + if (E->get().texture_order<0) + continue; // not a texture, does not go here + + RID texture; + + Map::Element *V = material->params.find(E->key()); + if (V) { + texture=V->get(); + } + + if (!texture.is_valid()) { + Map::Element *W = material->shader->default_textures.find(E->key()); + if (W) { + texture=W->get(); + } + } + + material->textures[ E->get().texture_order ]=texture; + + + } + + + } else { + material->textures.clear(); + } + +} + +void RasterizerStorageGLES3::update_dirty_materials() { + + while( _material_dirty_list.first() ) { + + Material *material = _material_dirty_list.first()->self(); + + _update_material(material); + } +} + /* MESH API */ RID RasterizerStorageGLES3::mesh_create(){ @@ -1950,6 +2792,49 @@ bool RasterizerStorageGLES3::free(RID p_rid){ info.texture_mem-=texture->total_data_size; texture_owner.free(p_rid); memdelete(texture); + + } else if (shader_owner.owns(p_rid)) { + + // delete the texture + Shader *shader = shader_owner.get(p_rid); + + if (shader->shader) + shader->shader->free_custom_shader(shader->custom_code_id); + + if (shader->dirty_list.in_list()) + _shader_dirty_list.remove(&shader->dirty_list); + + while (shader->materials.first()) { + + Material *mat = shader->materials.first()->self(); + + mat->shader=NULL; + _material_make_dirty(mat); + + shader->materials.remove( shader->materials.first() ); + } + + //material_shader.free_custom_shader(shader->custom_code_id); + shader_owner.free(p_rid); + memdelete(shader); + + } else if (material_owner.owns(p_rid)) { + + // delete the texture + Material *material = material_owner.get(p_rid); + + if (material->shader) { + material->shader->materials.remove( & material->list ); + } + + if (material->ubo_id) { + glDeleteBuffers(1,&material->ubo_id); + } + + material_owner.free(p_rid); + memdelete(material); + + } else if (canvas_occluder_owner.owns(p_rid)) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 9820fbc941..b7b3e607c6 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -2,16 +2,21 @@ #define RASTERIZERSTORAGEGLES3_H #include "servers/visual/rasterizer.h" +#include "servers/visual/shader_language.h" #include "shader_gles3.h" #include "shaders/copy.glsl.h" #include "shaders/canvas.glsl.h" +#include "self_list.h" +#include "shader_compiler_gles3.h" - +class RasterizerCanvasGLES3; class RasterizerStorageGLES3 : public RasterizerStorage { public: + RasterizerCanvasGLES3 *canvas; + enum FBOFormat { FBO_FORMAT_16_BITS, FBO_FORMAT_32_BITS, @@ -47,9 +52,13 @@ public: Set extensions; } config; - struct Shaders { + mutable struct Shaders { CopyShaderGLES3 copy; + + ShaderCompilerGLES3 compiler; + + ShaderCompilerGLES3::IdentifierActions actions_canvas; } shaders; struct Resources { @@ -169,11 +178,71 @@ public: /* SHADER API */ + struct Material; + struct Shader : public RID_Data { + RID self; + + VS::ShaderMode mode; + ShaderGLES3 *shader; + String code; + SelfList::List materials; + + + + Map uniforms; + Vector ubo_offsets; + uint32_t ubo_size; + + uint32_t texture_count; + + uint32_t custom_code_id; + uint32_t version; + + SelfList dirty_list; + + Map default_textures; + + bool valid; + + String path; + + struct CanvasItem { + + enum BlendMode { + BLEND_MODE_MIX, + BLEND_MODE_ADD, + BLEND_MODE_SUB, + BLEND_MODE_MUL, + BLEND_MODE_PMALPHA, + }; + + int blend_mode; + enum LightMode { + LIGHT_MODE_NORMAL, + LIGHT_MODE_UNSHADED, + LIGHT_MODE_LIGHT_ONLY + }; + + int light_mode; + + } canvas_item; + + Shader() : dirty_list(this) { + + shader=NULL; + valid=false; + custom_code_id=0; + version=1; + } }; + mutable SelfList::List _shader_dirty_list; + void _shader_make_dirty(Shader* p_shader); + + mutable RID_Owner shader_owner; virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_SPATIAL); @@ -187,17 +256,48 @@ public: virtual void shader_set_default_texture_param(RID p_shader, const StringName& p_name, RID p_texture); virtual RID shader_get_default_texture_param(RID p_shader, const StringName& p_name) const; + void _update_shader(Shader* p_shader) const; + + void update_dirty_shaders(); /* COMMON MATERIAL API */ + struct Material : public RID_Data { + + Shader *shader; + GLuint ubo_id; + uint32_t ubo_size; + Map params; + SelfList list; + SelfList dirty_list; + Vector textures; + + Material() : list(this), dirty_list(this) { + shader=NULL; + ubo_id=0; + ubo_size=0; + } + + }; + + mutable SelfList::List _material_dirty_list; + void _material_make_dirty(Material *p_material) const; + + + mutable RID_Owner material_owner; + virtual RID material_create(); - virtual void material_set_shader(RID p_shader_material, RID p_shader); - virtual RID material_get_shader(RID p_shader_material) const; + virtual void material_set_shader(RID p_material, RID p_shader); + virtual RID material_get_shader(RID p_material) const; virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); virtual Variant material_get_param(RID p_material, const StringName& p_param) const; + void _update_material(Material* material); + + void update_dirty_materials(); + /* MESH API */ virtual RID mesh_create(); @@ -432,6 +532,7 @@ public: bool clear_request; Color clear_request_color; int canvas_draw_commands; + float time[4]; } frame; void initialize(); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp new file mode 100644 index 0000000000..49707400ca --- /dev/null +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -0,0 +1,528 @@ +#include "shader_compiler_gles3.h" +#include "os/os.h" + +#define SL ShaderLanguage + +static String _mktab(int p_level) { + + String tb; + for(int i=0;i& p_values) { + + switch(p_type) { + case SL::TYPE_BOOL: return p_values[0].boolean?"true":"false"; + case SL::TYPE_BVEC2: return String()+"bvec2("+(p_values[0].boolean?"true":"false")+(p_values[1].boolean?"true":"false")+")"; + case SL::TYPE_BVEC3: return String()+"bvec3("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+")"; + case SL::TYPE_BVEC4: return String()+"bvec4("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+","+(p_values[3].boolean?"true":"false")+")"; + case SL::TYPE_INT: return rtos(p_values[0].sint); + case SL::TYPE_IVEC2: return String()+"ivec2("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+")"; + case SL::TYPE_IVEC3: return String()+"ivec3("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+")"; + case SL::TYPE_IVEC4: return String()+"ivec4("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+","+rtos(p_values[3].sint)+")"; + case SL::TYPE_UINT: return rtos(p_values[0].real); + case SL::TYPE_UVEC2: return String()+"uvec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; + case SL::TYPE_UVEC3: return String()+"uvec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; + case SL::TYPE_UVEC4: return String()+"uvec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; + case SL::TYPE_FLOAT: return rtos(p_values[0].real); + case SL::TYPE_VEC2: return String()+"vec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; + case SL::TYPE_VEC3: return String()+"vec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; + case SL::TYPE_VEC4: return String()+"vec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; + default: ERR_FAIL_V(String()); + } +} + +void ShaderCompilerGLES3::_dump_function_deps(SL::ShaderNode* p_node, const StringName& p_for_func, const Map& p_func_code, String& r_to_add, Set &added) { + + int fidx=-1; + + for(int i=0;ifunctions.size();i++) { + if (p_node->functions[i].name==p_for_func) { + fidx=i; + break; + } + } + + ERR_FAIL_COND(fidx==-1); + + for (Set::Element *E=p_node->functions[fidx].uses_function.front();E;E=E->next()) { + + if (added.has(E->get())) { + continue; //was added already + } + + _dump_function_deps(p_node,E->get(),p_func_code,r_to_add,added); + + SL::FunctionNode *fnode=NULL; + + for(int i=0;ifunctions.size();i++) { + if (p_node->functions[i].name==E->get()) { + fnode=p_node->functions[i].function; + break; + } + } + + ERR_FAIL_COND(!fnode); + + r_to_add+="\n"; + + String header; + header=_typestr(fnode->return_type)+" "+_mkid(fnode->name)+"("; + for(int i=0;iarguments.size();i++) { + + if (i>0) + header+=", "; + header+=_prestr(fnode->arguments[i].precision)+_typestr(fnode->arguments[i].type)+" "+_mkid(fnode->arguments[i].name); + } + + header+=")\n"; + r_to_add+=header; + r_to_add+=p_func_code[E->get()]; + + added.insert(E->get()); + } +} + +String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, GeneratedCode& r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions) { + + String code; + + switch(p_node->type) { + + case SL::Node::TYPE_SHADER: { + + SL::ShaderNode *pnode=(SL::ShaderNode*)p_node; + + for(int i=0;irender_modes.size();i++) { + + if (p_default_actions.render_mode_defines.has(pnode->render_modes[i]) && !used_rmode_defines.has(pnode->render_modes[i])) { + + r_gen_code.defines.push_back(p_default_actions.render_mode_defines[pnode->render_modes[i]].utf8()); + used_rmode_defines.insert(pnode->render_modes[i]); + } + + if (p_actions.render_mode_flags.has(pnode->render_modes[i])) { + *p_actions.render_mode_flags[pnode->render_modes[i]]=true; + } + + if (p_actions.render_mode_values.has(pnode->render_modes[i])) { + Pair &p = p_actions.render_mode_values[pnode->render_modes[i]]; + *p.first=p.second; + } + } + + + int max_texture_uniforms=0; + int max_uniforms=0; + + for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { + if (SL::is_sampler_type(E->get().type)) + max_texture_uniforms++; + else + max_uniforms++; + } + + r_gen_code.texture_uniforms.resize(max_texture_uniforms); + + Vector uniform_sizes; + uniform_sizes.resize(max_uniforms); + + for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { + + String ucode="uniform "; + ucode+=_prestr(E->get().precission); + ucode+=_typestr(E->get().type); + ucode+=" "+_mkid(E->key()); + ucode+=";\n"; + if (SL::is_sampler_type(E->get().type)) { + r_gen_code.vertex_global+=ucode; + r_gen_code.fragment_global+=ucode; + r_gen_code.texture_uniforms[E->get().texture_order]=_mkid(E->key()); + } else { + if (r_gen_code.uniforms.empty()) { + + r_gen_code.defines.push_back(String("#define USE_MATERIAL\n").ascii()); + } + r_gen_code.uniforms+=ucode; + uniform_sizes[E->get().order]=_get_datatype_size(E->get().type); + } + + p_actions.uniforms->insert(E->key(),E->get()); + + } + + // add up + for(int i=0;i0) + uniform_sizes[i]=uniform_sizes[i]+uniform_sizes[i-1]; + } + //offset + r_gen_code.uniform_offsets.resize(uniform_sizes.size()); + for(int i=0;i0) + r_gen_code.uniform_offsets[i]=uniform_sizes[i]-1; + else + r_gen_code.uniform_offsets[i]=0; + } + + if (uniform_sizes.size()) { + r_gen_code.uniform_total_size=uniform_sizes[ uniform_sizes.size() -1 ]; + } else { + r_gen_code.uniform_total_size=0; + } + + for(Map::Element *E=pnode->varyings.front();E;E=E->next()) { + + String vcode; + vcode+=_prestr(E->get().precission); + vcode+=_typestr(E->get().type); + vcode+=" "+String(E->key()); + vcode+=";\n"; + r_gen_code.vertex_global+="out "+vcode; + r_gen_code.fragment_global+="in "+vcode; + } + + Map function_code; + + //code for functions + for(int i=0;ifunctions.size();i++) { + SL::FunctionNode *fnode=pnode->functions[i].function; + function_code[fnode->name]=_dump_node_code(fnode->body,p_level+1,r_gen_code,p_actions,p_default_actions); + } + + //place functions in actual code + + Set added_vtx; + Set added_fragment; //share for light + + for(int i=0;ifunctions.size();i++) { + + SL::FunctionNode *fnode=pnode->functions[i].function; + + + if (fnode->name=="vertex") { + + _dump_function_deps(pnode,fnode->name,function_code,r_gen_code.vertex_global,added_vtx); + r_gen_code.vertex=function_code["vertex"]; + } + + if (fnode->name=="fragment") { + + _dump_function_deps(pnode,fnode->name,function_code,r_gen_code.fragment_global,added_fragment); + r_gen_code.fragment=function_code["fragment"]; + } + + if (fnode->name=="light") { + + _dump_function_deps(pnode,fnode->name,function_code,r_gen_code.fragment_global,added_fragment); + r_gen_code.light=function_code["light"]; + } + } + + //code+=dump_node_code(pnode->body,p_level); + } break; + case SL::Node::TYPE_FUNCTION: { + + } break; + case SL::Node::TYPE_BLOCK: { + SL::BlockNode *bnode=(SL::BlockNode*)p_node; + + //variables + code+=_mktab(p_level-1)+"{\n"; + for(Map::Element *E=bnode->variables.front();E;E=E->next()) { + + code+=_mktab(p_level)+_prestr(E->get().precision)+_typestr(E->get().type)+" "+_mkid(E->key())+";\n"; + } + + for(int i=0;istatements.size();i++) { + + String scode = _dump_node_code(bnode->statements[i],p_level,r_gen_code,p_actions,p_default_actions); + + if (bnode->statements[i]->type==SL::Node::TYPE_CONTROL_FLOW || bnode->statements[i]->type==SL::Node::TYPE_CONTROL_FLOW) { + code+=scode; //use directly + } else { + code+=_mktab(p_level)+scode+";\n"; + } + } + code+=_mktab(p_level-1)+"}\n"; + + + } break; + case SL::Node::TYPE_VARIABLE: { + SL::VariableNode *vnode=(SL::VariableNode*)p_node; + + if (p_default_actions.usage_defines.has(vnode->name) && !used_name_defines.has(vnode->name)) { + r_gen_code.defines.push_back(p_default_actions.usage_defines[vnode->name].utf8()); + used_name_defines.insert(vnode->name); + } + + if (p_actions.usage_flag_pointers.has(vnode->name) && !used_name_defines.has(vnode->name)) { + *p_actions.usage_flag_pointers[vnode->name]=true; + used_name_defines.insert(vnode->name); + } + + if (p_default_actions.renames.has(vnode->name)) + code=p_default_actions.renames[vnode->name]; + else + code=_mkid(vnode->name); + + + } break; + case SL::Node::TYPE_CONSTANT: { + SL::ConstantNode *cnode=(SL::ConstantNode*)p_node; + return get_constant_text(cnode->datatype,cnode->values); + + } break; + case SL::Node::TYPE_OPERATOR: { + SL::OperatorNode *onode=(SL::OperatorNode*)p_node; + + + switch(onode->op) { + + case SL::OP_ASSIGN: + case SL::OP_ASSIGN_ADD: + case SL::OP_ASSIGN_SUB: + case SL::OP_ASSIGN_MUL: + case SL::OP_ASSIGN_DIV: + case SL::OP_ASSIGN_SHIFT_LEFT: + case SL::OP_ASSIGN_SHIFT_RIGHT: + case SL::OP_ASSIGN_MOD: + case SL::OP_ASSIGN_BIT_AND: + case SL::OP_ASSIGN_BIT_OR: + case SL::OP_ASSIGN_BIT_XOR: + code=_dump_node_code(onode->arguments[0],p_level,r_gen_code,p_actions,p_default_actions)+_opstr(onode->op)+_dump_node_code(onode->arguments[1],p_level,r_gen_code,p_actions,p_default_actions); + break; + case SL::OP_BIT_INVERT: + case SL::OP_NEGATE: + case SL::OP_NOT: + case SL::OP_DECREMENT: + case SL::OP_INCREMENT: + code=_opstr(onode->op)+_dump_node_code(onode->arguments[0],p_level,r_gen_code,p_actions,p_default_actions); + break; + case SL::OP_POST_DECREMENT: + case SL::OP_POST_INCREMENT: + code=_dump_node_code(onode->arguments[0],p_level,r_gen_code,p_actions,p_default_actions)+_opstr(onode->op); + break; + case SL::OP_CALL: + case SL::OP_CONSTRUCT: { + + ERR_FAIL_COND_V(onode->arguments[0]->type!=SL::Node::TYPE_VARIABLE,String()); + + SL::VariableNode *vnode=(SL::VariableNode*)onode->arguments[0]; + + if (onode->op==SL::OP_CONSTRUCT) { + code+=String(vnode->name); + } else { + + if (internal_functions.has(vnode->name)) { + code+=vnode->name; + } else if (p_default_actions.renames.has(vnode->name)) { + code+=p_default_actions.renames[vnode->name]; + } else { + code+=_mkid(vnode->name); + } + } + + code+="("; + + for(int i=1;iarguments.size();i++) { + if (i>1) + code+=", "; + code+=_dump_node_code(onode->arguments[i],p_level,r_gen_code,p_actions,p_default_actions); + } + code+=")"; + } break; + default: { + + code="("+_dump_node_code(onode->arguments[0],p_level,r_gen_code,p_actions,p_default_actions)+_opstr(onode->op)+_dump_node_code(onode->arguments[1],p_level,r_gen_code,p_actions,p_default_actions)+")"; + break; + + } + } + + } break; + case SL::Node::TYPE_CONTROL_FLOW: { + SL::ControlFlowNode *cfnode=(SL::ControlFlowNode*)p_node; + if (cfnode->flow_op==SL::FLOW_OP_IF) { + + code+=_mktab(p_level)+"if ("+_dump_node_code(cfnode->expressions[0],p_level,r_gen_code,p_actions,p_default_actions)+")\n"; + code+=_dump_node_code(cfnode->blocks[0],p_level+1,r_gen_code,p_actions,p_default_actions); + if (cfnode->blocks.size()==2) { + + code+=_mktab(p_level)+"else\n"; + code+=_dump_node_code(cfnode->blocks[1],p_level+1,r_gen_code,p_actions,p_default_actions); + } + + + } else if (cfnode->flow_op==SL::FLOW_OP_RETURN) { + + if (cfnode->blocks.size()) { + code="return "+_dump_node_code(cfnode->blocks[0],p_level,r_gen_code,p_actions,p_default_actions); + } else { + code="return"; + } + } + + } break; + case SL::Node::TYPE_MEMBER: { + SL::MemberNode *mnode=(SL::MemberNode*)p_node; + code=_dump_node_code(mnode->owner,p_level,r_gen_code,p_actions,p_default_actions)+"."+mnode->name; + + } break; + } + + return code; + +} + + +Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, IdentifierActions* p_actions, const String &p_path,GeneratedCode& r_gen_code) { + + + + Error err = parser.compile(p_code,ShaderTypes::get_singleton()->get_functions(p_mode),ShaderTypes::get_singleton()->get_modes(p_mode)); + + if (err!=OK) { + _err_print_error(NULL,p_path.utf8().get_data(),parser.get_error_line(),parser.get_error_text().utf8().get_data(),ERR_HANDLER_SHADER); + return err; + } + + r_gen_code.defines.clear(); + r_gen_code.vertex=String(); + r_gen_code.vertex_global=String(); + r_gen_code.fragment=String(); + r_gen_code.fragment_global=String(); + r_gen_code.light=String(); + + + + used_name_defines.clear(); + used_rmode_defines.clear(); + + _dump_node_code(parser.get_shader(),1,r_gen_code,*p_actions,actions[p_mode]); + + return OK; + +} + + +ShaderCompilerGLES3::ShaderCompilerGLES3() { + + /** CANVAS ITEM SHADER **/ + + actions[VS::SHADER_CANVAS_ITEM].renames["SRC_VERTEX"]="vertex"; + actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"]="outvec.xy"; + actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX_COLOR"]="vertex_color"; + actions[VS::SHADER_CANVAS_ITEM].renames["UV"]="uv_interp"; + actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"]="gl_PointSize"; + + actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"]="modelview_matrix"; + actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"]="projection_matrix"; + actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"]=="extra_matrix"; + actions[VS::SHADER_CANVAS_ITEM].renames["TIME"]="time"; + + actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"]="color"; + actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"]="normal"; + actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP"]="normal_map"; + actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"]="normal_depth"; + actions[VS::SHADER_CANVAS_ITEM].renames["UV"]="uv_interp"; + actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"]="color"; + actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"]="color_texture"; + actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"]="color_texpixel_size"; + actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"]="screen_uv"; + actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"]="screen_texture"; + actions[VS::SHADER_CANVAS_ITEM].renames["POINT_COORD"]="gl_PointCoord"; + + actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"]="light_vec"; + actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"]="light_height"; + actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"]="light_color"; + actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"]="light_uv"; + //actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_SHADOW_COLOR"]="light_shadow_color"; + actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT"]="light"; + actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"]="shadow_color"; + + actions[VS::SHADER_CANVAS_ITEM].usage_defines["COLOR"]="#define COLOR_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"]="#define SCREEN_TEXTURE_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"]="#define SCREEN_UV_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"]="#define NORMAL_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"]="#define NORMALMAP_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_COLOR"]="#define SHADOW_COLOR_USED\n"; + + actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_transform"]="#define SKIP_TRANSFORM_USED\n"; + + List func_list; + + ShaderLanguage::get_builtin_funcs(&func_list); + + for (List::Element *E=func_list.front();E;E=E->next()) { + internal_functions.insert(E->get()); + } +} diff --git a/drivers/gles3/shader_compiler_gles3.h b/drivers/gles3/shader_compiler_gles3.h new file mode 100644 index 0000000000..ad51b99927 --- /dev/null +++ b/drivers/gles3/shader_compiler_gles3.h @@ -0,0 +1,67 @@ +#ifndef SHADERCOMPILERGLES3_H +#define SHADERCOMPILERGLES3_H + +#include "servers/visual/shader_language.h" +#include "servers/visual/shader_types.h" +#include "servers/visual_server.h" +#include "pair.h" + +class ShaderCompilerGLES3 { +public: + struct IdentifierActions { + + Map > render_mode_values; + Map render_mode_flags; + Map usage_flag_pointers; + + Map *uniforms; + }; + + struct GeneratedCode { + + Vector defines; + Vector texture_uniforms; + Vector uniform_offsets; + uint32_t uniform_total_size; + String uniforms; + String vertex_global; + String vertex; + String fragment_global; + String fragment; + String light; + + }; + +private: + + ShaderLanguage parser; + + struct DefaultIdentifierActions { + + Map renames; + Map render_mode_defines; + Map usage_defines; + }; + + void _dump_function_deps(ShaderLanguage::ShaderNode *p_node, const StringName& p_for_func, const Map &p_func_code, String& r_to_add,Set &added); + String _dump_node_code(ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions& p_actions, const DefaultIdentifierActions& p_default_actions); + + + + Set used_name_defines; + Set used_rmode_defines; + Set internal_functions; + + + DefaultIdentifierActions actions[VS::SHADER_MAX]; + +public: + + + Error compile(VS::ShaderMode p_mode, const String& p_code, IdentifierActions* p_actions, const String& p_path, GeneratedCode& r_gen_code); + + + ShaderCompilerGLES3(); +}; + +#endif // SHADERCOMPILERGLES3_H diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index f8c0234943..35191fecf7 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -214,6 +214,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { } + + v.ok=false; /* SETUP CONDITIONALS */ @@ -245,6 +247,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { CharString code_string; CharString code_string2; CharString code_globals; + CharString material_string; //print_line("code version? "+itos(conditional_version.code_version)); @@ -258,6 +261,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { cc=&custom_code_map[conditional_version.code_version]; v.code_version=cc->version; define_line_ofs+=2; + } @@ -273,7 +277,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { if (cc) { for(int i=0;icustom_defines.size();i++) { - strings.push_back(cc->custom_defines[i]); + strings.push_back(cc->custom_defines[i].get_data()); DEBUG_PRINT("CD #"+itos(i)+": "+String(cc->custom_defines[i])); } } @@ -305,14 +309,22 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { code_globals=cc->vertex_globals.ascii(); strings.push_back(code_globals.get_data()); } + strings.push_back(vertex_code1.get_data()); + if (cc) { + material_string=cc->uniforms.ascii(); + strings.push_back(material_string.get_data()); + } + + strings.push_back(vertex_code2.get_data()); + if (cc) { code_string=cc->vertex.ascii(); strings.push_back(code_string.get_data()); } - strings.push_back(vertex_code2.get_data()); + strings.push_back(vertex_code3.get_data()); #ifdef DEBUG_SHADER DEBUG_PRINT("\nVertex Code:\n\n"+String(code_string.get_data())); @@ -367,7 +379,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { ERR_FAIL_V(NULL); } - + + /* FRAGMENT SHADER */ strings.resize(strings_base_size); @@ -396,21 +409,29 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { code_globals=cc->fragment_globals.ascii(); strings.push_back(code_globals.get_data()); } + strings.push_back(fragment_code1.get_data()); + if (cc) { + material_string=cc->uniforms.ascii(); + strings.push_back(material_string.get_data()); + } + + strings.push_back(fragment_code2.get_data()); + if (cc) { code_string=cc->fragment.ascii(); strings.push_back(code_string.get_data()); } - strings.push_back(fragment_code2.get_data()); + strings.push_back(fragment_code3.get_data()); if (cc) { code_string2=cc->light.ascii(); strings.push_back(code_string2.get_data()); } - strings.push_back(fragment_code3.get_data()); + strings.push_back(fragment_code4.get_data()); #ifdef DEBUG_SHADER DEBUG_PRINT("\nFragment Code:\n\n"+String(code_string.get_data())); @@ -463,7 +484,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { ERR_FAIL_V( NULL ); } - + glAttachShader(v.id,v.frag_id); glAttachShader(v.id,v.vert_id); @@ -552,10 +573,11 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { if ( cc ) { - v.custom_uniform_locations.resize(cc->custom_uniforms.size()); - for(int i=0;icustom_uniforms.size();i++) { + v.texture_uniform_locations.resize(cc->texture_uniforms.size()); + for(int i=0;itexture_uniforms.size();i++) { - v.custom_uniform_locations[i]=glGetUniformLocation(v.id,String(cc->custom_uniforms[i]).ascii().get_data()); + v.texture_uniform_locations[i]=glGetUniformLocation(v.id,String(cc->texture_uniforms[i]).ascii().get_data()); + glUniform1i(v.texture_uniform_locations[i],i+base_material_tex_index); } } @@ -597,6 +619,7 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co //split vertex and shader code (thank you, retarded shader compiler programmers from you know what company). { String globals_tag="\nVERTEX_SHADER_GLOBALS"; + String material_tag="\nMATERIAL_UNIFORMS"; String code_tag="\nVERTEX_SHADER_CODE"; String code = vertex_code; int cpos = code.find(globals_tag); @@ -606,20 +629,31 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co vertex_code0=code.substr(0,cpos).ascii(); code = code.substr(cpos+globals_tag.length(),code.length()); - cpos = code.find(code_tag); + cpos = code.find(material_tag); if (cpos==-1) { vertex_code1=code.ascii(); } else { vertex_code1=code.substr(0,cpos).ascii(); - vertex_code2=code.substr(cpos+code_tag.length(),code.length()).ascii(); + String code2 = code.substr(cpos+material_tag.length(),code.length()); + + cpos = code2.find(code_tag); + if (cpos==-1) { + vertex_code2=code2.ascii(); + } else { + + vertex_code2=code2.substr(0,cpos).ascii(); + vertex_code3 = code2.substr(cpos+code_tag.length(),code2.length()).ascii(); + } + } } } { String globals_tag="\nFRAGMENT_SHADER_GLOBALS"; + String material_tag="\nMATERIAL_UNIFORMS"; String code_tag="\nFRAGMENT_SHADER_CODE"; String light_code_tag="\nLIGHT_SHADER_CODE"; String code = fragment_code; @@ -630,22 +664,31 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co fragment_code0=code.substr(0,cpos).ascii(); code = code.substr(cpos+globals_tag.length(),code.length()); - cpos = code.find(code_tag); + cpos = code.find(material_tag); if (cpos==-1) { fragment_code1=code.ascii(); } else { fragment_code1=code.substr(0,cpos).ascii(); - String code2 = code.substr(cpos+code_tag.length(),code.length()); + String code2 = code.substr(cpos+material_tag.length(),code.length()); - cpos = code2.find(light_code_tag); + cpos = code2.find(code_tag); if (cpos==-1) { fragment_code2=code2.ascii(); } else { fragment_code2=code2.substr(0,cpos).ascii(); - fragment_code3 = code2.substr(cpos+light_code_tag.length(),code2.length()).ascii(); + String code3 = code2.substr(cpos+code_tag.length(),code2.length()); + + cpos = code3.find(light_code_tag); + if (cpos==-1) { + fragment_code3=code3.ascii(); + } else { + + fragment_code3=code3.substr(0,cpos).ascii(); + fragment_code4 = code3.substr(cpos+light_code_tag.length(),code3.length()).ascii(); + } } } } @@ -697,7 +740,7 @@ uint32_t ShaderGLES3::create_custom_shader() { return last_custom_code++; } -void ShaderGLES3::set_custom_shader_code(uint32_t p_code_id, const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_light, const String& p_fragment_globals,const Vector& p_uniforms,const Vector &p_custom_defines) { +void ShaderGLES3::set_custom_shader_code(uint32_t p_code_id, const String& p_vertex, const String& p_vertex_globals, const String& p_fragment, const String& p_light, const String& p_fragment_globals, const String &p_uniforms, const Vector &p_texture_uniforms, const Vector &p_custom_defines) { ERR_FAIL_COND(!custom_code_map.has(p_code_id)); CustomCode *cc=&custom_code_map[p_code_id]; @@ -707,7 +750,8 @@ void ShaderGLES3::set_custom_shader_code(uint32_t p_code_id, const String& p_ver cc->fragment=p_fragment; cc->fragment_globals=p_fragment_globals; cc->light=p_light; - cc->custom_uniforms=p_uniforms; + cc->texture_uniforms=p_texture_uniforms; + cc->uniforms=p_uniforms; cc->custom_defines=p_custom_defines; cc->version++; } @@ -734,13 +778,16 @@ void ShaderGLES3::free_custom_shader(uint32_t p_code_id) { } +void ShaderGLES3::set_base_material_tex_index(int p_idx) { + base_material_tex_index=p_idx; +} ShaderGLES3::ShaderGLES3() { version=NULL; last_custom_code=1; uniforms_dirty = true; - + base_material_tex_index=0; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&max_image_units); } diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index 7aaf65d450..176a2282fd 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -105,9 +105,10 @@ private: String fragment; String fragment_globals; String light; + String uniforms; uint32_t version; - Vector custom_uniforms; - Vector custom_defines; + Vector texture_uniforms; + Vector custom_defines; }; @@ -118,7 +119,7 @@ private: GLuint vert_id; GLuint frag_id; GLint *uniform_location; - Vector custom_uniform_locations; + Vector texture_uniform_locations; uint32_t code_version; bool ok; Version() { code_version=0; ok=false; uniform_location=NULL; } @@ -166,10 +167,14 @@ private: CharString fragment_code1; CharString fragment_code2; CharString fragment_code3; + CharString fragment_code4; CharString vertex_code0; CharString vertex_code1; CharString vertex_code2; + CharString vertex_code3; + + int base_material_tex_index; Version * get_current_version(); @@ -308,7 +313,7 @@ public: void clear_caches(); uint32_t create_custom_shader(); - void set_custom_shader_code(uint32_t p_id,const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_p_light,const String& p_fragment_globals,const Vector& p_uniforms,const Vector &p_custom_defines); + void set_custom_shader_code(uint32_t p_id,const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_p_light,const String& p_fragment_globals,const String& p_uniforms,const Vector& p_texture_uniforms,const Vector &p_custom_defines); void set_custom_shader(uint32_t p_id); void free_custom_shader(uint32_t p_id); @@ -332,23 +337,25 @@ public: uniforms_dirty = true; }; - _FORCE_INLINE_ void set_custom_uniform(int p_idx, const Variant& p_value) { + _FORCE_INLINE_ void set_texture_uniform(int p_idx, const Variant& p_value) { ERR_FAIL_COND(!version); - ERR_FAIL_INDEX(p_idx,version->custom_uniform_locations.size()); - _set_uniform_variant( version->custom_uniform_locations[p_idx], p_value ); + ERR_FAIL_INDEX(p_idx,version->texture_uniform_locations.size()); + _set_uniform_variant( version->texture_uniform_locations[p_idx], p_value ); } - _FORCE_INLINE_ GLint get_custom_uniform_location(int p_idx) { + _FORCE_INLINE_ GLint get_texture_uniform_location(int p_idx) { ERR_FAIL_COND_V(!version,-1); - ERR_FAIL_INDEX_V(p_idx,version->custom_uniform_locations.size(),-1); - return version->custom_uniform_locations[p_idx]; + ERR_FAIL_INDEX_V(p_idx,version->texture_uniform_locations.size(),-1); + return version->texture_uniform_locations[p_idx]; } virtual void init()=0; void finish(); + void set_base_material_tex_index(int p_idx); + virtual ~ShaderGLES3(); }; diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index eed2239ec9..cf2e0f776f 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -1,7 +1,7 @@ [vertex] -layout(location=0) in highp vec3 vertex; +layout(location=0) in highp vec2 vertex; layout(location=3) in vec4 color_attrib; #ifdef USE_TEXTURE_RECT @@ -20,6 +20,7 @@ layout(location=4) in highp vec2 uv_attrib; layout(std140) uniform CanvasItemData { //ubo:0 highp mat4 projection_matrix; + highp vec4 time; }; uniform highp mat4 modelview_matrix; @@ -29,10 +30,6 @@ uniform highp mat4 extra_matrix; out mediump vec2 uv_interp; out mediump vec4 color_interp; -#if defined(USE_TIME) -uniform float time; -#endif - #ifdef USE_LIGHTING layout(std140) uniform LightData { //ubo:1 @@ -51,6 +48,7 @@ layout(std140) uniform LightData { //ubo:1 highp float shadow_distance_mult; }; + out vec4 light_uv_interp; #if defined(NORMAL_USED) @@ -66,20 +64,30 @@ out highp vec2 pos; VERTEX_SHADER_GLOBALS +#if defined(USE_MATERIAL) + +layout(std140) uniform UniformData { //ubo:2 + +MATERIAL_UNIFORMS + +}; + +#endif + void main() { - color_interp = color_attrib; + vec4 vertex_color = color_attrib; #ifdef USE_TEXTURE_RECT - uv_interp = src_rect.xy + abs(src_rect.zw) * vertex.xy; - highp vec4 outvec = vec4(dst_rect.xy + dst_rect.zw * mix(vertex.xy,vec2(1.0,1.0)-vertex.xy,lessThan(src_rect.zw,vec2(0.0,0.0))),0.0,1.0); + uv_interp = src_rect.xy + abs(src_rect.zw) * vertex; + highp vec4 outvec = vec4(dst_rect.xy + dst_rect.zw * mix(vertex,vec2(1.0,1.0)-vertex,lessThan(src_rect.zw,vec2(0.0,0.0))),0.0,1.0); #else uv_interp = uv_attrib; - highp vec4 outvec = vec4(vertex, 1.0); + highp vec4 outvec = vec4(vertex,0.0,1.0); #endif @@ -90,16 +98,16 @@ VERTEX_SHADER_CODE } -#if !defined(USE_WORLD_VEC) +#if !defined(SKIP_TRANSFORM_USED) outvec = extra_matrix * outvec; outvec = modelview_matrix * outvec; #endif - + color_interp = vertex_color; #ifdef USE_PIXEL_SNAP - outvec.xy=floor(outvec.xy+0.5); + outvec.xy=floor(outvec+0.5); #endif @@ -132,20 +140,24 @@ VERTEX_SHADER_CODE uniform mediump sampler2D color_texture; // texunit:0 +uniform highp vec2 color_texpixel_size; in mediump vec2 uv_interp; in mediump vec4 color_interp; -#if defined(ENABLE_TEXSCREEN) +#if defined(SCREEN_TEXTURE_USED) -uniform sampler2D texscreen_tex; // texunit:-3 +uniform sampler2D screen_texture; // texunit:-3 #endif -#if defined(USE_TIME) -uniform float time; -#endif +layout(std140) uniform CanvasItemData { + + highp mat4 projection_matrix; + highp vec4 time; +}; + #ifdef USE_LIGHTING @@ -188,6 +200,17 @@ FRAGMENT_SHADER_GLOBALS layout(location=0) out mediump vec4 frag_color; + +#if defined(USE_MATERIAL) + +layout(std140) uniform UniformData { + +MATERIAL_UNIFORMS + +}; + +#endif + void main() { vec4 color = color_interp; @@ -195,6 +218,9 @@ void main() { vec3 normal = vec3(0.0,0.0,1.0); #endif +#if !defined(COLOR_USED) +//default behavior, texture by color + #ifdef USE_DISTANCE_FIELD const float smoothing = 1.0/32.0; float distance = texture(color_texture, uv_interp).a; @@ -204,6 +230,7 @@ void main() { #endif +#endif #if defined(ENABLE_SCREEN_UV) vec2 screen_uv = gl_FragCoord.xy*screen_uv_mult; @@ -211,14 +238,15 @@ void main() { { -#if defined(USE_NORMALMAP) - vec3 normal_map=vec3(0.0,0.0,1.0); float normal_depth=1.0; + +#if defined(NORMALMAP_USED) + vec3 normal_map=vec3(0.0,0.0,1.0); #endif FRAGMENT_SHADER_CODE -#if defined(USE_NORMALMAP) +#if defined(NORMALMAP_USED) normal = mix(vec3(0.0,0.0,1.0), normal_map * vec3(2.0,-2.0,1.0) - vec3( 1.0, -1.0, 0.0 ), normal_depth ); #endif @@ -246,7 +274,7 @@ FRAGMENT_SHADER_CODE vec2 light_uv = light_uv_interp.xy; vec4 light = texture(light_texture,light_uv) * light_color; -#if defined(USE_OUTPUT_SHADOW_COLOR) +#if defined(SHADOW_COLOR_USED) vec4 shadow_color=vec4(0.0,0.0,0.0,0.0); #endif @@ -409,7 +437,7 @@ LIGHT_SHADER_CODE #endif -#if defined(USE_OUTPUT_SHADOW_COLOR) +#if defined(SHADOW_COLOR_USED) color=mix(shadow_color,color,shadow_attenuation); #else //color*=shadow_attenuation; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 271cf302ef..b9ee6178f0 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -88,6 +88,10 @@ void OS_Unix::print_error(const char* p_function,const char* p_file,int p_line,c print("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n",p_function,err_details); print("\E[0;35m At: %s:%i.\E[0m\n",p_file,p_line); break; + case ERR_SHADER: + print("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n",p_function,err_details); + print("\E[0;36m At: %s:%i.\E[0m\n",p_file,p_line); + break; } } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 1af7cb2a49..92359892a8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1727,6 +1727,10 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l print("SCRIPT ERROR: %s: %s\n", p_function, err_details); print(" At: %s:%i\n", p_file, p_line); break; + case ERR_SHADER: + print("SHADER ERROR: %s: %s\n", p_function, err_details); + print(" At: %s:%i\n", p_file, p_line); + break; } } else { @@ -1742,6 +1746,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: basecol = FOREGROUND_RED; break; case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break; case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break; + case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break; } basecol |= current_bg; @@ -1753,6 +1758,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: "); break; case ERR_WARNING: print("WARNING: "); break; case ERR_SCRIPT: print("SCRIPT ERROR: "); break; + case ERR_SCRIPT: print("SHADER ERROR: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); @@ -1763,6 +1769,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print(" At: "); break; case ERR_WARNING: print(" At: "); break; case ERR_SCRIPT: print(" At: "); break; + case ERR_SHADER: print(" At: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg); @@ -1775,6 +1782,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: %s: ", p_function); break; case ERR_WARNING: print("WARNING: %s: ", p_function); break; case ERR_SCRIPT: print("SCRIPT ERROR: %s: ", p_function); break; + case ERR_SHADER: print("SCRIPT ERROR: %s: ", p_function); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); @@ -1785,6 +1793,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print(" At: "); break; case ERR_WARNING: print(" At: "); break; case ERR_SCRIPT: print(" At: "); break; + case ERR_SHADER: print(" At: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 07ee1ff753..0696261401 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -55,7 +55,7 @@ bool CanvasItemMaterial::_set(const StringName& p_name, const Variant& p_value) } } if (pr) { - VisualServer::get_singleton()->material_set_param(material,pr,p_value); + VisualServer::get_singleton()->material_set_param(_get_material(),pr,p_value); return true; } } @@ -78,7 +78,7 @@ bool CanvasItemMaterial::_get(const StringName& p_name,Variant &r_ret) const { StringName pr = shader->remap_param(p_name); if (pr) { - r_ret=VisualServer::get_singleton()->material_get_param(material,pr); + r_ret=VisualServer::get_singleton()->material_get_param(_get_material(),pr); return true; } } @@ -111,7 +111,7 @@ void CanvasItemMaterial::set_shader(const Ref& p_shader) { if (shader.is_valid()) rid=shader->get_rid(); - VS::get_singleton()->material_set_shader(material,rid); + VS::get_singleton()->material_set_shader(_get_material(),rid); _change_notify(); //properties for shader exposed emit_changed(); } @@ -123,18 +123,14 @@ Ref CanvasItemMaterial::get_shader() const{ void CanvasItemMaterial::set_shader_param(const StringName& p_param,const Variant& p_value){ - VS::get_singleton()->material_set_param(material,p_param,p_value); + VS::get_singleton()->material_set_param(_get_material(),p_param,p_value); } Variant CanvasItemMaterial::get_shader_param(const StringName& p_param) const{ - return VS::get_singleton()->material_get_param(material,p_param); + return VS::get_singleton()->material_get_param(_get_material(),p_param); } -RID CanvasItemMaterial::get_rid() const { - - return material; -} void CanvasItemMaterial::_bind_methods() { diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index b65c1a60b4..9cc7982aa3 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -41,10 +41,9 @@ class Font; class StyleBox; -class CanvasItemMaterial : public Material{ +class CanvasItemMaterial : public Material { OBJ_TYPE(CanvasItemMaterial,Material); - RID material; Ref shader; public: /*enum ShadingMode { @@ -70,7 +69,6 @@ public: void set_shader_param(const StringName& p_param,const Variant& p_value); Variant get_shader_param(const StringName& p_param) const; - virtual RID get_rid() const; CanvasItemMaterial(); ~CanvasItemMaterial(); }; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 27bdb581e1..3d9c07ac86 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -34,31 +34,12 @@ #include "os/input.h" #include "os/keyboard.h" -void update_material(Refmat,const Color& p_color,float h,float s,float v) { - if (!mat.is_valid()) - return; - Ref sdr = mat->get_shader(); - if (!sdr.is_valid()) - return; - - mat->set_shader_param("R",p_color.r); - mat->set_shader_param("G",p_color.g); - mat->set_shader_param("B",p_color.b); - mat->set_shader_param("H",h); - mat->set_shader_param("S",s); - mat->set_shader_param("V",v); - mat->set_shader_param("A",p_color.a); -} void ColorPicker::_notification(int p_what) { switch(p_what) { case NOTIFICATION_THEME_CHANGED: { - uv_material->set_shader(get_shader("uv_editor")); - w_material->set_shader(get_shader("w_editor")); - update_material(uv_material,color,h,s,v); - update_material(w_material,color,h,s,v); uv_edit->set_texture(get_icon("color_main")); w_edit->set_texture(get_icon("color_hue")); sample->set_texture(get_icon("color_sample")); @@ -68,8 +49,6 @@ void ColorPicker::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { btn_pick->set_icon(get_icon("screen_picker", "ColorPicker")); - update_material(uv_material, color,h,s,v); - update_material(w_material, color,h,s,v); uv_edit->get_child(0)->cast_to()->update(); w_edit->get_child(0)->cast_to()->update(); @@ -113,8 +92,6 @@ void ColorPicker::set_color(const Color& p_color) { if (!is_inside_tree()) return; - update_material(uv_material, color,h,s,v); - update_material(w_material, color,h,s,v); uv_edit->get_child(0)->cast_to()->update(); w_edit->get_child(0)->cast_to()->update(); @@ -509,7 +486,6 @@ ColorPicker::ColorPicker() : uv_edit->add_child(c); c->set_area_as_parent_rect(); c->set_stop_mouse(false); - c->set_material(memnew ( CanvasItemMaterial )); Vector args=Vector(); args.push_back(0); args.push_back(c); @@ -525,7 +501,6 @@ ColorPicker::ColorPicker() : w_edit->add_child(c); c->set_area_as_parent_rect(); c->set_stop_mouse(false); - c->set_material(memnew ( CanvasItemMaterial )); args.clear(); args.push_back(1); args.push_back(c); @@ -593,18 +568,6 @@ ColorPicker::ColorPicker() : //_update_color(); updating=false; - uv_material.instance(); - Ref s_uv = get_shader("uv_editor"); - uv_material->set_shader(s_uv); - - w_material.instance(); - - Ref s_w = get_shader("w_editor"); - w_material->set_shader(s_w); - - uv_edit->set_material(uv_material); - w_edit->set_material(w_material); - set_color(Color(1,1,1)); diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index 5e2cc57274..b742454361 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -57,8 +57,6 @@ private: List presets; ToolButton *btn_pick; CheckButton *btn_mode; - Ref uv_material; - Ref w_material; HSlider *scroll[4]; SpinBox *values[4]; Label *labels[4]; diff --git a/scene/resources/material.h b/scene/resources/material.h index 87afa60ce9..1acc031641 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -46,6 +46,9 @@ class Material : public Resource { OBJ_SAVE_TYPE( Material ); RID material; +protected: + + _FORCE_INLINE_ RID _get_material() const { return material; } public: virtual RID get_rid() const; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 1a9912e3fb..065bb4d31a 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -712,6 +712,8 @@ bool ShaderLanguage::is_token_nonvoid_datatype(TokenType p_type) { void ShaderLanguage::clear() { + current_function=StringName(); + completion_type=COMPLETION_NONE; completion_block=NULL; completion_function=StringName(); @@ -2096,6 +2098,12 @@ bool ShaderLanguage::is_scalar_type(DataType p_type) { return p_type==TYPE_BOOL || p_type==TYPE_INT || p_type==TYPE_UINT || p_type==TYPE_FLOAT; } +bool ShaderLanguage::is_sampler_type(DataType p_type) { + + return p_type==TYPE_SAMPLER2D || p_type==TYPE_ISAMPLER2D || p_type==TYPE_USAMPLER2D || p_type==TYPE_SAMPLERCUBE; + +} + void ShaderLanguage::get_keyword_list(List *r_keywords) { Set kws; @@ -2122,6 +2130,27 @@ void ShaderLanguage::get_keyword_list(List *r_keywords) { } } +void ShaderLanguage::get_builtin_funcs(List *r_keywords) { + + + Set kws; + + int idx=0; + + while (builtin_func_defs[idx].name) { + + kws.insert(builtin_func_defs[idx].name); + + idx++; + } + + for(Set::Element *E=kws.front();E;E=E->next()) { + r_keywords->push_back(E->get()); + } +} + + + ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) { static const DataType scalar_types[]={ @@ -2342,6 +2371,12 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const bool ok =_parse_function_arguments(p_block,p_builtin_types,func,&carg); + for(int i=0;ifunctions.size();i++) { + if (shader->functions[i].name==name) { + shader->functions[i].uses_function.insert(name); + } + } + if (carg>=0) { @@ -3140,6 +3175,9 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Maprender_modes.has(tk.text)) { + if (shader->render_modes.find(tk.text)!=-1) { _set_error("Duplicate render mode: '"+String(tk.text)+"'"); return ERR_PARSE_ERROR; } - shader->render_modes.insert(tk.text); + shader->render_modes.push_back(tk.text); tk = _get_token(); if (tk.type==TK_COMMA) { @@ -3225,6 +3263,13 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Mapuniforms.size(); + if (is_sampler_type(type)) { + uniform.texture_order=texture_uniforms++; + uniform.order=-1; + } else { + uniform.texture_order=-1; + uniform.order=uniforms++; + } uniform.type=type; uniform.precission=precision; @@ -3520,9 +3565,13 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Mapbody,builtin_types); if (err) return err; + + current_function=StringName(); } } diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 45dc556115..dc1279efd3 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -370,6 +370,7 @@ public: struct Function { StringName name; FunctionNode*function; + Set uses_function; bool callable; }; @@ -391,6 +392,7 @@ public: }; int order; + int texture_order; DataType type; DataPrecision precission; Vector default_value; @@ -403,7 +405,7 @@ public: Map varyings; Map uniforms; - Set render_modes; + Vector render_modes; Vector functions; @@ -461,8 +463,10 @@ public: static bool convert_constant(ConstantNode* p_constant, DataType p_to_type,ConstantNode::Value *p_value=NULL); static DataType get_scalar_type(DataType p_type); static bool is_scalar_type(DataType p_type); + static bool is_sampler_type(DataType p_type); static void get_keyword_list(List *r_keywords); + static void get_builtin_funcs(List *r_keywords); private: struct KeyWord { TokenType token; const char *text;}; @@ -476,6 +480,8 @@ private: int char_idx; int tk_line; + StringName current_function; + struct TkPos { int char_idx; int tk_line; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 675be3458c..1a01a19021 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -18,6 +18,7 @@ ShaderTypes::ShaderTypes() { singleton=this; + /*************** SPATIAL ***********************/ shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_VERTEX"]=ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["vertex"]["SRC_NORMAL"]=ShaderLanguage::TYPE_VEC3; @@ -96,4 +97,65 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_model_space"); shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_camera_space"); + /************ CANVAS ITEM **************************/ + + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["SRC_VERTEX"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["VERTEX"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["VERTEX_COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["POINT_SIZE"]=ShaderLanguage::TYPE_FLOAT; + + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["WORLD_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["PROJECTION_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["EXTRA_MATRIX"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SRC_COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POSITION"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMALMAP"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["NORMALMAP_DEPTH"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TEXTURE"]=ShaderLanguage::TYPE_SAMPLER2D; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TEXTURE_PIXEL_SIZE"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POINT_COORD"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POSITION"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["TEXTURE"]=ShaderLanguage::TYPE_SAMPLER2D; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["TEXTURE_PIXEL_SIZE"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["VAR1"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["VAR2"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT_VEC"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT_HEIGHT"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT_COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT_UV"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT_SHADOW"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["LIGHT"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["SHADOW"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POINT_COORD"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + + shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_transform"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mix"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_add"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_sub"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mul"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_premul_alpha"); + + shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("light_only"); + + + + + + } diff --git a/servers/visual_server.h b/servers/visual_server.h index 238bcc216d..90e99710fd 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -140,6 +140,7 @@ public: SHADER_SPATIAL, SHADER_CANVAS_ITEM, SHADER_LIGHT, + SHADER_MAX }; diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 02af9712a8..f69b7ba3e1 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -67,6 +67,10 @@ void EditorLog::_error_handler(void *p_self, const char*p_func, const char*p_fil icon = self->get_icon("ScriptError","EditorIcons"); } break; + case ERR_HANDLER_SHADER: { + + icon = self->get_icon("Shader","EditorIcons"); + } break; } -- cgit v1.2.3 From 4428115916144b45c4697cd65d9c8c093631bec6 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 19 Oct 2016 11:14:41 -0300 Subject: Everything returning to normal in 3D, still a long way to go -implemented the scene part of visual server and rasterizer, objects without lighting and material are rendererd only --- bin/tests/test_render.cpp | 5 +- core/math/math_funcs.h | 102 ++ core/rid.h | 8 + drivers/gles3/rasterizer_canvas_gles3.cpp | 1 + drivers/gles3/rasterizer_gles3.cpp | 9 +- drivers/gles3/rasterizer_gles3.h | 3 + drivers/gles3/rasterizer_scene_gles3.cpp | 808 +++++++++++++ drivers/gles3/rasterizer_scene_gles3.h | 178 +++ drivers/gles3/rasterizer_storage_gles3.cpp | 720 ++++++++++- drivers/gles3/rasterizer_storage_gles3.h | 200 +++- drivers/gles3/shader_gles3.cpp | 12 +- drivers/gles3/shaders/SCsub | 1 + drivers/gles3/shaders/scene.glsl | 351 ++++++ servers/visual/rasterizer.h | 99 +- servers/visual/shader_types.cpp | 13 +- servers/visual/visual_server_raster.cpp | 179 +-- servers/visual/visual_server_raster.h | 103 +- servers/visual/visual_server_scene.cpp | 1517 ++++++++++++++++++++++++ servers/visual/visual_server_scene.h | 390 ++++++ servers/visual/visual_server_viewport.cpp | 14 + servers/visual_server.cpp | 746 ++++++++++++ servers/visual_server.h | 8 +- tools/editor/plugins/spatial_editor_plugin.cpp | 1 + 23 files changed, 5196 insertions(+), 272 deletions(-) create mode 100644 drivers/gles3/rasterizer_scene_gles3.cpp create mode 100644 drivers/gles3/rasterizer_scene_gles3.h create mode 100644 drivers/gles3/shaders/scene.glsl create mode 100644 servers/visual/visual_server_scene.cpp create mode 100644 servers/visual/visual_server_scene.h diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index 7bf833c8a7..b971d412aa 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -173,7 +173,10 @@ public: // vs->camera_set_perspective( camera, 60.0,0.1, 100.0 ); viewport = vs->viewport_create(); - vs->viewport_attach_to_screen(viewport,Rect2(Vector2(),OS::get_singleton()->get_window_size())); + Size2i screen_size = OS::get_singleton()->get_window_size(); + vs->viewport_set_size(viewport,screen_size.x,screen_size.y); + vs->viewport_attach_to_screen(viewport,Rect2(Vector2(),screen_size)); + vs->viewport_set_active(viewport,true); vs->viewport_attach_camera( viewport, camera ); vs->viewport_set_scenario( viewport, scenario ); vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,3,30 ) ) ); diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index fc76d96b2e..c8ced0b306 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -175,6 +175,108 @@ public: static double log(double x); static double exp(double x); + + static _FORCE_INLINE_ uint32_t halfbits_to_floatbits(uint16_t h) + { + uint16_t h_exp, h_sig; + uint32_t f_sgn, f_exp, f_sig; + + h_exp = (h&0x7c00u); + f_sgn = ((uint32_t)h&0x8000u) << 16; + switch (h_exp) { + case 0x0000u: /* 0 or subnormal */ + h_sig = (h&0x03ffu); + /* Signed zero */ + if (h_sig == 0) { + return f_sgn; + } + /* Subnormal */ + h_sig <<= 1; + while ((h_sig&0x0400u) == 0) { + h_sig <<= 1; + h_exp++; + } + f_exp = ((uint32_t)(127 - 15 - h_exp)) << 23; + f_sig = ((uint32_t)(h_sig&0x03ffu)) << 13; + return f_sgn + f_exp + f_sig; + case 0x7c00u: /* inf or NaN */ + /* All-ones exponent and a copy of the significand */ + return f_sgn + 0x7f800000u + (((uint32_t)(h&0x03ffu)) << 13); + default: /* normalized */ + /* Just need to adjust the exponent and shift */ + return f_sgn + (((uint32_t)(h&0x7fffu) + 0x1c000u) << 13); + } + } + + static _FORCE_INLINE_ float halfptr_to_float(uint16_t *h) { + + union { + uint32_t u32; + float f32; + } u; + + u.u32=halfbits_to_floatbits(*h); + return u.f32; + } + + static _FORCE_INLINE_ uint16_t make_half_float(float f) { + + union { + float fv; + uint32_t ui; + } ci; + ci.fv=f; + + uint32_t x = ci.ui; + uint32_t sign = (unsigned short)(x >> 31); + uint32_t mantissa; + uint32_t exp; + uint16_t hf; + + // get mantissa + mantissa = x & ((1 << 23) - 1); + // get exponent bits + exp = x & (0xFF << 23); + if (exp >= 0x47800000) + { + // check if the original single precision float number is a NaN + if (mantissa && (exp == (0xFF << 23))) + { + // we have a single precision NaN + mantissa = (1 << 23) - 1; + } + else + { + // 16-bit half-float representation stores number as Inf + mantissa = 0; + } + hf = (((uint16_t)sign) << 15) | (uint16_t)((0x1F << 10)) | + (uint16_t)(mantissa >> 13); + } + // check if exponent is <= -15 + else if (exp <= 0x38000000) + { + + /*// store a denorm half-float value or zero + exp = (0x38000000 - exp) >> 23; + mantissa >>= (14 + exp); + + hf = (((uint16_t)sign) << 15) | (uint16_t)(mantissa); + */ + hf=0; //denormals do not work for 3D, convert to zero + } + else + { + hf = (((uint16_t)sign) << 15) | + (uint16_t)((exp - 0x38000000) >> 13) | + (uint16_t)(mantissa >> 13); + } + + return hf; + } + + + }; diff --git a/core/rid.h b/core/rid.h index 85a69ac0ef..92b7e6ee69 100644 --- a/core/rid.h +++ b/core/rid.h @@ -181,6 +181,14 @@ public: } + + _FORCE_INLINE_ T * getptr(const RID& p_rid) { + + return static_cast(p_rid.get_data()); + + } + + _FORCE_INLINE_ bool owns(const RID& p_rid) const { if (p_rid.get_data()==NULL) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b2228a6cfa..237b3ec3fc 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -117,6 +117,7 @@ void RasterizerCanvasGLES3::canvas_begin(){ glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); glClear(GL_COLOR_BUFFER_BIT); storage->frame.clear_request=false; + print_line("canvas clear?"); } diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index eaa9825605..83c40edc1d 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -15,7 +15,7 @@ RasterizerCanvas *RasterizerGLES3::get_canvas() { RasterizerScene *RasterizerGLES3::get_scene() { - return NULL; + return scene; } @@ -111,6 +111,7 @@ void RasterizerGLES3::initialize() { */ storage->initialize(); canvas->initialize(); + scene->initialize(); } void RasterizerGLES3::begin_frame(){ @@ -124,6 +125,7 @@ void RasterizerGLES3::begin_frame(){ storage->update_dirty_shaders(); storage->update_dirty_materials(); + } void RasterizerGLES3::set_current_render_target(RID p_render_target){ @@ -131,6 +133,7 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target){ if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) { //handle pending clear request, if the framebuffer was not cleared glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + print_line("unbind clear of: "+storage->frame.clear_request_color); glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, @@ -265,8 +268,12 @@ RasterizerGLES3::RasterizerGLES3() storage = memnew( RasterizerStorageGLES3 ); canvas = memnew( RasterizerCanvasGLES3 ); + scene = memnew( RasterizerSceneGLES3 ); canvas->storage=storage; storage->canvas=canvas; + scene->storage=storage; + storage->scene=scene; + } diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index d461664ea2..f70dac506d 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -4,6 +4,7 @@ #include "servers/visual/rasterizer.h" #include "rasterizer_storage_gles3.h" #include "rasterizer_canvas_gles3.h" +#include "rasterizer_scene_gles3.h" class RasterizerGLES3 : public Rasterizer { @@ -12,6 +13,8 @@ class RasterizerGLES3 : public Rasterizer { RasterizerStorageGLES3 *storage; RasterizerCanvasGLES3 *canvas; + RasterizerSceneGLES3 *scene; + public: virtual RasterizerStorage *get_storage(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp new file mode 100644 index 0000000000..121620594d --- /dev/null +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -0,0 +1,808 @@ +#include "rasterizer_scene_gles3.h" +#include "globals.h" +static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { + + p_array[ 0]=p_mtx.elements[0][0]; + p_array[ 1]=p_mtx.elements[0][1]; + p_array[ 2]=0; + p_array[ 3]=0; + p_array[ 4]=p_mtx.elements[1][0]; + p_array[ 5]=p_mtx.elements[1][1]; + p_array[ 6]=0; + p_array[ 7]=0; + p_array[ 8]=0; + p_array[ 9]=0; + p_array[10]=1; + p_array[11]=0; + p_array[12]=p_mtx.elements[2][0]; + p_array[13]=p_mtx.elements[2][1]; + p_array[14]=0; + p_array[15]=1; +} + + +static _FORCE_INLINE_ void store_transform(const Transform& p_mtx, float* p_array) { + p_array[ 0]=p_mtx.basis.elements[0][0]; + p_array[ 1]=p_mtx.basis.elements[1][0]; + p_array[ 2]=p_mtx.basis.elements[2][0]; + p_array[ 3]=0; + p_array[ 4]=p_mtx.basis.elements[0][1]; + p_array[ 5]=p_mtx.basis.elements[1][1]; + p_array[ 6]=p_mtx.basis.elements[2][1]; + p_array[ 7]=0; + p_array[ 8]=p_mtx.basis.elements[0][2]; + p_array[ 9]=p_mtx.basis.elements[1][2]; + p_array[10]=p_mtx.basis.elements[2][2]; + p_array[11]=0; + p_array[12]=p_mtx.origin.x; + p_array[13]=p_mtx.origin.y; + p_array[14]=p_mtx.origin.z; + p_array[15]=1; +} + +static _FORCE_INLINE_ void store_camera(const CameraMatrix& p_mtx, float* p_array) { + + for (int i=0;i<4;i++) { + for (int j=0;j<4;j++) { + + p_array[i*4+j]=p_mtx.matrix[i][j]; + } + } +} + + + +RID RasterizerSceneGLES3::light_instance_create(RID p_light) { + + + return RID(); +} + +void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance,const Transform& p_transform){ + + +} + + +bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_material,bool p_alpha_pass) { + + if (p_material->shader->spatial.cull_mode==RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_DISABLED) { + glDisable(GL_CULL_FACE); + } else { + glEnable(GL_CULL_FACE); + } + + //glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + + /* + if (p_material->flags[VS::MATERIAL_FLAG_WIREFRAME]) + glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + else + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + */ + + //if (p_material->line_width) + // glLineWidth(p_material->line_width); + + + //blend mode + if (state.current_blend_mode!=p_material->shader->spatial.blend_mode) { + + switch(p_material->shader->spatial.blend_mode) { + + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: { + + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE); + + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: { + + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + } break; + } + + state.current_blend_mode=p_material->shader->spatial.blend_mode; + + } + + //material parameters + + state.scene_shader.set_custom_shader(p_material->shader->custom_code_id); + bool rebind = state.scene_shader.bind(); + + + if (p_material->ubo_id) { + glBindBufferBase(GL_UNIFORM_BUFFER,1,p_material->ubo_id); + } + + + + int tc = p_material->textures.size(); + RID* textures = p_material->textures.ptr(); + + for(int i=0;itexture_owner.getornull( textures[i] ); + if (!t) { + //check hints + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + continue; + } + + glBindTexture(t->target,t->tex_id); + } + + + return rebind; + +} + + +void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { + + switch(e->instance->base_type) { + + case VS::INSTANCE_MESH: { + + RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); + glBindVertexArray(s->array_id); // everything is so easy nowadays + } break; + } + +} + +static const GLenum gl_primitive[]={ + GL_POINTS, + GL_LINES, + GL_LINE_STRIP, + GL_LINE_LOOP, + GL_TRIANGLES, + GL_TRIANGLE_STRIP, + GL_TRIANGLE_FAN +}; + + + +void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { + + switch(e->instance->base_type) { + + case VS::INSTANCE_MESH: { + + RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); + + if (s->index_array_len>0) { + + glDrawElements(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0); + + } else { + + glDrawArrays(gl_primitive[s->primitive],0,s->array_len); + + } + + } break; + } + +} + +void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,bool p_reverse_cull,bool p_alpha_pass) { + + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { + //p_reverse_cull=!p_reverse_cull; + glFrontFace(GL_CCW); + } else { + glFrontFace(GL_CW); + } + + glBindBufferBase(GL_UNIFORM_BUFFER,0,state.scene_ubo); //bind globals ubo + + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); + + state.current_blend_mode=-1; + + glDisable(GL_BLEND); + + RasterizerStorageGLES3::Material* prev_material=NULL; + RasterizerStorageGLES3::Geometry* prev_geometry=NULL; + VS::InstanceType prev_base_type = VS::INSTANCE_MAX; + + for (int i=0;imaterial; + + bool rebind=i==0; + + if (material!=prev_material || rebind) { + + rebind = _setup_material(material,p_alpha_pass); +// _rinfo.mat_change_count++; + } + + + if (prev_base_type != e->instance->base_type || prev_geometry!=e->geometry) { + + _setup_geometry(e); + } + +// _set_cull(e->mirror,p_reverse_cull); + + state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror?-1.0:1.0); + state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, e->instance->transform); + + +// _render(e->geometry, material, skeleton,e->owner,e->instance->transform); + + _render_geometry(e); + + prev_material=material; + prev_base_type=e->instance->base_type; + prev_geometry=e->geometry; + } + + //print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count)); + + + glFrontFace(GL_CW); + glBindVertexArray(0); + +} + +void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material) { + + RasterizerStorageGLES3::Material *m=NULL; + RID m_src=p_instance->material_override.is_valid() ? p_instance->material_override :(p_material>=0?p_instance->materials[p_material]:p_geometry->material); + +/* +#ifdef DEBUG_ENABLED + if (current_debug==VS::SCENARIO_DEBUG_OVERDRAW) { + m_src=overdraw_material; + } + +#endif +*/ + if (m_src.is_valid()) { + m=storage->material_owner.getornull( m_src ); + if (!m->shader) { + m=NULL; + } + } + + if (!m) { + m=storage->material_owner.getptr( default_material ); + } + + ERR_FAIL_COND(!m); + + + + //bool has_base_alpha=(m->shader_cache && m->shader_cache->has_alpha); + //bool has_blend_alpha=m->blend_mode!=VS::MATERIAL_BLEND_MODE_MIX || m->flags[VS::MATERIAL_FLAG_ONTOP]; + bool has_alpha = false; //has_base_alpha || has_blend_alpha; + +#if 0 + if (shadow) { + + if (has_blend_alpha || (has_base_alpha && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) + return; //bye + + if (!m->shader_cache || (!m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) { + //shader does not use discard and does not write a vertex position, use generic material + if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) + m = shadow_mat_double_sided_ptr; + else + m = shadow_mat_ptr; + if (m->last_pass!=frame) { + + if (m->shader.is_valid()) { + + m->shader_cache=shader_owner.get(m->shader); + if (m->shader_cache) { + + + if (!m->shader_cache->valid) + m->shader_cache=NULL; + } else { + m->shader=RID(); + } + + } else { + m->shader_cache=NULL; + } + + m->last_pass=frame; + } + } + + render_list = &opaque_render_list; + /* notyet + if (!m->shader_cache || m->shader_cache->can_zpass) + render_list = &alpha_render_list; + } else { + render_list = &opaque_render_list; + }*/ + + } else { + if (has_alpha) { + render_list = &alpha_render_list; + } else { + render_list = &opaque_render_list; + + } + } +#endif + + RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element(); + + if (!e) + return; + + e->geometry=p_geometry; + e->material=m; + e->instance=p_instance; + e->owner=p_owner; + e->additive=false; + e->additive_ptr=&e->additive; + e->sort_key=0; + + if (e->geometry->last_pass!=render_pass) { + e->geometry->last_pass=render_pass; + e->geometry->index=current_geometry_index++; + } + + e->sort_key|=uint64_t(e->instance->base_type)<sort_key|=uint64_t(e->instance->base_type)<material->last_pass!=render_pass) { + e->material->last_pass=render_pass; + e->material->index=current_material_index++; + } + + e->sort_key|=uint64_t(e->material->index)<sort_key|=uint64_t(e->instance->depth_layer)<geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) + // e->sort_flags|=RenderList::SORT_FLAG_INSTANCING; + + bool mirror = e->instance->mirror; + +// if (m->flags[VS::MATERIAL_FLAG_INVERT_FACES]) +// e->mirror=!e->mirror; + + if (mirror) { + e->sort_key|=RenderList::SORT_KEY_MIRROR_FLAG; + } + + //e->light_type=0xFF; // no lights! + e->sort_key|=uint64_t(0xF)<sort_key|=uint64_t(0xFFFF)<depth_draw_mode==VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA) { + + //if nothing exists, add this element as opaque too + RenderList::Element *oe = opaque_render_list.add_element(); + + if (!oe) + return; + + memcpy(oe,e,sizeof(RenderList::Element)); + oe->additive_ptr=&oe->additive; + } +*/ + +#if 0 + if (shadow || m->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug==VS::SCENARIO_DEBUG_SHADELESS) { + + e->light_type=0x7F; //unshaded is zero + } else { + + bool duplicate=false; + + + for(int i=0;isort_key; + uint8_t light_type = VS::LIGHT_DIRECTIONAL; + if (directional_lights[i]->base->shadow_enabled) { + light_type|=0x8; + if (directional_lights[i]->base->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) + light_type|=0x10; + else if (directional_lights[i]->base->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) + light_type|=0x30; + + } + + RenderList::Element *ec; + if (duplicate) { + + ec = render_list->add_element(); + memcpy(ec,e,sizeof(RenderList::Element)); + } else { + + ec=e; + duplicate=true; + } + + ec->light_type=light_type; + ec->light=sort_key; + ec->additive_ptr=&e->additive; + + } + + + const RID *liptr = p_instance->light_instances.ptr(); + int ilc=p_instance->light_instances.size(); + + + + for(int i=0;ilast_pass!=scene_pass) //lit by light not in visible scene + continue; + uint8_t light_type=li->base->type|0x40; //penalty to ensure directionals always go first + if (li->base->shadow_enabled) { + light_type|=0x8; + } + uint16_t sort_key =li->sort_key; + + RenderList::Element *ec; + if (duplicate) { + + ec = render_list->add_element(); + memcpy(ec,e,sizeof(RenderList::Element)); + } else { + + duplicate=true; + ec=e; + } + + ec->light_type=light_type; + ec->light=sort_key; + ec->additive_ptr=&e->additive; + + } + + + + } + +#endif +} + +void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment){ + + + //fill up ubo + + store_camera(p_cam_projection,state.ubo_data.projection_matrix); + store_transform(p_cam_transform,state.ubo_data.camera_matrix); + store_transform(p_cam_transform.affine_inverse(),state.ubo_data.camera_inverse_matrix); + for(int i=0;i<4;i++) { + state.ubo_data.time[i]=storage->frame.time[i]; + } + + + glBindBuffer(GL_UNIFORM_BUFFER, state.scene_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0,sizeof(State::SceneDataUBO), &state.ubo_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + + render_list.clear(); + + render_pass++; + current_material_index=0; + + //fill list + + for(int i=0;ibase_type) { + + case VS::INSTANCE_MESH: { + + RasterizerStorageGLES3::Mesh *mesh = storage->mesh_owner.getptr(inst->base); + ERR_CONTINUE(!mesh); + + int ssize = mesh->surfaces.size(); + + for (int i=0;imaterials[i].is_valid() ? i : -1; + RasterizerStorageGLES3::Surface *s = mesh->surfaces[i]; + _add_geometry(s,inst,NULL,mat_idx); + } + + //mesh->last_pass=frame; + + } break; + case VS::INSTANCE_MULTIMESH: { + + } break; + case VS::INSTANCE_IMMEDIATE: { + + } break; + + } + } + + // + + + glEnable(GL_BLEND); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glClearDepth(1.0); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + + + if (true) { + + if (storage->frame.clear_request) { + + glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + storage->frame.clear_request=false; + + } + } + + state.current_depth_test=true; + state.current_depth_mask=true; + state.texscreen_copied=false; + + glBlendEquation(GL_FUNC_ADD); + + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + glDisable(GL_BLEND); + //current_blend_mode=VS::MATERIAL_BLEND_MODE_MIX; + + + render_list.sort_by_key(false); + + //_render_list_forward(&opaque_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting); +/* + if (draw_tex_background) { + + //most 3D vendors recommend drawing a texture bg or skybox here, + //after opaque geometry has been drawn + //so the zbuffer can get rid of most pixels + _draw_tex_bg(); + } +*/ + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + +// glDisable(GL_BLEND); +// current_blend_mode=VS::MATERIAL_BLEND_MODE_MIX; +// state.scene_shader.set_conditional(SceneShaderGLES3::USE_GLOW,false); +// if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) { +// glColorMask(1,1,1,0); //don't touch alpha +// } + + + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,false,false); + + //_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); + //glColorMask(1,1,1,1); + +// state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false); + + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); +#if 0 + if (use_fb) { + + + + for(int i=0;ifx_enabled[VS::ENV_FX_HDR]) { + + int hdr_tm = current_env->fx_param[VS::ENV_FX_PARAM_HDR_TONEMAPPER]; + switch(hdr_tm) { + case VS::ENV_FX_HDR_TONE_MAPPER_LINEAR: { + + + } break; + case VS::ENV_FX_HDR_TONE_MAPPER_LOG: { + copy_shader.set_conditional(CopyShaderGLES2::USE_LOG_TONEMAPPER,true); + + } break; + case VS::ENV_FX_HDR_TONE_MAPPER_REINHARDT: { + copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,true); + } break; + case VS::ENV_FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE: { + + copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,true); + copy_shader.set_conditional(CopyShaderGLES2::USE_AUTOWHITE,true); + } break; + } + + + _process_hdr(); + } + if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) { + _process_glow_bloom(); + int glow_transfer_mode=current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE]; + if (glow_transfer_mode==1) + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SCREEN,true); + if (glow_transfer_mode==2) + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SOFTLIGHT,true); + } + + glBindFramebuffer(GL_FRAMEBUFFER, current_rt?current_rt->fbo:base_framebuffer); + + Size2 size; + if (current_rt) { + glBindFramebuffer(GL_FRAMEBUFFER, current_rt->fbo); + glViewport( 0,0,viewport.width,viewport.height); + size=Size2(viewport.width,viewport.height); + } else { + glBindFramebuffer(GL_FRAMEBUFFER, base_framebuffer); + glViewport( viewport.x, window_size.height-(viewport.height+viewport.y), viewport.width,viewport.height ); + size=Size2(viewport.width,viewport.height); + } + + //time to copy!!! + copy_shader.set_conditional(CopyShaderGLES2::USE_BCS,current_env && current_env->fx_enabled[VS::ENV_FX_BCS]); + copy_shader.set_conditional(CopyShaderGLES2::USE_SRGB,current_env && current_env->fx_enabled[VS::ENV_FX_SRGB]); + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]); + copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,current_env && current_env->fx_enabled[VS::ENV_FX_HDR]); + copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,true); + copy_shader.set_conditional(CopyShaderGLES2::USE_FXAA,current_env && current_env->fx_enabled[VS::ENV_FX_FXAA]); + + copy_shader.bind(); + //copy_shader.set_uniform(CopyShaderGLES2::SOURCE,0); + + if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) { + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, framebuffer.blur[0].color ); + glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::GLOW_SOURCE),1); + + } + + if (current_env && current_env->fx_enabled[VS::ENV_FX_HDR]) { + + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, current_vd->lum_color ); + glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::HDR_SOURCE),2); + copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE])); + copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE])); + + } + + if (current_env && current_env->fx_enabled[VS::ENV_FX_FXAA]) + copy_shader.set_uniform(CopyShaderGLES2::PIXEL_SIZE,Size2(1.0/size.x,1.0/size.y)); + + + if (current_env && current_env->fx_enabled[VS::ENV_FX_BCS]) { + + Vector3 bcs; + bcs.x=current_env->fx_param[VS::ENV_FX_PARAM_BCS_BRIGHTNESS]; + bcs.y=current_env->fx_param[VS::ENV_FX_PARAM_BCS_CONTRAST]; + bcs.z=current_env->fx_param[VS::ENV_FX_PARAM_BCS_SATURATION]; + copy_shader.set_uniform(CopyShaderGLES2::BCS,bcs); + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, framebuffer.color ); + glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE),0); + + _copy_screen_quad(); + + copy_shader.set_conditional(CopyShaderGLES2::USE_BCS,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_SRGB,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_FXAA,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SCREEN,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW_SOFTLIGHT,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_REINHARDT_TONEMAPPER,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_AUTOWHITE,false); + copy_shader.set_conditional(CopyShaderGLES2::USE_LOG_TONEMAPPER,false); + + state.scene_shader.set_conditional(SceneShaderGLES3::USE_8BIT_HDR,false); + + + if (current_env && current_env->fx_enabled[VS::ENV_FX_HDR] && GLOBAL_DEF("rasterizer/debug_hdr",false)) { + _debug_luminances(); + } + } + + current_env=NULL; + current_debug=VS::SCENARIO_DEBUG_DISABLED; + if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) { + _debug_shadows(); + } +// _debug_luminances(); +// _debug_samplers(); + + if (using_canvas_bg) { + using_canvas_bg=false; + glColorMask(1,1,1,1); //don't touch alpha + } +#endif +} + +bool RasterizerSceneGLES3::free(RID p_rid) { + + return false; + +} + +void RasterizerSceneGLES3::initialize() { + + state.scene_shader.init(); + + default_shader = storage->shader_create(VS::SHADER_SPATIAL); + default_material = storage->material_create(); + storage->material_set_shader(default_material,default_shader); + + glGenBuffers(1, &state.scene_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.scene_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(State::SceneDataUBO), &state.scene_ubo, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + render_list.max_elements=GLOBAL_DEF("rendering/gles3/max_renderable_elements",(int)RenderList::DEFAULT_MAX_ELEMENTS); + if (render_list.max_elements>1000000) + render_list.max_elements=1000000; + if (render_list.max_elements<1024) + render_list.max_elements=1024; + + render_list.init(); +} + +void RasterizerSceneGLES3::finalize(){ + + +} + + +RasterizerSceneGLES3::RasterizerSceneGLES3() +{ + +} diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h new file mode 100644 index 0000000000..6fba777fc8 --- /dev/null +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -0,0 +1,178 @@ +#ifndef RASTERIZERSCENEGLES3_H +#define RASTERIZERSCENEGLES3_H + +#include "rasterizer_storage_gles3.h" +#include "drivers/gles3/shaders/scene.glsl.h" + +class RasterizerSceneGLES3 : public RasterizerScene { +public: + + uint64_t render_pass; + uint32_t current_material_index; + uint32_t current_geometry_index; + + RID default_material; + RID default_shader; + + RasterizerStorageGLES3 *storage; + + + + struct State { + + bool current_depth_test; + bool current_depth_mask; + bool texscreen_copied; + int current_blend_mode; + + SceneShaderGLES3 scene_shader; + + + struct SceneDataUBO { + + float projection_matrix[16]; + float camera_inverse_matrix[16]; + float camera_matrix[16]; + float time[4]; + float ambient_light[4]; + + } ubo_data; + + GLuint scene_ubo; + + + + } state; + + struct RenderList { + + enum { + DEFAULT_MAX_ELEMENTS=65536, + MAX_LIGHTS=4, + SORT_FLAG_SKELETON=1, + SORT_FLAG_INSTANCING=2, + + SORT_KEY_DEPTH_LAYER_SHIFT=58, + SORT_KEY_LIGHT_TYPE_SHIFT=54, //type is most important + SORT_KEY_LIGHT_INDEX_SHIFT=38, //type is most important + SORT_KEY_MATERIAL_INDEX_SHIFT=22, + SORT_KEY_GEOMETRY_INDEX_SHIFT=6, + SORT_KEY_GEOMETRY_TYPE_SHIFT=2, + SORT_KEY_SKELETON_FLAG=2, + SORT_KEY_MIRROR_FLAG=1 + + }; + + int max_elements; + + struct Element { + + RasterizerScene::InstanceBase *instance; + RasterizerStorageGLES3::Geometry *geometry; + RasterizerStorageGLES3::Material *material; + RasterizerStorageGLES3::GeometryOwner *owner; + uint64_t sort_key; + bool *additive_ptr; + bool additive; + + }; + + + Element *_elements; + Element **elements; + + int element_count; + int alpha_element_count; + + void clear() { + + element_count=0; + alpha_element_count=0; + } + + //should eventually be replaced by radix + + struct SortByKey { + + _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const { + return A->sort_key < B->sort_key; + } + }; + + void sort_by_key(bool p_alpha) { + + SortArray sorter; + if (p_alpha) { + sorter.sort(&elements[max_elements-alpha_element_count-1],alpha_element_count); + } else { + sorter.sort(elements,element_count); + } + } + + + _FORCE_INLINE_ Element* add_element() { + + if (element_count+alpha_element_count>=max_elements) + return NULL; + elements[element_count]=&_elements[element_count]; + return elements[element_count++]; + } + + _FORCE_INLINE_ Element* add_alpha_element() { + + if (element_count+alpha_element_count>=max_elements) + return NULL; + int idx = max_elements-alpha_element_count-1; + elements[idx]=&_elements[idx]; + alpha_element_count++; + return elements[idx]; + } + + void init() { + + element_count = 0; + alpha_element_count =0; + elements=memnew_arr(Element*,max_elements); + _elements=memnew_arr(Element,max_elements); + for (int i=0;istate.canvas_shader, - &canvas->state.canvas_shader, + &scene->state.scene_shader, &canvas->state.canvas_shader, }; @@ -1108,6 +1109,37 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { actions->uniforms=&p_shader->uniforms; } break; + + case VS::SHADER_SPATIAL: { + + p_shader->spatial.blend_mode=Shader::Spatial::BLEND_MODE_MIX; + p_shader->spatial.depth_draw_mode=Shader::Spatial::DEPTH_DRAW_OPAQUE; + p_shader->spatial.cull_mode=Shader::Spatial::CULL_MODE_BACK; + p_shader->spatial.uses_alpha=false; + p_shader->spatial.unshaded=false; + p_shader->spatial.ontop=false; + + shaders.actions_scene.render_mode_values["blend_add"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_ADD); + shaders.actions_scene.render_mode_values["blend_mix"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_MIX); + shaders.actions_scene.render_mode_values["blend_sub"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_SUB); + shaders.actions_scene.render_mode_values["blend_mul"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_MUL); + + shaders.actions_scene.render_mode_values["depth_draw_opaque"]=Pair(&p_shader->spatial.depth_draw_mode,Shader::Spatial::DEPTH_DRAW_OPAQUE); + shaders.actions_scene.render_mode_values["depth_draw_always"]=Pair(&p_shader->spatial.depth_draw_mode,Shader::Spatial::DEPTH_DRAW_ALWAYS); + shaders.actions_scene.render_mode_values["depth_draw_never"]=Pair(&p_shader->spatial.depth_draw_mode,Shader::Spatial::DEPTH_DRAW_NEVER); + shaders.actions_scene.render_mode_values["depth_draw_alpha_prepass"]=Pair(&p_shader->spatial.depth_draw_mode,Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS); + + shaders.actions_scene.render_mode_values["cull_front"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_FRONT); + shaders.actions_scene.render_mode_values["cull_back"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_BACK); + shaders.actions_scene.render_mode_values["cull_disable"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_DISABLED); + + shaders.actions_canvas.render_mode_flags["unshaded"]=&p_shader->spatial.unshaded; + shaders.actions_canvas.render_mode_flags["ontop"]=&p_shader->spatial.ontop; + + shaders.actions_canvas.usage_flag_pointers["ALPHA"]=&p_shader->spatial.uses_alpha; + + } + } @@ -1905,97 +1937,685 @@ void RasterizerStorageGLES3::update_dirty_materials() { RID RasterizerStorageGLES3::mesh_create(){ - return RID(); + Mesh * mesh = memnew( Mesh ); + + return mesh_owner.make_rid(mesh); } -void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes){ +void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes,const Vector& p_bone_aabbs){ + + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + + ERR_FAIL_COND(!(p_format&VS::ARRAY_FORMAT_VERTEX)); + + //must have index and bones, both. + { + uint32_t bones_weight = VS::ARRAY_FORMAT_BONES|VS::ARRAY_FORMAT_WEIGHTS; + ERR_EXPLAIN("Array must have both bones and weights in format or none."); + ERR_FAIL_COND( (p_format&bones_weight) && (p_format&bones_weight)!=bones_weight ); + } + + + bool has_morph = p_blend_shapes.size(); + + Surface::Attrib attribs[VS::ARRAY_MAX],morph_attribs[VS::ARRAY_MAX]; + + int stride=0; + int morph_stride=0; + + for(int i=0;i=(1<<16)) { + attribs[i].type=GL_UNSIGNED_INT; + attribs[i].stride=4; + } else { + attribs[i].type=GL_UNSIGNED_SHORT; + attribs[i].stride=2; + } + + attribs[i].normalized=GL_FALSE; + + } break; + + } + } + + for(int i=0;imorph_target_count); + + for(int i=0;iactive=true; + surface->array_len=p_vertex_count; + surface->index_array_len=p_index_count; + surface->primitive=p_primitive; + surface->mesh=mesh; + surface->format=p_format; + surface->skeleton_bone_aabb=p_bone_aabbs; + surface->skeleton_bone_used.resize(surface->skeleton_bone_aabb.size()); + surface->aabb=p_aabb; + surface->max_bone=p_bone_aabbs.size(); + + for(int i=0;iskeleton_bone_used.size();i++) { + if (surface->skeleton_bone_aabb[i].size.x<0 || surface->skeleton_bone_aabb[i].size.y<0 || surface->skeleton_bone_aabb[i].size.z<0) { + surface->skeleton_bone_used[i]=false; + } else { + surface->skeleton_bone_used[i]=true; + } + } + + for(int i=0;iattribs[i]=attribs[i]; + surface->morph_attribs[i]=morph_attribs[i]; + } + + { + + DVector::Read vr = p_array.read(); + + glGenBuffers(1,&surface->vertex_id); + glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); + glBufferData(GL_ARRAY_BUFFER,array_size,vr.ptr(),GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + + if (p_format&VS::ARRAY_FORMAT_INDEX) { + + DVector::Read ir = p_index_array.read(); + + glGenBuffers(1,&surface->index_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); + glBufferData(GL_ELEMENT_ARRAY_BUFFER,index_array_size,ir.ptr(),GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); //unbind + } + //generate arrays for faster state switching + + glGenVertexArrays(1,&surface->array_id); + glBindVertexArray(surface->array_id); + glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); + + for(int i=0;iindex_id) { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); + } + + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + } + + { + + //blend shapes + + for(int i=0;i::Read vr = p_blend_shapes[i].read(); + + glGenBuffers(1,&mt.vertex_id); + glBindBuffer(GL_ARRAY_BUFFER,mt.vertex_id); + glBufferData(GL_ARRAY_BUFFER,array_size,vr.ptr(),GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + glGenVertexArrays(1,&mt.array_id); + glBindVertexArray(mt.array_id); + glBindBuffer(GL_ARRAY_BUFFER,mt.vertex_id); + + for(int i=0;imorph_targets.push_back(mt); + + } + } + + mesh->surfaces.push_back(surface); + mesh->instance_change_notify(); } void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount){ + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + + + ERR_FAIL_COND(mesh->surfaces.size()!=0); + ERR_FAIL_COND(p_amount<0); + + mesh->morph_target_count=p_amount; } int RasterizerStorageGLES3::mesh_get_morph_target_count(RID p_mesh) const{ - return 0; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,0); + + return mesh->morph_target_count; } void RasterizerStorageGLES3::mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode){ + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + + mesh->morph_target_mode=p_mode; } VS::MorphTargetMode RasterizerStorageGLES3::mesh_get_morph_target_mode(RID p_mesh) const{ - return VS::MORPH_MODE_NORMALIZED; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,VS::MORPH_MODE_NORMALIZED); + + return mesh->morph_target_mode; } void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + ERR_FAIL_INDEX(p_surface,mesh->surfaces.size()); + + mesh->surfaces[p_surface]->material=p_material; } RID RasterizerStorageGLES3::mesh_surface_get_material(RID p_mesh, int p_surface) const{ - return RID(); + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,RID()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),RID()); + + return mesh->surfaces[p_surface]->material; } int RasterizerStorageGLES3::mesh_surface_get_array_len(RID p_mesh, int p_surface) const{ - return 0; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,0); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),0); + + return mesh->surfaces[p_surface]->array_len; + } int RasterizerStorageGLES3::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const{ + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,0); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),0); - return 0; + return mesh->surfaces[p_surface]->index_array_len; } DVector RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int p_surface) const{ - return DVector(); + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,DVector()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),DVector()); + + Surface *surface = mesh->surfaces[p_surface]; + + glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); + void * data = glMapBufferRange(GL_ARRAY_BUFFER,0,surface->array_len,GL_MAP_READ_BIT); + + ERR_FAIL_COND_V(!data,DVector()); + + DVector ret; + ret.resize(surface->array_len); + + { + + DVector::Write w = ret.write(); + copymem(w.ptr(),data,surface->array_len); + } + glUnmapBuffer(GL_ARRAY_BUFFER); + + + return ret; } -DVector RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_mesh, int p_surface) const{ +DVector RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_mesh, int p_surface) const { + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,DVector()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),DVector()); + + Surface *surface = mesh->surfaces[p_surface]; + + ERR_FAIL_COND_V(surface->index_array_len==0,DVector()); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->vertex_id); + void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,surface->index_array_len,GL_MAP_READ_BIT); + + ERR_FAIL_COND_V(!data,DVector()); + + DVector ret; + ret.resize(surface->index_array_len); + + { + + DVector::Write w = ret.write(); + copymem(w.ptr(),data,surface->index_array_len); + } + + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - return DVector(); + return ret; } uint32_t RasterizerStorageGLES3::mesh_surface_get_format(RID p_mesh, int p_surface) const{ - return 0; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + + ERR_FAIL_COND_V(!mesh,0); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),0); + + return mesh->surfaces[p_surface]->format; + } + VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const{ - return VS::PRIMITIVE_MAX; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,VS::PRIMITIVE_MAX); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),VS::PRIMITIVE_MAX); + + return mesh->surfaces[p_surface]->primitive; } -void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh,int p_index){ +void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ + + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + ERR_FAIL_INDEX(p_surface,mesh->surfaces.size()); + Surface *surface = mesh->surfaces[p_surface]; + ERR_FAIL_COND(surface->index_array_len==0); + + glDeleteBuffers(1,&surface->array_id); + if (surface->index_id) { + glDeleteBuffers(1,&surface->index_id); + } + + glDeleteVertexArrays(1,&surface->array_id); + + for(int i=0;imorph_targets.size();i++) { + + glDeleteBuffers(1,&surface->morph_targets[i].vertex_id); + glDeleteVertexArrays(1,&surface->morph_targets[i].array_id); + } + + memdelete(surface); + + mesh->surfaces.remove(p_surface); + + mesh->instance_change_notify(); } int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const{ - return 0; + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,0); + return mesh->surfaces.size(); + } void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb){ + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + mesh->custom_aabb=p_aabb; } AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const{ - return AABB(); + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,AABB()); + + return mesh->custom_aabb; + } -AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh) const{ +AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ + + Mesh *mesh = mesh_owner.get( p_mesh ); + ERR_FAIL_COND_V(!mesh,AABB()); + + if (mesh->custom_aabb!=AABB()) + return mesh->custom_aabb; +/* + Skeleton *sk=NULL; + if (p_skeleton.is_valid()) + sk=skeleton_owner.get(p_skeleton); +*/ + AABB aabb; + /* + if (sk && sk->bones.size()!=0) { + + + for (int i=0;isurfaces.size();i++) { + + AABB laabb; + if (mesh->surfaces[i]->format&VS::ARRAY_FORMAT_BONES && mesh->surfaces[i]->skeleton_bone_aabb.size()) { + + + int bs = mesh->surfaces[i]->skeleton_bone_aabb.size(); + const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); + const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr(); + + int sbs = sk->bones.size(); + ERR_CONTINUE(bs>sbs); + Skeleton::Bone *skb = sk->bones.ptr(); + + bool first=true; + for(int j=0;jsurfaces[i]->aabb; + } + + if (i==0) + aabb=laabb; + else + aabb.merge_with(laabb); + } + } else { +*/ + for (int i=0;isurfaces.size();i++) { + + if (i==0) + aabb=mesh->surfaces[i]->aabb; + else + aabb.merge_with(mesh->surfaces[i]->aabb); + } +/* + } +*/ + return aabb; - return AABB(); } void RasterizerStorageGLES3::mesh_clear(RID p_mesh){ + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + while(mesh->surfaces.size()) { + mesh_remove_surface(p_mesh,0); + } } /* MULTIMESH API */ @@ -2206,6 +2826,16 @@ void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light,VS::L } +VS::LightType RasterizerStorageGLES3::light_get_type(RID p_light) const { + + return VS::LIGHT_DIRECTIONAL; +} + +AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { + + return AABB(); +} + /* PROBE API */ RID RasterizerStorageGLES3::reflection_probe_create(){ @@ -2292,6 +2922,42 @@ void RasterizerStorageGLES3::portal_set_disabled_color(RID p_portal, const Color } +void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance) { + + Instantiable *inst=NULL; + switch(p_instance->base_type) { + case VS::INSTANCE_MESH: { + inst = mesh_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; + default: { + ERR_FAIL(); + } + } + + inst->instance_list.add( &p_instance->dependency_item ); +} + +void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance){ + + Instantiable *inst=NULL; + + switch(p_instance->base_type) { + case VS::INSTANCE_MESH: { + inst = mesh_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + + } break; + default: { + ERR_FAIL(); + } + } + + ERR_FAIL_COND(!inst); + + inst->instance_list.remove( &p_instance->dependency_item ); +} + /* RENDER TARGET */ @@ -2773,6 +3439,15 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, } +VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { + + if (mesh_owner.owns(p_rid)) { + return VS::INSTANCE_MESH; + } + + return VS::INSTANCE_NONE; +} + bool RasterizerStorageGLES3::free(RID p_rid){ if (render_target_owner.owns(p_rid)) { @@ -2834,6 +3509,15 @@ bool RasterizerStorageGLES3::free(RID p_rid){ material_owner.free(p_rid); memdelete(material); + } else if (mesh_owner.owns(p_rid)) { + + // delete the texture + Mesh *mesh = mesh_owner.get(p_rid); + + mesh_clear(p_rid); + + mesh_owner.free(p_rid); + memdelete(mesh); } else if (canvas_occluder_owner.owns(p_rid)) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b7b3e607c6..950d65b9d0 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -10,12 +10,14 @@ #include "shader_compiler_gles3.h" class RasterizerCanvasGLES3; +class RasterizerSceneGLES3; class RasterizerStorageGLES3 : public RasterizerStorage { public: RasterizerCanvasGLES3 *canvas; + RasterizerSceneGLES3 *scene; enum FBOFormat { FBO_FORMAT_16_BITS, @@ -59,6 +61,7 @@ public: ShaderCompilerGLES3 compiler; ShaderCompilerGLES3::IdentifierActions actions_canvas; + ShaderCompilerGLES3::IdentifierActions actions_scene; } shaders; struct Resources { @@ -230,6 +233,40 @@ public: } canvas_item; + struct Spatial { + + enum BlendMode { + BLEND_MODE_MIX, + BLEND_MODE_ADD, + BLEND_MODE_SUB, + BLEND_MODE_MUL, + }; + + int blend_mode; + + enum DepthDrawMode { + DEPTH_DRAW_OPAQUE, + DEPTH_DRAW_ALWAYS, + DEPTH_DRAW_NEVER, + DEPTH_DRAW_ALPHA_PREPASS, + }; + + int depth_draw_mode; + + enum CullMode { + CULL_MODE_FRONT, + CULL_MODE_BACK, + CULL_MODE_DISABLED, + }; + + int cull_mode; + + bool uses_alpha; + bool unshaded; + bool ontop; + + } spatial; + Shader() : dirty_list(this) { shader=NULL; @@ -272,10 +309,14 @@ public: SelfList dirty_list; Vector textures; + uint32_t index; + uint64_t last_pass; + Material() : list(this), dirty_list(this) { shader=NULL; ubo_id=0; ubo_size=0; + last_pass=0; } }; @@ -300,9 +341,155 @@ public: /* MESH API */ + struct Instantiable : public RID_Data { + + enum Type { + GEOMETRY_INVALID, + GEOMETRY_SURFACE, + GEOMETRY_IMMEDIATE, + GEOMETRY_MULTISURFACE, + }; + + SelfList::List instance_list; + + _FORCE_INLINE_ void instance_change_notify() { + + SelfList *instances = instance_list.first(); + while(instances) { + + instances->self()->base_changed(); + instances=instances->next(); + } + } + + Instantiable() { } + virtual ~Instantiable() { + + while(instance_list.first()) { + instance_list.first()->self()->base_removed(); + } + } + }; + + struct Geometry : Instantiable { + + enum Type { + GEOMETRY_INVALID, + GEOMETRY_SURFACE, + GEOMETRY_IMMEDIATE, + GEOMETRY_MULTISURFACE, + }; + + Type type; + RID material; + uint64_t last_pass; + uint32_t index; + + Geometry() { + last_pass=0; + index=0; + } + + }; + + struct GeometryOwner : public Instantiable { + + virtual ~GeometryOwner() {} + }; + + struct Mesh; + struct Surface : public Geometry { + + struct Attrib { + + bool enabled; + GLuint index; + GLint size; + GLenum type; + GLboolean normalized; + GLsizei stride; + uint32_t offset; + }; + + Attrib attribs[VS::ARRAY_MAX]; + Attrib morph_attribs[VS::ARRAY_MAX]; + + + Mesh *mesh; + uint32_t format; + + GLuint array_id; + GLuint vertex_id; + GLuint index_id; + + Vector skeleton_bone_aabb; + Vector skeleton_bone_used; + + //bool packed; + + struct MorphTarget { + GLuint vertex_id; + GLuint array_id; + }; + + Vector morph_targets; + + AABB aabb; + + int array_len; + int index_array_len; + int max_bone; + + int array_bytes; + + + VS::PrimitiveType primitive; + + bool active; + + Surface() { + + array_bytes=0; + mesh=NULL; + format=0; + array_id=0; + vertex_id=0; + index_id=0; + array_len=0; + type=GEOMETRY_SURFACE; + primitive=VS::PRIMITIVE_POINTS; + index_array_len=0; + active=false; + + } + + ~Surface() { + + } + }; + + + struct Mesh : public GeometryOwner { + + bool active; + Vector surfaces; + int morph_target_count; + VS::MorphTargetMode morph_target_mode; + AABB custom_aabb; + mutable uint64_t last_pass; + Mesh() { + morph_target_mode=VS::MORPH_MODE_NORMALIZED; + morph_target_count=0; + last_pass=0; + active=false; + } + }; + + mutable RID_Owner mesh_owner; + virtual RID mesh_create(); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >()); + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector()); virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); virtual int mesh_get_morph_target_count(RID p_mesh) const; @@ -324,13 +511,13 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; - virtual void mesh_remove_surface(RID p_mesh,int p_index); + virtual void mesh_remove_surface(RID p_mesh, int p_surface); virtual int mesh_get_surface_count(RID p_mesh) const; virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); virtual AABB mesh_get_custom_aabb(RID p_mesh) const; - virtual AABB mesh_get_aabb(RID p_mesh) const; + virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const; virtual void mesh_clear(RID p_mesh); /* MULTIMESH API */ @@ -401,6 +588,8 @@ public: virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode); + virtual VS::LightType light_get_type(RID p_light) const; + virtual AABB light_get_aabb(RID p_light) const; /* PROBE API */ virtual RID reflection_probe_create(); @@ -434,6 +623,9 @@ public: virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); + virtual void instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance); + virtual void instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance); + /* RENDER TARGET */ struct RenderTarget : public RID_Data { @@ -522,6 +714,8 @@ public: virtual RID canvas_light_occluder_create(); virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines); + virtual VS::InstanceType get_base_type(RID p_rid) const; + virtual bool free(RID p_rid); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 35191fecf7..ebdf60cf42 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -662,8 +662,8 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co fragment_code0=code.ascii(); } else { fragment_code0=code.substr(0,cpos).ascii(); - code = code.substr(cpos+globals_tag.length(),code.length()); - + //print_line("CODE0:\n"+String(fragment_code0.get_data())); + code = code.substr(cpos+globals_tag.length(),code.length()); cpos = code.find(material_tag); if (cpos==-1) { @@ -671,14 +671,18 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co } else { fragment_code1=code.substr(0,cpos).ascii(); - String code2 = code.substr(cpos+material_tag.length(),code.length()); + //print_line("CODE1:\n"+String(fragment_code1.get_data())); + String code2 = code.substr(cpos+material_tag.length(),code.length()); cpos = code2.find(code_tag); + if (cpos==-1) { fragment_code2=code2.ascii(); } else { fragment_code2=code2.substr(0,cpos).ascii(); + //print_line("CODE2:\n"+String(fragment_code2.get_data())); + String code3 = code2.substr(cpos+code_tag.length(),code2.length()); cpos = code3.find(light_code_tag); @@ -687,7 +691,9 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co } else { fragment_code3=code3.substr(0,cpos).ascii(); + // print_line("CODE3:\n"+String(fragment_code3.get_data())); fragment_code4 = code3.substr(cpos+light_code_tag.length(),code3.length()).ascii(); + //print_line("CODE4:\n"+String(fragment_code4.get_data())); } } } diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index 628fa14e4e..0fa0e3b73a 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -4,4 +4,5 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('copy.glsl'); env.GLES3_GLSL('canvas.glsl'); env.GLES3_GLSL('canvas_shadow.glsl'); + env.GLES3_GLSL('scene.glsl'); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl new file mode 100644 index 0000000000..4183e828f5 --- /dev/null +++ b/drivers/gles3/shaders/scene.glsl @@ -0,0 +1,351 @@ +[vertex] + + + +/* +from VisualServer: + +ARRAY_VERTEX=0, +ARRAY_NORMAL=1, +ARRAY_TANGENT=2, +ARRAY_COLOR=3, +ARRAY_TEX_UV=4, +ARRAY_TEX_UV2=5, +ARRAY_BONES=6, +ARRAY_WEIGHTS=7, +ARRAY_INDEX=8, +*/ + +//hack to use uv if no uv present so it works with lightmap + + +/* INPUT ATTRIBS */ + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=1) in vec3 normal_attrib; +layout(location=2) in vec4 tangent_attrib; +layout(location=3) in vec4 color_attrib; +layout(location=4) in vec2 uv_attrib; +layout(location=5) in vec2 uv2_attrib; + +uniform float normal_mult; + +#ifdef USE_SKELETON +layout(location=6) mediump ivec4 bone_indices; // attrib:6 +layout(location=7) mediump vec4 bone_weights; // attrib:7 +uniform highp sampler2D skeleton_matrices; +#endif + +#ifdef USE_ATTRIBUTE_INSTANCING + +layout(location=8) in highp vec4 instance_xform0; +layout(location=9) in highp vec4 instance_xform1; +layout(location=10) in highp vec4 instance_xform2; +layout(location=11) in lowp vec4 instance_color; + +#endif + +layout(std140) uniform SceneData { //ubo:0 + + highp mat4 projection_matrix; + highp mat4 camera_inverse_matrix; + highp mat4 camera_matrix; + highp vec4 time; + + highp vec4 ambient_light; +}; + +uniform highp mat4 world_transform; + +/* Varyings */ + +out vec3 vertex_interp; +out vec3 normal_interp; + +#if defined(ENABLE_COLOR_INTERP) +out vec4 color_interp; +#endif + +#if defined(ENABLE_UV_INTERP) +out vec2 uv_interp; +#endif + +#if defined(ENABLE_UV2_INTERP) +out vec2 uv2_interp; +#endif + +#if defined(ENABLE_VAR1_INTERP) +out vec4 var1_interp; +#endif + +#if defined(ENABLE_VAR2_INTERP) +out vec4 var2_interp; +#endif + +#if defined(ENABLE_TANGENT_INTERP) +out vec3 tangent_interp; +out vec3 binormal_interp; +#endif + + +#if !defined(USE_DEPTH_SHADOWS) && defined(USE_SHADOW_PASS) + +varying vec4 position_interp; + +#endif + +#ifdef USE_SHADOW_PASS + +uniform highp float shadow_z_offset; +uniform highp float shadow_z_slope_scale; + +#endif + + +VERTEX_SHADER_GLOBALS + + +#if defined(USE_MATERIAL) + +layout(std140) uniform UniformData { //ubo:1 + +MATERIAL_UNIFORMS + +}; + +#endif + + +void main() { + + highp vec4 vertex_in = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0); + highp mat4 modelview = camera_inverse_matrix * world_transform; + vec3 normal_in = normal_attrib; + normal_in*=normal_mult; +#if defined(ENABLE_TANGENT_INTERP) + vec3 tangent_in = tangent_attrib.xyz; + tangent_in*=normal_mult; + float binormalf = tangent_attrib.a; +#endif + +#ifdef USE_SKELETON + + { + //skeleton transform + highp mat4 m=mat4(texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.x; + m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.y; + m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.z; + m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.w; + + vertex_in = vertex_in * m; + normal_in = (vec4(normal_in,0.0) * m).xyz; +#if defined(ENABLE_TANGENT_INTERP) + tangent_in = (vec4(tangent_in,0.0) * m).xyz; +#endif + } + +#endif + + vertex_interp = (modelview * vertex_in).xyz; + normal_interp = normalize((modelview * vec4(normal_in,0.0)).xyz); + +#if defined(ENABLE_TANGENT_INTERP) + tangent_interp=normalize((modelview * vec4(tangent_in,0.0)).xyz); + binormal_interp = normalize( cross(normal_interp,tangent_interp) * binormalf ); +#endif + +#if defined(ENABLE_COLOR_INTERP) + color_interp = color_attrib; +#endif + +#if defined(ENABLE_UV_INTERP) + uv_interp = uv_attrib; +#endif +#if defined(ENABLE_UV2_INTERP) + uv2_interp = uv2_attrib; +#endif + + +VERTEX_SHADER_CODE + + +#ifdef USE_SHADOW_PASS + + float z_ofs = shadow_z_offset; + z_ofs += (1.0-abs(normal_interp.z))*shadow_z_slope_scale; + vertex_interp.z-=z_ofs; +#endif + + +#ifdef USE_FOG + + fog_interp.a = pow( clamp( (length(vertex_interp)-fog_params.x)/(fog_params.y-fog_params.x), 0.0, 1.0 ), fog_params.z ); + fog_interp.rgb = mix( fog_color_begin, fog_color_end, fog_interp.a ); +#endif + +#ifndef VERTEX_SHADER_WRITE_POSITION +//vertex shader might write a position + gl_Position = projection_matrix * vec4(vertex_interp,1.0); +#endif + + + + +} + + +[fragment] + + +//hack to use uv if no uv present so it works with lightmap + + +/* Varyings */ + +#if defined(ENABLE_COLOR_INTERP) +in vec4 color_interp; +#endif + +#if defined(ENABLE_UV_INTERP) +in vec2 uv_interp; +#endif + +#if defined(ENABLE_UV2_INTERP) +in vec2 uv2_interp; +#endif + +#if defined(ENABLE_TANGENT_INTERP) +in vec3 tangent_interp; +in vec3 binormal_interp; +#endif + +#if defined(ENABLE_VAR1_INTERP) +in vec4 var1_interp; +#endif + +#if defined(ENABLE_VAR2_INTERP) +in vec4 var2_interp; +#endif + +in vec3 vertex_interp; +in vec3 normal_interp; + + +/* Material Uniforms */ + + +FRAGMENT_SHADER_GLOBALS + + +#if defined(USE_MATERIAL) + +layout(std140) uniform UniformData { + +MATERIAL_UNIFORMS + +}; + +#endif + + +layout(std140) uniform SceneData { + + highp mat4 projection_matrix; + highp mat4 camera_inverse_matrix; + highp mat4 camera_matrix; + highp vec4 time; + + highp vec4 ambient_light; +}; + +layout(location=0) out vec4 frag_color; + +void main() { + + //lay out everything, whathever is unused is optimized away anyway + vec3 vertex = vertex_interp; + vec3 albedo = vec3(0.9,0.9,0.9); + vec3 metal = vec3(0.0,0.0,0.0); + float rough = 0.0; + float alpha = 1.0; + +#ifdef METERIAL_DOUBLESIDED + float side=float(gl_FrontFacing)*2.0-1.0; +#else + float side=1.0; +#endif + + +#if defined(ENABLE_TANGENT_INTERP) + vec3 binormal = normalize(binormal_interp)*side; + vec3 tangent = normalize(tangent_interp)*side; +#endif + vec3 normal = normalize(normal_interp)*side; + +#if defined(ENABLE_UV_INTERP) + vec2 uv = uv_interp; +#endif + +#if defined(ENABLE_UV2_INTERP) + vec2 uv2 = uv2_interp; +#endif + +#if defined(ENABLE_COLOR_INTERP) + vec4 color = color_interp; +#endif + +#if defined(ENABLE_NORMALMAP) + + vec3 normalmap = vec3(0.0); +#endif + + float normaldepth=1.0; + + + +#if defined(ENABLE_DISCARD) + bool discard_=false; +#endif + +{ + + +FRAGMENT_SHADER_CODE + +} + +#if defined(ENABLE_NORMALMAP) + + normal = normalize( mix(normal_interp,tangent_interp * normalmap.x + binormal_interp * normalmap.y + normal_interp * normalmap.z,normaldepth) ) * side; + +#endif + +#if defined(ENABLE_DISCARD) + if (discard_) { + //easy to eliminate dead code + discard; + } +#endif + +#ifdef ENABLE_CLIP_ALPHA + if (diffuse.a<0.99) { + //used for doublepass and shadowmapping + discard; + } +#endif + + + +#if defined(USE_LIGHT_SHADER_CODE) +//light is written by the light shader +{ + +LIGHT_SHADER_CODE + +} +#endif + + frag_color=vec4(albedo,alpha); +} + + diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 865298f64e..d3f27687ca 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -33,6 +33,75 @@ #include "servers/visual_server.h" #include "camera_matrix.h" +#include "self_list.h" + + +class RasterizerScene { +public: + + + struct InstanceBase : RID_Data { + + VS::InstanceType base_type; + RID base; + + RID skeleton; + RID material_override; + + Transform transform; + + int depth_layer; + + //RID sampled_light; + + Vector materials; + Vector light_instances; + + Vector morph_values; + + //BakedLightData *baked_light; + VS::ShadowCastingSetting cast_shadows; + //Transform *baked_light_octree_xform; + //int baked_lightmap_id; + + bool mirror :8; + bool depth_scale :8; + bool billboard :8; + bool billboard_y :8; + bool receive_shadows : 8; + + SelfList dependency_item; + + virtual void base_removed()=0; + virtual void base_changed()=0; + + InstanceBase() : dependency_item(this) { + + base_type=VS::INSTANCE_NONE; + cast_shadows=VS::SHADOW_CASTING_SETTING_ON; + receive_shadows=true; + depth_scale=false; + billboard=false; + billboard_y=false; + depth_layer=0; + + } + }; + + virtual RID light_instance_create(RID p_light)=0; + virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform)=0; + + virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment)=0; + + virtual bool free(RID p_rid)=0; + + virtual ~RasterizerScene() {} +}; + + + + + class RasterizerStorage { @@ -88,7 +157,7 @@ public: virtual RID mesh_create()=0; - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >())=0; + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -116,7 +185,7 @@ public: virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb)=0; virtual AABB mesh_get_custom_aabb(RID p_mesh) const=0; - virtual AABB mesh_get_aabb(RID p_mesh) const=0; + virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const=0; virtual void mesh_clear(RID p_mesh)=0; /* MULTIMESH API */ @@ -184,9 +253,11 @@ public: virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; virtual void light_set_shader(RID p_light,RID p_shader)=0; - virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode)=0; + virtual VS::LightType light_get_type(RID p_light) const=0; + virtual AABB light_get_aabb(RID p_light) const=0; + /* PROBE API */ virtual RID reflection_probe_create()=0; @@ -220,6 +291,10 @@ public: virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0; + + virtual void instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; + virtual void instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; + /* RENDER TARGET */ enum RenderTargetFlags { @@ -246,6 +321,8 @@ public: virtual RID canvas_light_occluder_create()=0; virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector& p_lines)=0; + + virtual VS::InstanceType get_base_type(RID p_rid) const=0; virtual bool free(RID p_rid)=0; @@ -257,6 +334,7 @@ public: + class RasterizerCanvas { public: @@ -563,7 +641,7 @@ public: case Item::Command::TYPE_MESH: { const Item::CommandMesh* mesh = static_cast< const Item::CommandMesh*>(c); - AABB aabb = RasterizerStorage::base_signleton->mesh_get_aabb(mesh->mesh); + AABB aabb = RasterizerStorage::base_signleton->mesh_get_aabb(mesh->mesh,mesh->skeleton); r=Rect2(aabb.pos.x,aabb.pos.y,aabb.size.x,aabb.size.y); @@ -654,17 +732,6 @@ public: }; - -class RasterizerScene { -public: - - - - virtual ~RasterizerScene() {} -}; - - - class Rasterizer { protected: static Rasterizer* (*_create_func)(); @@ -689,8 +756,6 @@ public: }; - - #if 0 /** @author Juan Linietsky diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 1a01a19021..767d11bc84 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -58,8 +58,8 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["NORMAL"]=ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALBEDO"]=ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ALPHA"]=ShaderLanguage::TYPE_FLOAT; - shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["METAL"]=ShaderLanguage::TYPE_FLOAT; - shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ROUGH"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECULAR"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ROUGHNESS"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["EMISSION"]=ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECIAL"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["DISCARD"]=ShaderLanguage::TYPE_BOOL; @@ -77,10 +77,6 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_sub"); shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mul"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("special_glow"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("special_subsurf"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("special_specular"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_opaque"); shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_always"); shader_modes[VS::SHADER_SPATIAL].modes.insert("depth_draw_never"); @@ -90,12 +86,10 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_back"); shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disable"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("lightmap_on_uv2"); shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); shader_modes[VS::SHADER_SPATIAL].modes.insert("ontop"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_model_space"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_camera_space"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_transform"); /************ CANVAS ITEM **************************/ @@ -158,4 +152,5 @@ ShaderTypes::ShaderTypes() + } diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index d6e057bb52..70abfe2361 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -34,183 +34,12 @@ #include "io/marshalls.h" #include "visual_server_canvas.h" #include "visual_server_global.h" +#include "visual_server_scene.h" // careful, these may run in different threads than the visual server -/* CAMERA API */ - -RID VisualServerRaster::camera_create() { - - return RID(); -} -void VisualServerRaster::camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far) { - -} -void VisualServerRaster::camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far){ - -} -void VisualServerRaster::camera_set_transform(RID p_camera,const Transform& p_transform) { - -} -void VisualServerRaster::camera_set_cull_mask(RID p_camera,uint32_t p_layers){ - -} -void VisualServerRaster::camera_set_environment(RID p_camera,RID p_env){ - -} -void VisualServerRaster::camera_set_use_vertical_aspect(RID p_camera,bool p_enable){ - -} - - -/* ENVIRONMENT API */ - -RID VisualServerRaster::environment_create(){ - - return RID(); -} - -void VisualServerRaster::environment_set_background(RID p_env,EnvironmentBG p_bg){ - -} -void VisualServerRaster::environment_set_skybox(RID p_env,RID p_skybox,float p_energy){ - -} -void VisualServerRaster::environment_set_bg_color(RID p_env,const Color& p_color){ - -} -void VisualServerRaster::environment_set_canvas_max_layer(RID p_env,int p_max_layer){ - -} -void VisualServerRaster::environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy){ - -} - -void VisualServerRaster::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode){ - -} -void VisualServerRaster::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ - -} - -void VisualServerRaster::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper){ - -} -void VisualServerRaster::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ - -} -void VisualServerRaster::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ - -} -void VisualServerRaster::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ - -} -void VisualServerRaster::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ - -} - - -/* SCENARIO API */ - - -RID VisualServerRaster::scenario_create() { - - return RID(); -} - -void VisualServerRaster::scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode){ - -} -void VisualServerRaster::scenario_set_environment(RID p_scenario, RID p_environment){ - -} -RID VisualServerRaster::scenario_get_environment(RID p_scenario, RID p_environment) const{ - - return RID(); -} -void VisualServerRaster::scenario_set_fallback_environment(RID p_scenario, RID p_environment){ - -} - - -/* INSTANCING API */ -// from can be mesh, light, area and portal so far. -RID VisualServerRaster::instance_create(){ - - return RID(); -} - -void VisualServerRaster::instance_set_base(RID p_instance, RID p_base){ - -} -void VisualServerRaster::instance_set_scenario(RID p_instance, RID p_scenario){ - -} -void VisualServerRaster::instance_set_layer_mask(RID p_instance, uint32_t p_mask){ - -} -void VisualServerRaster::instance_set_transform(RID p_instance, const Transform& p_transform){ - -} -void VisualServerRaster::instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID){ - -} -void VisualServerRaster::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ - -} -void VisualServerRaster::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ - -} - -void VisualServerRaster::instance_attach_skeleton(RID p_instance,RID p_skeleton){ - -} -void VisualServerRaster::instance_set_exterior( RID p_instance, bool p_enabled ){ - -} -void VisualServerRaster::instance_set_room( RID p_instance, RID p_room ){ - -} - -void VisualServerRaster::instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ){ - -} - -// don't use these in a game! -Vector VisualServerRaster::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const{ - - return Vector(); -} - -Vector VisualServerRaster::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{ - - return Vector(); -} -Vector VisualServerRaster::instances_cull_convex(const Vector& p_convex, RID p_scenario) const { - - return Vector(); -} - - -void VisualServerRaster::instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled){ - -} -void VisualServerRaster::instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) { - -} -void VisualServerRaster::instance_geometry_set_material_override(RID p_instance, RID p_material){ - -} - - -void VisualServerRaster::instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin){ - -} -void VisualServerRaster::instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance){ - -} /* CURSOR */ void VisualServerRaster::cursor_set_rotation(float p_rotation, int p_cursor ){ @@ -247,6 +76,8 @@ void VisualServerRaster::free( RID p_rid ){ return; if (VSG::viewport->free(p_rid)) return; + if (VSG::scene->free(p_rid)) + return; } @@ -258,6 +89,9 @@ void VisualServerRaster::draw(){ // print_line("changes: "+itos(changes)); changes=0; + + VSG::scene->update_dirty_instances(); //update scene stuff + VSG::rasterizer->begin_frame(); VSG::viewport->draw_viewports(); //_draw_cursors_and_margins(); @@ -322,6 +156,7 @@ VisualServerRaster::VisualServerRaster() { VSG::canvas = memnew( VisualServerCanvas); VSG::viewport = memnew( VisualServerViewport); + VSG::scene = memnew( VisualServerScene ); VSG::rasterizer = Rasterizer::create(); VSG::storage=VSG::rasterizer->get_storage(); VSG::canvas_render=VSG::rasterizer->get_canvas(); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 2171998f3f..62d45f8206 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -37,6 +37,7 @@ #include "visual_server_global.h" #include "visual_server_viewport.h" #include "visual_server_canvas.h" +#include "visual_server_scene.h" /** @author Juan Linietsky */ @@ -600,6 +601,7 @@ public: #define BIND6(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6); } #define BIND7(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7); } #define BIND8(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7,m_type8 arg8) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); } +#define BIND9(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8,m_type9) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7,m_type8 arg8,m_type9 arg9) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); } #define BIND10(m_name,m_type1,m_type2,m_type3,m_type4,m_type5,m_type6,m_type7,m_type8,m_type9,m_type10) void m_name(m_type1 arg1,m_type2 arg2,m_type3 arg3,m_type4 arg4,m_type5 arg5,m_type6 arg6,m_type7 arg7,m_type8 arg8,m_type9 arg9,m_type10 arg10) { DISPLAY_CHANGED BINDBASE->m_name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); } //from now on, calls forwarded to this singleton @@ -659,7 +661,7 @@ public: BIND0R(RID,mesh_create) - BIND8(mesh_add_surface,RID,uint32_t,PrimitiveType,const DVector&,int ,const DVector& ,int ,const Vector >& ) + BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const DVector&,int ,const DVector& ,int ,const AABB&,const Vector >&,const Vector& ) BIND2(mesh_set_morph_target_count,RID,int) BIND1RC(int,mesh_get_morph_target_count,RID) @@ -788,13 +790,18 @@ public: /* CAMERA API */ - virtual RID camera_create(); - virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far); - virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far); - virtual void camera_set_transform(RID p_camera,const Transform& p_transform); - virtual void camera_set_cull_mask(RID p_camera,uint32_t p_layers); - virtual void camera_set_environment(RID p_camera,RID p_env); - virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable); +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::scene + + + BIND0R(RID, camera_create) + BIND4(camera_set_perspective,RID,float, float , float ) + BIND4(camera_set_orthogonal,RID,float , float , float ) + BIND2(camera_set_transform,RID,const Transform&) + BIND2(camera_set_cull_mask,RID,uint32_t ) + BIND2(camera_set_environment,RID ,RID ) + BIND2(camera_set_use_vertical_aspect,RID,bool) #undef BINDBASE //from now on, calls forwarded to this singleton @@ -839,66 +846,69 @@ public: /* ENVIRONMENT API */ - virtual RID environment_create(); +#undef BINDBASE +//from now on, calls forwarded to this singleton +#define BINDBASE VSG::scene + + BIND0R(RID,environment_create) - virtual void environment_set_background(RID p_env,EnvironmentBG p_bg); - virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0); - virtual void environment_set_bg_color(RID p_env,const Color& p_color); - virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0); + BIND2(environment_set_background,RID ,EnvironmentBG ) + BIND3(environment_set_skybox,RID,RID ,float ) + BIND2(environment_set_bg_color,RID,const Color& ) + BIND2(environment_set_canvas_max_layer,RID,int ) + BIND3(environment_set_ambient_light,RID,const Color& ,float ) - virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode); - virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); + BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) + BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper); - virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); - virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); - virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); - virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); + BIND8(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float ,EnvironmentToneMapper ) + BIND3(environment_set_brightness,RID,bool ,float ) + BIND3(environment_set_contrast,RID,bool ,float ) + BIND3(environment_set_saturation,RID,bool ,float ) + BIND3(environment_set_color_correction,RID,bool ,RID ) /* SCENARIO API */ - virtual RID scenario_create(); + BIND0R(RID,scenario_create) - virtual void scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode); - virtual void scenario_set_environment(RID p_scenario, RID p_environment); - virtual RID scenario_get_environment(RID p_scenario, RID p_environment) const; - virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment); + BIND2(scenario_set_debug,RID,ScenarioDebugMode ) + BIND2(scenario_set_environment,RID, RID ) + BIND2(scenario_set_fallback_environment,RID, RID ) /* INSTANCING API */ // from can be mesh, light, area and portal so far. - virtual RID instance_create(); // from can be mesh, light, poly, area and portal so far. + BIND0R(RID,instance_create) - virtual void instance_set_base(RID p_instance, RID p_base); // from can be mesh, light, poly, area and portal so far. - virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far. - virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); - virtual void instance_set_transform(RID p_instance, const Transform& p_transform); - virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); - virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); + BIND2(instance_set_base,RID, RID ) // from can be mesh, light, poly, area and portal so far. + BIND2(instance_set_scenario,RID, RID ) // from can be mesh, light, poly, area and portal so far. + BIND2(instance_set_layer_mask,RID, uint32_t ) + BIND2(instance_set_transform,RID, const Transform& ) + BIND2(instance_attach_object_instance_ID,RID,ObjectID ) + BIND3(instance_set_morph_target_weight,RID,int , float ) + BIND3(instance_set_surface_material,RID,int , RID ) - virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); - virtual void instance_set_exterior( RID p_instance, bool p_enabled ); - virtual void instance_set_room( RID p_instance, RID p_room ); + BIND2(instance_attach_skeleton,RID,RID ) + BIND2(instance_set_exterior, RID, bool ) + BIND2(instance_set_room, RID, RID ) - virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ); + BIND2(instance_set_extra_visibility_margin, RID, real_t ) // don't use these in a game! - virtual Vector instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; - virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; - virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const; + BIND2RC(Vector,instances_cull_aabb,const AABB& , RID) + BIND3RC(Vector,instances_cull_ray,const Vector3& , const Vector3& , RID ) + BIND2RC(Vector,instances_cull_convex,const Vector& , RID) - virtual void instance_geometry_set_flag(RID p_instance,InstanceFlags p_flags,bool p_enabled); - virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting); - virtual void instance_geometry_set_material_override(RID p_instance, RID p_material); + BIND3(instance_geometry_set_flag,RID,InstanceFlags ,bool ) + BIND2(instance_geometry_set_cast_shadows_setting,RID, ShadowCastingSetting ) + BIND2(instance_geometry_set_material_override,RID, RID ) - virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin); - virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance); + BIND5(instance_geometry_set_draw_range,RID,float ,float ,float ,float ) + BIND2(instance_geometry_set_as_instance_lod,RID,RID ) #undef BINDBASE @@ -1055,6 +1065,7 @@ public: #undef BIND6 #undef BIND7 #undef BIND8 +#undef BIND9 #undef BIND10 }; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp new file mode 100644 index 0000000000..a3b1d76fb8 --- /dev/null +++ b/servers/visual/visual_server_scene.cpp @@ -0,0 +1,1517 @@ +#include "visual_server_scene.h" +#include "visual_server_global.h" + +/* CAMERA API */ + + +RID VisualServerScene::camera_create() { + + Camera * camera = memnew( Camera ); + return camera_owner.make_rid( camera ); + +} + +void VisualServerScene::camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far) { + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + camera->type=Camera::PERSPECTIVE; + camera->fov=p_fovy_degrees; + camera->znear=p_z_near; + camera->zfar=p_z_far; + +} + +void VisualServerScene::camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far) { + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + camera->type=Camera::ORTHOGONAL; + camera->size=p_size; + camera->znear=p_z_near; + camera->zfar=p_z_far; +} + +void VisualServerScene::camera_set_transform(RID p_camera,const Transform& p_transform) { + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + camera->transform=p_transform.orthonormalized(); + + +} + +void VisualServerScene::camera_set_cull_mask(RID p_camera,uint32_t p_layers) { + + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + + camera->visible_layers=p_layers; + +} + +void VisualServerScene::camera_set_environment(RID p_camera,RID p_env) { + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + camera->env=p_env; + +} + + +void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera,bool p_enable) { + + Camera *camera = camera_owner.get( p_camera ); + ERR_FAIL_COND(!camera); + camera->vaspect=p_enable; + +} + + + +/* ENVIRONMENT API */ + +RID VisualServerScene::environment_create(){ + + return RID(); +} + +void VisualServerScene::environment_set_background(RID p_env,VS::EnvironmentBG p_bg){ + +} +void VisualServerScene::environment_set_skybox(RID p_env,RID p_skybox,float p_energy){ + +} +void VisualServerScene::environment_set_bg_color(RID p_env,const Color& p_color){ + +} +void VisualServerScene::environment_set_canvas_max_layer(RID p_env,int p_max_layer){ + +} +void VisualServerScene::environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy){ + +} + +void VisualServerScene::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode){ + +} +void VisualServerScene::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ + +} + +void VisualServerScene::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper){ + +} +void VisualServerScene::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ + +} +void VisualServerScene::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ + +} +void VisualServerScene::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ + +} +void VisualServerScene::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ + +} + + +/* SCENARIO API */ + + + +void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int) { + +// VisualServerScene *self = (VisualServerScene*)p_self; + Instance *A = p_A; + Instance *B = p_B; + + //instance indices are designed so greater always contains lesser + if (A->base_type > B->base_type) { + SWAP(A,B); //lesser always first + } + + if (B->base_type==VS::INSTANCE_LIGHT && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceLightData * light = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + + InstanceLightData::PairInfo pinfo; + pinfo.geometry=A; + pinfo.L = geom->lighting.push_back(B); + + List::Element *E = light->geometries.push_back(pinfo); + + light->shadow_sirty=true; + geom->lighting_dirty=true; + + return E; //this element should make freeing faster + } + +#if 0 + if (A->base_type==INSTANCE_PORTAL) { + + ERR_FAIL_COND_V( B->base_type!=INSTANCE_PORTAL,NULL ); + + A->portal_info->candidate_set.insert(B); + B->portal_info->candidate_set.insert(A); + + self->_portal_attempt_connect(A); + //attempt to conncet portal A (will go through B anyway) + //this is a little hackish, but works fine in practice + + } else if (A->base_type==INSTANCE_BAKED_LIGHT || B->base_type==INSTANCE_BAKED_LIGHT) { + + if (B->base_type==INSTANCE_BAKED_LIGHT) { + SWAP(A,B); + } + + ERR_FAIL_COND_V(B->base_type!=INSTANCE_BAKED_LIGHT_SAMPLER,NULL); + B->baked_light_sampler_info->baked_lights.insert(A); + + } else if (A->base_type==INSTANCE_ROOM || B->base_type==INSTANCE_ROOM) { + + if (B->base_type==INSTANCE_ROOM) + SWAP(A,B); + + ERR_FAIL_COND_V(! ((1<base_type)&INSTANCE_GEOMETRY_MASK ),NULL); + + B->auto_rooms.insert(A); + A->room_info->owned_autoroom_geometry.insert(B); + + self->_instance_validate_autorooms(B); + + + } else { + + if (B->base_type==INSTANCE_LIGHT) { + + SWAP(A,B); + } else if (A->base_type!=INSTANCE_LIGHT) { + return NULL; + } + + + A->light_info->affected.insert(B); + B->lights.insert(A); + B->light_cache_dirty=true; + + + } +#endif + + return NULL; + +} +void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int,void* udata) { + +// VisualServerScene *self = (VisualServerScene*)p_self; + Instance *A = p_A; + Instance *B = p_B; + + //instance indices are designed so greater always contains lesser + if (A->base_type > B->base_type) { + SWAP(A,B); //lesser always first + } + + + + if (B->base_type==VS::INSTANCE_LIGHT && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceLightData * light = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + List::Element *E = reinterpret_cast::Element*>(udata); + + geom->lighting.erase(E->get().L); + light->geometries.erase(E); + + light->shadow_sirty=true; + geom->lighting_dirty=true; + + + } +#if 0 + if (A->base_type==INSTANCE_PORTAL) { + + ERR_FAIL_COND( B->base_type!=INSTANCE_PORTAL ); + + + A->portal_info->candidate_set.erase(B); + B->portal_info->candidate_set.erase(A); + + //after disconnecting them, see if they can connect again + self->_portal_attempt_connect(A); + self->_portal_attempt_connect(B); + + } else if (A->base_type==INSTANCE_BAKED_LIGHT || B->base_type==INSTANCE_BAKED_LIGHT) { + + if (B->base_type==INSTANCE_BAKED_LIGHT) { + SWAP(A,B); + } + + ERR_FAIL_COND(B->base_type!=INSTANCE_BAKED_LIGHT_SAMPLER); + B->baked_light_sampler_info->baked_lights.erase(A); + + } else if (A->base_type==INSTANCE_ROOM || B->base_type==INSTANCE_ROOM) { + + if (B->base_type==INSTANCE_ROOM) + SWAP(A,B); + + ERR_FAIL_COND(! ((1<base_type)&INSTANCE_GEOMETRY_MASK )); + + B->auto_rooms.erase(A); + B->valid_auto_rooms.erase(A); + A->room_info->owned_autoroom_geometry.erase(B); + + }else { + + + + if (B->base_type==INSTANCE_LIGHT) { + + SWAP(A,B); + } else if (A->base_type!=INSTANCE_LIGHT) { + return; + } + + + A->light_info->affected.erase(B); + B->lights.erase(A); + B->light_cache_dirty=true; + + } +#endif +} + +RID VisualServerScene::scenario_create() { + + Scenario *scenario = memnew( Scenario ); + ERR_FAIL_COND_V(!scenario,RID()); + RID scenario_rid = scenario_owner.make_rid( scenario ); + scenario->self=scenario_rid; + + scenario->octree.set_pair_callback(_instance_pair,this); + scenario->octree.set_unpair_callback(_instance_unpair,this); + + return scenario_rid; +} + +void VisualServerScene::scenario_set_debug(RID p_scenario,VS::ScenarioDebugMode p_debug_mode) { + + Scenario *scenario = scenario_owner.get(p_scenario); + ERR_FAIL_COND(!scenario); + scenario->debug=p_debug_mode; +} + +void VisualServerScene::scenario_set_environment(RID p_scenario, RID p_environment) { + + Scenario *scenario = scenario_owner.get(p_scenario); + ERR_FAIL_COND(!scenario); + scenario->environment=p_environment; + +} + +void VisualServerScene::scenario_set_fallback_environment(RID p_scenario, RID p_environment) { + + + Scenario *scenario = scenario_owner.get(p_scenario); + ERR_FAIL_COND(!scenario); + scenario->fallback_environment=p_environment; + + +} + + + +/* INSTANCING API */ + +void VisualServerScene::_instance_queue_update(Instance *p_instance,bool p_update_aabb,bool p_update_materials) { + + if (p_update_aabb) + p_instance->update_aabb=true; + if (p_update_materials) + p_instance->update_materials=true; + + if (p_instance->update_item.in_list()) + return; + + _instance_update_list.add(&p_instance->update_item); + + +} + +// from can be mesh, light, area and portal so far. +RID VisualServerScene::instance_create(){ + + Instance *instance = memnew( Instance ); + ERR_FAIL_COND_V(!instance,RID()); + + RID instance_rid = instance_owner.make_rid(instance); + instance->self=instance_rid; + + + return instance_rid; + + +} + +void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + Scenario *scenario = instance->scenario; + + if (instance->base_type!=VS::INSTANCE_NONE) { + //free anything related to that base + + VSG::storage->instance_remove_dependency(instance->base,instance); + + if (scenario && instance->octree_id) { + scenario->octree.erase(instance->octree_id); //make dependencies generated by the octree go away + instance->octree_id=0; + } + + switch(instance->base_type) { + case VS::INSTANCE_LIGHT: { + + InstanceLightData *light = static_cast(instance->base_data); + + if (instance->scenario && light->D) { + instance->scenario->directional_lights.erase( light->D ); + light->D=NULL; + } + VSG::scene_render->free(light->instance); + + } + } + + if (instance->base_data) { + memdelete( instance->base_data ); + instance->base_data=NULL; + } + + instance->morph_values.clear(); + instance->materials.clear(); + +#if 0 + if (instance->light_info) { + + if (instance->scenario && instance->light_info->D) + instance->scenario->directional_lights.erase( instance->light_info->D ); + rasterizer->free(instance->light_info->instance); + memdelete(instance->light_info); + instance->light_info=NULL; + } + + + + if ( instance->room ) { + + instance_set_room(p_instance,RID()); + /* + if((1<base_type)&INSTANCE_GEOMETRY_MASK) + instance->room->room_info->owned_geometry_instances.erase(instance->RE); + else if (instance->base_type==INSTANCE_PORTAL) { + print_line("freeing portal, is it there? "+itos(instance->room->room_info->owned_portal_instances.(instance->RE))); + instance->room->room_info->owned_portal_instances.erase(instance->RE); + } else if (instance->base_type==INSTANCE_ROOM) + instance->room->room_info->owned_room_instances.erase(instance->RE); + else if (instance->base_type==INSTANCE_LIGHT) + instance->room->room_info->owned_light_instances.erase(instance->RE); + + instance->RE=NULL;*/ + } + + + + + + + if (instance->portal_info) { + + _portal_disconnect(instance,true); + memdelete(instance->portal_info); + instance->portal_info=NULL; + + } + + if (instance->baked_light_info) { + + while(instance->baked_light_info->owned_instances.size()) { + + Instance *owned=instance->baked_light_info->owned_instances.front()->get(); + owned->baked_light=NULL; + owned->data.baked_light=NULL; + owned->data.baked_light_octree_xform=NULL; + owned->BLE=NULL; + instance->baked_light_info->owned_instances.pop_front(); + } + + memdelete(instance->baked_light_info); + instance->baked_light_info=NULL; + + } + + if (instance->scenario && instance->octree_id) { + instance->scenario->octree.erase( instance->octree_id ); + instance->octree_id=0; + } + + + if (instance->room_info) { + + for(List::Element *E=instance->room_info->owned_geometry_instances.front();E;E=E->next()) { + + Instance *owned = E->get(); + owned->room=NULL; + owned->RE=NULL; + } + for(List::Element *E=instance->room_info->owned_portal_instances.front();E;E=E->next()) { + + _portal_disconnect(E->get(),true); + Instance *owned = E->get(); + owned->room=NULL; + owned->RE=NULL; + } + + for(List::Element *E=instance->room_info->owned_room_instances.front();E;E=E->next()) { + + Instance *owned = E->get(); + owned->room=NULL; + owned->RE=NULL; + } + + if (instance->room_info->disconnected_child_portals.size()) { + ERR_PRINT("BUG: Disconnected portals remain!"); + } + memdelete(instance->room_info); + instance->room_info=NULL; + + } + + if (instance->particles_info) { + + rasterizer->free( instance->particles_info->instance ); + memdelete(instance->particles_info); + instance->particles_info=NULL; + + } + + if (instance->baked_light_sampler_info) { + + while (instance->baked_light_sampler_info->owned_instances.size()) { + + instance_geometry_set_baked_light_sampler(instance->baked_light_sampler_info->owned_instances.front()->get()->self,RID()); + } + + if (instance->baked_light_sampler_info->sampled_light.is_valid()) { + rasterizer->free(instance->baked_light_sampler_info->sampled_light); + } + memdelete( instance->baked_light_sampler_info ); + instance->baked_light_sampler_info=NULL; + } +#endif + + } + + + instance->base_type=VS::INSTANCE_NONE; + instance->base=RID(); + + + if (p_base.is_valid()) { + + instance->base_type=VSG::storage->get_base_type(p_base); + ERR_FAIL_COND(instance->base_type==VS::INSTANCE_NONE); + + switch(instance->base_type) { + case VS::INSTANCE_LIGHT: { + + InstanceLightData *light = memnew( InstanceLightData ); + + if (scenario && VSG::storage->light_get_type(p_base)==VS::LIGHT_DIRECTIONAL) { + light->D = scenario->directional_lights.push_back(instance); + } + + light->instance = VSG::scene_render->light_instance_create(p_base); + + instance->base_data=light; + } + case VS::INSTANCE_MESH: { + + InstanceGeometryData *geom = memnew( InstanceGeometryData ); + instance->base_data=geom; + } + + } + + VSG::storage->instance_add_dependency(p_base,instance); + + instance->base=p_base; + + if (scenario) + _instance_queue_update(instance,true,true); + + +#if 0 + if (rasterizer->is_mesh(p_base)) { + instance->base_type=INSTANCE_MESH; + instance->data.morph_values.resize( rasterizer->mesh_get_morph_target_count(p_base)); + instance->data.materials.resize( rasterizer->mesh_get_surface_count(p_base)); + } else if (rasterizer->is_multimesh(p_base)) { + instance->base_type=INSTANCE_MULTIMESH; + } else if (rasterizer->is_immediate(p_base)) { + instance->base_type=INSTANCE_IMMEDIATE; + } else if (rasterizer->is_particles(p_base)) { + instance->base_type=INSTANCE_PARTICLES; + instance->particles_info=memnew( Instance::ParticlesInfo ); + instance->particles_info->instance = rasterizer->particles_instance_create( p_base ); + } else if (rasterizer->is_light(p_base)) { + + instance->base_type=INSTANCE_LIGHT; + instance->light_info = memnew( Instance::LightInfo ); + instance->light_info->instance = rasterizer->light_instance_create(p_base); + if (instance->scenario && rasterizer->light_get_type(p_base)==LIGHT_DIRECTIONAL) { + + instance->light_info->D = instance->scenario->directional_lights.push_back(instance->self); + } + + } else if (room_owner.owns(p_base)) { + instance->base_type=INSTANCE_ROOM; + instance->room_info = memnew( Instance::RoomInfo ); + instance->room_info->room=room_owner.get(p_base); + } else if (portal_owner.owns(p_base)) { + + instance->base_type=INSTANCE_PORTAL; + instance->portal_info = memnew(Instance::PortalInfo); + instance->portal_info->portal=portal_owner.get(p_base); + } else if (baked_light_owner.owns(p_base)) { + + instance->base_type=INSTANCE_BAKED_LIGHT; + instance->baked_light_info=memnew(Instance::BakedLightInfo); + instance->baked_light_info->baked_light=baked_light_owner.get(p_base); + + //instance->portal_info = memnew(Instance::PortalInfo); + //instance->portal_info->portal=portal_owner.get(p_base); + } else if (baked_light_sampler_owner.owns(p_base)) { + + + instance->base_type=INSTANCE_BAKED_LIGHT_SAMPLER; + instance->baked_light_sampler_info=memnew( Instance::BakedLightSamplerInfo); + instance->baked_light_sampler_info->sampler=baked_light_sampler_owner.get(p_base); + + //instance->portal_info = memnew(Instance::PortalInfo); + //instance->portal_info->portal=portal_owner.get(p_base); + + } else { + ERR_EXPLAIN("Invalid base RID for instance!") + ERR_FAIL(); + } + + instance_dependency_map[ p_base ].insert( instance->self ); +#endif + + + } +} +void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + if (instance->scenario) { + + instance->scenario->instances.remove( &instance->scenario_item ); + + if (instance->octree_id) { + instance->scenario->octree.erase(instance->octree_id); //make dependencies generated by the octree go away + instance->octree_id=0; + } + + + switch(instance->base_type) { + + case VS::INSTANCE_LIGHT: { + + + InstanceLightData *light = static_cast(instance->base_data); + + if (light->D) { + instance->scenario->directional_lights.erase( light->D ); + light->D=NULL; + } + } + } + + instance->scenario=NULL; + } + + + if (p_scenario.is_valid()) { + + Scenario *scenario = scenario_owner.get( p_scenario ); + ERR_FAIL_COND(!scenario); + + instance->scenario=scenario; + + scenario->instances.add( &instance->scenario_item ); + + + switch(instance->base_type) { + + case VS::INSTANCE_LIGHT: { + + + InstanceLightData *light = static_cast(instance->base_data); + + if (VSG::storage->light_get_type(instance->base)==VS::LIGHT_DIRECTIONAL) { + light->D = scenario->directional_lights.push_back(instance); + } + } + } + + _instance_queue_update(instance,true,true); + } +} +void VisualServerScene::instance_set_layer_mask(RID p_instance, uint32_t p_mask){ + + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + instance->layer_mask=p_mask; +} +void VisualServerScene::instance_set_transform(RID p_instance, const Transform& p_transform){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + if (instance->transform==p_transform) + return; //must be checked to avoid worst evil + + instance->transform=p_transform; + _instance_queue_update(instance,true); +} +void VisualServerScene::instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + instance->object_ID=p_ID; + +} +void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ + +} +void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + _update_dirty_instance(instance); + + ERR_FAIL_INDEX(p_surface,instance->materials.size()); + + instance->materials[p_surface]=p_material; + +} + +void VisualServerScene::instance_attach_skeleton(RID p_instance,RID p_skeleton){ + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + instance->skeleton=p_skeleton; + + _instance_queue_update(instance,true); +} + +void VisualServerScene::instance_set_exterior( RID p_instance, bool p_enabled ){ + +} +void VisualServerScene::instance_set_room( RID p_instance, RID p_room ){ + +} + +void VisualServerScene::instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ){ + +} + +// don't use these in a game! +Vector VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const{ + + return Vector(); +} + +Vector VisualServerScene::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{ + + return Vector(); +} +Vector VisualServerScene::instances_cull_convex(const Vector& p_convex, RID p_scenario) const { + + return Vector(); +} + + +void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFlags p_flags,bool p_enabled){ + +} +void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) { + +} +void VisualServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material){ + +} + + +void VisualServerScene::instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin){ + +} +void VisualServerScene::instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance){ + +} + + +void VisualServerScene::_update_instance(Instance *p_instance) { + + p_instance->version++; + + if (p_instance->base_type == VS::INSTANCE_LIGHT) { + + InstanceLightData *light = static_cast(p_instance->base_data); + + VSG::scene_render->light_instance_set_transform( light->instance, p_instance->transform ); + + } + + + if (p_instance->aabb.has_no_surface()) + return; + +#if 0 + if (p_instance->base_type == VS::INSTANCE_PARTICLES) { + + rasterizer->particles_instance_set_transform( p_instance->particles_info->instance, p_instance->data.transform ); + } + +#endif + if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceGeometryData *geom = static_cast(p_instance->base_data); + //make sure lights are updated + + for (List::Element *E=geom->lighting.front();E;E=E->next()) { + InstanceLightData *light = static_cast(E->get()->base_data); + light->shadow_sirty=true; + } + + } +#if 0 + else if (p_instance->base_type == INSTANCE_ROOM) { + + p_instance->room_info->affine_inverse=p_instance->data.transform.affine_inverse(); + } else if (p_instance->base_type == INSTANCE_BAKED_LIGHT) { + + Transform scale; + scale.basis.scale(p_instance->baked_light_info->baked_light->octree_aabb.size); + scale.origin=p_instance->baked_light_info->baked_light->octree_aabb.pos; + //print_line("scale: "+scale); + p_instance->baked_light_info->affine_inverse=(p_instance->data.transform*scale).affine_inverse(); + } + + +#endif + + p_instance->mirror = p_instance->transform.basis.determinant() < 0.0; + + AABB new_aabb; +#if 0 + if (p_instance->base_type==INSTANCE_PORTAL) { + + //portals need to be transformed in a special way, so they don't become too wide if they have scale.. + Transform portal_xform = p_instance->data.transform; + portal_xform.basis.set_axis(2,portal_xform.basis.get_axis(2).normalized()); + + p_instance->portal_info->plane_cache=Plane( p_instance->data.transform.origin, portal_xform.basis.get_axis(2)); + int point_count=p_instance->portal_info->portal->shape.size(); + p_instance->portal_info->transformed_point_cache.resize(point_count); + + AABB portal_aabb; + + for(int i=0;iportal_info->portal->shape[i]; + Vector3 point = portal_xform.xform(Vector3(src.x,src.y,0)); + p_instance->portal_info->transformed_point_cache[i]=point; + if (i==0) + portal_aabb.pos=point; + else + portal_aabb.expand_to(point); + } + + portal_aabb.grow_by(p_instance->portal_info->portal->connect_range); + + new_aabb = portal_aabb; + + } else { +#endif + new_aabb = p_instance->transform.xform(p_instance->aabb); +#if 0 + } +#endif + + + p_instance->transformed_aabb=new_aabb; + + if (!p_instance->scenario) { + + return; + } + + + + if (p_instance->octree_id==0) { + + uint32_t base_type = 1<base_type; + uint32_t pairable_mask=0; + bool pairable=false; + + if (p_instance->base_type == VS::INSTANCE_LIGHT) { + + pairable_mask=p_instance->visible?VS::INSTANCE_GEOMETRY_MASK:0; + pairable=true; + } +#if 0 + + if (p_instance->base_type == VS::INSTANCE_PORTAL) { + + pairable_mask=(1<base_type == VS::INSTANCE_BAKED_LIGHT_SAMPLER) { + + pairable_mask=(1<room && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + base_type|=VS::INSTANCE_ROOMLESS_MASK; + } + + if (p_instance->base_type == VS::INSTANCE_ROOM) { + + pairable_mask=INSTANCE_ROOMLESS_MASK; + pairable=true; + } +#endif + + // not inside octree + p_instance->octree_id = p_instance->scenario->octree.create(p_instance,new_aabb,0,pairable,base_type,pairable_mask); + + } else { + + // if (new_aabb==p_instance->data.transformed_aabb) + // return; + + p_instance->scenario->octree.move(p_instance->octree_id,new_aabb); + } +#if 0 + if (p_instance->base_type==INSTANCE_PORTAL) { + + _portal_attempt_connect(p_instance); + } + + if (!p_instance->room && (1<base_type)&INSTANCE_GEOMETRY_MASK) { + + _instance_validate_autorooms(p_instance); + } + + if (p_instance->base_type == INSTANCE_ROOM) { + + for(Set::Element *E=p_instance->room_info->owned_autoroom_geometry.front();E;E=E->next()) + _instance_validate_autorooms(E->get()); + } +#endif + +} + +void VisualServerScene::_update_instance_aabb(Instance *p_instance) { + + AABB new_aabb; + + ERR_FAIL_COND(p_instance->base_type!=VS::INSTANCE_NONE && !p_instance->base.is_valid()); + + switch(p_instance->base_type) { + case VisualServer::INSTANCE_NONE: { + + // do nothing + } break; + case VisualServer::INSTANCE_MESH: { + + new_aabb = VSG::storage->mesh_get_aabb(p_instance->base,p_instance->skeleton); + + } break; +#if 0 + case VisualServer::INSTANCE_MULTIMESH: { + + new_aabb = rasterizer->multimesh_get_aabb(p_instance->base); + + } break; + case VisualServer::INSTANCE_IMMEDIATE: { + + new_aabb = rasterizer->immediate_get_aabb(p_instance->base); + + + } break; + case VisualServer::INSTANCE_PARTICLES: { + + new_aabb = rasterizer->particles_get_aabb(p_instance->base); + + + } break; +#endif + case VisualServer::INSTANCE_LIGHT: { + + new_aabb = VSG::storage->light_get_aabb(p_instance->base); + + } break; +#if 0 + case VisualServer::INSTANCE_ROOM: { + + Room *room = room_owner.get( p_instance->base ); + ERR_FAIL_COND(!room); + new_aabb=room->bounds.get_aabb(); + + } break; + case VisualServer::INSTANCE_PORTAL: { + + Portal *portal = portal_owner.get( p_instance->base ); + ERR_FAIL_COND(!portal); + for (int i=0;ishape.size();i++) { + + Vector3 point( portal->shape[i].x, portal->shape[i].y, 0 ); + if (i==0) { + + new_aabb.pos=point; + new_aabb.size.z=0.01; // make it not flat for octree + } else { + + new_aabb.expand_to(point); + } + } + + } break; + case VisualServer::INSTANCE_BAKED_LIGHT: { + + BakedLight *baked_light = baked_light_owner.get( p_instance->base ); + ERR_FAIL_COND(!baked_light); + new_aabb=baked_light->octree_aabb; + + } break; + case VisualServer::INSTANCE_BAKED_LIGHT_SAMPLER: { + + BakedLightSampler *baked_light_sampler = baked_light_sampler_owner.get( p_instance->base ); + ERR_FAIL_COND(!baked_light_sampler); + float radius = baked_light_sampler->params[VS::BAKED_LIGHT_SAMPLER_RADIUS]; + + new_aabb=AABB(Vector3(-radius,-radius,-radius),Vector3(radius*2,radius*2,radius*2)); + + } break; +#endif + default: {} + } + + if (p_instance->extra_margin) + new_aabb.grow_by(p_instance->extra_margin); + + p_instance->aabb=new_aabb; + +} + + + +void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewport_size) { + + + + Camera *camera = camera_owner.getornull(p_camera); + ERR_FAIL_COND(!camera); + + Scenario *scenario = scenario_owner.getornull(p_scenario); + + render_pass++; + uint32_t camera_layer_mask=camera->visible_layers; + + + /* STEP 1 - SETUP CAMERA */ + CameraMatrix camera_matrix; + bool ortho=false; + + switch(camera->type) { + case Camera::ORTHOGONAL: { + + camera_matrix.set_orthogonal( + camera->size, + p_viewport_size.width / (float)p_viewport_size.height, + camera->znear, + camera->zfar, + camera->vaspect + + ); + ortho=true; + } break; + case Camera::PERSPECTIVE: { + + camera_matrix.set_perspective( + camera->fov, + p_viewport_size.width / (float)p_viewport_size.height, + camera->znear, + camera->zfar, + camera->vaspect + + ); + ortho=false; + + } break; + } + + +// rasterizer->set_camera(camera->transform, camera_matrix,ortho); + + Vector planes = camera_matrix.get_projection_planes(camera->transform); + + Plane near_plane(camera->transform.origin,-camera->transform.basis.get_axis(2).normalized()); + + /* STEP 2 - CULL */ + int cull_count = scenario->octree.cull_convex(planes,instance_cull_result,MAX_INSTANCE_CULL); + light_cull_count=0; +// light_samplers_culled=0; + +/* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); + print_line("OTO: "+itos(p_scenario->octree.get_octant_count())); +// print_line("OTE: "+itos(p_scenario->octree.get_elem_count())); + print_line("OTP: "+itos(p_scenario->octree.get_pair_count())); +*/ + + /* STEP 3 - PROCESS PORTALS, VALIDATE ROOMS */ + + + // compute portals +#if 0 + exterior_visited=false; + exterior_portal_cull_count=0; + + if (room_cull_enabled) { + for(int i=0;ilast_render_pass=render_pass; + + if (ins->base_type!=INSTANCE_PORTAL) + continue; + + if (ins->room) + continue; + + ERR_CONTINUE(exterior_portal_cull_count>=MAX_EXTERIOR_PORTALS); + exterior_portal_cull_result[exterior_portal_cull_count++]=ins; + + } + + room_cull_count = p_scenario->octree.cull_point(camera->transform.origin,room_cull_result,MAX_ROOM_CULL,NULL,(1< current_rooms; + Set portal_rooms; + //add to set + for(int i=0;ibase_type==INSTANCE_ROOM) { + current_rooms.insert(room_cull_result[i]); + } + if (room_cull_result[i]->base_type==INSTANCE_PORTAL) { + //assume inside that room if also inside the portal.. + if (room_cull_result[i]->room) { + portal_rooms.insert(room_cull_result[i]->room); + } + + SWAP(room_cull_result[i],room_cull_result[room_cull_count-1]); + room_cull_count--; + i--; + } + } + + //remove from set if it has a parent room or BSP doesn't contain + for(int i=0;iroom_info->affine_inverse.xform( camera->transform.origin ); + + if (!portal_rooms.has(r) && !r->room_info->room->bounds.point_is_inside(room_local_point)) { + + current_rooms.erase(r); + continue; + } + + //check parent + while (r->room) {// has parent room + + current_rooms.erase(r); + r=r->room; + } + + } + + if (current_rooms.size()) { + //camera is inside a room + // go through rooms + for(Set::Element *E=current_rooms.front();E;E=E->next()) { + _cull_room(camera,E->get()); + } + + } else { + //start from exterior + _cull_room(camera,NULL); + + } + } + +#endif + /* STEP 4 - REMOVE FURTHER CULLED OBJECTS, ADD LIGHTS */ + + for(int i=0;ilayer_mask)==0) { + + //failure + } else if (ins->base_type==VS::INSTANCE_LIGHT && ins->visible) { + + if (light_cull_count(ins->base_data); + + if (!light->geometries.empty()) { + //do not add this light if no geometry is affected by it.. + light_cull_result[light_cull_count]=ins; + light_instance_cull_result[light_cull_count]=light->instance; + + light_cull_count++; + } + +// rasterizer->light_instance_set_active_hint(ins->light_info->instance); + } + + } else if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK && ins->visible && ins->cast_shadows!=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { + + keep=true; +#if 0 + bool discarded=false; + + if (ins->draw_range_end>0) { + + float d = cull_range.nearp.distance_to(ins->data.transform.origin); + if (d<0) + d=0; + discarded=(ddraw_range_begin || d>=ins->draw_range_end); + + + } + + if (!discarded) { + + // test if this geometry should be visible + + if (room_cull_enabled) { + + + if (ins->visible_in_all_rooms) { + keep=true; + } else if (ins->room) { + + if (ins->room->room_info->last_visited_pass==render_pass) + keep=true; + } else if (ins->auto_rooms.size()) { + + + for(Set::Element *E=ins->auto_rooms.front();E;E=E->next()) { + + if (E->get()->room_info->last_visited_pass==render_pass) { + keep=true; + break; + } + } + } else if(exterior_visited) + keep=true; + } else { + + keep=true; + } + + + } + + + if (keep) { + // update cull range + float min,max; + ins->transformed_aabb.project_range_in_plane(cull_range.nearp,min,max); + + if (mincull_range.max) + cull_range.max=max; + + if (ins->sampled_light && ins->sampled_light->baked_light_sampler_info->last_pass!=render_pass) { + if (light_samplers_culledsampled_light; + ins->sampled_light->baked_light_sampler_info->last_pass=render_pass; + } + } + } +#endif + + + InstanceGeometryData * geom = static_cast(ins->base_data); + + if (geom->lighting_dirty) { + int l=0; + //only called when lights AABB enter/exit this geometry + ins->light_instances.resize(geom->lighting.size()); + + for (List::Element *E=geom->lighting.front();E;E=E->next()) { + + InstanceLightData * light = static_cast(E->get()->base_data); + + ins->light_instances[l++]=light->instance; + } + + geom->lighting_dirty=false; + } + + } + + if (!keep) { + // remove, no reason to keep + cull_count--; + SWAP( instance_cull_result[i], instance_cull_result[ cull_count ] ); + i--; + ins->last_render_pass=0; // make invalid + } else { + + ins->last_render_pass=render_pass; + } + } + + /* STEP 5 - PROCESS LIGHTS */ + + RID *directional_light_ptr=&light_instance_cull_result[light_cull_count]; + int directional_light_count=0; + + // directional lights + { + for (List::Element *E=scenario->directional_lights.front();E;E=E->next()) { + + if (light_cull_count+directional_light_count>=MAX_LIGHTS_CULLED) { + break; + } + + if (!E->get()->visible) + continue; + + InstanceLightData * light = static_cast(E->get()->base_data); + + + //check shadow.. + + +/* if (light && light->light_info->enabled && rasterizer->light_has_shadow(light->base_rid)) { + //rasterizer->light_instance_set_active_hint(light->light_info->instance); + _light_instance_update_shadow(light,p_scenario,camera,cull_range); + } +*/ + + //add to list + + + directional_light_ptr[directional_light_count++]=light->instance; + + } + } + +#if 0 + { //this should eventually change to + //assign shadows by distance to camera + SortArray sorter; + sorter.sort(light_cull_result,light_cull_count); + for (int i=0;ilight_has_shadow(ins->base_rid) || !shadows_enabled) + continue; + + /* for far shadows? + if (ins->version == ins->light_info->last_version && rasterizer->light_instance_has_far_shadow(ins->light_info->instance)) + continue; // didn't change + */ + + _light_instance_update_shadow(ins,p_scenario,camera,cull_range); + ins->light_info->last_version=ins->version; + } + } +#endif + /* ENVIRONMENT */ + + RID environment; + if (camera->env.is_valid()) //camera has more environment priority + environment=camera->env; + else if (scenario->environment.is_valid()) + environment=scenario->environment; + else + environment=scenario->fallback_environment; + +#if 0 + /* STEP 6 - SAMPLE BAKED LIGHT */ + + bool islinear =false; + if (environment.is_valid()) { + islinear = rasterizer->environment_is_fx_enabled(environment,VS::ENV_FX_SRGB); + } + + for(int i=0;itransform,light_sampler_cull_result[i],islinear); + } +#endif + /* STEP 7 - PROCESS GEOMETRY AND DRAW SCENE*/ + +#if 0 + // add lights + + { + List::Element *E=p_scenario->directional_lights.front(); + + + for(;E;E=E->next()) { + Instance *light = E->get().is_valid()?instance_owner.get(E->get()):NULL; + + ERR_CONTINUE(!light); + if (!light->light_info->enabled) + continue; + + rasterizer->add_light(light->light_info->instance); + light->light_info->last_add_pass=render_pass; + } + + for (int i=0;iadd_light(ins->light_info->instance); + ins->light_info->last_add_pass=render_pass; + } + } + // add geometry +#endif + + + VSG::scene_render->render_scene(camera->transform, camera_matrix,ortho,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count,directional_light_ptr,directional_light_count,environment); + +} + + + +void VisualServerScene::_update_dirty_instance(Instance *p_instance) { + + + if (p_instance->update_aabb) + _update_instance_aabb(p_instance); + + if (p_instance->update_materials) { + if (p_instance->base_type==VS::INSTANCE_MESH) { + p_instance->materials.resize(VSG::storage->mesh_get_surface_count(p_instance->base)); + } + } + + _update_instance(p_instance); + + p_instance->update_aabb=false; + p_instance->update_materials=false; + + _instance_update_list.remove( &p_instance->update_item ); +} + + +void VisualServerScene::update_dirty_instances() { + + while(_instance_update_list.first()) { + + _update_dirty_instance( _instance_update_list.first()->self() ); + } +} + +bool VisualServerScene::free(RID p_rid) { + + if (camera_owner.owns(p_rid)) { + + Camera *camera = camera_owner.get( p_rid ); + + camera_owner.free(p_rid); + memdelete(camera); + + } else if (scenario_owner.owns(p_rid)) { + + Scenario *scenario = scenario_owner.get( p_rid ); + + while(scenario->instances.first()) { + instance_set_scenario(scenario->instances.first()->self()->self,RID()); + } + + scenario_owner.free(p_rid); + memdelete(scenario); + + } else if (instance_owner.owns(p_rid)) { + // delete the instance + + update_dirty_instances(); + + Instance *instance = instance_owner.get(p_rid); + + instance_set_room(p_rid,RID()); + instance_set_scenario(p_rid,RID()); + instance_set_base(p_rid,RID()); + + if (instance->skeleton.is_valid()) + instance_attach_skeleton(p_rid,RID()); + + instance_owner.free(p_rid); + memdelete(instance); + } else { + return false; + } + + + return true; +} + +VisualServerScene *VisualServerScene::singleton=NULL; + +VisualServerScene::VisualServerScene() { + + + render_pass=1; + singleton=this; + +} diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h new file mode 100644 index 0000000000..ceec4af598 --- /dev/null +++ b/servers/visual/visual_server_scene.h @@ -0,0 +1,390 @@ +#ifndef VISUALSERVERSCENE_H +#define VISUALSERVERSCENE_H + +#include "servers/visual/rasterizer.h" + +#include "geometry.h" +#include "allocators.h" +#include "octree.h" +#include "self_list.h" + +class VisualServerScene { +public: + + + enum { + + MAX_INSTANCE_CULL=65536, + MAX_LIGHTS_CULLED=4096, + MAX_ROOM_CULL=32, + MAX_EXTERIOR_PORTALS=128, + }; + + uint64_t render_pass; + + + static VisualServerScene *singleton; +#if 0 + struct Portal { + + bool enabled; + float disable_distance; + Color disable_color; + float connect_range; + Vector shape; + Rect2 bounds; + + + Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; } + }; + + struct BakedLight { + + Rasterizer::BakedLightData data; + DVector sampler; + AABB octree_aabb; + Size2i octree_tex_size; + Size2i light_tex_size; + + }; + + struct BakedLightSampler { + + float params[BAKED_LIGHT_SAMPLER_MAX]; + int resolution; + Vector dp_cache; + + BakedLightSampler() { + params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0; + params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0; + params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0; + params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1; + resolution=16; + } + }; + + void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp); + +#endif + + + struct Camera : public RID_Data { + + enum Type { + PERSPECTIVE, + ORTHOGONAL + }; + Type type; + float fov; + float znear,zfar; + float size; + uint32_t visible_layers; + bool vaspect; + RID env; + + Transform transform; + + Camera() { + + visible_layers=0xFFFFFFFF; + fov=60; + type=PERSPECTIVE; + znear=0.1; zfar=100; + size=1.0; + vaspect=false; + + } + }; + + mutable RID_Owner camera_owner; + + virtual RID camera_create(); + virtual void camera_set_perspective(RID p_camera,float p_fovy_degrees, float p_z_near, float p_z_far); + virtual void camera_set_orthogonal(RID p_camera,float p_size, float p_z_near, float p_z_far); + virtual void camera_set_transform(RID p_camera,const Transform& p_transform); + virtual void camera_set_cull_mask(RID p_camera,uint32_t p_layers); + virtual void camera_set_environment(RID p_camera,RID p_env); + virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable); + + + /* + + struct RoomInfo { + + Transform affine_inverse; + Room *room; + List owned_geometry_instances; + List owned_portal_instances; + List owned_room_instances; + List owned_light_instances; //not used, but just for the sake of it + Set disconnected_child_portals; + Set owned_autoroom_geometry; + uint64_t last_visited_pass; + RoomInfo() { last_visited_pass=0; } + + }; + + struct InstancePortal { + + Portal *portal; + Set candidate_set; + Instance *connected; + uint64_t last_visited_pass; + + Plane plane_cache; + Vector transformed_point_cache; + + + PortalInfo() { connected=NULL; last_visited_pass=0;} + }; +*/ + + /* ENVIRONMENT API */ + + virtual RID environment_create(); + + virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); + virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0); + virtual void environment_set_bg_color(RID p_env,const Color& p_color); + virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0); + + virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); + virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); + + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper); + virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); + virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); + virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); + virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); + + + /* SCENARIO API */ + + struct Instance; + + struct Scenario : RID_Data { + + + VS::ScenarioDebugMode debug; + RID self; + // well wtf, balloon allocator is slower? + + Octree octree; + + List directional_lights; + RID environment; + RID fallback_environment; + + SelfList::List instances; + + Scenario() { debug=VS::SCENARIO_DEBUG_DISABLED; } + }; + + RID_Owner scenario_owner; + + static void* _instance_pair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int); + static void _instance_unpair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int,void*); + + virtual RID scenario_create(); + + virtual void scenario_set_debug(RID p_scenario,VS::ScenarioDebugMode p_debug_mode); + virtual void scenario_set_environment(RID p_scenario, RID p_environment); + virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment); + + + /* INSTANCING API */ + + struct InstanceBaseData { + + + virtual ~InstanceBaseData() {} + }; + + + + struct Instance : RasterizerScene::InstanceBase { + + RID self; + //scenario stuff + OctreeElementID octree_id; + Scenario *scenario; + SelfList scenario_item; + + //aabb stuff + bool update_aabb; + bool update_materials; + SelfList update_item; + + + AABB aabb; + AABB transformed_aabb; + float extra_margin; + uint32_t object_ID; + bool visible; + uint32_t layer_mask; + + float lod_begin; + float lod_end; + float lod_begin_hysteresis; + float lod_end_hysteresis; + RID lod_instance; + + Instance *room; + SelfList room_item; + bool visible_in_all_rooms; + + uint64_t last_render_pass; + uint64_t last_frame_pass; + + uint64_t version; // changes to this, and changes to base increase version + + InstanceBaseData *base_data; + + virtual void base_removed() { + + singleton->instance_set_base(self,RID()); + } + + virtual void base_changed() { + + singleton->_instance_queue_update(this,true,true); + } + + + Instance() : scenario_item(this), update_item(this), room_item(this) { + + octree_id=0; + scenario=NULL; + + + update_aabb=false; + update_materials=false; + + extra_margin=0; + + + object_ID=0; + visible=true; + layer_mask=1; + + lod_begin=0; + lod_end=0; + lod_begin_hysteresis=0; + lod_end_hysteresis=0; + + room=NULL; + visible_in_all_rooms=false; + + + + last_render_pass=0; + last_frame_pass=0; + version=1; + base_data=NULL; + + } + + ~Instance() { + + if (base_data) + memdelete(base_data); + + } + }; + + SelfList::List _instance_update_list; + void _instance_queue_update(Instance *p_instance,bool p_update_aabb,bool p_update_materials=false); + + + struct InstanceGeometryData : public InstanceBaseData { + + List lighting; + bool lighting_dirty; + + InstanceGeometryData() { + + lighting_dirty=false; + } + }; + + + struct InstanceLightData : public InstanceBaseData { + + struct PairInfo { + List::Element *L; //light iterator in geometry + Instance *geometry; + }; + + RID instance; + uint64_t last_hash; + List::Element *D; // directional light in scenario + + bool shadow_sirty; + + List geometries; + + InstanceLightData() { + + shadow_sirty=true; + D=NULL; + last_hash=0; + } + }; + + + Instance *instance_cull_result[MAX_INSTANCE_CULL]; + Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps + Instance *light_cull_result[MAX_LIGHTS_CULLED]; + RID light_instance_cull_result[MAX_LIGHTS_CULLED]; + int light_cull_count; + + + RID_Owner instance_owner; + + // from can be mesh, light, area and portal so far. + virtual RID instance_create(); // from can be mesh, light, poly, area and portal so far. + + virtual void instance_set_base(RID p_instance, RID p_base); // from can be mesh, light, poly, area and portal so far. + virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far. + virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); + virtual void instance_set_transform(RID p_instance, const Transform& p_transform); + virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); + virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); + virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); + + virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); + virtual void instance_set_exterior( RID p_instance, bool p_enabled ); + virtual void instance_set_room( RID p_instance, RID p_room ); + + virtual void instance_set_extra_visibility_margin( RID p_instance, real_t p_margin ); + + + // don't use these in a game! + virtual Vector instances_cull_aabb(const AABB& p_aabb, RID p_scenario=RID()) const; + virtual Vector instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario=RID()) const; + virtual Vector instances_cull_convex(const Vector& p_convex, RID p_scenario=RID()) const; + + + virtual void instance_geometry_set_flag(RID p_instance,VS::InstanceFlags p_flags,bool p_enabled); + virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting); + virtual void instance_geometry_set_material_override(RID p_instance, RID p_material); + + + virtual void instance_geometry_set_draw_range(RID p_instance,float p_min,float p_max,float p_min_margin,float p_max_margin); + virtual void instance_geometry_set_as_instance_lod(RID p_instance,RID p_as_lod_of_instance); + + + _FORCE_INLINE_ void _update_instance(Instance *p_instance); + _FORCE_INLINE_ void _update_instance_aabb(Instance *p_instance); + _FORCE_INLINE_ void _update_dirty_instance(Instance *p_instance); + + + void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size); + void update_dirty_instances(); + bool free(RID p_rid); + + VisualServerScene(); +}; + +#endif // VISUALSERVERSCENE_H diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index baf18b7a56..583b42bfc1 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -1,8 +1,11 @@ #include "visual_server_viewport.h" #include "visual_server_global.h" #include "visual_server_canvas.h" +#include "visual_server_scene.h" #include "globals.h" + + void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { /* Camera should always be BEFORE any other 3D */ @@ -58,6 +61,12 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { } } + + if (!p_viewport->disable_3d && p_viewport->camera.is_valid()) { + + VSG::scene->render_camera(p_viewport->camera,p_viewport->scenario,p_viewport->size); + } + if (!p_viewport->hide_canvas) { int i=0; @@ -248,6 +257,11 @@ void VisualServerViewport::draw_viewports() { ERR_CONTINUE( !vp->render_target.is_valid() ); + bool visible = vp->viewport_to_screen_rect!=Rect2() || vp->update_mode==VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode==VS::VIEWPORT_UPDATE_ONCE; + + if (!visible) + continue; + VSG::rasterizer->set_current_render_target(vp->render_target); _draw_viewport(vp); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 175dfd47d1..97825c172b 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -345,8 +345,754 @@ RID VisualServer::get_white_texture() { } +Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,DVector &r_vertex_array,int p_vertex_array_len,DVector &r_index_array,int p_index_array_len,AABB &r_aabb,Vector r_bone_aabb) { + + DVector::Write vw = r_vertex_array.write(); + + DVector::Write iw; + if (r_index_array.size()) { + iw=r_index_array.write(); + } + + int max_bone=0; + + + for(int ai=0;ai array = p_arrays[ai]; + ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + const Vector2* src=read.ptr(); + + // setting vertices means regenerating the AABB + Rect2 aabb; + + + if (p_format&ARRAY_COMPRESS_VERTEX) { + + for (int i=0;i array = p_arrays[ai]; + ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + const Vector3* src=read.ptr(); + + // setting vertices means regenerating the AABB + AABB aabb; + + + if (p_format&ARRAY_COMPRESS_VERTEX) { + + for (int i=0;i array = p_arrays[ai]; + ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + const Vector3* src=read.ptr(); + + // setting vertices means regenerating the AABB + + if (p_format&ARRAY_COMPRESS_NORMAL) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len*4, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + const real_t* src = read.ptr(); + + if (p_format&ARRAY_COMPRESS_TANGENT) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + const Color* src = read.ptr(); + + if (p_format&ARRAY_COMPRESS_COLOR) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len , ERR_INVALID_PARAMETER); + + DVector::Read read = array.read(); + + const Vector2 * src=read.ptr(); + + + + if (p_format&ARRAY_COMPRESS_TEX_UV) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len , ERR_INVALID_PARAMETER); + + DVector::Read read = array.read(); + + const Vector2 * src=read.ptr(); + + + + if (p_format&ARRAY_COMPRESS_TEX_UV2) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + + const real_t * src = read.ptr(); + + if (p_format&ARRAY_COMPRESS_WEIGHTS) { + + for (int i=0;i array = p_arrays[ai]; + + ERR_FAIL_COND_V( array.size() != p_vertex_array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); + + + DVector::Read read = array.read(); + + const int * src = read.ptr(); + + + if (!(p_format&ARRAY_FLAG_USE_16_BIT_BONES)) { + + for (int i=0;i indices = p_arrays[ai]; + ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( indices.size() != p_index_array_len, ERR_INVALID_PARAMETER ); + + /* determine wether using 16 or 32 bits indices */ + + DVector::Read read = indices.read(); + const int *src=read.ptr(); + + for (int i=0;i vertices = p_arrays[VS::ARRAY_VERTEX]; + DVector bones = p_arrays[VS::ARRAY_BONES]; + DVector weights = p_arrays[VS::ARRAY_WEIGHTS]; + + bool any_valid=false; + + if (vertices.size() && bones.size()==vertices.size()*4 && weights.size()==bones.size()) { + + int vs = vertices.size(); + DVector::Read rv =vertices.read(); + DVector::Read rb=bones.read(); + DVector::Read rw=weights.read(); + + AABB *bptr = r_bone_aabb.ptr(); + + for(int i=0;isize.x<0) { + //first + bptr[idx]=AABB(); + bptr[idx].pos=v; + any_valid=true; + } else { + bptr[idx].expand_to(v); + } + } + } + } + + if (!any_valid && first) { + + r_bone_aabb.clear(); + } + } + return OK; +} + + void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes,uint32_t p_compress_format) { + ERR_FAIL_INDEX( p_primitive, VS::PRIMITIVE_MAX ); + ERR_FAIL_COND(p_arrays.size()!=VS::ARRAY_MAX); + + uint32_t format=0; + + // validation + int index_array_len=0; + int array_len=0; + + for(int i=0;i v2 = var; + array_len=v2.size(); + } break; + case Variant::VECTOR3_ARRAY: { + DVector v3 = var; + array_len=v3.size(); + } break; + default: { + Array v = var; + array_len=v.size(); + } break; + } + + array_len=Vector3Array(p_arrays[i]).size(); + ERR_FAIL_COND(array_len==0); + } else if (i==VS::ARRAY_INDEX) { + + index_array_len=IntArray(p_arrays[i]).size(); + } + } + + ERR_FAIL_COND((format&VS::ARRAY_FORMAT_VERTEX)==0); // mandatory + + + if (p_blend_shapes.size()) { + //validate format for morphs + for(int i=0;i(1<<16)) { + + elem_size=4; + + } else { + elem_size=2; + } + offsets[i]=elem_size; + continue; + } break; + default: { + ERR_FAIL( ); + } + } + + print_line("type "+itos(i)+" size: "+itos(elem_size)+" offset "+itos(total_elem_size)); + offsets[i]=total_elem_size; + total_elem_size+=elem_size; + + + } + + print_line("total elemn size: "+itos(total_elem_size)); + + uint32_t mask = (1< vertex_array; + vertex_array.resize(array_size); + + int index_array_size = offsets[VS::ARRAY_INDEX]*index_array_len; + + print_line("index array size: "+itos(index_array_size)); + + DVector index_array; + index_array.resize(index_array_size); + + AABB aabb; + Vector bone_aabb; + + Error err = _surface_set_data(p_arrays,format,offsets,total_elem_size,vertex_array,array_len,index_array,index_array_len,aabb,bone_aabb); + + if (err) { + ERR_EXPLAIN("Invalid array format for surface"); + ERR_FAIL_COND(err!=OK); + } + + Vector > blend_shape_data; + + for(int i=0;i vertex_array_shape; + vertex_array_shape.resize(array_size); + DVector noindex; + + AABB laabb; + Error err = _surface_set_data(p_blend_shapes[i],format&~ARRAY_FORMAT_INDEX,offsets,total_elem_size,vertex_array,array_len,noindex,0,laabb,bone_aabb); + aabb.merge_with(laabb); + if (err) { + ERR_EXPLAIN("Invalid blend shape array format for surface"); + ERR_FAIL_COND(err!=OK); + } + + blend_shape_data.push_back(vertex_array_shape); + } + + mesh_add_surface(p_mesh,format,p_primitive,vertex_array,array_len,index_array,index_array_len,aabb,blend_shape_data,bone_aabb); } diff --git a/servers/visual_server.h b/servers/visual_server.h index 90e99710fd..eb20355efb 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -59,6 +59,9 @@ protected: RID test_material; RID material_2d[16]; + + Error _surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,DVector &r_vertex_array,int p_vertex_array_len,DVector &r_index_array,int p_index_array_len,AABB &r_aabb,Vector r_bone_aabb); + static VisualServer* (*create_func)(); static void _bind_methods(); public: @@ -207,6 +210,7 @@ public: ARRAY_COMPRESS_INDEX=1<<(ARRAY_INDEX+ARRAY_COMPRESS_BASE), ARRAY_FLAG_USE_2D_VERTICES=ARRAY_COMPRESS_INDEX<<1, + ARRAY_FLAG_USE_16_BIT_BONES=ARRAY_COMPRESS_INDEX<<2, ARRAY_COMPRESS_DEFAULT=ARRAY_COMPRESS_VERTEX|ARRAY_COMPRESS_NORMAL|ARRAY_COMPRESS_TANGENT|ARRAY_COMPRESS_COLOR|ARRAY_COMPRESS_TEX_UV|ARRAY_COMPRESS_TEX_UV2|ARRAY_COMPRESS_BONES|ARRAY_COMPRESS_WEIGHTS|ARRAY_COMPRESS_INDEX @@ -228,7 +232,7 @@ public: virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const Vector >& p_blend_shapes=Vector >())=0; + virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -530,7 +534,6 @@ public: virtual void scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode)=0; virtual void scenario_set_environment(RID p_scenario, RID p_environment)=0; - virtual RID scenario_get_environment(RID p_scenario, RID p_environment) const=0; virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment)=0; @@ -546,6 +549,7 @@ public: INSTANCE_REFLECTION_PROBE, INSTANCE_ROOM, INSTANCE_PORTAL, + INSTANCE_MAX, /*INSTANCE_BAKED_LIGHT, INSTANCE_BAKED_LIGHT_SAMPLER,*/ diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 55a4c6c934..38a7706acc 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2349,6 +2349,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed spatial_editor=p_spatial_editor; ViewportContainer *c=memnew(ViewportContainer); + c->set_stretch(true); add_child(c); c->set_area_as_parent_rect(); viewport = memnew( Viewport ); -- cgit v1.2.3 From cb34b70df13ad9f7942b0c363edc71cfd417bb21 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 21 Oct 2016 07:27:13 -0300 Subject: More scene work, can display a skybox --- drivers/gles3/rasterizer_canvas_gles3.cpp | 1 - drivers/gles3/rasterizer_scene_gles3.cpp | 225 ++++++++++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 66 ++++++++- drivers/gles3/rasterizer_storage_gles3.cpp | 137 ++++++++++++++++++ drivers/gles3/rasterizer_storage_gles3.h | 8 + drivers/gles3/shaders/SCsub | 1 + drivers/gles3/shaders/copy.glsl | 17 ++- drivers/gles3/shaders/cubemap_filter.glsl | 143 ++++++++++++++++++ scene/resources/environment.cpp | 175 +++++++++++++++++++++- scene/resources/environment.h | 54 ++++++- servers/visual/rasterizer.h | 21 +++ servers/visual/visual_server_raster.h | 12 +- servers/visual/visual_server_scene.cpp | 48 ------ servers/visual/visual_server_scene.h | 19 --- servers/visual_server.h | 16 +- 15 files changed, 860 insertions(+), 83 deletions(-) create mode 100644 drivers/gles3/shaders/cubemap_filter.glsl diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 237b3ec3fc..b2228a6cfa 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -117,7 +117,6 @@ void RasterizerCanvasGLES3::canvas_begin(){ glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); glClear(GL_COLOR_BUFFER_BIT); storage->frame.clear_request=false; - print_line("canvas clear?"); } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 121620594d..4ce2bd2f37 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1,5 +1,10 @@ #include "rasterizer_scene_gles3.h" #include "globals.h" + + + + + static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { p_array[ 0]=p_mtx.elements[0][0]; @@ -52,6 +57,121 @@ static _FORCE_INLINE_ void store_camera(const CameraMatrix& p_mtx, float* p_arra + +/* ENVIRONMENT API */ + +RID RasterizerSceneGLES3::environment_create(){ + + + Environment *env = memnew( Environment ); + + return environment_owner.make_rid(env); +} + +void RasterizerSceneGLES3::environment_set_background(RID p_env,VS::EnvironmentBG p_bg){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + env->bg_mode=p_bg; +} + +void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox, int p_radiance_size, int p_irradiance_size){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + if (env->skybox_color.is_valid()) { + env->skybox_color=RID(); + } + if (env->skybox_radiance.is_valid()) { + storage->free(env->skybox_radiance); + env->skybox_radiance=RID(); + } + if (env->skybox_irradiance.is_valid()) { + storage->free(env->skybox_irradiance); + env->skybox_irradiance=RID(); + } + + if (p_skybox.is_valid()) { + + env->skybox_color=p_skybox; + // env->skybox_radiance=storage->texture_create_pbr_cubemap(p_skybox,VS::PBR_CUBEMAP_RADIANCE,p_radiance_size); + //env->skybox_irradiance=storage->texture_create_pbr_cubemap(p_skybox,VS::PBR_CUBEMAP_IRRADIANCE,p_irradiance_size); + } + +} + +void RasterizerSceneGLES3::environment_set_skybox_scale(RID p_env,float p_scale) { + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->skybox_scale=p_scale; + +} + +void RasterizerSceneGLES3::environment_set_bg_color(RID p_env,const Color& p_color){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->bg_color=p_color; + +} +void RasterizerSceneGLES3::environment_set_bg_energy(RID p_env,float p_energy) { + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->energy=p_energy; + +} + +void RasterizerSceneGLES3::environment_set_canvas_max_layer(RID p_env,int p_max_layer){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->canvas_max_layer=p_max_layer; + +} +void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color& p_color, float p_energy, float p_skybox_energy){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->ambient_color=p_color; + env->ambient_anergy=p_energy; + env->skybox_ambient=p_skybox_energy; + +} + +void RasterizerSceneGLES3::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode){ + +} +void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ + +} + +void RasterizerSceneGLES3::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper){ + +} +void RasterizerSceneGLES3::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ + +} +void RasterizerSceneGLES3::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ + +} +void RasterizerSceneGLES3::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ + +} +void RasterizerSceneGLES3::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ + +} + + + + RID RasterizerSceneGLES3::light_instance_create(RID p_light) { @@ -493,6 +613,70 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g #endif } +void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { + + RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_skybox); + + ERR_FAIL_COND(!tex); + glActiveTexture(GL_TEXTURE0); + glBindTexture(tex->target,tex->tex_id); + + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glColorMask(1,1,1,1); + + float flip_sign = p_vflip?-1:1; + + Vector3 vertices[8]={ + Vector3(-1,-1*flip_sign,0.1), + Vector3( 0, 1, 0), + Vector3( 1,-1*flip_sign,0.1), + Vector3( 1, 1, 0), + Vector3( 1, 1*flip_sign,0.1), + Vector3( 1, 0, 0), + Vector3(-1, 1*flip_sign,0.1), + Vector3( 0, 0, 0), + + }; + + + + //skybox uv vectors + float vw,vh,zn; + p_projection.get_viewport_size(vw,vh); + zn=p_projection.get_z_near(); + + float scale=p_scale; + + for(int i=0;i<4;i++) { + + Vector3 uv=vertices[i*2+1]; + uv.x=(uv.x*2.0-1.0)*vw*scale; + uv.y=-(uv.y*2.0-1.0)*vh*scale; + uv.z=-zn; + vertices[i*2+1] = p_transform.basis.xform(uv).normalized(); + vertices[i*2+1].z = -vertices[i*2+1].z; + } + + glBindBuffer(GL_ARRAY_BUFFER,state.skybox_verts); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Vector3)*8,vertices); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + glBindVertexArray(state.skybox_array); + + storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_CUBEMAP,true); + storage->shaders.copy.bind(); + + glDrawArrays(GL_TRIANGLE_FAN,0,4); + + glBindVertexArray(0); + + storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_CUBEMAP,false); + +} + void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment){ @@ -561,7 +745,9 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); - if (true) { + Environment *env = environment_owner.getornull(p_environment); + + if (!env || env->bg_mode==VS::ENV_BG_CLEAR_COLOR) { if (storage->frame.clear_request) { @@ -570,6 +756,16 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM storage->frame.clear_request=false; } + } else if (env->bg_mode==VS::ENV_BG_COLOR) { + + + glClearColor( env->bg_color.r, env->bg_color.g, env->bg_color.b, env->bg_color.a ); + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + storage->frame.clear_request=false; + } else { + glClear(GL_DEPTH_BUFFER_BIT); + storage->frame.clear_request=false; + } state.current_depth_test=true; @@ -616,6 +812,12 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,false,false); + + if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { + + _draw_skybox(env->skybox_color,p_cam_projection,p_cam_transform,storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); + } + //_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); //glColorMask(1,1,1,1); @@ -793,6 +995,27 @@ void RasterizerSceneGLES3::initialize() { if (render_list.max_elements<1024) render_list.max_elements=1024; + + + { + //quad buffers + + glGenBuffers(1,&state.skybox_verts); + glBindBuffer(GL_ARRAY_BUFFER,state.skybox_verts); + glBufferData(GL_ARRAY_BUFFER,sizeof(Vector3)*8,NULL,GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + + glGenVertexArrays(1,&state.skybox_array); + glBindVertexArray(state.skybox_array); + glBindBuffer(GL_ARRAY_BUFFER,state.skybox_verts); + glVertexAttribPointer(VS::ARRAY_VERTEX,3,GL_FLOAT,GL_FALSE,sizeof(Vector3)*2,0); + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glVertexAttribPointer(VS::ARRAY_TEX_UV,3,GL_FLOAT,GL_FALSE,sizeof(Vector3)*2,((uint8_t*)NULL)+sizeof(Vector3)); + glEnableVertexAttribArray(VS::ARRAY_TEX_UV); + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + } render_list.init(); } diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 6fba777fc8..53088deb0d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -16,8 +16,6 @@ public: RasterizerStorageGLES3 *storage; - - struct State { bool current_depth_test; @@ -40,10 +38,70 @@ public: GLuint scene_ubo; - + GLuint skybox_verts; + GLuint skybox_array; } state; + + + + /* ENVIRONMENT API */ + + struct Environment : public RID_Data { + + VS::EnvironmentBG bg_mode; + + RID skybox_color; + RID skybox_radiance; + RID skybox_irradiance; + float skybox_scale; + + Color bg_color; + float energy; + float skybox_ambient; + + Color ambient_color; + float ambient_anergy; + float ambient_skybox_energy; + + int canvas_max_layer; + + + Environment() { + bg_mode=VS::ENV_BG_CLEAR_COLOR; + skybox_scale=1.0; + energy=1.0; + skybox_ambient=0; + ambient_anergy=1.0; + ambient_skybox_energy=0.0; + canvas_max_layer=0; + } + }; + + RID_Owner environment_owner; + + virtual RID environment_create(); + + virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size); + virtual void environment_set_skybox_scale(RID p_env,float p_scale); + virtual void environment_set_bg_color(RID p_env,const Color& p_color); + virtual void environment_set_bg_energy(RID p_env,float p_energy); + virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0); + + virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); + virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); + + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper); + virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); + virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); + virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); + virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); + + /* RENDER LIST */ + struct RenderList { enum { @@ -166,6 +224,8 @@ public: _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material); + void _draw_skybox(RID p_skybox, CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); + virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment); virtual bool free(RID p_rid); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index f633ef21cc..94ad2afabe 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -995,6 +995,104 @@ void RasterizerStorageGLES3::texture_set_shrink_all_x2_on_set_data(bool p_enable config.shrink_textures_x2=p_enable; } +RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution) const { + + Texture * texture = texture_owner.get(p_source); + ERR_FAIL_COND_V(!texture,RID()); + ERR_FAIL_COND_V(!(texture->flags&VS::TEXTURE_FLAG_CUBEMAP),RID()); + + bool use_float=true; + + if (p_resolution<0) { + p_resolution=texture->width; + } + + + glBindVertexArray(0); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); +#ifdef GLEW_ENABLED + glDisable(GL_POINT_SPRITE); + glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); +#endif + glDisable(GL_BLEND); + + + glActiveTexture(GL_TEXTURE1); + glBindTexture(texture->target, texture->tex_id); + + glActiveTexture(GL_TEXTURE0); + GLuint new_cubemap; + glGenTextures(1, &new_cubemap); + + + GLuint tmp_fb; + + glGenFramebuffers(1, &tmp_fb); + glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb); + + + int w = texture->width; + int h = texture->height; + + int lod=0; + + shaders.cubemap_filter.bind(); + + int mipmaps=6; + + int mm_level=mipmaps; + + while(mm_level) { + + for(int i=0;i<6;i++) { + glTexImage2D(_cube_side_enum[i], lod, use_float?GL_RGBA16F:GL_RGB10_A2, w, h, 0, GL_RGBA, use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV, NULL); + glTexParameteri(_cube_side_enum[i], GL_TEXTURE_BASE_LEVEL, lod); + glTexParameteri(_cube_side_enum[i], GL_TEXTURE_MAX_LEVEL, lod); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], new_cubemap, 0); + + glViewport(0,0,w,h); + glBindVertexArray(resources.quadie_array); + + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::FACE_ID,i); + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS,lod/float(mipmaps)); + + + glDrawArrays(GL_TRIANGLE_FAN,0,4); + glBindVertexArray(0); +#ifdef DEBUG_ENABLED + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); +#endif + } + + + + if (w>1) + w>>=1; + if (h>1) + h>>=1; + + lod++; + mm_level--; + + } + + + for(int i=0;i<6;i++) { + //restore ranges + glTexParameteri(_cube_side_enum[i], GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(_cube_side_enum[i], GL_TEXTURE_MAX_LEVEL, lod); + + } + + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + glDeleteFramebuffers(1, &tmp_fb); + + + return RID(); +} /* SHADER API */ @@ -3649,6 +3747,45 @@ void RasterizerStorageGLES3::initialize() { #else config.use_rgba_2d_shadows=true; #endif + + + //generic quadie for copying + + { + //quad buffers + + glGenBuffers(1,&resources.quadie); + glBindBuffer(GL_ARRAY_BUFFER,resources.quadie); + { + const float qv[16]={ + -1,-1, + 0, 0, + -1, 1, + 0, 1, + 1, 1, + 1, 1, + 1,-1, + 1, 0, + }; + + glBufferData(GL_ARRAY_BUFFER,sizeof(float)*16,qv,GL_STATIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + + + glGenVertexArrays(1,&resources.quadie_array); + glBindVertexArray(resources.quadie_array); + glBindBuffer(GL_ARRAY_BUFFER,resources.quadie); + glVertexAttribPointer(0,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,0); + glEnableVertexAttribArray(0); + glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,((uint8_t*)NULL)+8); + glEnableVertexAttribArray(1); + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + } + + shaders.cubemap_filter.init(); } void RasterizerStorageGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 950d65b9d0..c3022b3ac0 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -6,6 +6,7 @@ #include "shader_gles3.h" #include "shaders/copy.glsl.h" #include "shaders/canvas.glsl.h" +#include "shaders/cubemap_filter.glsl.h" #include "self_list.h" #include "shader_compiler_gles3.h" @@ -60,6 +61,8 @@ public: ShaderCompilerGLES3 compiler; + CubemapFilterShaderGLES3 cubemap_filter; + ShaderCompilerGLES3::IdentifierActions actions_canvas; ShaderCompilerGLES3::IdentifierActions actions_scene; } shaders; @@ -70,6 +73,9 @@ public: GLuint black_tex; GLuint normal_tex; + GLuint quadie; + GLuint quadie_array; + } resources; struct Info { @@ -178,6 +184,8 @@ public: virtual void texture_debug_usage(List *r_info); + virtual RID texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution=-1) const; + /* SHADER API */ diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index 0fa0e3b73a..afffe10316 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -5,4 +5,5 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('canvas.glsl'); env.GLES3_GLSL('canvas_shadow.glsl'); env.GLES3_GLSL('scene.glsl'); + env.GLES3_GLSL('cubemap_filter.glsl'); diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index aba280186a..eb58d66431 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -33,20 +33,31 @@ void main() { #ifdef USE_CUBEMAP in vec3 cube_interp; -uniform samplerCube source_cube; +uniform samplerCube source_cube; //texunit:0 #else in vec2 uv_interp; -uniform sampler2D source; +uniform sampler2D source; //texunit:0 #endif + +uniform float stuff; + in vec2 uv2_interp; -layout(location = 0) vec4 frag_color; //color:0 +layout(location = 0) out vec4 frag_color; void main() { //vec4 color = color_interp; +#ifdef USE_CUBEMAP + vec4 color = texture( source_cube, normalize(cube_interp) ); + +#else + vec4 color = texture( source, uv_interp ); +#endif + + frag_color = color; } diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl new file mode 100644 index 0000000000..f450f34113 --- /dev/null +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -0,0 +1,143 @@ +[vertex] + + +layout(location=0) in highp vec2 vertex; + +layout(location=1) in highp vec2 uv; + +out highp vec2 uv_interp; + +void main() { + + uv_interp=uv; + gl_Position=vec4(vertex,0,1); +} + +[fragment] + + +uniform samplerCube source_cube; //texunit:1 +uniform int face_id; +uniform float roughness; +in highp vec2 uv_interp; + + +layout(location = 0) vec4 frag_color; + + +vec3 texelCoordToVec(vec2 uv, int faceID) +{ + mat3 faceUvVectors[6]; + + // -x + faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z + faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face + + // +x + faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z + faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face + + // -y + faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z + faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face + + // +y + faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z + faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face + + // -z + faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x + faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face + + // +z + faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face + + // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2]. + vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2]; + return normalize(result); +} + +vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) +{ + float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph] + + // Compute distribution direction + float Phi = 2.0 * M_PI * Xi.x; + float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y)); + float SinTheta = sqrt(1.0 - CosTheta * CosTheta); + + // Convert to spherical direction + vec3 H; + H.x = SinTheta * cos(Phi); + H.y = SinTheta * sin(Phi); + H.z = CosTheta; + + vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 TangentX = normalize(cross(UpVector, N)); + vec3 TangentY = cross(N, TangentX); + + // Tangent to world space + return TangentX * H.x + TangentY * H.y + N * H.z; +} + +// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html +float GGX(float NdotV, float a) +{ + float k = a / 2.0; + return NdotV / (NdotV * (1.0 - k) + k); +} + +// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html +float G_Smith(float a, float nDotV, float nDotL) +{ + return GGX(nDotL, a * a) * GGX(nDotV, a * a); +} + +float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 +} + +vec2 Hammersley(uint i, uint N) { + return vec2(float(i)/float(N), radicalInverse_VdC(i)); +} + +#define SAMPLE_COUNT 1024 + +void main() { + + vec2 uv = (uv_interp * 2.0) - 1.0; + vec3 N = texelCoordToVec(uv, face_id); + + //vec4 color = color_interp; + vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); + + for(int sampleNum = 0; sampleNum < SAMPLE_COUNT; sampleNum++) { + vec2 xi = Hammersley(sampleNum, SAMPLE_COUNT); + vec2 xi = texture2DLod(Texture0, vec2(float(sampleNum) / float(SAMPLE_COUNT), 0.5), 0.0).xy; + + vec3 H = ImportanceSampleGGX( xi, roughness, N ); + vec3 V = N; + vec3 L = normalize(2.0 * dot( V, H ) * H - V); + + float ndotl = max(0.0, dot(N, L)); + vec3 s = textureCubeLod(u_skyCube, H, 0.0).rgb * ndotl; + + sum += vec4(s, 1.0); + } + sum /= sum.w; + + frag_color = vec4(sum.rgb, 1.0); +} + diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 6fecdef59d..85d16da915 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -28,20 +28,193 @@ /*************************************************************************/ #include "environment.h" #include "texture.h" - +#include "globals.h" +#include "servers/visual_server.h" RID Environment::get_rid() const { return environment; } + +void Environment::set_background(BGMode p_bg) { + + bg_mode=p_bg; + VS::get_singleton()->environment_set_background(environment,VS::EnvironmentBG(p_bg)); + _change_notify(); +} + +void Environment::set_skybox(const Ref& p_skybox){ + + bg_skybox=p_skybox; + + RID sb_rid; + if (bg_skybox.is_valid()) + sb_rid=bg_skybox->get_rid(); + print_line("skybox valid: "+itos(sb_rid.is_valid())); + + VS::get_singleton()->environment_set_skybox(environment,sb_rid,Globals::get_singleton()->get("rendering/skybox/radiance_cube_resolution"),Globals::get_singleton()->get("rendering/skybox/iradiance_cube_resolution")); +} + +void Environment::set_skybox_scale(float p_scale) { + + bg_skybox_scale=p_scale; + VS::get_singleton()->environment_set_skybox_scale(environment,p_scale); +} + +void Environment::set_bg_color(const Color& p_color){ + + bg_color=p_color; + VS::get_singleton()->environment_set_bg_color(environment,p_color); +} +void Environment::set_bg_energy(float p_energy){ + + bg_energy=p_energy; + VS::get_singleton()->environment_set_bg_energy(environment,p_energy); +} +void Environment::set_canvas_max_layer(int p_max_layer){ + + bg_canvas_max_layer=p_max_layer; + VS::get_singleton()->environment_set_canvas_max_layer(environment,p_max_layer); +} +void Environment::set_ambient_light_color(const Color& p_color){ + + ambient_color=p_color; + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); +} +void Environment::set_ambient_light_energy(float p_energy){ + + ambient_energy=p_energy; + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); +} +void Environment::set_ambient_light_skybox_energy(float p_energy){ + + ambient_skybox_energy=p_energy; + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); +} + +Environment::BGMode Environment::get_background() const{ + + return bg_mode; +} +Ref Environment::get_skybox() const{ + + return bg_skybox; +} + +float Environment::get_skybox_scale() const { + + return bg_skybox_scale; +} + +Color Environment::get_bg_color() const{ + + return bg_color; +} +float Environment::get_bg_energy() const{ + + return bg_energy; +} +int Environment::get_canvas_max_layer() const{ + + return bg_canvas_max_layer; +} +Color Environment::get_ambient_light_color() const{ + + return ambient_color; +} +float Environment::get_ambient_light_energy() const{ + + return ambient_energy; +} +float Environment::get_ambient_light_skybox_energy() const{ + + return ambient_skybox_energy; +} + + + +void Environment::_validate_property(PropertyInfo& property) const { + + if (property.name=="background/skybox" || property.name=="ambient_light/skybox_energy") { + if (bg_mode!=BG_SKYBOX) { + property.usage=PROPERTY_USAGE_NOEDITOR; + } + } + + if (property.name=="background/color") { + if (bg_mode!=BG_COLOR) { + property.usage=PROPERTY_USAGE_NOEDITOR; + } + } + + if (property.name=="background/canvas_max_layer") { + if (bg_mode!=BG_CANVAS) { + property.usage=PROPERTY_USAGE_NOEDITOR; + } + } + +} + void Environment::_bind_methods() { + ObjectTypeDB::bind_method(_MD("set_background","mode"),&Environment::set_background); + ObjectTypeDB::bind_method(_MD("set_skybox","skybox:CubeMap"),&Environment::set_skybox); + ObjectTypeDB::bind_method(_MD("set_skybox_scale","scale"),&Environment::set_skybox_scale); + ObjectTypeDB::bind_method(_MD("set_bg_color","color"),&Environment::set_bg_color); + ObjectTypeDB::bind_method(_MD("set_bg_energy","energy"),&Environment::set_bg_energy); + ObjectTypeDB::bind_method(_MD("set_canvas_max_layer","layer"),&Environment::set_canvas_max_layer); + ObjectTypeDB::bind_method(_MD("set_ambient_light_color","color"),&Environment::set_ambient_light_color); + ObjectTypeDB::bind_method(_MD("set_ambient_light_energy","energy"),&Environment::set_ambient_light_energy); + ObjectTypeDB::bind_method(_MD("set_ambient_light_skybox_energy","energy"),&Environment::set_ambient_light_skybox_energy); + + + ObjectTypeDB::bind_method(_MD("get_background"),&Environment::get_background); + ObjectTypeDB::bind_method(_MD("get_skybox:CubeMap"),&Environment::get_skybox); + ObjectTypeDB::bind_method(_MD("get_skybox_scale"),&Environment::get_skybox_scale); + ObjectTypeDB::bind_method(_MD("get_bg_color"),&Environment::get_bg_color); + ObjectTypeDB::bind_method(_MD("get_bg_energy"),&Environment::get_bg_energy); + ObjectTypeDB::bind_method(_MD("get_canvas_max_layer"),&Environment::get_canvas_max_layer); + ObjectTypeDB::bind_method(_MD("get_ambient_light_color"),&Environment::get_ambient_light_color); + ObjectTypeDB::bind_method(_MD("get_ambient_light_energy"),&Environment::get_ambient_light_energy); + ObjectTypeDB::bind_method(_MD("get_ambient_light_skybox_energy"),&Environment::get_ambient_light_skybox_energy); + + + ADD_PROPERTY(PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Clear Color,Custom Color,Skybox,Canvas,Keep"),_SCS("set_background"),_SCS("get_background") ); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"background/skybox",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_skybox"),_SCS("get_skybox") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/skybox_scale",PROPERTY_HINT_RANGE,"0,32,0.01"),_SCS("set_skybox_scale"),_SCS("get_skybox_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_bg_color"),_SCS("get_bg_color") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_bg_energy"),_SCS("get_bg_energy") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"background/canvas_max_layer",PROPERTY_HINT_RANGE,"-1000,1000,1"),_SCS("set_canvas_max_layer"),_SCS("get_canvas_max_layer") ); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_light/color"),_SCS("set_ambient_light_color"),_SCS("get_ambient_light_color") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_skybox_energy"),_SCS("get_ambient_light_skybox_energy") ); + + GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution",256); + GLOBAL_DEF("rendering/skybox/radiance_cube_resolution",64); + + BIND_CONSTANT(BG_KEEP); + BIND_CONSTANT(BG_CLEAR_COLOR); + BIND_CONSTANT(BG_COLOR); + BIND_CONSTANT(BG_SKYBOX); + BIND_CONSTANT(BG_CANVAS); + BIND_CONSTANT(BG_MAX); + BIND_CONSTANT(GLOW_BLEND_MODE_ADDITIVE); + BIND_CONSTANT(GLOW_BLEND_MODE_SCREEN); + BIND_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); + BIND_CONSTANT(GLOW_BLEND_MODE_DISABLED); } Environment::Environment() { + bg_mode=BG_CLEAR_COLOR; + bg_energy=1.0; + bg_canvas_max_layer=0; + ambient_energy=1.0; + ambient_skybox_energy=0; + + environment = VS::get_singleton()->environment_create(); } diff --git a/scene/resources/environment.h b/scene/resources/environment.h index f8ea0cb36f..0435ffc6cb 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -31,28 +31,80 @@ #include "resource.h" #include "servers/visual_server.h" +#include "scene/resources/texture.h" class Environment : public Resource { OBJ_TYPE(Environment,Resource); public: + enum BGMode { -private: + BG_CLEAR_COLOR, + BG_COLOR, + BG_SKYBOX, + BG_CANVAS, + BG_KEEP, + BG_MAX + }; + enum GlowBlendMode { + GLOW_BLEND_MODE_ADDITIVE, + GLOW_BLEND_MODE_SCREEN, + GLOW_BLEND_MODE_SOFTLIGHT, + GLOW_BLEND_MODE_DISABLED, + }; +private: RID environment; + BGMode bg_mode; + Ref bg_skybox; + float bg_skybox_scale; + Color bg_color; + float bg_energy; + int bg_canvas_max_layer; + Color ambient_color; + float ambient_energy; + float ambient_skybox_energy; + protected: static void _bind_methods(); + virtual void _validate_property(PropertyInfo& property) const; + public: + + void set_background(BGMode p_bg); + void set_skybox(const Ref& p_skybox); + void set_skybox_scale(float p_scale); + void set_bg_color(const Color& p_color); + void set_bg_energy(float p_energy); + void set_canvas_max_layer(int p_max_layer); + void set_ambient_light_color(const Color& p_color); + void set_ambient_light_energy(float p_energy); + void set_ambient_light_skybox_energy(float p_energy); + + BGMode get_background() const; + Ref get_skybox() const; + float get_skybox_scale() const; + Color get_bg_color() const; + float get_bg_energy() const; + int get_canvas_max_layer() const; + Color get_ambient_light_color() const; + float get_ambient_light_energy() const; + float get_ambient_light_skybox_energy() const; + + virtual RID get_rid() const; Environment(); ~Environment(); }; +VARIANT_ENUM_CAST(Environment::BGMode) +VARIANT_ENUM_CAST(Environment::GlowBlendMode) + #endif // ENVIRONMENT_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index d3f27687ca..81cdcf6a25 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -39,6 +39,26 @@ class RasterizerScene { public: + /* ENVIRONMENT API */ + + virtual RID environment_create()=0; + + virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size)=0; + virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; + virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; + virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; + virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0)=0; + + virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0; + virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; + + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0; + virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0; + virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0; + virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0; struct InstanceBase : RID_Data { @@ -126,6 +146,7 @@ public: virtual void texture_debug_usage(List *r_info)=0; + virtual RID texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution=-1) const=0; /* SHADER API */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 62d45f8206..a2502e89f9 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -620,6 +620,7 @@ public: BIND1RC(uint32_t,texture_get_width,RID) BIND1RC(uint32_t,texture_get_height,RID) BIND3(texture_set_size_override,RID,int,int) + BIND3RC(RID,texture_create_pbr_cubemap,RID,PBRCubeMapMode,int) @@ -848,15 +849,17 @@ public: #undef BINDBASE //from now on, calls forwarded to this singleton -#define BINDBASE VSG::scene +#define BINDBASE VSG::scene_render BIND0R(RID,environment_create) BIND2(environment_set_background,RID ,EnvironmentBG ) - BIND3(environment_set_skybox,RID,RID ,float ) + BIND4(environment_set_skybox,RID,RID ,int,int ) + BIND2(environment_set_skybox_scale,RID,float) BIND2(environment_set_bg_color,RID,const Color& ) + BIND2(environment_set_bg_energy,RID,float ) BIND2(environment_set_canvas_max_layer,RID,int ) - BIND3(environment_set_ambient_light,RID,const Color& ,float ) + BIND4(environment_set_ambient_light,RID,const Color& ,float,float ) BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) @@ -871,6 +874,9 @@ public: /* SCENARIO API */ +#undef BINDBASE +#define BINDBASE VSG::scene + BIND0R(RID,scenario_create) BIND2(scenario_set_debug,RID,ScenarioDebugMode ) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index a3b1d76fb8..8fdf3d160d 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -69,54 +69,6 @@ void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera,bool p_enabl } - -/* ENVIRONMENT API */ - -RID VisualServerScene::environment_create(){ - - return RID(); -} - -void VisualServerScene::environment_set_background(RID p_env,VS::EnvironmentBG p_bg){ - -} -void VisualServerScene::environment_set_skybox(RID p_env,RID p_skybox,float p_energy){ - -} -void VisualServerScene::environment_set_bg_color(RID p_env,const Color& p_color){ - -} -void VisualServerScene::environment_set_canvas_max_layer(RID p_env,int p_max_layer){ - -} -void VisualServerScene::environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy){ - -} - -void VisualServerScene::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode){ - -} -void VisualServerScene::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ - -} - -void VisualServerScene::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper){ - -} -void VisualServerScene::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ - -} -void VisualServerScene::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ - -} -void VisualServerScene::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ - -} -void VisualServerScene::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ - -} - - /* SCENARIO API */ diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index ceec4af598..515d52db7b 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -139,25 +139,6 @@ public: }; */ - /* ENVIRONMENT API */ - - virtual RID environment_create(); - - virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); - virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0); - virtual void environment_set_bg_color(RID p_env,const Color& p_color); - virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0); - - virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); - virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); - - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper); - virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); - virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); - virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); - virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); - /* SCENARIO API */ diff --git a/servers/visual_server.h b/servers/visual_server.h index eb20355efb..11828c7d26 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -125,6 +125,13 @@ public: virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0; + enum PBRCubeMapMode { + PBR_CUBEMAP_RADIANCE, + PBR_CUBEMAP_IRRADIANCE, + }; + + virtual RID texture_create_pbr_cubemap(RID p_source,PBRCubeMapMode p_mode,int p_resolution=-1) const=0; + struct TextureInfo { RID texture; Size2 size; @@ -478,18 +485,21 @@ public: enum EnvironmentBG { - ENV_BG_KEEP, + ENV_BG_CLEAR_COLOR, ENV_BG_COLOR, ENV_BG_SKYBOX, ENV_BG_CANVAS, + ENV_BG_KEEP, ENV_BG_MAX }; virtual void environment_set_background(RID p_env,EnvironmentBG p_bg)=0; - virtual void environment_set_skybox(RID p_env,RID p_skybox,float p_energy=1.0)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size)=0; + virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; + virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0)=0; + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0)=0; //set default SSAO options //set default SSR options -- cgit v1.2.3 From 53d8f2b1ec1d86b189800b7fe156c464fdf9e380 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 27 Oct 2016 11:50:26 -0300 Subject: PBR more or less working, still working on bringing gizmos back --- doc/base/classes.xml | 4 +- drivers/gles3/rasterizer_scene_gles3.cpp | 709 +++++++++++++++++-- drivers/gles3/rasterizer_scene_gles3.h | 138 +++- drivers/gles3/rasterizer_storage_gles3.cpp | 226 ++++-- drivers/gles3/rasterizer_storage_gles3.h | 26 +- drivers/gles3/shader_compiler_gles3.cpp | 81 ++- drivers/gles3/shader_gles3.cpp | 1 + drivers/gles3/shader_gles3.h | 1 + drivers/gles3/shaders/cubemap_filter.glsl | 59 +- drivers/gles3/shaders/scene.glsl | 282 ++++++-- modules/gridmap/grid_map.cpp | 4 +- platform/iphone/rasterizer_iphone.cpp | 16 +- platform/iphone/rasterizer_iphone.h | 20 +- scene/3d/light.cpp | 156 ++++- scene/3d/light.h | 41 +- scene/3d/particles.cpp | 10 +- scene/main/scene_main_loop.cpp | 52 +- scene/main/scene_main_loop.h | 12 + scene/main/viewport.cpp | 2 +- scene/register_scene_types.cpp | 11 +- scene/resources/environment.cpp | 27 +- scene/resources/environment.h | 6 +- scene/resources/material.cpp | 754 ++++++++++++++++++++- scene/resources/material.h | 291 +++++++- servers/visual/rasterizer.cpp | 98 +-- servers/visual/rasterizer.h | 60 +- servers/visual/shader_language.cpp | 42 +- servers/visual/shader_types.cpp | 16 +- servers/visual/visual_server_raster.cpp | 20 +- servers/visual/visual_server_raster.h | 4 +- servers/visual/visual_server_scene.cpp | 63 +- servers/visual_server.cpp | 7 - servers/visual_server.h | 19 +- tools/editor/io_plugins/editor_import_collada.cpp | 26 +- .../io_plugins/editor_scene_import_plugin.cpp | 30 +- .../io_plugins/editor_scene_importer_fbxconv.cpp | 24 +- tools/editor/plugins/baked_light_baker.cpp | 10 +- .../plugins/collision_polygon_editor_plugin.cpp | 20 +- .../plugins/collision_polygon_editor_plugin.h | 4 +- tools/editor/plugins/path_editor_plugin.cpp | 12 +- tools/editor/plugins/path_editor_plugin.h | 4 +- tools/editor/plugins/spatial_editor_plugin.cpp | 56 +- tools/editor/plugins/spatial_editor_plugin.h | 8 +- tools/editor/spatial_editor_gizmos.cpp | 98 +-- tools/editor/spatial_editor_gizmos.h | 56 +- 45 files changed, 3020 insertions(+), 586 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 9453cdc77d..df1d0262ac 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -13434,12 +13434,12 @@ - + Simple Material with a fixed parameter set. - FixedMaterial is a simple type of material [Resource], which contains a fixed amount of parameters. It is the only type of material supported in fixed-pipeline devices and APIs. It is also an often a better alternative to [ShaderMaterial] for most simple use cases. + FixedSpatialMaterial is a simple type of material [Resource], which contains a fixed amount of parameters. It is the only type of material supported in fixed-pipeline devices and APIs. It is also an often a better alternative to [ShaderMaterial] for most simple use cases. diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 4ce2bd2f37..aadf9e6336 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -75,7 +75,7 @@ void RasterizerSceneGLES3::environment_set_background(RID p_env,VS::EnvironmentB env->bg_mode=p_bg; } -void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox, int p_radiance_size, int p_irradiance_size){ +void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox, int p_radiance_size){ Environment *env=environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -87,15 +87,12 @@ void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox, int p storage->free(env->skybox_radiance); env->skybox_radiance=RID(); } - if (env->skybox_irradiance.is_valid()) { - storage->free(env->skybox_irradiance); - env->skybox_irradiance=RID(); - } + if (p_skybox.is_valid()) { env->skybox_color=p_skybox; - // env->skybox_radiance=storage->texture_create_pbr_cubemap(p_skybox,VS::PBR_CUBEMAP_RADIANCE,p_radiance_size); + env->skybox_radiance=storage->texture_create_radiance_cubemap(p_skybox,p_radiance_size); //env->skybox_irradiance=storage->texture_create_pbr_cubemap(p_skybox,VS::PBR_CUBEMAP_IRRADIANCE,p_irradiance_size); } @@ -123,7 +120,7 @@ void RasterizerSceneGLES3::environment_set_bg_energy(RID p_env,float p_energy) { Environment *env=environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - env->energy=p_energy; + env->bg_energy=p_energy; } @@ -135,14 +132,14 @@ void RasterizerSceneGLES3::environment_set_canvas_max_layer(RID p_env,int p_max_ env->canvas_max_layer=p_max_layer; } -void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color& p_color, float p_energy, float p_skybox_energy){ +void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color& p_color, float p_energy, float p_skybox_contribution){ Environment *env=environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->ambient_color=p_color; - env->ambient_anergy=p_energy; - env->skybox_ambient=p_skybox_energy; + env->ambient_energy=p_energy; + env->ambient_skybox_contribution=p_skybox_contribution; } @@ -174,13 +171,28 @@ void RasterizerSceneGLES3::environment_set_color_correction(RID p_env,bool p_ena RID RasterizerSceneGLES3::light_instance_create(RID p_light) { + LightInstance *light_instance = memnew( LightInstance ); + + light_instance->light=p_light; + light_instance->light_ptr=storage->light_owner.getornull(p_light); + + glGenBuffers(1, &light_instance->light_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, light_instance->light_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(LightInstance::LightDataUBO), NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + - return RID(); + ERR_FAIL_COND_V(!light_instance->light_ptr,RID()); + + return light_instance_owner.make_rid(light_instance); } void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance,const Transform& p_transform){ + LightInstance *light_instance = light_instance_owner.getornull(p_light_instance); + ERR_FAIL_COND(!light_instance); + light_instance->transform=p_transform; } @@ -247,11 +259,13 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m //material parameters + state.scene_shader.set_custom_shader(p_material->shader->custom_code_id); bool rebind = state.scene_shader.bind(); if (p_material->ubo_id) { + glBindBufferBase(GL_UNIFORM_BUFFER,1,p_material->ubo_id); } @@ -267,6 +281,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m RasterizerStorageGLES3::Texture *t = storage->texture_owner.getornull( textures[i] ); if (!t) { //check hints + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); continue; } @@ -328,7 +343,14 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } -void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,bool p_reverse_cull,bool p_alpha_pass) { +void RasterizerSceneGLES3::_setup_light(LightInstance *p_light) { + + + glBindBufferBase(GL_UNIFORM_BUFFER,3,p_light->light_ubo); //bind light uniform +} + + +void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass) { if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { //p_reverse_cull=!p_reverse_cull; @@ -337,8 +359,22 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glFrontFace(GL_CW); } + bool shadow=false; + glBindBufferBase(GL_UNIFORM_BUFFER,0,state.scene_ubo); //bind globals ubo + + glBindBufferBase(GL_UNIFORM_BUFFER,2,state.env_radiance_ubo); //bind environment radiance info + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-1); + glBindTexture(GL_TEXTURE_2D,state.brdf_texture); + + if (p_base_env) { + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); + glBindTexture(p_base_env->target,p_base_env->tex_id); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,true); + } + + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); state.current_blend_mode=-1; @@ -349,6 +385,11 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e RasterizerStorageGLES3::Geometry* prev_geometry=NULL; VS::InstanceType prev_base_type = VS::INSTANCE_MAX; + int prev_light_type=-1; + int prev_light_index=-1; + int prev_blend=-1; + int current_blend_mode=-1; + for (int i=0;isort_key>>RenderList::SORT_KEY_LIGHT_TYPE_SHIFT)&0xF; + int light_index=(e->sort_key>>RenderList::SORT_KEY_LIGHT_INDEX_SHIFT)&0xFFFF; + + bool additive=false; + + if (!shadow) { +#if 0 + if (texscreen_used && !texscreen_copied && material->shader_cache && material->shader_cache->valid && material->shader_cache->has_texscreen) { + texscreen_copied=true; + _copy_to_texscreen(); + + //force reset state + prev_material=NULL; + prev_light=0x777E; + prev_geometry_cmp=NULL; + prev_light_type=0xEF; + prev_skeleton =NULL; + prev_sort_flags=0xFF; + prev_morph_values=NULL; + prev_receive_shadows_state=-1; + glEnable(GL_BLEND); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + + } +#endif + if (light_type!=prev_light_type /* || receive_shadows_state!=prev_receive_shadows_state*/) { + + if (material->shader->spatial.unshaded/* || current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); + + //state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); + } else { + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,light_type!=0xF); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,light_type==VS::LIGHT_DIRECTIONAL); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,light_type==VS::LIGHT_OMNI); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,light_type==VS::LIGHT_SPOT); + /* + if (receive_shadows_state==1) { + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_SHADOW,(light_type&0x8)); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM,(light_type&0x10)); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,(light_type&0x20)); + } + else { + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_SHADOW,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); + } + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); + */ + } + + rebind=true; + } + + + if (!*e->additive_ptr) { + + additive=false; + *e->additive_ptr=true; + } else { + additive=true; + } + + bool desired_blend=false; + int desired_blend_mode=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX; + + if (additive) { + desired_blend=true; + desired_blend_mode=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD; + } else { + desired_blend=p_alpha_pass; + desired_blend_mode=material->shader->spatial.blend_mode; + } + + if (prev_blend!=desired_blend) { + + if (desired_blend) { + glEnable(GL_BLEND); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glColorMask(1,1,1,0); + } + } else { + glDisable(GL_BLEND); + glColorMask(1,1,1,1); + } + + prev_blend=desired_blend; + } + + if (desired_blend && desired_blend_mode!=current_blend_mode) { + + + switch(desired_blend_mode) { + + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: { + + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE); + + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: { + + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + } break; + + } + + current_blend_mode=desired_blend_mode; + } + } + + if (light_index!=prev_light_index) { + if (light_index!=0xFFFF) { //not unshaded + _setup_light(light_instances[light_index]); + } + } + if (material!=prev_material || rebind) { rebind = _setup_material(material,p_alpha_pass); @@ -396,6 +582,7 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g RasterizerStorageGLES3::Material *m=NULL; RID m_src=p_instance->material_override.is_valid() ? p_instance->material_override :(p_material>=0?p_instance->materials[p_material]:p_geometry->material); + /* #ifdef DEBUG_ENABLED if (current_debug==VS::SCENARIO_DEBUG_OVERDRAW) { @@ -404,8 +591,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g #endif */ + if (m_src.is_valid()) { m=storage->material_owner.getornull( m_src ); + if (!m->shader) { m=NULL; } @@ -419,9 +608,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g - //bool has_base_alpha=(m->shader_cache && m->shader_cache->has_alpha); - //bool has_blend_alpha=m->blend_mode!=VS::MATERIAL_BLEND_MODE_MIX || m->flags[VS::MATERIAL_FLAG_ONTOP]; - bool has_alpha = false; //has_base_alpha || has_blend_alpha; + bool has_base_alpha=(m->shader->spatial.uses_alpha); + bool has_blend_alpha=m->shader->spatial.blend_mode!=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || m->shader->spatial.ontop; + bool has_alpha = has_base_alpha || has_blend_alpha; + bool shadow = false; #if 0 if (shadow) { @@ -488,12 +678,13 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g e->additive_ptr=&e->additive; e->sort_key=0; + if (e->geometry->last_pass!=render_pass) { e->geometry->last_pass=render_pass; e->geometry->index=current_geometry_index++; } - e->sort_key|=uint64_t(e->instance->base_type)<sort_key|=uint64_t(e->geometry->index)<sort_key|=uint64_t(e->instance->base_type)<material->last_pass!=render_pass) { @@ -502,7 +693,6 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g } e->sort_key|=uint64_t(e->material->index)<sort_key|=uint64_t(e->instance->depth_layer)<geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) @@ -510,42 +700,45 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g bool mirror = e->instance->mirror; -// if (m->flags[VS::MATERIAL_FLAG_INVERT_FACES]) -// e->mirror=!e->mirror; + if (m->shader->spatial.cull_mode==RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { + mirror=!mirror; + } if (mirror) { e->sort_key|=RenderList::SORT_KEY_MIRROR_FLAG; } //e->light_type=0xFF; // no lights! - e->sort_key|=uint64_t(0xF)<sort_key|=uint64_t(0xFFFF)<depth_draw_mode==VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA) { + + if (!shadow && !has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode==RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //if nothing exists, add this element as opaque too - RenderList::Element *oe = opaque_render_list.add_element(); + RenderList::Element *oe = render_list.add_element(); if (!oe) return; - memcpy(oe,e,sizeof(RenderList::Element)); + copymem(oe,e,sizeof(RenderList::Element)); oe->additive_ptr=&oe->additive; } -*/ -#if 0 - if (shadow || m->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug==VS::SCENARIO_DEBUG_SHADELESS) { - e->light_type=0x7F; //unshaded is zero + + + if (shadow || m->shader->spatial.unshaded /*|| current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { + + e->sort_key=RenderList::SORT_KEY_LIGHT_INDEX_UNSHADED; + e->sort_key|=uint64_t(0xF)<sort_key|=uint64_t(0xFFFF)<sort_key; - uint8_t light_type = VS::LIGHT_DIRECTIONAL; + for(int i=0;ibase->shadow_enabled) { light_type|=0x8; if (directional_lights[i]->base->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) @@ -554,22 +747,24 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g light_type|=0x30; } +*/ RenderList::Element *ec; if (duplicate) { - - ec = render_list->add_element(); - memcpy(ec,e,sizeof(RenderList::Element)); + ec = render_list.add_element(); + copymem(ec,e,sizeof(RenderList::Element)); } else { ec=e; duplicate=true; } - ec->light_type=light_type; - ec->light=sort_key; ec->additive_ptr=&e->additive; + ec->sort_key|=uint64_t(directional_light_instances[i]->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; + ec->sort_key|=uint64_t(VS::LIGHT_DIRECTIONAL) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; + + lighted=true; } @@ -580,37 +775,45 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g for(int i=0;ilast_pass!=scene_pass) //lit by light not in visible scene + LightInstance *li=light_instance_owner.getptr( liptr[i] ); + + if (!li || li->last_pass!=render_pass) //lit by light not in visible scene continue; - uint8_t light_type=li->base->type|0x40; //penalty to ensure directionals always go first - if (li->base->shadow_enabled) { - light_type|=0x8; - } - uint16_t sort_key =li->sort_key; + + +// if (li->base->shadow_enabled) { +// light_type|=0x8; +// } RenderList::Element *ec; if (duplicate) { - ec = render_list->add_element(); - memcpy(ec,e,sizeof(RenderList::Element)); + ec = render_list.add_element(); + copymem(ec,e,sizeof(RenderList::Element)); } else { duplicate=true; ec=e; } - ec->light_type=light_type; - ec->light=sort_key; ec->additive_ptr=&e->additive; + ec->sort_key|=uint64_t(li->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; + ec->sort_key|=uint64_t(li->light_ptr->type) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; + + lighted=true; } + if (!lighted) { + e->sort_key|=uint64_t(0xE)<sort_key|=uint64_t(0xFFFF)<frame.time[i]; } + //bg and ambient + if (env) { + state.ubo_data.bg_energy=env->bg_energy; + state.ubo_data.ambient_energy=env->ambient_energy; + Color linear_ambient_color = env->ambient_color.to_linear(); + state.ubo_data.ambient_light_color[0]=linear_ambient_color.r; + state.ubo_data.ambient_light_color[1]=linear_ambient_color.g; + state.ubo_data.ambient_light_color[2]=linear_ambient_color.b; + state.ubo_data.ambient_light_color[3]=linear_ambient_color.a; + + Color bg_color; + + switch(env->bg_mode) { + case VS::ENV_BG_CLEAR_COLOR: { + bg_color=storage->frame.clear_request_color.to_linear(); + } break; + case VS::ENV_BG_COLOR: { + bg_color=env->bg_color.to_linear(); + } break; + default: { + bg_color=Color(0,0,0,1); + } break; + } + + state.ubo_data.bg_color[0]=bg_color.r; + state.ubo_data.bg_color[1]=bg_color.g; + state.ubo_data.bg_color[2]=bg_color.b; + state.ubo_data.bg_color[3]=bg_color.a; + + state.env_radiance_data.ambient_contribution=env->ambient_skybox_contribution; + } else { + state.ubo_data.bg_energy=1.0; + state.ubo_data.ambient_energy=1.0; + //use from clear color instead, since there is no ambient + Color linear_ambient_color = storage->frame.clear_request_color.to_linear(); + state.ubo_data.ambient_light_color[0]=linear_ambient_color.r; + state.ubo_data.ambient_light_color[1]=linear_ambient_color.g; + state.ubo_data.ambient_light_color[2]=linear_ambient_color.b; + state.ubo_data.ambient_light_color[3]=linear_ambient_color.a; + + state.ubo_data.bg_color[0]=linear_ambient_color.r; + state.ubo_data.bg_color[1]=linear_ambient_color.g; + state.ubo_data.bg_color[2]=linear_ambient_color.b; + state.ubo_data.bg_color[3]=linear_ambient_color.a; + + state.env_radiance_data.ambient_contribution=0; + + } glBindBuffer(GL_UNIFORM_BUFFER, state.scene_ubo); glBufferSubData(GL_UNIFORM_BUFFER, 0,sizeof(State::SceneDataUBO), &state.ubo_data); glBindBuffer(GL_UNIFORM_BUFFER, 0); + //fill up environment + + store_transform(p_cam_transform,state.env_radiance_data.transform); + + + glBindBuffer(GL_UNIFORM_BUFFER, state.env_radiance_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0,sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + +} + +void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cull_count,const Transform& p_camera_inverse_transform) { + + directional_light_instance_count=0; + light_instance_count=0; + + for(int i=0;i=RenderList::MAX_LIGHTS ); + + LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]); + + switch(li->light_ptr->type) { + + case VS::LIGHT_DIRECTIONAL: { + + ERR_FAIL_COND( directional_light_instance_count >= RenderList::MAX_LIGHTS); + directional_light_instances[directional_light_instance_count++]=li; + + li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; + li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; + li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + + //omni, keep at 0 + li->light_ubo_data.light_pos_inv_radius[0]=0.0; + li->light_ubo_data.light_pos_inv_radius[1]=0.0; + li->light_ubo_data.light_pos_inv_radius[2]=0.0; + li->light_ubo_data.light_pos_inv_radius[3]=0.0; + + Vector3 direction = p_camera_inverse_transform.basis.xform(li->transform.basis.xform(Vector3(0,0,-1))).normalized(); + li->light_ubo_data.light_direction_attenuation[0]=direction.x; + li->light_ubo_data.light_direction_attenuation[1]=direction.y; + li->light_ubo_data.light_direction_attenuation[2]=direction.z; + li->light_ubo_data.light_direction_attenuation[3]=1.0; + + li->light_ubo_data.light_params[0]=0; + li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + li->light_ubo_data.light_params[2]=0; + li->light_ubo_data.light_params[3]=0; - render_list.clear(); + +#if 0 + if (li->light_ptr->shadow_enabled) { + CameraMatrix bias; + bias.set_light_bias(); + + int passes=light_instance_get_shadow_passes(p_light_instance); + + for(int i=0;icustom_transform[i]).inverse(); + li->shadow_projection[i] = bias * li->custom_projection[i] * modelview; + } + lights_use_shadow=true; + } +#endif + } break; + case VS::LIGHT_OMNI: { + + li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; + li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; + li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + + Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); + + //directional, keep at 0 + li->light_ubo_data.light_pos_inv_radius[0]=pos.x; + li->light_ubo_data.light_pos_inv_radius[1]=pos.y; + li->light_ubo_data.light_pos_inv_radius[2]=pos.z; + li->light_ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); + + li->light_ubo_data.light_direction_attenuation[0]=0; + li->light_ubo_data.light_direction_attenuation[1]=0; + li->light_ubo_data.light_direction_attenuation[2]=0; + li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; + + li->light_ubo_data.light_params[0]=0; + li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + li->light_ubo_data.light_params[2]=0; + li->light_ubo_data.light_params[3]=0; + +#if 0 + if (li->light_ptr->shadow_enabled) { + li->shadow_projection[0] = Transform(camera_transform_inverse * li->transform).inverse(); + lights_use_shadow=true; + } +#endif + } break; + case VS::LIGHT_SPOT: { + + li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; + li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; + li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + + Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); + + //directional, keep at 0 + li->light_ubo_data.light_pos_inv_radius[0]=pos.x; + li->light_ubo_data.light_pos_inv_radius[1]=pos.y; + li->light_ubo_data.light_pos_inv_radius[2]=pos.z; + li->light_ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); + + Vector3 direction = p_camera_inverse_transform.basis.xform(li->transform.basis.xform(Vector3(0,0,-1))).normalized(); + li->light_ubo_data.light_direction_attenuation[0]=direction.x; + li->light_ubo_data.light_direction_attenuation[1]=direction.y; + li->light_ubo_data.light_direction_attenuation[2]=direction.z; + li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; + + li->light_ubo_data.light_params[0]=li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION]; + li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + li->light_ubo_data.light_params[2]=0; + li->light_ubo_data.light_params[3]=0; + +#if 0 + if (li->light_ptr->shadow_enabled) { + CameraMatrix bias; + bias.set_light_bias(); + Transform modelview=Transform(camera_transform_inverse * li->transform).inverse(); + li->shadow_projection[0] = bias * li->projection * modelview; + lights_use_shadow=true; + } +#endif + } break; + + } + + + /* make light hash */ + + // actually, not really a hash, but helps to sort the lights + // and avoid recompiling redudant shader versions + + + li->last_pass=render_pass; + li->light_index=i; + + //update UBO for forward rendering, blit to texture for clustered + + glBindBuffer(GL_UNIFORM_BUFFER, li->light_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(LightInstance::LightDataUBO), &li->light_ubo_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + light_instances[i]=li; + } + +} + +void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment){ + + //first of all, make a new render pass render_pass++; + + //fill up ubo + + Environment *env = environment_owner.getornull(p_environment); + + _setup_environment(env,p_cam_projection,p_cam_transform); + + _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse()); + + render_list.clear(); + current_material_index=0; //fill list @@ -744,8 +1169,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM glClearDepth(1.0); glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); - - Environment *env = environment_owner.getornull(p_environment); + RasterizerStorageGLES3::Texture* env_radiance_tex; if (!env || env->bg_mode==VS::ENV_BG_CLEAR_COLOR) { @@ -756,12 +1180,21 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM storage->frame.clear_request=false; } + } else if (env->bg_mode==VS::ENV_BG_COLOR) { glClearColor( env->bg_color.r, env->bg_color.g, env->bg_color.b, env->bg_color.a ); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); storage->frame.clear_request=false; + } else if (env->bg_mode==VS::ENV_BG_SKYBOX) { + + if (env->skybox_radiance.is_valid()) { + env_radiance_tex = storage->texture_owner.getornull(env->skybox_radiance); + } + glClear(GL_DEPTH_BUFFER_BIT); + storage->frame.clear_request=false; + } else { glClear(GL_DEPTH_BUFFER_BIT); storage->frame.clear_request=false; @@ -810,7 +1243,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM // } - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,false,false); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false); if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { @@ -824,6 +1257,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM // state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glEnable(GL_BLEND); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + + render_list.sort_by_depth(true); + + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false); + + #if 0 if (use_fb) { @@ -972,7 +1416,143 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM bool RasterizerSceneGLES3::free(RID p_rid) { - return false; + if (light_instance_owner.owns(p_rid)) { + + LightInstance *light_instance = light_instance_owner.getptr(p_rid); + glDeleteBuffers(1,&light_instance->light_ubo); + light_instance_owner.free(p_rid); + memdelete(light_instance); + + + } else { + return false; + } + + + return true; + +} + +// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html +static _FORCE_INLINE_ float radicalInverse_VdC(uint32_t bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10f; // / 0x100000000 +} + +static _FORCE_INLINE_ Vector2 Hammersley(uint32_t i, uint32_t N) { + return Vector2(float(i) / float(N), radicalInverse_VdC(i)); +} + +static _FORCE_INLINE_ Vector3 ImportanceSampleGGX(Vector2 Xi, float Roughness, Vector3 N) { + float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph] + + // Compute distribution direction + float Phi = 2.0f * M_PI * Xi.x; + float CosTheta = Math::sqrt((1.0f - Xi.y) / (1.0f + (a*a - 1.0f) * Xi.y)); + float SinTheta = Math::sqrt((float)Math::abs(1.0f - CosTheta * CosTheta)); + + // Convert to spherical direction + Vector3 H; + H.x = SinTheta * Math::cos(Phi); + H.y = SinTheta * Math::sin(Phi); + H.z = CosTheta; + + Vector3 UpVector = Math::abs(N.z) < 0.999 ? Vector3(0.0, 0.0, 1.0) : Vector3(1.0, 0.0, 0.0); + Vector3 TangentX = UpVector.cross(N); + TangentX.normalize(); + Vector3 TangentY = N.cross(TangentX); + + // Tangent to world space + return TangentX * H.x + TangentY * H.y + N * H.z; +} + +static _FORCE_INLINE_ float GGX(float NdotV, float a) { + float k = a / 2.0; + return NdotV / (NdotV * (1.0 - k) + k); +} + +// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html +float _FORCE_INLINE_ G_Smith(float a, float nDotV, float nDotL) +{ + return GGX(nDotL, a * a) * GGX(nDotV, a * a); +} + +void RasterizerSceneGLES3::_generate_brdf() { + + int brdf_size=GLOBAL_DEF("rendering/gles3/brdf_texture_size",64); + + + + DVector brdf; + brdf.resize(brdf_size*brdf_size*2); + + DVector::Write w = brdf.write(); + + + for(int i=0;i 0.0 ) { + float G = G_Smith( Roughness, NoV, NoL ); + float G_Vis = G * VoH / (NoH * NoV); + float Fc = pow(1.0 - VoH, 5.0); + + A += (1.0 - Fc) * G_Vis; + B += Fc * G_Vis; + } + } + + A/=512.0; + B/=512.0; + + int tofs = ((brdf_size-j-1)*brdf_size+i)*2; + w[tofs+0]=CLAMP(A*255,0,255); + w[tofs+1]=CLAMP(B*255,0,255); + } + } + + + //set up brdf texture + + + glGenTextures(1, &state.brdf_texture); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,state.brdf_texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RG8, brdf_size, brdf_size, 0, GL_RG, GL_UNSIGNED_BYTE,w.ptr()); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D,0); } @@ -989,6 +1569,12 @@ void RasterizerSceneGLES3::initialize() { glBufferData(GL_UNIFORM_BUFFER, sizeof(State::SceneDataUBO), &state.scene_ubo, GL_DYNAMIC_DRAW); glBindBuffer(GL_UNIFORM_BUFFER, 0); + glGenBuffers(1, &state.env_radiance_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.env_radiance_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_ubo, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + render_list.max_elements=GLOBAL_DEF("rendering/gles3/max_renderable_elements",(int)RenderList::DEFAULT_MAX_ELEMENTS); if (render_list.max_elements>1000000) render_list.max_elements=1000000; @@ -1017,6 +1603,7 @@ void RasterizerSceneGLES3::initialize() { glBindBuffer(GL_ARRAY_BUFFER,0); //unbind } render_list.init(); + _generate_brdf(); } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 53088deb0d..4b1b77f13c 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -32,12 +32,28 @@ public: float camera_inverse_matrix[16]; float camera_matrix[16]; float time[4]; - float ambient_light[4]; + float ambient_light_color[4]; + float bg_color[4]; + float ambient_energy; + float bg_energy; } ubo_data; GLuint scene_ubo; + struct EnvironmentRadianceUBO { + + float transform[16]; + float box_min[4]; //unused for now + float box_max[4]; + float ambient_contribution; + + } env_radiance_data; + + GLuint env_radiance_ubo; + + GLuint brdf_texture; + GLuint skybox_verts; GLuint skybox_array; @@ -54,16 +70,15 @@ public: RID skybox_color; RID skybox_radiance; - RID skybox_irradiance; float skybox_scale; Color bg_color; - float energy; + float bg_energy; float skybox_ambient; Color ambient_color; - float ambient_anergy; - float ambient_skybox_energy; + float ambient_energy; + float ambient_skybox_contribution; int canvas_max_layer; @@ -71,10 +86,10 @@ public: Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; skybox_scale=1.0; - energy=1.0; + bg_energy=1.0; skybox_ambient=0; - ambient_anergy=1.0; - ambient_skybox_energy=0.0; + ambient_energy=1.0; + ambient_skybox_contribution=0.0; canvas_max_layer=0; } }; @@ -84,12 +99,12 @@ public: virtual RID environment_create(); virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size); + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size); virtual void environment_set_skybox_scale(RID p_env,float p_scale); virtual void environment_set_bg_color(RID p_env,const Color& p_color); virtual void environment_set_bg_energy(RID p_env,float p_energy); virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0); + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0); virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); @@ -100,19 +115,81 @@ public: virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); + + /* LIGHT INSTANCE */ + + struct LightInstance : public RID_Data { + + struct SplitInfo { + + CameraMatrix camera; + Transform transform; + float near; + float far; + }; + + struct LightDataUBO { + + float light_pos_inv_radius[4]; + float light_direction_attenuation[4]; + float light_color_energy[4]; + float light_params[4]; //cone attenuation, specular, shadow darkening, + float shadow_split_offsets[4]; + float shadow_matrix1[16]; + float shadow_matrix2[16]; + float shadow_matrix3[16]; + float shadow_matrix4[16]; + + } light_ubo_data; + + + SplitInfo split_info[4]; + + RID light; + RasterizerStorageGLES3::Light *light_ptr; + + CameraMatrix shadow_matrix[4]; + + Transform transform; + + Vector3 light_vector; + Vector3 spot_vector; + float linear_att; + + GLuint light_ubo; + + uint64_t shadow_pass; + uint64_t last_pass; + uint16_t light_index; + + Vector2 dp; + + CameraMatrix shadow_projection[4]; + + + LightInstance() { } + + }; + + mutable RID_Owner light_instance_owner; + + virtual RID light_instance_create(RID p_light); + virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform); + /* RENDER LIST */ struct RenderList { enum { DEFAULT_MAX_ELEMENTS=65536, - MAX_LIGHTS=4, SORT_FLAG_SKELETON=1, SORT_FLAG_INSTANCING=2, - + MAX_DIRECTIONAL_LIGHTS=16, + MAX_LIGHTS=4096, SORT_KEY_DEPTH_LAYER_SHIFT=58, SORT_KEY_LIGHT_TYPE_SHIFT=54, //type is most important SORT_KEY_LIGHT_INDEX_SHIFT=38, //type is most important + SORT_KEY_LIGHT_INDEX_UNSHADED=uint64_t(0xF) << SORT_KEY_LIGHT_TYPE_SHIFT, //type is most important SORT_KEY_MATERIAL_INDEX_SHIFT=22, SORT_KEY_GEOMETRY_INDEX_SHIFT=6, SORT_KEY_GEOMETRY_TYPE_SHIFT=2, @@ -161,7 +238,24 @@ public: SortArray sorter; if (p_alpha) { - sorter.sort(&elements[max_elements-alpha_element_count-1],alpha_element_count); + sorter.sort(&elements[max_elements-alpha_element_count],alpha_element_count); + } else { + sorter.sort(elements,element_count); + } + } + + struct SortByDepth { + + _FORCE_INLINE_ bool operator()(const Element* A, const Element* B ) const { + return A->instance->depth > B->instance->depth; + } + }; + + void sort_by_depth(bool p_alpha) { + + SortArray sorter; + if (p_alpha) { + sorter.sort(&elements[max_elements-alpha_element_count],alpha_element_count); } else { sorter.sort(elements,element_count); } @@ -197,6 +291,7 @@ public: } + RenderList() { max_elements=DEFAULT_MAX_ELEMENTS; @@ -210,26 +305,35 @@ public: + LightInstance *directional_light_instances[RenderList::MAX_DIRECTIONAL_LIGHTS]; + int directional_light_instance_count; + + LightInstance *light_instances[RenderList::MAX_LIGHTS]; + int light_instance_count; + RenderList render_list; _FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material* p_material,bool p_alpha_pass); _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); + _FORCE_INLINE_ void _setup_light(LightInstance *p_light); + void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass); - void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, bool p_reverse_cull, bool p_alpha_pass); - - virtual RID light_instance_create(RID p_light); - virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform); _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material); void _draw_skybox(RID p_skybox, CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); + void _setup_environment(Environment *env,CameraMatrix& p_cam_projection, const Transform& p_cam_transform); + void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform); + virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment); virtual bool free(RID p_rid); + void _generate_brdf(); + void initialize(); void finalize(); RasterizerSceneGLES3(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 94ad2afabe..1141a605c5 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -587,6 +587,7 @@ void RasterizerStorageGLES3::texture_allocate(RID p_texture,int p_width, int p_h texture->height=p_height; texture->format=p_format; texture->flags=p_flags; + texture->stored_cube_sides=0; texture->target = (p_flags & VS::TEXTURE_FLAG_CUBEMAP) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D; _get_gl_image_and_format(Image(),texture->format,texture->flags,format,internal_format,type,compressed,srgb); @@ -759,8 +760,9 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image //printf("texture: %i x %i - size: %i - total: %i\n",texture->width,texture->height,tsize,_rinfo.texture_mem); + texture->stored_cube_sides|=(1<flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1 && !texture->ignore_mipmaps) { + if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1 && !texture->ignore_mipmaps && (!(texture->flags&VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides==(1<<6)-1)) { //generate mipmaps if they were requested and the image does not contain them glGenerateMipmap(texture->target); } @@ -995,7 +997,7 @@ void RasterizerStorageGLES3::texture_set_shrink_all_x2_on_set_data(bool p_enable config.shrink_textures_x2=p_enable; } -RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution) const { +RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_resolution) const { Texture * texture = texture_owner.get(p_source); ERR_FAIL_COND_V(!texture,RID()); @@ -1019,12 +1021,13 @@ RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeM glDisable(GL_BLEND); - glActiveTexture(GL_TEXTURE1); + glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); - glActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE1); GLuint new_cubemap; glGenTextures(1, &new_cubemap); + glBindTexture(GL_TEXTURE_CUBE_MAP, new_cubemap); GLuint tmp_fb; @@ -1033,8 +1036,7 @@ RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeM glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb); - int w = texture->width; - int h = texture->height; + int size = p_resolution; int lod=0; @@ -1044,19 +1046,42 @@ RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeM int mm_level=mipmaps; + GLenum internal_format = use_float?GL_RGBA16F:GL_RGB10_A2; + GLenum format = GL_RGBA; + GLenum type = use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV; + + + while(mm_level) { + + for(int i=0;i<6;i++) { + glTexImage2D(_cube_side_enum[i], lod, internal_format, size, size, 0, format, type, NULL); + } + + lod++; + mm_level--; + + if (size>1) + size>>=1; + } + + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, lod-1); + + lod=0; + mm_level=mipmaps; + + size = p_resolution; + while(mm_level) { for(int i=0;i<6;i++) { - glTexImage2D(_cube_side_enum[i], lod, use_float?GL_RGBA16F:GL_RGB10_A2, w, h, 0, GL_RGBA, use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV, NULL); - glTexParameteri(_cube_side_enum[i], GL_TEXTURE_BASE_LEVEL, lod); - glTexParameteri(_cube_side_enum[i], GL_TEXTURE_MAX_LEVEL, lod); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], new_cubemap, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], new_cubemap, lod); - glViewport(0,0,w,h); + glViewport(0,0,size,size); glBindVertexArray(resources.quadie_array); shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::FACE_ID,i); - shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS,lod/float(mipmaps)); + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS,lod/float(mipmaps-1)); glDrawArrays(GL_TRIANGLE_FAN,0,4); @@ -1069,29 +1094,51 @@ RID RasterizerStorageGLES3::texture_create_pbr_cubemap(RID p_source,VS::PBRCubeM - if (w>1) - w>>=1; - if (h>1) - h>>=1; - + if (size>1) + size>>=1; lod++; mm_level--; } - for(int i=0;i<6;i++) { - //restore ranges - glTexParameteri(_cube_side_enum[i], GL_TEXTURE_BASE_LEVEL, 0); - glTexParameteri(_cube_side_enum[i], GL_TEXTURE_MAX_LEVEL, lod); + //restore ranges + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, lod-1); - } + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); glDeleteFramebuffers(1, &tmp_fb); - - return RID(); + Texture * ctex = memnew( Texture ); + + ctex->flags=VS::TEXTURE_FLAG_CUBEMAP|VS::TEXTURE_FLAG_MIPMAPS|VS::TEXTURE_FLAG_FILTER; + ctex->width=p_resolution; + ctex->height=p_resolution; + ctex->alloc_width=p_resolution; + ctex->alloc_height=p_resolution; + ctex->format=use_float?Image::FORMAT_RGBAH:Image::FORMAT_RGBA8; + ctex->target=GL_TEXTURE_CUBE_MAP; + ctex->gl_format_cache=format; + ctex->gl_internal_format_cache=internal_format; + ctex->gl_type_cache=type; + ctex->data_size=0; + ctex->compressed=false; + ctex->srgb=false; + ctex->total_data_size=0; + ctex->ignore_mipmaps=false; + ctex->mipmaps=mipmaps; + ctex->active=true; + ctex->tex_id=new_cubemap; + ctex->stored_cube_sides=(1<<6)-1; + ctex->render_target=NULL; + + return texture_owner.make_rid(ctex); } @@ -1137,9 +1184,9 @@ void RasterizerStorageGLES3::shader_set_mode(RID p_shader,VS::ShaderMode p_mode) shader->mode=p_mode; ShaderGLES3* shaders[VS::SHADER_MAX]={ - &canvas->state.canvas_shader, &scene->state.scene_shader, &canvas->state.canvas_shader, + &canvas->state.canvas_shader, }; @@ -1231,10 +1278,14 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { shaders.actions_scene.render_mode_values["cull_back"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_BACK); shaders.actions_scene.render_mode_values["cull_disable"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_DISABLED); - shaders.actions_canvas.render_mode_flags["unshaded"]=&p_shader->spatial.unshaded; - shaders.actions_canvas.render_mode_flags["ontop"]=&p_shader->spatial.ontop; + shaders.actions_scene.render_mode_flags["unshaded"]=&p_shader->spatial.unshaded; + shaders.actions_scene.render_mode_flags["ontop"]=&p_shader->spatial.ontop; + + shaders.actions_scene.usage_flag_pointers["ALPHA"]=&p_shader->spatial.uses_alpha; + + actions=&shaders.actions_scene; + actions->uniforms=&p_shader->uniforms; - shaders.actions_canvas.usage_flag_pointers["ALPHA"]=&p_shader->spatial.uses_alpha; } @@ -1243,6 +1294,7 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { Error err = shaders.compiler.compile(p_shader->mode,p_shader->code,actions,p_shader->path,gen_code); + ERR_FAIL_COND(err!=OK); p_shader->shader->set_custom_shader_code(p_shader->custom_code_id,gen_code.vertex,gen_code.vertex_global,gen_code.fragment,gen_code.light,gen_code.fragment_global,gen_code.uniforms,gen_code.texture_uniforms,gen_code.defines); @@ -1633,29 +1685,29 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy gui[0]=v.r; gui[1]=v.g; - gui[3]=v.b; - gui[4]=v.a; + gui[2]=v.b; + gui[3]=v.a; } else if (value.get_type()==Variant::RECT2) { Rect2 v=value; gui[0]=v.pos.x; gui[1]=v.pos.y; - gui[3]=v.size.x; - gui[4]=v.size.y; + gui[2]=v.size.x; + gui[3]=v.size.y; } else if (value.get_type()==Variant::QUAT) { Quat v=value; gui[0]=v.x; gui[1]=v.y; - gui[3]=v.z; - gui[4]=v.w; + gui[2]=v.z; + gui[3]=v.w; } else { Plane v=value; gui[0]=v.normal.x; gui[1]=v.normal.y; - gui[3]=v.normal.x; - gui[4]=v.d; + gui[2]=v.normal.x; + gui[3]=v.d; } } break; @@ -2307,8 +2359,6 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P if (p_format&VS::ARRAY_FORMAT_INDEX) { index_array_size=attribs[VS::ARRAY_INDEX].stride*p_index_count; - - print_line("index count: "+itos(p_index_count)+" stride: "+itos(attribs[VS::ARRAY_INDEX].stride) ); } @@ -2882,55 +2932,134 @@ Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,i RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ - return RID(); + Light *light = memnew( Light ); + light->type=p_type; + + light->param[VS::LIGHT_PARAM_ENERGY]=1.0; + light->param[VS::LIGHT_PARAM_SPECULAR]=1.0; + light->param[VS::LIGHT_PARAM_RANGE]=1.0; + light->param[VS::LIGHT_PARAM_SPOT_ANGLE]=45; + light->param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE]=0; + light->param[VS::LIGHT_PARAM_SHADOW_DARKNESS]=0; + light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET]=0.1; + light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET]=0.3; + light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET]=0.6; + light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET]=1.0; + light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS]=0.1; + light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]=0.1; + + + light->color=Color(1,1,1,1); + light->shadow=false; + light->negative=false; + light->cull_mask=0xFFFFFFFF; + light->directional_shadow_mode=VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; + + return light_owner.make_rid(light); } void RasterizerStorageGLES3::light_set_color(RID p_light,const Color& p_color){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + light->color=p_color; } void RasterizerStorageGLES3::light_set_param(RID p_light,VS::LightParam p_param,float p_value){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + ERR_FAIL_INDEX(p_param,VS::LIGHT_PARAM_MAX); + if (p_param==VS::LIGHT_PARAM_RANGE || p_param==VS::LIGHT_PARAM_SPOT_ANGLE) { + light->instance_change_notify(); + } + light->param[p_param]=p_value; } void RasterizerStorageGLES3::light_set_shadow(RID p_light,bool p_enabled){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + light->shadow=p_enabled; } void RasterizerStorageGLES3::light_set_projector(RID p_light,RID p_texture){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + } void RasterizerStorageGLES3::light_set_attenuation_texure(RID p_light,RID p_texture){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + } void RasterizerStorageGLES3::light_set_negative(RID p_light,bool p_enable){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + light->negative=p_enable; } void RasterizerStorageGLES3::light_set_cull_mask(RID p_light,uint32_t p_mask){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + light->cull_mask=p_mask; } void RasterizerStorageGLES3::light_set_shader(RID p_light,RID p_shader){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); } void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode){ + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); } VS::LightType RasterizerStorageGLES3::light_get_type(RID p_light) const { + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,VS::LIGHT_DIRECTIONAL); + return VS::LIGHT_DIRECTIONAL; } AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,AABB()); + + switch( light->type ) { + + case VS::LIGHT_SPOT: { + + float len=light->param[VS::LIGHT_PARAM_RANGE]; + float size=Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE]))*len; + return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); + } break; + case VS::LIGHT_OMNI: { + + float r = light->param[VS::LIGHT_PARAM_RANGE]; + return AABB( -Vector3(r,r,r), Vector3(r,r,r)*2 ); + } break; + case VS::LIGHT_DIRECTIONAL: { + + return AABB(); + } break; + default: {} + } + + ERR_FAIL_V( AABB() ); return AABB(); } @@ -3028,6 +3157,10 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: inst = mesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_LIGHT: { + inst = light_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; default: { ERR_FAIL(); } @@ -3046,6 +3179,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_LIGHT: { + inst = light_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; default: { ERR_FAIL(); } @@ -3542,6 +3679,9 @@ VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { return VS::INSTANCE_MESH; } + if (light_owner.owns(p_rid)) { + return VS::INSTANCE_LIGHT; + } return VS::INSTANCE_NONE; } @@ -3617,6 +3757,14 @@ bool RasterizerStorageGLES3::free(RID p_rid){ mesh_owner.free(p_rid); memdelete(mesh); + } else if (light_owner.owns(p_rid)) { + + // delete the texture + Light *light = light_owner.get(p_rid); + + light_owner.free(p_rid); + memdelete(light); + } else if (canvas_occluder_owner.owns(p_rid)) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index c3022b3ac0..f052aa8019 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -135,10 +135,13 @@ public: bool active; GLuint tex_id; + uint16_t stored_cube_sides; + RenderTarget *render_target; Texture() { + stored_cube_sides=0; ignore_mipmaps=false; render_target=NULL; flags=width=height=0; @@ -184,7 +187,7 @@ public: virtual void texture_debug_usage(List *r_info); - virtual RID texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution=-1) const; + virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const; /* SHADER API */ @@ -351,13 +354,6 @@ public: struct Instantiable : public RID_Data { - enum Type { - GEOMETRY_INVALID, - GEOMETRY_SURFACE, - GEOMETRY_IMMEDIATE, - GEOMETRY_MULTISURFACE, - }; - SelfList::List instance_list; _FORCE_INLINE_ void instance_change_notify() { @@ -582,6 +578,20 @@ public: /* Light API */ + + struct Light : Instantiable { + + VS::LightType type; + float param[VS::LIGHT_PARAM_MAX]; + Color color; + bool shadow; + bool negative; + uint32_t cull_mask; + VS::LightDirectionalShadowMode directional_shadow_mode; + }; + + mutable RID_Owner light_owner; + virtual RID light_create(VS::LightType p_type); virtual void light_set_color(RID p_light,const Color& p_color); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 49707400ca..da8f6689d0 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -48,7 +48,7 @@ static int _get_datatype_size(SL::DataType p_type) { case SL::TYPE_SAMPLERCUBE: return 16; } - + ERR_FAIL_V(0); } @@ -195,7 +195,12 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { - String ucode="uniform "; + String ucode; + + if (SL::is_sampler_type(E->get().type)) { + ucode="uniform "; + } + ucode+=_prestr(E->get().precission); ucode+=_typestr(E->get().type); ucode+=" "+_mkid(E->key()); @@ -228,7 +233,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener for(int i=0;i0) - r_gen_code.uniform_offsets[i]=uniform_sizes[i]-1; + r_gen_code.uniform_offsets[i]=uniform_sizes[i-1]; else r_gen_code.uniform_offsets[i]=0; } @@ -320,7 +325,11 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener SL::VariableNode *vnode=(SL::VariableNode*)p_node; if (p_default_actions.usage_defines.has(vnode->name) && !used_name_defines.has(vnode->name)) { - r_gen_code.defines.push_back(p_default_actions.usage_defines[vnode->name].utf8()); + String define = p_default_actions.usage_defines[vnode->name]; + if (define.begins_with("@")) { + define = p_default_actions.usage_defines[define.substr(1,define.length())]; + } + r_gen_code.defines.push_back(define.utf8()); used_name_defines.insert(vnode->name); } @@ -451,6 +460,14 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, Error err = parser.compile(p_code,ShaderTypes::get_singleton()->get_functions(p_mode),ShaderTypes::get_singleton()->get_modes(p_mode)); if (err!=OK) { +#if 1 + + Vector shader = p_code.split("\n"); + for(int i=0;i func_list; ShaderLanguage::get_builtin_funcs(&func_list); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index ebdf60cf42..052c915241 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -751,6 +751,7 @@ void ShaderGLES3::set_custom_shader_code(uint32_t p_code_id, const String& p_ver ERR_FAIL_COND(!custom_code_map.has(p_code_id)); CustomCode *cc=&custom_code_map[p_code_id]; + cc->vertex=p_vertex; cc->vertex_globals=p_vertex_globals; cc->fragment=p_fragment; diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index 176a2282fd..4c7f682dff 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -29,6 +29,7 @@ #ifndef SHADER_GLES3_H #define SHADER_GLES3_H +#include #include "platform_config.h" #ifndef GLES3_INCLUDE_H diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index f450f34113..d3d4cbd435 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -16,19 +16,26 @@ void main() { [fragment] -uniform samplerCube source_cube; //texunit:1 +precision highp float; +precision highp int; + + +uniform samplerCube source_cube; //texunit:0 uniform int face_id; uniform float roughness; in highp vec2 uv_interp; -layout(location = 0) vec4 frag_color; +layout(location = 0) out vec4 frag_color; + + +#define M_PI 3.14159265359 vec3 texelCoordToVec(vec2 uv, int faceID) { mat3 faceUvVectors[6]; - +/* // -x faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y @@ -58,6 +65,37 @@ vec3 texelCoordToVec(vec2 uv, int faceID) faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face +*/ + + // -x + faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z + faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face + + // +x + faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z + faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face + + // -y + faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z + faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face + + // +y + faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z + faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face + + // -z + faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x + faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face + + // +z + faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x + faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y + faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2]. vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2]; @@ -113,7 +151,7 @@ vec2 Hammersley(uint i, uint N) { return vec2(float(i)/float(N), radicalInverse_VdC(i)); } -#define SAMPLE_COUNT 1024 +#define SAMPLE_COUNT 1024u void main() { @@ -123,20 +161,21 @@ void main() { //vec4 color = color_interp; vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); - for(int sampleNum = 0; sampleNum < SAMPLE_COUNT; sampleNum++) { + for(uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) { vec2 xi = Hammersley(sampleNum, SAMPLE_COUNT); - vec2 xi = texture2DLod(Texture0, vec2(float(sampleNum) / float(SAMPLE_COUNT), 0.5), 0.0).xy; vec3 H = ImportanceSampleGGX( xi, roughness, N ); vec3 V = N; vec3 L = normalize(2.0 * dot( V, H ) * H - V); - float ndotl = max(0.0, dot(N, L)); - vec3 s = textureCubeLod(u_skyCube, H, 0.0).rgb * ndotl; + float ndotl = clamp(dot(N, L),0.0,1.0); - sum += vec4(s, 1.0); + if (ndotl>0.0) { + sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl; + sum.a += ndotl; + } } - sum /= sum.w; + sum /= sum.a; frag_color = vec4(sum.rgb, 1.0); } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 4183e828f5..3f94252606 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1,7 +1,7 @@ [vertex] - +#define ENABLE_UV_INTERP /* from VisualServer: @@ -52,14 +52,47 @@ layout(std140) uniform SceneData { //ubo:0 highp mat4 camera_matrix; highp vec4 time; - highp vec4 ambient_light; + highp vec4 ambient_light_color; + highp vec4 bg_color; + float ambient_energy; + float bg_energy; }; uniform highp mat4 world_transform; +#ifdef USE_FORWARD_LIGHTING + +layout(std140) uniform LightData { //ubo:3 + + highp vec4 light_pos_inv_radius; + mediump vec4 light_direction_attenuation; + mediump vec4 light_color_energy; + mediump vec4 light_params; //cone attenuation, specular, shadow darkening, + mediump vec4 shadow_split_offsets; + highp mat4 shadow_matrix1; + highp mat4 shadow_matrix2; + highp mat4 shadow_matrix3; + highp mat4 shadow_matrix4; +}; + +#ifdef USE_FORWARD_1_SHADOW_MAP +out mediump vec4 forward_shadow_pos1; +#endif + +#ifdef USE_FORWARD_2_SHADOW_MAP +out mediump vec4 forward_shadow_pos2; +#endif + +#ifdef USE_FORWARD_4_SHADOW_MAP +out mediump vec4 forward_shadow_pos3; +out mediump vec4 forward_shadow_pos4; +#endif + +#endif + /* Varyings */ -out vec3 vertex_interp; +out highp vec3 vertex_interp; out vec3 normal_interp; #if defined(ENABLE_COLOR_INTERP) @@ -74,13 +107,6 @@ out vec2 uv_interp; out vec2 uv2_interp; #endif -#if defined(ENABLE_VAR1_INTERP) -out vec4 var1_interp; -#endif - -#if defined(ENABLE_VAR2_INTERP) -out vec4 var2_interp; -#endif #if defined(ENABLE_TANGENT_INTERP) out vec3 tangent_interp; @@ -118,13 +144,13 @@ MATERIAL_UNIFORMS void main() { - highp vec4 vertex_in = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0); + highp vec4 vertex = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0); highp mat4 modelview = camera_inverse_matrix * world_transform; - vec3 normal_in = normal_attrib; - normal_in*=normal_mult; + vec3 normal = normal_attrib * normal_mult; + #if defined(ENABLE_TANGENT_INTERP) - vec3 tangent_in = tangent_attrib.xyz; - tangent_in*=normal_mult; + vec3 tangent = tangent_attrib.xyz; + tangent*=normal_mult; float binormalf = tangent_attrib.a; #endif @@ -137,23 +163,31 @@ void main() { m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.z; m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.w; - vertex_in = vertex_in * m; - normal_in = (vec4(normal_in,0.0) * m).xyz; + vertex = vertex_in * m; + normal = (vec4(normal,0.0) * m).xyz; #if defined(ENABLE_TANGENT_INTERP) - tangent_in = (vec4(tangent_in,0.0) * m).xyz; + tangent = (vec4(tangent,0.0) * m).xyz; #endif } #endif - vertex_interp = (modelview * vertex_in).xyz; - normal_interp = normalize((modelview * vec4(normal_in,0.0)).xyz); +#if !defined(SKIP_TRANSFORM_USED) + + vertex = modelview * vertex; + normal = normalize((modelview * vec4(normal,0.0)).xyz); +#endif #if defined(ENABLE_TANGENT_INTERP) - tangent_interp=normalize((modelview * vec4(tangent_in,0.0)).xyz); - binormal_interp = normalize( cross(normal_interp,tangent_interp) * binormalf ); +# if !defined(SKIP_TRANSFORM_USED) + + tangent=normalize((modelview * vec4(tangent,0.0)).xyz); +# endif + vec3 binormal = normalize( cross(normal,tangent) * binormalf ); #endif + + #if defined(ENABLE_COLOR_INTERP) color_interp = color_attrib; #endif @@ -161,13 +195,17 @@ void main() { #if defined(ENABLE_UV_INTERP) uv_interp = uv_attrib; #endif + #if defined(ENABLE_UV2_INTERP) uv2_interp = uv2_attrib; #endif +{ VERTEX_SHADER_CODE +} + #ifdef USE_SHADOW_PASS @@ -177,26 +215,32 @@ VERTEX_SHADER_CODE #endif -#ifdef USE_FOG + vertex_interp = vertex.xyz; + normal_interp = normal; - fog_interp.a = pow( clamp( (length(vertex_interp)-fog_params.x)/(fog_params.y-fog_params.x), 0.0, 1.0 ), fog_params.z ); - fog_interp.rgb = mix( fog_color_begin, fog_color_end, fog_interp.a ); +#if defined(ENABLE_TANGENT_INTERP) + tangent_interp = tangent; + binormal_interp = binormal; #endif -#ifndef VERTEX_SHADER_WRITE_POSITION -//vertex shader might write a position +#if !defined(SKIP_TRANSFORM_USED) gl_Position = projection_matrix * vec4(vertex_interp,1.0); +#else + gl_Position = vertex; #endif - - } [fragment] + +#define M_PI 3.14159265359 + + +#define ENABLE_UV_INTERP //hack to use uv if no uv present so it works with lightmap @@ -219,17 +263,27 @@ in vec3 tangent_interp; in vec3 binormal_interp; #endif -#if defined(ENABLE_VAR1_INTERP) -in vec4 var1_interp; -#endif +in highp vec3 vertex_interp; +in vec3 normal_interp; -#if defined(ENABLE_VAR2_INTERP) -in vec4 var2_interp; -#endif -in vec3 vertex_interp; -in vec3 normal_interp; +/* PBR CHANNELS */ + +#ifdef USE_RADIANCE_CUBEMAP + +uniform sampler2D brdf_texture; //texunit:-1 +uniform samplerCube radiance_cube; //texunit:-2 + +layout(std140) uniform Radiance { //ubo:2 + + mat4 radiance_inverse_xform; + vec3 radiance_box_min; + vec3 radiance_box_max; + float radiance_ambient_contribution; + +}; +#endif /* Material Uniforms */ @@ -255,18 +309,97 @@ layout(std140) uniform SceneData { highp mat4 camera_matrix; highp vec4 time; - highp vec4 ambient_light; + highp vec4 ambient_light_color; + highp vec4 bg_color; + float ambient_energy; + float bg_energy; }; + +#ifdef USE_FORWARD_LIGHTING + +layout(std140) uniform LightData { + + highp vec4 light_pos_inv_radius; + mediump vec4 light_direction_attenuation; + mediump vec4 light_color_energy; + mediump vec4 light_params; //cone attenuation, specular, shadow darkening, + mediump vec4 shadow_split_offsets; + highp mat4 shadow_matrix1; + highp mat4 shadow_matrix2; + highp mat4 shadow_matrix3; + highp mat4 shadow_matrix4; +}; + +#ifdef USE_FORWARD_1_SHADOW_MAP +in mediump vec4 forward_shadow_pos1; +#endif + +#ifdef USE_FORWARD_2_SHADOW_MAP +in mediump vec4 forward_shadow_pos2; +#endif + +#ifdef USE_FORWARD_4_SHADOW_MAP +in mediump vec4 forward_shadow_pos3; +in mediump vec4 forward_shadow_pos4; +#endif + +#endif + layout(location=0) out vec4 frag_color; + +// GGX Specular +// Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl +float G1V(float dotNV, float k) +{ + return 1.0 / (dotNV * (1.0 - k) + k); +} + +float specularGGX(vec3 N, vec3 V, vec3 L, float roughness, float F0) +{ + float alpha = roughness * roughness; + + vec3 H = normalize(V + L); + + float dotNL = max(dot(N,L), 0.0 ); + float dotNV = max(dot(N,V), 0.0 ); + float dotNH = max(dot(N,H), 0.0 ); + float dotLH = max(dot(L,H), 0.0 ); + + // D + float alphaSqr = alpha * alpha; + float pi = M_PI; + float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0; + float D = alphaSqr / (pi * denom * denom); + + // F + float dotLH5 = pow(1.0 - dotLH, 5.0); + float F = F0 + (1.0 - F0) * (dotLH5); + + // V + float k = alpha / 2.0f; + float vis = G1V(dotNL, k) * G1V(dotNV, k); + + return dotNL * D * F * vis; +} + +void light_compute(vec3 normal, vec3 light_vec,vec3 eye_vec,vec3 diffuse_color, vec3 specular_color, float roughness, float attenuation, inout vec3 diffuse, inout vec3 specular) { + + diffuse += max(0.0,dot(normal,light_vec)) * diffuse_color * attenuation; + //specular += specular_ggx( roughness, max(0.0,dot(normal,eye_vec)) ) * specular_color * attenuation; + float s = roughness > 0.0 ? specularGGX(normal,eye_vec,light_vec,roughness,1.0) : 0.0; + specular += s * specular_color * attenuation; +} + + void main() { //lay out everything, whathever is unused is optimized away anyway vec3 vertex = vertex_interp; - vec3 albedo = vec3(0.9,0.9,0.9); - vec3 metal = vec3(0.0,0.0,0.0); - float rough = 0.0; + vec3 albedo = vec3(0.8,0.8,0.8); + vec3 specular = vec3(0.2,0.2,0.2); + float roughness = 1.0; float alpha = 1.0; #ifdef METERIAL_DOUBLESIDED @@ -334,6 +467,66 @@ FRAGMENT_SHADER_CODE } #endif +/////////////////////// LIGHTING ////////////////////////////// + + vec3 specular_light = vec3(0.0,0.0,0.0); + vec3 ambient_light = ambient_light_color.rgb; + vec3 diffuse_light = vec3(0.0,0.0,0.0); + + vec3 eye_vec = -normalize( vertex_interp ); + +#ifdef USE_RADIANCE_CUBEMAP + + { + + float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); + vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; + + float lod = roughness * 5.0; + vec3 r = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); + r=normalize((radiance_inverse_xform * vec4(r,0.0)).xyz); + vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); + + specular_light=mix(albedo,radiance,specular); + + } + + { + + vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); + vec3 env_ambient=textureLod(radiance_cube, ambient_dir, 5.0).xyz; + + ambient_light=mix(ambient_light,env_ambient,radiance_ambient_contribution); + } + + +#else + + ambient_light=albedo; +#endif + + +#ifdef USE_FORWARD_LIGHTING + +#ifdef USE_FORWARD_DIRECTIONAL + + light_compute(normal,light_direction_attenuation.xyz,eye_vec,albedo,specular,roughness,1.0,diffuse_light,specular_light); +#endif + +#ifdef USE_FORWARD_OMNI + + vec3 light_rel_vec = light_pos_inv_radius.xyz-vertex; + float normalized_distance = length( light_rel_vec )*light_pos_inv_radius.w; + float light_attenuation = pow( max(1.0 - normalized_distance, 0.0), light_direction_attenuation.w ); + light_compute(normal,normalize(light_rel_vec),eye_vec,albedo,specular,roughness,light_attenuation,diffuse_light,specular_light); + +#endif + +#ifdef USE_FORWARD_SPOT + +#endif + +#endif #if defined(USE_LIGHT_SHADER_CODE) @@ -345,7 +538,14 @@ LIGHT_SHADER_CODE } #endif +#ifdef SHADELESS + frag_color=vec4(albedo,alpha); +#else + frag_color=vec4(ambient_light+diffuse_light+specular_light,alpha); + +#endif + } diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 6e73244b57..57027bd9bf 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -960,9 +960,9 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref& p_tm st->add_to_format(VS::ARRAY_FORMAT_COLOR); if (m.is_valid()) { - Ref fm = m; + Ref fm = m; if (fm.is_valid()) - fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); } } } diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp index 5478569a42..874056f76d 100644 --- a/platform/iphone/rasterizer_iphone.cpp +++ b/platform/iphone/rasterizer_iphone.cpp @@ -486,7 +486,7 @@ RID RasterizerIPhone::material_create() { return material_owner.make_rid( memnew( Material ) ); } -void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value) { +void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value) { Material *m=material_owner.get( p_material ); ERR_FAIL_COND(!m); @@ -494,7 +494,7 @@ void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedMat m->parameters[p_parameter] = p_value; } -Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const { +Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const { Material *m=material_owner.get( p_material ); ERR_FAIL_COND_V(!m, Variant()); @@ -503,7 +503,7 @@ Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedM return m->parameters[p_parameter]; } -void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture) { +void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture) { Material *m=material_owner.get( p_material ); ERR_FAIL_COND(!m); @@ -511,7 +511,7 @@ void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedMateri m->textures[p_parameter] = p_texture; } -RID RasterizerIPhone::fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const { +RID RasterizerIPhone::fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const { Material *m=material_owner.get( p_material ); ERR_FAIL_COND_V(!m, RID()); @@ -535,7 +535,7 @@ VS::MaterialBlendMode RasterizerIPhone::fixed_material_get_detail_blend_mode(RID return m->detail_blend_mode; } -void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode) { +void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode) { Material *m=material_owner.get( p_material ); ERR_FAIL_COND(!m); @@ -543,7 +543,7 @@ void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::Fixed m->texcoord_mode[p_parameter] = p_mode; } -VS::FixedMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const { +VS::FixedSpatialMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const { Material *m=material_owner.get( p_material ); ERR_FAIL_COND_V(!m, VS::FIXED_MATERIAL_TEXCOORD_TEXGEN); @@ -552,7 +552,7 @@ VS::FixedMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode return m->texcoord_mode[p_parameter]; // for now } -void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedMaterialTexGenMode p_mode) { +void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedSpatialMaterialTexGenMode p_mode) { Material *m=material_owner.get( p_material ); ERR_FAIL_COND(!m); @@ -560,7 +560,7 @@ void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedMa m->texgen_mode = p_mode; }; -VS::FixedMaterialTexGenMode RasterizerIPhone::fixed_material_get_texgen_mode(RID p_material) const { +VS::FixedSpatialMaterialTexGenMode RasterizerIPhone::fixed_material_get_texgen_mode(RID p_material) const { Material *m=material_owner.get( p_material ); ERR_FAIL_COND_V(!m, VS::FIXED_MATERIAL_TEXGEN_SPHERE); diff --git a/platform/iphone/rasterizer_iphone.h b/platform/iphone/rasterizer_iphone.h index fcbb339ab3..bb9bddfe2d 100644 --- a/platform/iphone/rasterizer_iphone.h +++ b/platform/iphone/rasterizer_iphone.h @@ -100,11 +100,11 @@ class RasterizerIPhone : public Rasterizer { RID textures[VisualServer::FIXED_MATERIAL_PARAM_MAX]; Transform uv_transform; - VS::FixedMaterialTexCoordMode texcoord_mode[VisualServer::FIXED_MATERIAL_PARAM_MAX]; + VS::FixedSpatialMaterialTexCoordMode texcoord_mode[VisualServer::FIXED_MATERIAL_PARAM_MAX]; VS::MaterialBlendMode detail_blend_mode; - VS::FixedMaterialTexGenMode texgen_mode; + VS::FixedSpatialMaterialTexGenMode texgen_mode; Material() { @@ -624,20 +624,20 @@ public: virtual RID material_create(); - virtual void fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value); - virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value); + virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; - virtual void fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture); - virtual RID fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture); + virtual RID fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; virtual void fixed_material_set_detail_blend_mode(RID p_material,VS::MaterialBlendMode p_mode); virtual VS::MaterialBlendMode fixed_material_get_detail_blend_mode(RID p_material) const; - virtual void fixed_material_set_texgen_mode(RID p_material,VS::FixedMaterialTexGenMode p_mode); - virtual VS::FixedMaterialTexGenMode fixed_material_get_texgen_mode(RID p_material) const; + virtual void fixed_material_set_texgen_mode(RID p_material,VS::FixedSpatialMaterialTexGenMode p_mode); + virtual VS::FixedSpatialMaterialTexGenMode fixed_material_get_texgen_mode(RID p_material) const; - virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode); - virtual VS::FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode); + virtual VS::FixedSpatialMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform); virtual Transform fixed_material_get_uv_transform(RID p_material) const; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index d98f100020..88ba7b3731 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -39,24 +39,88 @@ bool Light::_can_gizmo_scale() const { } +void Light::set_param(Param p_param, float p_value) { + + ERR_FAIL_INDEX(p_param,PARAM_MAX); + param[p_param]=p_value; + + VS::get_singleton()->light_set_param(light,VS::LightParam(p_param),p_value); + + if (p_param==PARAM_SPOT_ANGLE || p_param==PARAM_RANGE) { + update_gizmo();; + } + + +} + +float Light::get_param(Param p_param) const{ + + ERR_FAIL_INDEX_V(p_param,PARAM_MAX,0); + return param[p_param]; + +} + +void Light::set_shadow(bool p_enable){ + + shadow=p_enable; + VS::get_singleton()->light_set_shadow(light,p_enable); + +} +bool Light::has_shadow() const{ + + return shadow; +} + +void Light::set_negative(bool p_enable){ + + negative=p_enable; + VS::get_singleton()->light_set_negative(light,p_enable); +} +bool Light::is_negative() const{ + + return negative; +} + +void Light::set_cull_mask(uint32_t p_cull_mask){ + + cull_mask=p_cull_mask; + VS::get_singleton()->light_set_cull_mask(light,p_cull_mask); + +} +uint32_t Light::get_cull_mask() const{ + + return cull_mask; +} + +void Light::set_color(const Color& p_color){ + + color=p_color; + VS::get_singleton()->light_set_color(light,p_color); +} +Color Light::get_color() const{ + + return color; +} + + AABB Light::get_aabb() const { -#if 0 + if (type==VisualServer::LIGHT_DIRECTIONAL) { return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); } else if (type==VisualServer::LIGHT_OMNI) { - return AABB( Vector3(-1,-1,-1) * vars[PARAM_RADIUS], Vector3(2, 2, 2 ) * vars[PARAM_RADIUS]); + return AABB( Vector3(-1,-1,-1) * param[PARAM_RANGE], Vector3(2, 2, 2 ) * param[PARAM_RANGE]); } else if (type==VisualServer::LIGHT_SPOT) { - float len=vars[PARAM_RADIUS]; - float size=Math::tan(Math::deg2rad(vars[PARAM_SPOT_ANGLE]))*len; + float len=param[PARAM_RANGE]; + float size=Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE]))*len; return AABB( Vector3( -size,-size,-len ), Vector3( size*2, size*2, len ) ); } -#endif + return AABB(); } @@ -118,10 +182,51 @@ void Light::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_editor_only"), &Light::is_editor_only ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "params/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); - - - + ObjectTypeDB::bind_method(_MD("set_param","param","value"), &Light::set_param ); + ObjectTypeDB::bind_method(_MD("get_param","param"), &Light::get_param ); + + ObjectTypeDB::bind_method(_MD("set_shadow","enabled"), &Light::set_shadow ); + ObjectTypeDB::bind_method(_MD("has_shadow"), &Light::has_shadow ); + + ObjectTypeDB::bind_method(_MD("set_negative","enabled"), &Light::set_negative ); + ObjectTypeDB::bind_method(_MD("is_negative"), &Light::is_negative ); + + ObjectTypeDB::bind_method(_MD("set_cull_mask","cull_mask"), &Light::set_cull_mask ); + ObjectTypeDB::bind_method(_MD("get_cull_mask"), &Light::get_cull_mask ); + + ObjectTypeDB::bind_method(_MD("set_color","color"), &Light::set_color ); + ObjectTypeDB::bind_method(_MD("get_color"), &Light::get_color ); + + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "light/color"), _SCS("set_color"), _SCS("get_color")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/energy"), _SCS("set_param"), _SCS("get_param"), PARAM_ENERGY); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "light/negative"), _SCS("set_negative"), _SCS("is_negative")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/specular"), _SCS("set_param"), _SCS("get_param"), PARAM_SPECULAR); + ADD_PROPERTY( PropertyInfo( Variant::INT, "light/cull_mask"), _SCS("set_cull_mask"), _SCS("get_cull_mask")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "shadow/enabled"), _SCS("set_shadow"), _SCS("has_shadow")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/darkness"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_DARKNESS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/normal_bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_NORMAL_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias_split_scale"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS_SPLIT_SCALE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/max_distance"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_MAX_DISTANCE); + + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "editor/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); + + BIND_CONSTANT( PARAM_ENERGY ); + BIND_CONSTANT( PARAM_SPECULAR ); + BIND_CONSTANT( PARAM_RANGE ); + BIND_CONSTANT( PARAM_ATTENUATION ); + BIND_CONSTANT( PARAM_SPOT_ANGLE ); + BIND_CONSTANT( PARAM_SPOT_ATTENUATION ); + BIND_CONSTANT( PARAM_SHADOW_MAX_DISTANCE ); + BIND_CONSTANT( PARAM_SHADOW_DARKNESS ); + BIND_CONSTANT( PARAM_SHADOW_SPLIT_1_OFFSET ); + BIND_CONSTANT( PARAM_SHADOW_SPLIT_2_OFFSET ); + BIND_CONSTANT( PARAM_SHADOW_SPLIT_3_OFFSET ); + BIND_CONSTANT( PARAM_SHADOW_SPLIT_4_OFFSET ); + BIND_CONSTANT( PARAM_SHADOW_NORMAL_BIAS ); + BIND_CONSTANT( PARAM_SHADOW_BIAS ); + BIND_CONSTANT( PARAM_SHADOW_BIAS_SPLIT_SCALE ); + BIND_CONSTANT( PARAM_MAX ); } @@ -131,9 +236,29 @@ Light::Light(VisualServer::LightType p_type) { type=p_type; light=VisualServer::get_singleton()->light_create(p_type); - + VS::get_singleton()->instance_set_base(get_instance(),light); editor_only=false; + set_color(Color(1,1,1,1)); + set_shadow(false); + set_negative(false); + set_cull_mask(0xFFFFFFFF); + + set_param(PARAM_ENERGY,1); + set_param(PARAM_SPECULAR,1); + set_param(PARAM_RANGE,5); + set_param(PARAM_ATTENUATION,1); + set_param(PARAM_SPOT_ANGLE,45); + set_param(PARAM_SPOT_ATTENUATION,1); + set_param(PARAM_SHADOW_MAX_DISTANCE,0); + set_param(PARAM_SHADOW_DARKNESS,0); + set_param(PARAM_SHADOW_SPLIT_1_OFFSET,0.1); + set_param(PARAM_SHADOW_SPLIT_2_OFFSET,0.2); + set_param(PARAM_SHADOW_SPLIT_3_OFFSET,0.5); + set_param(PARAM_SHADOW_SPLIT_4_OFFSET,1.0); + set_param(PARAM_SHADOW_NORMAL_BIAS,0.1); + set_param(PARAM_SHADOW_BIAS,0.1); + set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE,0.1); } @@ -147,6 +272,8 @@ Light::Light() { Light::~Light() { + VS::get_singleton()->instance_set_base(get_instance(),RID()); + if (light.is_valid()) VisualServer::get_singleton()->free(light); } @@ -156,6 +283,10 @@ Light::~Light() { void DirectionalLight::_bind_methods() { + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_1_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_2"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_2_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_3"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_3_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_4"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_4_OFFSET); } @@ -169,11 +300,16 @@ DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) void OmniLight::_bind_methods() { + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); } void SpotLight::_bind_methods() { + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/spot_angle"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ANGLE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/spot_attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ATTENUATION); + } diff --git a/scene/3d/light.h b/scene/3d/light.h index 3c31d90d4c..7da2d8e7ca 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -44,10 +44,32 @@ class Light : public VisualInstance { public: - + enum Param { + PARAM_ENERGY, + PARAM_SPECULAR, + PARAM_RANGE, + PARAM_ATTENUATION, + PARAM_SPOT_ANGLE, + PARAM_SPOT_ATTENUATION, + PARAM_SHADOW_MAX_DISTANCE, + PARAM_SHADOW_DARKNESS, + PARAM_SHADOW_SPLIT_1_OFFSET, + PARAM_SHADOW_SPLIT_2_OFFSET, + PARAM_SHADOW_SPLIT_3_OFFSET, + PARAM_SHADOW_SPLIT_4_OFFSET, + PARAM_SHADOW_NORMAL_BIAS, + PARAM_SHADOW_BIAS, + PARAM_SHADOW_BIAS_SPLIT_SCALE, + PARAM_MAX + }; private: + Color color; + float param[PARAM_MAX]; + bool shadow; + bool negative; + uint32_t cull_mask; VS::LightType type; bool editor_only; void _update_visibility(); @@ -71,6 +93,22 @@ public: void set_editor_only(bool p_editor_only); bool is_editor_only() const; + void set_param(Param p_param, float p_value); + float get_param(Param p_param) const; + + void set_shadow(bool p_enable); + bool has_shadow() const; + + void set_negative(bool p_enable); + bool is_negative() const; + + void set_cull_mask(uint32_t p_cull_mask); + uint32_t get_cull_mask() const; + + void set_color(const Color& p_color); + Color get_color() const; + + virtual AABB get_aabb() const; virtual DVector get_faces(uint32_t p_usage_flags) const; @@ -79,6 +117,7 @@ public: }; +VARIANT_ENUM_CAST(Light::Param); class DirectionalLight : public Light { diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 994e329853..1e18ba2c79 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -319,10 +319,10 @@ RES Particles::_get_gizmo_geometry() const { Ref surface_tool( memnew( SurfaceTool )); - Ref mat( memnew( FixedMaterial )); + Ref mat( memnew( FixedSpatialMaterial )); - mat->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.2) ); - mat->set_parameter( FixedMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) ); + mat->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.0,0.6,0.7,0.2) ); + mat->set_parameter( FixedSpatialMaterial::PARAM_EMISSION,Color(0.5,0.7,0.8) ); mat->set_blend_mode( Material::BLEND_MODE_ADD ); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); // mat->set_hint(Material::HINT_NO_DEPTH_DRAW,true); @@ -382,9 +382,9 @@ RES Particles::_get_gizmo_geometry() const { Ref mesh = surface_tool->commit(); - Ref mat_aabb( memnew( FixedMaterial )); + Ref mat_aabb( memnew( FixedSpatialMaterial )); - mat_aabb->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.9,0.7) ); + mat_aabb->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.9,0.7) ); mat_aabb->set_line_width(3); mat_aabb->set_flag( Material::FLAG_UNSHADED, true ); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index c1552a4167..cfc6753378 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -490,6 +490,8 @@ void SceneTree::input_event( const InputEvent& p_event ) { } + _call_idle_callbacks(); + } void SceneTree::init() { @@ -528,6 +530,7 @@ bool SceneTree::iteration(float p_time) { root_lock--; _flush_delete_queue(); + _call_idle_callbacks(); return _quit; } @@ -590,6 +593,8 @@ bool SceneTree::idle(float p_time){ E=N; } + _call_idle_callbacks(); + return _quit; } @@ -745,12 +750,12 @@ Ref SceneTree::get_debug_navigation_material() { if (navigation_material.is_valid()) return navigation_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ navigation_material=line_material; @@ -763,12 +768,12 @@ Ref SceneTree::get_debug_navigation_disabled_material(){ if (navigation_disabled_material.is_valid()) return navigation_disabled_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /* line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ navigation_disabled_material=line_material; @@ -781,12 +786,12 @@ Ref SceneTree::get_debug_collision_material() { return collision_material; - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); /*line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ collision_material=line_material; @@ -800,11 +805,11 @@ Ref SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref( memnew( Mesh ) ); - Ref mat = memnew( FixedMaterial ); + Ref mat = memnew( FixedSpatialMaterial ); /*mat->set_flag(Material::FLAG_UNSHADED,true); mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ Vector3 diamond[6]={ Vector3(-1, 0, 0), @@ -2259,6 +2264,23 @@ void SceneTree::_bind_methods() { SceneTree *SceneTree::singleton=NULL; + +SceneTree::IdleCallback SceneTree::idle_callbacks[SceneTree::MAX_IDLE_CALLBACKS]; +int SceneTree::idle_callback_count=0; + +void SceneTree::_call_idle_callbacks() { + + for(int i=0;i=MAX_IDLE_CALLBACKS); + idle_callbacks[idle_callback_count++]=p_callback; +} + + SceneTree::SceneTree() { singleton=this; diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h index 1c0f88862c..4860f4a9bf 100644 --- a/scene/main/scene_main_loop.h +++ b/scene/main/scene_main_loop.h @@ -74,6 +74,8 @@ class SceneTree : public MainLoop { public: + typedef void (*IdleCallback)(); + enum StretchMode { STRETCH_MODE_DISABLED, @@ -303,6 +305,15 @@ friend class Viewport; static void _live_edit_reparent_node_funcs(void* self,const NodePath& p_at,const NodePath& p_new_place,const String& p_new_name,int p_at_pos) { reinterpret_cast(self)->_live_edit_reparent_node_func(p_at,p_new_place,p_new_name,p_at_pos); } #endif + + enum { + MAX_IDLE_CALLBACKS=256 + }; + + static IdleCallback idle_callbacks[MAX_IDLE_CALLBACKS]; + static int idle_callback_count; + void _call_idle_callbacks(); + protected: @@ -430,6 +441,7 @@ public: void set_refuse_new_network_connections(bool p_refuse); bool is_refusing_new_network_connections() const; + static void add_idle_callback(IdleCallback p_callback); SceneTree(); ~SceneTree(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e93a16371d..35f72c5ce7 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2513,7 +2513,7 @@ Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const { Vector2 Viewport::get_camera_rect_size() const { - return last_vp_rect.size; + return size; } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index ad845555a4..e2f5b56796 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -544,14 +544,16 @@ void register_scene_types() { #ifndef _3D_DISABLED ObjectTypeDB::register_type(); ObjectTypeDB::register_virtual_type(); - ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + SceneTree::add_idle_callback(FixedSpatialMaterial::flush_changes); + FixedSpatialMaterial::init_shaders(); // ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); // ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::add_compatibility_type("Shader","MaterialShader"); - ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedMaterial"); - ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedMaterial"); + ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedSpatialMaterial"); + ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedSpatialMaterial"); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); @@ -655,6 +657,7 @@ void unregister_scene_types() { memdelete( resource_loader_wav ); memdelete( resource_loader_dynamic_font ); + #ifdef TOOLS_ENABLED @@ -669,5 +672,7 @@ void unregister_scene_types() { if (resource_loader_text) { memdelete(resource_loader_text); } + + FixedSpatialMaterial::finish_shaders(); SceneStringNames::free(); } diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 85d16da915..3897c86d5b 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -53,7 +53,7 @@ void Environment::set_skybox(const Ref& p_skybox){ sb_rid=bg_skybox->get_rid(); print_line("skybox valid: "+itos(sb_rid.is_valid())); - VS::get_singleton()->environment_set_skybox(environment,sb_rid,Globals::get_singleton()->get("rendering/skybox/radiance_cube_resolution"),Globals::get_singleton()->get("rendering/skybox/iradiance_cube_resolution")); + VS::get_singleton()->environment_set_skybox(environment,sb_rid,Globals::get_singleton()->get("rendering/skybox/radiance_cube_resolution")); } void Environment::set_skybox_scale(float p_scale) { @@ -80,17 +80,17 @@ void Environment::set_canvas_max_layer(int p_max_layer){ void Environment::set_ambient_light_color(const Color& p_color){ ambient_color=p_color; - VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_contribution); } void Environment::set_ambient_light_energy(float p_energy){ ambient_energy=p_energy; - VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_contribution); } -void Environment::set_ambient_light_skybox_energy(float p_energy){ +void Environment::set_ambient_light_skybox_contribution(float p_energy){ - ambient_skybox_energy=p_energy; - VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_energy); + ambient_skybox_contribution=p_energy; + VS::get_singleton()->environment_set_ambient_light(environment,ambient_color,ambient_energy,ambient_skybox_contribution); } Environment::BGMode Environment::get_background() const{ @@ -127,16 +127,16 @@ float Environment::get_ambient_light_energy() const{ return ambient_energy; } -float Environment::get_ambient_light_skybox_energy() const{ +float Environment::get_ambient_light_skybox_contribution() const{ - return ambient_skybox_energy; + return ambient_skybox_contribution; } void Environment::_validate_property(PropertyInfo& property) const { - if (property.name=="background/skybox" || property.name=="ambient_light/skybox_energy") { + if (property.name=="background/skybox" || property.name=="background/skybox_scale" || property.name=="ambient_light/skybox_contribution") { if (bg_mode!=BG_SKYBOX) { property.usage=PROPERTY_USAGE_NOEDITOR; } @@ -166,7 +166,7 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_canvas_max_layer","layer"),&Environment::set_canvas_max_layer); ObjectTypeDB::bind_method(_MD("set_ambient_light_color","color"),&Environment::set_ambient_light_color); ObjectTypeDB::bind_method(_MD("set_ambient_light_energy","energy"),&Environment::set_ambient_light_energy); - ObjectTypeDB::bind_method(_MD("set_ambient_light_skybox_energy","energy"),&Environment::set_ambient_light_skybox_energy); + ObjectTypeDB::bind_method(_MD("set_ambient_light_skybox_contribution","energy"),&Environment::set_ambient_light_skybox_contribution); ObjectTypeDB::bind_method(_MD("get_background"),&Environment::get_background); @@ -177,7 +177,7 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_canvas_max_layer"),&Environment::get_canvas_max_layer); ObjectTypeDB::bind_method(_MD("get_ambient_light_color"),&Environment::get_ambient_light_color); ObjectTypeDB::bind_method(_MD("get_ambient_light_energy"),&Environment::get_ambient_light_energy); - ObjectTypeDB::bind_method(_MD("get_ambient_light_skybox_energy"),&Environment::get_ambient_light_skybox_energy); + ObjectTypeDB::bind_method(_MD("get_ambient_light_skybox_contribution"),&Environment::get_ambient_light_skybox_contribution); ADD_PROPERTY(PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Clear Color,Custom Color,Skybox,Canvas,Keep"),_SCS("set_background"),_SCS("get_background") ); @@ -188,7 +188,7 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"background/canvas_max_layer",PROPERTY_HINT_RANGE,"-1000,1000,1"),_SCS("set_canvas_max_layer"),_SCS("get_canvas_max_layer") ); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_light/color"),_SCS("set_ambient_light_color"),_SCS("get_ambient_light_color") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_skybox_energy"),_SCS("get_ambient_light_skybox_energy") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") ); GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution",256); GLOBAL_DEF("rendering/skybox/radiance_cube_resolution",64); @@ -209,10 +209,11 @@ void Environment::_bind_methods() { Environment::Environment() { bg_mode=BG_CLEAR_COLOR; + bg_skybox_scale=1.0; bg_energy=1.0; bg_canvas_max_layer=0; ambient_energy=1.0; - ambient_skybox_energy=0; + ambient_skybox_contribution=0; environment = VS::get_singleton()->environment_create(); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 0435ffc6cb..6478f6420f 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -66,7 +66,7 @@ private: int bg_canvas_max_layer; Color ambient_color; float ambient_energy; - float ambient_skybox_energy; + float ambient_skybox_contribution; protected: @@ -84,7 +84,7 @@ public: void set_canvas_max_layer(int p_max_layer); void set_ambient_light_color(const Color& p_color); void set_ambient_light_energy(float p_energy); - void set_ambient_light_skybox_energy(float p_energy); + void set_ambient_light_skybox_contribution(float p_energy); BGMode get_background() const; Ref get_skybox() const; @@ -94,7 +94,7 @@ public: int get_canvas_max_layer() const; Color get_ambient_light_color() const; float get_ambient_light_energy() const; - float get_ambient_light_skybox_energy() const; + float get_ambient_light_skybox_contribution() const; virtual RID get_rid() const; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 3ebe5b7800..e3df1461c7 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -45,14 +45,762 @@ Material::~Material() { } -FixedMaterial::FixedMaterial() { +///////////////////////////////// + +Mutex *FixedSpatialMaterial::material_mutex=NULL; +SelfList::List FixedSpatialMaterial::dirty_materials; +Map FixedSpatialMaterial::shader_map; +FixedSpatialMaterial::ShaderNames* FixedSpatialMaterial::shader_names=NULL; + +void FixedSpatialMaterial::init_shaders() { + +#ifndef NO_THREADS + material_mutex = Mutex::create(); +#endif + + shader_names = memnew( ShaderNames ); + shader_names->albedo="albedo"; + shader_names->specular="specular"; + shader_names->roughness="roughness"; + shader_names->emission="emission"; + shader_names->normal_scale="normal_scale"; + shader_names->sheen="sheen"; + shader_names->sheen_color="sheen_color"; + shader_names->clearcoat="clearcoat"; + shader_names->clearcoat_gloss="clearcoat_gloss"; + shader_names->anisotropy="anisotropy"; + shader_names->height_scale="height_scale"; + shader_names->subsurface_scattering="subsurface_scattering"; + shader_names->refraction="refraction"; + shader_names->refraction_roughness="refraction_roughness"; + + shader_names->texture_names[TEXTURE_ALBEDO]="texture_albedo"; + shader_names->texture_names[TEXTURE_SPECULAR]="texture_specular"; + shader_names->texture_names[TEXTURE_EMISSION]="texture_emission"; + shader_names->texture_names[TEXTURE_NORMAL]="texture_normal"; + shader_names->texture_names[TEXTURE_SHEEN]="texture_sheen"; + shader_names->texture_names[TEXTURE_CLEARCOAT]="texture_clearcoat"; + shader_names->texture_names[TEXTURE_ANISOTROPY]="texture_anisotropy"; + shader_names->texture_names[TEXTURE_AMBIENT_OCCLUSION]="texture_ambient_occlusion"; + shader_names->texture_names[TEXTURE_HEIGHT]="texture_height"; + shader_names->texture_names[TEXTURE_SUBSURFACE_SCATTERING]="texture_subsurface_scattering"; + shader_names->texture_names[TEXTURE_REFRACTION]="texture_refraction"; + shader_names->texture_names[TEXTURE_REFRACTION_ROUGHNESS]="texture_refraction_roughness"; + shader_names->texture_names[TEXTURE_DETAIL_MASK]="texture_detail_mask"; + shader_names->texture_names[TEXTURE_DETAIL_ALBEDO]="texture_detail_albedo"; + shader_names->texture_names[TEXTURE_DETAIL_NORMAL]="texture_detail_normal"; } -FixedMaterial::~FixedMaterial() { +void FixedSpatialMaterial::finish_shaders(){ + +#ifndef NO_THREADS + memdelete( material_mutex ); +#endif + memdelete( shader_names ); } -///////////////////////////////// + + +void FixedSpatialMaterial::_update_shader() { + + dirty_materials.remove( &element ); + + MaterialKey mk = _compute_key(); + if (mk.key==current_key.key) + return; //no update required in the end + + if (shader_map.has(current_key)) { + shader_map[current_key].users--; + if (shader_map[current_key].users==0) { + //deallocate shader, as it's no longer in use + VS::get_singleton()->free(shader_map[current_key].shader); + shader_map.erase(current_key); + } + } + + current_key=mk; + + if (shader_map.has(mk)) { + + VS::get_singleton()->material_set_shader(_get_material(),shader_map[mk].shader); + shader_map[mk].users++; + return; + } + + //must create a shader! + + String code="render_mode "; + switch(blend_mode) { + case BLEND_MODE_MIX: code+="blend_mix"; break; + case BLEND_MODE_ADD: code+="blend_add"; break; + case BLEND_MODE_SUB: code+="blend_sub"; break; + case BLEND_MODE_MUL: code+="blend_mul"; break; + } + + switch(depth_draw_mode) { + case DEPTH_DRAW_OPAQUE_ONLY: code+=",depth_draw_opaque"; break; + case DEPTH_DRAW_ALWAYS: code+=",depth_draw_always"; break; + case DEPTH_DRAW_DISABLED: code+=",depth_draw_never"; break; + case DEPTH_DRAW_ALPHA_OPAQUE_PREPASS: code+=",depth_draw_alpha_prepass"; break; + } + + switch(cull_mode) { + case CULL_BACK: code+=",cull_back"; break; + case CULL_FRONT: code+=",cull_front"; break; + case CULL_DISABLED: code+=",cull_disable"; break; + + } + + if (flags[FLAG_UNSHADED]) { + code+=",unshaded"; + } + if (flags[FLAG_ONTOP]) { + code+=",ontop"; + } + + code+=";\n"; + + + code+="uniform vec4 albedo : hint_color;\n"; + code+="uniform sampler2D albedo_texture : hint_albedo;\n"; + code+="uniform vec4 specular : hint_color;\n"; + code+="uniform float roughness : hint_range(0,1);\n"; + code+="uniform sampler2D specular_texture : hint_white;\n"; + code+="\n\n"; + + code+="\n\n"; + code+="void fragment() {\n"; + code+="\tvec4 albedo_tex = texture(albedo_texture,UV);\n"; + + if (flags[FLAG_ALBEDO_FROM_VERTEX_COLOR]) { + code+="\talbedo_tex *= COLOR;\n"; + } + + code+="\tALBEDO = albedo.rgb * albedo_tex.rgb;\n"; + if (features[FEATURE_TRANSPARENT]) { + code+="\tALPHA = albedo.a * albedo_tex.a;\n"; + } + code+="\tvec4 specular_tex = texture(specular_texture,UV);\n"; + code+="\tSPECULAR = specular.rgb * specular_tex.rgb;\n"; + code+="\tROUGHNESS = specular.a * roughness;\n"; + code+="}\n"; + + ShaderData shader_data; + shader_data.shader = VS::get_singleton()->shader_create(VS::SHADER_SPATIAL); + shader_data.users=1; + + VS::get_singleton()->shader_set_code( shader_data.shader, code ); + + shader_map[mk]=shader_data; + + VS::get_singleton()->material_set_shader(_get_material(),shader_data.shader); + +} + +void FixedSpatialMaterial::flush_changes() { + + if (material_mutex) + material_mutex->lock(); + + while (dirty_materials.first()) { + + dirty_materials.first()->self()->_update_shader(); + } + + if (material_mutex) + material_mutex->unlock(); +} + +void FixedSpatialMaterial::_queue_shader_change() { + + if (material_mutex) + material_mutex->lock(); + + if (!element.in_list()) { + dirty_materials.add(&element); + } + + if (material_mutex) + material_mutex->unlock(); + + +} + +bool FixedSpatialMaterial::_is_shader_dirty() const { + + bool dirty=false; + + if (material_mutex) + material_mutex->lock(); + + dirty=element.in_list(); + + if (material_mutex) + material_mutex->unlock(); + + return dirty; +} +void FixedSpatialMaterial::set_albedo(const Color& p_albedo) { + + albedo=p_albedo; + + VS::get_singleton()->material_set_param(_get_material(),shader_names->albedo,p_albedo); +} + +Color FixedSpatialMaterial::get_albedo() const{ + + return albedo; +} + +void FixedSpatialMaterial::set_specular(const Color& p_specular){ + + specular=p_specular; + VS::get_singleton()->material_set_param(_get_material(),shader_names->specular,p_specular); + +} +Color FixedSpatialMaterial::get_specular() const{ + + return specular; +} + +void FixedSpatialMaterial::set_roughness(float p_roughness){ + + roughness=p_roughness; + VS::get_singleton()->material_set_param(_get_material(),shader_names->roughness,p_roughness); + +} +float FixedSpatialMaterial::get_roughness() const{ + + return roughness; +} + +void FixedSpatialMaterial::set_emission(const Color& p_emission){ + + emission=p_emission; + VS::get_singleton()->material_set_param(_get_material(),shader_names->emission,p_emission); + +} +Color FixedSpatialMaterial::get_emission() const{ + + return emission; +} + +void FixedSpatialMaterial::set_normal_scale(float p_normal_scale){ + + normal_scale=p_normal_scale; + VS::get_singleton()->material_set_param(_get_material(),shader_names->normal_scale,p_normal_scale); + +} +float FixedSpatialMaterial::get_normal_scale() const{ + + return normal_scale; +} + +void FixedSpatialMaterial::set_sheen(float p_sheen){ + + sheen=p_sheen; + VS::get_singleton()->material_set_param(_get_material(),shader_names->sheen,p_sheen); + + +} +float FixedSpatialMaterial::get_sheen() const{ + + return sheen; +} + +void FixedSpatialMaterial::set_sheen_color(const Color& p_sheen_color){ + + sheen_color=p_sheen_color; + VS::get_singleton()->material_set_param(_get_material(),shader_names->sheen_color,p_sheen_color); + +} +Color FixedSpatialMaterial::get_sheen_color() const{ + + return sheen_color; +} + +void FixedSpatialMaterial::set_clearcoat(float p_clearcoat){ + + clearcoat=p_clearcoat; + VS::get_singleton()->material_set_param(_get_material(),shader_names->clearcoat,p_clearcoat); + +} + +float FixedSpatialMaterial::get_clearcoat() const{ + + return clearcoat; +} + +void FixedSpatialMaterial::set_clearcoat_gloss(float p_clearcoat_gloss){ + + clearcoat_gloss=p_clearcoat_gloss; + VS::get_singleton()->material_set_param(_get_material(),shader_names->clearcoat_gloss,p_clearcoat_gloss); + + +} + +float FixedSpatialMaterial::get_clearcoat_gloss() const{ + + return clearcoat_gloss; +} + +void FixedSpatialMaterial::set_anisotropy(float p_anisotropy){ + + anisotropy=p_anisotropy; + VS::get_singleton()->material_set_param(_get_material(),shader_names->anisotropy,p_anisotropy); + +} +float FixedSpatialMaterial::get_anisotropy() const{ + + return anisotropy; +} + +void FixedSpatialMaterial::set_height_scale(float p_height_scale){ + + height_scale=p_height_scale; + VS::get_singleton()->material_set_param(_get_material(),shader_names->height_scale,p_height_scale); + + +} + +float FixedSpatialMaterial::get_height_scale() const{ + + return height_scale; +} + +void FixedSpatialMaterial::set_subsurface_scattering(float p_subsurface_scattering){ + + subsurface_scattering=p_subsurface_scattering; + VS::get_singleton()->material_set_param(_get_material(),shader_names->subsurface_scattering,subsurface_scattering); + + +} + +float FixedSpatialMaterial::get_subsurface_scattering() const{ + + return subsurface_scattering; +} + +void FixedSpatialMaterial::set_refraction(float p_refraction){ + + refraction=p_refraction; + VS::get_singleton()->material_set_param(_get_material(),shader_names->refraction,refraction); + +} + +float FixedSpatialMaterial::get_refraction() const { + + return refraction; +} + +void FixedSpatialMaterial::set_refraction_roughness(float p_refraction_roughness) { + + refraction_roughness=p_refraction_roughness; + VS::get_singleton()->material_set_param(_get_material(),shader_names->refraction_roughness,refraction_roughness); + + +} +float FixedSpatialMaterial::get_refraction_roughness() const { + + return refraction_roughness; +} + +void FixedSpatialMaterial::set_detail_uv(DetailUV p_detail_uv) { + + if (detail_uv==p_detail_uv) + return; + + detail_uv=p_detail_uv; + _queue_shader_change(); +} +FixedSpatialMaterial::DetailUV FixedSpatialMaterial::get_detail_uv() const { + + return detail_uv; +} + +void FixedSpatialMaterial::set_blend_mode(BlendMode p_mode) { + + if (blend_mode==p_mode) + return; + + blend_mode=p_mode; + _queue_shader_change(); +} +FixedSpatialMaterial::BlendMode FixedSpatialMaterial::get_blend_mode() const { + + return blend_mode; +} + +void FixedSpatialMaterial::set_detail_blend_mode(BlendMode p_mode) { + + detail_blend_mode=p_mode; + _queue_shader_change(); +} +FixedSpatialMaterial::BlendMode FixedSpatialMaterial::get_detail_blend_mode() const { + + return detail_blend_mode; +} + +void FixedSpatialMaterial::set_depth_draw_mode(DepthDrawMode p_mode) { + + if (depth_draw_mode==p_mode) + return; + + depth_draw_mode=p_mode; + _queue_shader_change(); +} +FixedSpatialMaterial::DepthDrawMode FixedSpatialMaterial::get_depth_draw_mode() const { + + return depth_draw_mode; +} + +void FixedSpatialMaterial::set_cull_mode(CullMode p_mode) { + + if (cull_mode==p_mode) + return; + + cull_mode=p_mode; + _queue_shader_change(); +} +FixedSpatialMaterial::CullMode FixedSpatialMaterial::get_cull_mode() const { + + return cull_mode; +} + +void FixedSpatialMaterial::set_diffuse_mode(DiffuseMode p_mode) { + + if (diffuse_mode==p_mode) + return; + + diffuse_mode=p_mode; + _queue_shader_change(); +} +FixedSpatialMaterial::DiffuseMode FixedSpatialMaterial::get_diffuse_mode() const { + + return diffuse_mode; +} + +void FixedSpatialMaterial::set_flag(Flags p_flag,bool p_enabled) { + + ERR_FAIL_INDEX(p_flag,FLAG_MAX); + + if (flags[p_flag]==p_enabled) + return; + + flags[p_flag]=p_enabled; + _queue_shader_change(); +} + +bool FixedSpatialMaterial::get_flag(Flags p_flag) const { + + ERR_FAIL_INDEX_V(p_flag,FLAG_MAX,false); + return flags[p_flag]; +} + +void FixedSpatialMaterial::set_feature(Feature p_feature,bool p_enabled) { + + ERR_FAIL_INDEX(p_feature,FEATURE_MAX); + if (features[p_feature]==p_enabled) + return; + + features[p_feature]=p_enabled; + _change_notify(); + _queue_shader_change(); + + +} + +bool FixedSpatialMaterial::get_feature(Feature p_feature) const { + + ERR_FAIL_INDEX_V(p_feature,FEATURE_MAX,false); + return features[p_feature]; +} + + + +void FixedSpatialMaterial::set_texture(TextureParam p_param, const Ref &p_texture) { + + ERR_FAIL_INDEX(p_param,TEXTURE_MAX); + textures[p_param]=p_texture; + VS::get_singleton()->material_set_param(_get_material(),shader_names->texture_names[p_param],p_texture); +} + +Ref FixedSpatialMaterial::get_texture(TextureParam p_param) const { + + ERR_FAIL_INDEX_V(p_param,TEXTURE_MAX,Ref()); + return textures[p_param]; +} + + +void FixedSpatialMaterial::_validate_feature(const String& text, Feature feature,PropertyInfo& property) const { + if (property.name.begins_with(text) && property.name!=text+"/enabled" && !features[feature]) { + property.usage=0; + } +} + +void FixedSpatialMaterial::_validate_property(PropertyInfo& property) const { + _validate_feature("normal",FEATURE_NORMAL_MAPPING,property); + _validate_feature("sheen",FEATURE_SHEEN,property); + _validate_feature("clearcoat",FEATURE_CLEARCOAT,property); + _validate_feature("anisotropy",FEATURE_ANISOTROPY,property); + _validate_feature("ao",FEATURE_AMBIENT_OCCLUSION,property); + _validate_feature("height",FEATURE_HEIGHT_MAPPING,property); + _validate_feature("subsurf_scatter",FEATURE_SUBSURACE_SCATTERING,property); + _validate_feature("refraction",FEATURE_REFRACTION,property); + _validate_feature("detail",FEATURE_DETAIL,property); + +} + +void FixedSpatialMaterial::_bind_methods() { + + + ObjectTypeDB::bind_method(_MD("set_albedo","albedo"),&FixedSpatialMaterial::set_albedo); + ObjectTypeDB::bind_method(_MD("get_albedo"),&FixedSpatialMaterial::get_albedo); + + ObjectTypeDB::bind_method(_MD("set_specular","specular"),&FixedSpatialMaterial::set_specular); + ObjectTypeDB::bind_method(_MD("get_specular"),&FixedSpatialMaterial::get_specular); + + ObjectTypeDB::bind_method(_MD("set_roughness","roughness"),&FixedSpatialMaterial::set_roughness); + ObjectTypeDB::bind_method(_MD("get_roughness"),&FixedSpatialMaterial::get_roughness); + + ObjectTypeDB::bind_method(_MD("set_emission","emission"),&FixedSpatialMaterial::set_emission); + ObjectTypeDB::bind_method(_MD("get_emission"),&FixedSpatialMaterial::get_emission); + + ObjectTypeDB::bind_method(_MD("set_normal_scale","normal_scale"),&FixedSpatialMaterial::set_normal_scale); + ObjectTypeDB::bind_method(_MD("get_normal_scale"),&FixedSpatialMaterial::get_normal_scale); + + ObjectTypeDB::bind_method(_MD("set_sheen","sheen"),&FixedSpatialMaterial::set_sheen); + ObjectTypeDB::bind_method(_MD("get_sheen"),&FixedSpatialMaterial::get_sheen); + + ObjectTypeDB::bind_method(_MD("set_sheen_color","sheen_color"),&FixedSpatialMaterial::set_sheen_color); + ObjectTypeDB::bind_method(_MD("get_sheen_color"),&FixedSpatialMaterial::get_sheen_color); + + ObjectTypeDB::bind_method(_MD("set_clearcoat","clearcoat"),&FixedSpatialMaterial::set_clearcoat); + ObjectTypeDB::bind_method(_MD("get_clearcoat"),&FixedSpatialMaterial::get_clearcoat); + + ObjectTypeDB::bind_method(_MD("set_clearcoat_gloss","clearcoat_gloss"),&FixedSpatialMaterial::set_clearcoat_gloss); + ObjectTypeDB::bind_method(_MD("get_clearcoat_gloss"),&FixedSpatialMaterial::get_clearcoat_gloss); + + ObjectTypeDB::bind_method(_MD("set_anisotropy","anisotropy"),&FixedSpatialMaterial::set_anisotropy); + ObjectTypeDB::bind_method(_MD("get_anisotropy"),&FixedSpatialMaterial::get_anisotropy); + + ObjectTypeDB::bind_method(_MD("set_height_scale","height_scale"),&FixedSpatialMaterial::set_height_scale); + ObjectTypeDB::bind_method(_MD("get_height_scale"),&FixedSpatialMaterial::get_height_scale); + + ObjectTypeDB::bind_method(_MD("set_subsurface_scattering","subsurface_scattering"),&FixedSpatialMaterial::set_subsurface_scattering); + ObjectTypeDB::bind_method(_MD("get_subsurface_scattering"),&FixedSpatialMaterial::get_subsurface_scattering); + + ObjectTypeDB::bind_method(_MD("set_refraction","refraction"),&FixedSpatialMaterial::set_refraction); + ObjectTypeDB::bind_method(_MD("get_refraction"),&FixedSpatialMaterial::get_refraction); + + ObjectTypeDB::bind_method(_MD("set_refraction_roughness","refraction_roughness"),&FixedSpatialMaterial::set_refraction_roughness); + ObjectTypeDB::bind_method(_MD("get_refraction_roughness"),&FixedSpatialMaterial::get_refraction_roughness); + + ObjectTypeDB::bind_method(_MD("set_detail_uv","detail_uv"),&FixedSpatialMaterial::set_detail_uv); + ObjectTypeDB::bind_method(_MD("get_detail_uv"),&FixedSpatialMaterial::get_detail_uv); + + ObjectTypeDB::bind_method(_MD("set_blend_mode","blend_mode"),&FixedSpatialMaterial::set_blend_mode); + ObjectTypeDB::bind_method(_MD("get_blend_mode"),&FixedSpatialMaterial::get_blend_mode); + + ObjectTypeDB::bind_method(_MD("set_depth_draw_mode","depth_draw_mode"),&FixedSpatialMaterial::set_depth_draw_mode); + ObjectTypeDB::bind_method(_MD("get_depth_draw_mode"),&FixedSpatialMaterial::get_depth_draw_mode); + + ObjectTypeDB::bind_method(_MD("set_cull_mode","cull_mode"),&FixedSpatialMaterial::set_cull_mode); + ObjectTypeDB::bind_method(_MD("get_cull_mode"),&FixedSpatialMaterial::get_cull_mode); + + ObjectTypeDB::bind_method(_MD("set_diffuse_mode","diffuse_mode"),&FixedSpatialMaterial::set_diffuse_mode); + ObjectTypeDB::bind_method(_MD("get_diffuse_mode"),&FixedSpatialMaterial::get_diffuse_mode); + + ObjectTypeDB::bind_method(_MD("set_flag","flag","enable"),&FixedSpatialMaterial::set_flag); + ObjectTypeDB::bind_method(_MD("get_flag"),&FixedSpatialMaterial::get_flag); + + ObjectTypeDB::bind_method(_MD("set_feature","feature","enable"),&FixedSpatialMaterial::set_feature); + ObjectTypeDB::bind_method(_MD("get_feature","feature"),&FixedSpatialMaterial::get_feature); + + ObjectTypeDB::bind_method(_MD("set_texture","param:Texture","texture"),&FixedSpatialMaterial::set_texture); + ObjectTypeDB::bind_method(_MD("get_texture:Texture","param:Texture"),&FixedSpatialMaterial::get_texture); + + ObjectTypeDB::bind_method(_MD("set_detail_blend_mode","detail_blend_mode"),&FixedSpatialMaterial::set_detail_blend_mode); + ObjectTypeDB::bind_method(_MD("get_detail_blend_mode"),&FixedSpatialMaterial::get_detail_blend_mode); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/transparent"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_TRANSPARENT); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/unshaded"),_SCS("set_flag"),_SCS("get_flag"),FLAG_UNSHADED); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/on_top"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ONTOP); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/vcol_albedo"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ALBEDO_FROM_VERTEX_COLOR); + + ADD_PROPERTY(PropertyInfo(Variant::INT,"params/diffuse_mode",PROPERTY_HINT_ENUM,"Labert,Lambert Wrap,Oren Nayar,Burley"),_SCS("set_diffuse_mode"),_SCS("get_diffuse_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params/blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_blend_mode"),_SCS("get_blend_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params/cull_mode",PROPERTY_HINT_ENUM,"Back,Front,Disabled"),_SCS("set_cull_mode"),_SCS("get_cull_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"params/depth_draw_mode",PROPERTY_HINT_ENUM,"Opaque Only,Always,Never,Opaque Pre-Pass"),_SCS("set_depth_draw_mode"),_SCS("get_depth_draw_mode")); + + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo/color"),_SCS("set_albedo"),_SCS("get_albedo")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); + + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular/color"),_SCS("set_specular"),_SCS("get_specular")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_roughness"),_SCS("get_roughness")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"specular/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SPECULAR); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"normal/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_NORMAL_MAPPING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"normal/scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_normal_scale"),_SCS("get_normal_scale")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"normal/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_NORMAL); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"sheen/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SHEEN); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"sheen/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_sheen"),_SCS("get_sheen")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"sheen/color"),_SCS("set_sheen_color"),_SCS("get_sheen_color")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"sheen/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SHEEN); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"clearcoat/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_CLEARCOAT); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat"),_SCS("get_clearcoat")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/gloss"),_SCS("set_clearcoat_gloss"),_SCS("get_clearcoat_gloss")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"clearcoat/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_CLEARCOAT); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"anisotropy/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_ANISOTROPY); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"anisotropy/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_anisotropy"),_SCS("get_anisotropy")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"anisotropy/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ANISOTROPY); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"ao/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_AMBIENT_OCCLUSION); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"ao/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_AMBIENT_OCCLUSION); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"height/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_HEIGHT_MAPPING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"height/scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_height_scale"),_SCS("get_height_scale")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"height/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_HEIGHT); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"subsurf_scatter/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SUBSURACE_SCATTERING); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"subsurf_scatter/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_subsurface_scattering"),_SCS("get_subsurface_scattering")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"subsurf_scatter/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SUBSURFACE_SCATTERING); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"refraction/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_REFRACTION); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction/displacement",PROPERTY_HINT_RANGE,"-1,1,0.01"),_SCS("set_refraction"),_SCS("get_refraction")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"refraction/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_refraction_roughness"),_SCS("get_refraction_roughness")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"refraction/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_REFRACTION); + + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"detail/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_DETAIL); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/mask",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_MASK); + ADD_PROPERTY(PropertyInfo(Variant::INT,"detail/blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_detail_blend_mode"),_SCS("get_detail_blend_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"detail/uv_layer",PROPERTY_HINT_ENUM,"UV1,UV2"),_SCS("set_detail_uv"),_SCS("get_detail_uv")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/albedo",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_ALBEDO); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_NORMAL); + + BIND_CONSTANT( TEXTURE_ALBEDO ); + BIND_CONSTANT( TEXTURE_SPECULAR ); + BIND_CONSTANT( TEXTURE_EMISSION ); + BIND_CONSTANT( TEXTURE_NORMAL ); + BIND_CONSTANT( TEXTURE_SHEEN ); + BIND_CONSTANT( TEXTURE_CLEARCOAT ); + BIND_CONSTANT( TEXTURE_ANISOTROPY ); + BIND_CONSTANT( TEXTURE_AMBIENT_OCCLUSION ); + BIND_CONSTANT( TEXTURE_HEIGHT ); + BIND_CONSTANT( TEXTURE_SUBSURFACE_SCATTERING ); + BIND_CONSTANT( TEXTURE_REFRACTION ); + BIND_CONSTANT( TEXTURE_REFRACTION_ROUGHNESS ); + BIND_CONSTANT( TEXTURE_DETAIL_MASK ); + BIND_CONSTANT( TEXTURE_DETAIL_ALBEDO ); + BIND_CONSTANT( TEXTURE_DETAIL_NORMAL ); + BIND_CONSTANT( TEXTURE_MAX ); + + + BIND_CONSTANT( DETAIL_UV_1 ); + BIND_CONSTANT( DETAIL_UV_2 ); + + BIND_CONSTANT( FEATURE_TRANSPARENT ); + BIND_CONSTANT( FEATURE_EMISSION ); + BIND_CONSTANT( FEATURE_NORMAL_MAPPING ); + BIND_CONSTANT( FEATURE_SHEEN ); + BIND_CONSTANT( FEATURE_CLEARCOAT ); + BIND_CONSTANT( FEATURE_ANISOTROPY ); + BIND_CONSTANT( FEATURE_AMBIENT_OCCLUSION ); + BIND_CONSTANT( FEATURE_HEIGHT_MAPPING ); + BIND_CONSTANT( FEATURE_SUBSURACE_SCATTERING ); + BIND_CONSTANT( FEATURE_REFRACTION ); + BIND_CONSTANT( FEATURE_DETAIL ); + BIND_CONSTANT( FEATURE_MAX ); + + BIND_CONSTANT( BLEND_MODE_MIX ); + BIND_CONSTANT( BLEND_MODE_ADD ); + BIND_CONSTANT( BLEND_MODE_SUB ); + BIND_CONSTANT( BLEND_MODE_MUL ); + + BIND_CONSTANT( DEPTH_DRAW_OPAQUE_ONLY ); + BIND_CONSTANT( DEPTH_DRAW_ALWAYS ); + BIND_CONSTANT( DEPTH_DRAW_DISABLED ); + BIND_CONSTANT( DEPTH_DRAW_ALPHA_OPAQUE_PREPASS ); + + + BIND_CONSTANT( CULL_BACK ); + BIND_CONSTANT( CULL_FRONT ); + BIND_CONSTANT( CULL_DISABLED ); + + BIND_CONSTANT( FLAG_UNSHADED ); + BIND_CONSTANT( FLAG_ONTOP ); + BIND_CONSTANT( FLAG_ALBEDO_FROM_VERTEX_COLOR ); + BIND_CONSTANT( FLAG_MAX ); + + BIND_CONSTANT( DIFFUSE_LAMBERT ); + BIND_CONSTANT( DIFFUSE_LAMBERT_WRAP ); + BIND_CONSTANT( DIFFUSE_OREN_NAYAR ); + BIND_CONSTANT( DIFFUSE_BURLEY ); +} + + +FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { + + //initialize to right values + set_albedo(Color(0.7,0.7,0.7,1.0)); + set_specular(Color(0.1,0.1,0.1)); + set_roughness(0.0); + set_emission(Color(0,0,0)); + set_normal_scale(1); + set_sheen(0); + set_sheen_color(Color(1,1,1,1)); + set_clearcoat(0); + set_clearcoat_gloss(0.5); + set_anisotropy(0); + set_height_scale(1); + set_subsurface_scattering(0); + set_refraction(0); + set_refraction_roughness(0); + + detail_uv=DETAIL_UV_1; + blend_mode=BLEND_MODE_MIX; + detail_blend_mode=BLEND_MODE_MIX; + depth_draw_mode=DEPTH_DRAW_OPAQUE_ONLY; + cull_mode=CULL_BACK; + for(int i=0;ilock(); + + if (shader_map.has(current_key)) { + shader_map[current_key].users--; + if (shader_map[current_key].users==0) { + //deallocate shader, as it's no longer in use + VS::get_singleton()->free(shader_map[current_key].shader); + shader_map.erase(current_key); + } + + VS::get_singleton()->material_set_shader(_get_material(),RID()); + } + + + if (material_mutex) + material_mutex->unlock(); + +} diff --git a/scene/resources/material.h b/scene/resources/material.h index 1acc031641..0f0bf48025 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -34,7 +34,7 @@ #include "scene/resources/shader.h" #include "resource.h" #include "servers/visual/shader_language.h" - +#include "self_list.h" /** @author Juan Linietsky */ @@ -57,17 +57,298 @@ public: }; -class FixedMaterial : public Material { +class FixedSpatialMaterial : public Material { - OBJ_TYPE(FixedMaterial,Resource); + OBJ_TYPE(FixedSpatialMaterial,Material) public: - FixedMaterial(); - virtual ~FixedMaterial(); + enum TextureParam { + TEXTURE_ALBEDO, + TEXTURE_SPECULAR, + TEXTURE_EMISSION, + TEXTURE_NORMAL, + TEXTURE_SHEEN, + TEXTURE_CLEARCOAT, + TEXTURE_ANISOTROPY, + TEXTURE_AMBIENT_OCCLUSION, + TEXTURE_HEIGHT, + TEXTURE_SUBSURFACE_SCATTERING, + TEXTURE_REFRACTION, + TEXTURE_REFRACTION_ROUGHNESS, + TEXTURE_DETAIL_MASK, + TEXTURE_DETAIL_ALBEDO, + TEXTURE_DETAIL_NORMAL, + TEXTURE_MAX + + + }; + + + enum DetailUV { + DETAIL_UV_1, + DETAIL_UV_2 + }; + + enum Feature { + FEATURE_TRANSPARENT, + FEATURE_EMISSION, + FEATURE_NORMAL_MAPPING, + FEATURE_SHEEN, + FEATURE_CLEARCOAT, + FEATURE_ANISOTROPY, + FEATURE_AMBIENT_OCCLUSION, + FEATURE_HEIGHT_MAPPING, + FEATURE_SUBSURACE_SCATTERING, + FEATURE_REFRACTION, + FEATURE_DETAIL, + FEATURE_MAX + }; + + + enum BlendMode { + BLEND_MODE_MIX, + BLEND_MODE_ADD, + BLEND_MODE_SUB, + BLEND_MODE_MUL, + }; + + enum DepthDrawMode { + DEPTH_DRAW_OPAQUE_ONLY, + DEPTH_DRAW_ALWAYS, + DEPTH_DRAW_DISABLED, + DEPTH_DRAW_ALPHA_OPAQUE_PREPASS + + }; + + enum CullMode { + CULL_BACK, + CULL_FRONT, + CULL_DISABLED + }; + + enum Flags { + FLAG_UNSHADED, + FLAG_ONTOP, + FLAG_ALBEDO_FROM_VERTEX_COLOR, + FLAG_MAX + }; + + enum DiffuseMode { + DIFFUSE_LAMBERT, + DIFFUSE_LAMBERT_WRAP, + DIFFUSE_OREN_NAYAR, + DIFFUSE_BURLEY, + }; + +private: + union MaterialKey { + + struct { + uint32_t feature_mask : 16; + uint32_t detail_uv : 1; + uint32_t blend_mode : 2; + uint32_t depth_draw_mode : 2; + uint32_t cull_mode : 2; + uint32_t flags : 3; + uint32_t detail_blend_mode : 2; + uint32_t diffuse_mode : 2; + uint32_t invalid_key : 1; + }; + + uint32_t key; + + bool operator<(const MaterialKey& p_key) const { + return key < p_key.key; + } + + }; + + struct ShaderData { + RID shader; + int users; + }; + + static Map shader_map; + + MaterialKey current_key; + + _FORCE_INLINE_ MaterialKey _compute_key() const { + + MaterialKey mk; + mk.key=0; + for(int i=0;i::List dirty_materials; + static ShaderNames* shader_names; + + SelfList element; + + void _update_shader(); + _FORCE_INLINE_ void _queue_shader_change(); + _FORCE_INLINE_ bool _is_shader_dirty() const; + + Color albedo; + Color specular; + float roughness; + Color emission; + float normal_scale; + float sheen; + Color sheen_color; + float clearcoat; + float clearcoat_gloss; + float anisotropy; + float height_scale; + float subsurface_scattering; + float refraction; + float refraction_roughness; + + DetailUV detail_uv; + + BlendMode blend_mode; + BlendMode detail_blend_mode; + DepthDrawMode depth_draw_mode; + CullMode cull_mode; + bool flags[FLAG_MAX]; + DiffuseMode diffuse_mode; + + bool features[FEATURE_MAX]; + + Ref textures[TEXTURE_MAX]; + + _FORCE_INLINE_ void _validate_feature(const String& text, Feature feature,PropertyInfo& property) const; + +protected: + + static void _bind_methods(); + void _validate_property(PropertyInfo& property) const; + +public: + + + void set_albedo(const Color& p_albedo); + Color get_albedo() const; + + void set_specular(const Color& p_specular); + Color get_specular() const; + + void set_roughness(float p_roughness); + float get_roughness() const; + + void set_emission(const Color& p_emission); + Color get_emission() const; + + void set_normal_scale(float p_normal_scale); + float get_normal_scale() const; + + void set_sheen(float p_sheen); + float get_sheen() const; + + void set_sheen_color(const Color& p_sheen_color); + Color get_sheen_color() const; + + void set_clearcoat(float p_clearcoat); + float get_clearcoat() const; + + void set_clearcoat_gloss(float p_clearcoat_gloss); + float get_clearcoat_gloss() const; + + void set_anisotropy(float p_anisotropy); + float get_anisotropy() const; + + void set_height_scale(float p_height_scale); + float get_height_scale() const; + + void set_subsurface_scattering(float p_subsurface_scattering); + float get_subsurface_scattering() const; + + void set_refraction(float p_refraction); + float get_refraction() const; + + void set_refraction_roughness(float p_refraction_roughness); + float get_refraction_roughness() const; + + void set_detail_uv(DetailUV p_detail_uv); + DetailUV get_detail_uv() const; + + void set_blend_mode(BlendMode p_mode); + BlendMode get_blend_mode() const; + + void set_detail_blend_mode(BlendMode p_mode); + BlendMode get_detail_blend_mode() const; + + void set_depth_draw_mode(DepthDrawMode p_mode); + DepthDrawMode get_depth_draw_mode() const; + + void set_cull_mode(CullMode p_mode); + CullMode get_cull_mode() const; + + void set_diffuse_mode(DiffuseMode p_mode); + DiffuseMode get_diffuse_mode() const; + + void set_flag(Flags p_flag,bool p_enabled); + bool get_flag(Flags p_flag) const; + + void set_texture(TextureParam p_param,const Ref& p_texture); + Ref get_texture(TextureParam p_param) const; + + void set_feature(Feature p_feature,bool p_enabled); + bool get_feature(Feature p_feature) const; + + static void init_shaders(); + static void finish_shaders(); + static void flush_changes(); + + FixedSpatialMaterial(); + virtual ~FixedSpatialMaterial(); }; +VARIANT_ENUM_CAST( FixedSpatialMaterial::TextureParam ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::DetailUV ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::Feature ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::BlendMode ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::DepthDrawMode ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::CullMode ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::Flags ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::DiffuseMode ) ////////////////////// diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index 2952098a3c..2c62f22a61 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -55,10 +55,10 @@ RID Rasterizer::create_default_material() { /* Fixed MAterial SHADER API */ -RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) { +RID Rasterizer::_create_shader(const FixedSpatialMaterialShaderKey& p_key) { ERR_FAIL_COND_V(!p_key.valid,RID()); - Map::Element *E=fixed_material_shaders.find(p_key); + Map::Element *E=fixed_material_shaders.find(p_key); if (E) { E->get().refcount++; @@ -67,7 +67,7 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) { uint64_t t = OS::get_singleton()->get_ticks_usec(); - FixedMaterialShader fms; + FixedSpatialMaterialShader fms; fms.refcount=1; fms.shader=shader_create(); @@ -313,12 +313,12 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) { return fms.shader; } -void Rasterizer::_free_shader(const FixedMaterialShaderKey& p_key) { +void Rasterizer::_free_shader(const FixedSpatialMaterialShaderKey& p_key) { if (p_key.valid==0) return; //not a valid key - Map::Element *E=fixed_material_shaders.find(p_key); + Map::Element *E=fixed_material_shaders.find(p_key); ERR_FAIL_COND(!E); E->get().refcount--; @@ -330,12 +330,12 @@ void Rasterizer::_free_shader(const FixedMaterialShaderKey& p_key) { } -void Rasterizer::fixed_material_set_flag(RID p_material, VS::FixedMaterialFlags p_flag, bool p_enabled) { +void Rasterizer::fixed_material_set_flag(RID p_material, VS::FixedSpatialMaterialFlags p_flag, bool p_enabled) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); switch(p_flag) { @@ -351,11 +351,11 @@ void Rasterizer::fixed_material_set_flag(RID p_material, VS::FixedMaterialFlags } -bool Rasterizer::fixed_material_get_flag(RID p_material, VS::FixedMaterialFlags p_flag) const{ +bool Rasterizer::fixed_material_get_flag(RID p_material, VS::FixedSpatialMaterialFlags p_flag) const{ - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,false); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); switch(p_flag) { case VS::FIXED_MATERIAL_FLAG_USE_ALPHA: return fm.use_alpha;; break; @@ -374,8 +374,8 @@ bool Rasterizer::fixed_material_get_flag(RID p_material, VS::FixedMaterialFlags RID Rasterizer::fixed_material_create() { RID mat = material_create(); - fixed_materials[mat]=memnew( FixedMaterial() ); - FixedMaterial &fm=*fixed_materials[mat]; + fixed_materials[mat]=memnew( FixedSpatialMaterial() ); + FixedSpatialMaterial &fm=*fixed_materials[mat]; fm.self=mat; fm.get_key(); material_set_flag(mat,VS::MATERIAL_FLAG_COLOR_ARRAY_SRGB,true); @@ -391,11 +391,11 @@ RID Rasterizer::fixed_material_create() { -void Rasterizer::fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value){ +void Rasterizer::fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value){ - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); RID material=E->key(); ERR_FAIL_INDEX(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX); @@ -418,24 +418,24 @@ void Rasterizer::fixed_material_set_parameter(RID p_material, VS::FixedMaterialP } -Variant Rasterizer::fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const{ +Variant Rasterizer::fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const{ - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,Variant()); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); ERR_FAIL_INDEX_V(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX,Variant()); return fm.param[p_parameter]; } -void Rasterizer::fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture){ +void Rasterizer::fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture){ - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); if (!E) { print_line("Not found: "+itos(p_material.get_id())); } ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); ERR_FAIL_INDEX(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX); @@ -450,22 +450,22 @@ void Rasterizer::fixed_material_set_texture(RID p_material,VS::FixedMaterialPara } -RID Rasterizer::fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const{ +RID Rasterizer::fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const{ - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,RID()); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); ERR_FAIL_INDEX_V(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX,RID()); return fm.texture[p_parameter]; } -void Rasterizer::fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode) { +void Rasterizer::fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); ERR_FAIL_INDEX(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX); fm.get_key(); @@ -477,11 +477,11 @@ void Rasterizer::fixed_material_set_texcoord_mode(RID p_material,VS::FixedMateri } -VS::FixedMaterialTexCoordMode Rasterizer::fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const { +VS::FixedSpatialMaterialTexCoordMode Rasterizer::fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const { - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,VS::FIXED_MATERIAL_TEXCOORD_UV); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); ERR_FAIL_INDEX_V(p_parameter,VS::FIXED_MATERIAL_PARAM_MAX,VS::FIXED_MATERIAL_TEXCOORD_UV); return fm.texture_tc[p_parameter]; @@ -489,9 +489,9 @@ VS::FixedMaterialTexCoordMode Rasterizer::fixed_material_get_texcoord_mode(RID p void Rasterizer::fixed_material_set_uv_transform(RID p_material,const Transform& p_transform) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); RID material=E->key(); VS::get_singleton()->material_set_param(material,_fixed_material_uv_xform_name,p_transform); @@ -504,18 +504,18 @@ void Rasterizer::fixed_material_set_uv_transform(RID p_material,const Transform& Transform Rasterizer::fixed_material_get_uv_transform(RID p_material) const { - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,Transform()); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); return fm.uv_xform; } -void Rasterizer::fixed_material_set_light_shader(RID p_material,VS::FixedMaterialLightShader p_shader) { +void Rasterizer::fixed_material_set_light_shader(RID p_material,VS::FixedSpatialMaterialLightShader p_shader) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); fm.light_shader=p_shader; @@ -524,20 +524,20 @@ void Rasterizer::fixed_material_set_light_shader(RID p_material,VS::FixedMateria } -VS::FixedMaterialLightShader Rasterizer::fixed_material_get_light_shader(RID p_material) const { +VS::FixedSpatialMaterialLightShader Rasterizer::fixed_material_get_light_shader(RID p_material) const { - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,VS::FIXED_MATERIAL_LIGHT_SHADER_LAMBERT); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); return fm.light_shader; } void Rasterizer::fixed_material_set_point_size(RID p_material,float p_size) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND(!E); - FixedMaterial &fm=*E->get(); + FixedSpatialMaterial &fm=*E->get(); RID material=E->key(); VS::get_singleton()->material_set_param(material,_fixed_material_point_size_name,p_size); @@ -549,9 +549,9 @@ void Rasterizer::fixed_material_set_point_size(RID p_material,float p_size) { float Rasterizer::fixed_material_get_point_size(RID p_material) const{ - const Map::Element *E = fixed_materials.find(p_material); + const Map::Element *E = fixed_materials.find(p_material); ERR_FAIL_COND_V(!E,1.0); - const FixedMaterial &fm=*E->get(); + const FixedSpatialMaterial &fm=*E->get(); return fm.point_size; @@ -562,9 +562,9 @@ void Rasterizer::_update_fixed_materials() { while(fixed_material_dirty_list.first()) { - FixedMaterial &fm=*fixed_material_dirty_list.first()->self(); + FixedSpatialMaterial &fm=*fixed_material_dirty_list.first()->self(); - FixedMaterialShaderKey new_key = fm.get_key(); + FixedSpatialMaterialShaderKey new_key = fm.get_key(); if (new_key.key!=fm.current_key.key) { _free_shader(fm.current_key); @@ -594,7 +594,7 @@ void Rasterizer::_update_fixed_materials() { void Rasterizer::_free_fixed_material(const RID& p_material) { - Map::Element *E = fixed_materials.find(p_material); + Map::Element *E = fixed_materials.find(p_material); if (E) { @@ -637,7 +637,7 @@ Rasterizer::Rasterizer() { draw_viewport_func=NULL; - ERR_FAIL_COND( sizeof(FixedMaterialShaderKey)!=4); + ERR_FAIL_COND( sizeof(FixedSpatialMaterialShaderKey)!=4); } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 81cdcf6a25..78757c799f 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -44,12 +44,12 @@ public: virtual RID environment_create()=0; virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg)=0; - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size)=0; virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0)=0; + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0)=0; virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; @@ -90,6 +90,8 @@ public: bool billboard_y :8; bool receive_shadows : 8; + float depth; //used for sorting + SelfList dependency_item; virtual void base_removed()=0; @@ -146,7 +148,7 @@ public: virtual void texture_debug_usage(List *r_info)=0; - virtual RID texture_create_pbr_cubemap(RID p_source,VS::PBRCubeMapMode p_mode,int p_resolution=-1) const=0; + virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; /* SHADER API */ @@ -798,7 +800,7 @@ protected: /* Fixed Material Shader API */ - union FixedMaterialShaderKey { + union FixedSpatialMaterialShaderKey { struct { uint16_t texcoord_mask; @@ -814,21 +816,21 @@ protected: uint32_t key; - _FORCE_INLINE_ bool operator<(const FixedMaterialShaderKey& p_key) const { return key fixed_material_shaders; + Map fixed_material_shaders; - RID _create_shader(const FixedMaterialShaderKey& p_key); - void _free_shader(const FixedMaterialShaderKey& p_key); + RID _create_shader(const FixedSpatialMaterialShaderKey& p_key); + void _free_shader(const FixedSpatialMaterialShaderKey& p_key); - struct FixedMaterial { + struct FixedSpatialMaterial { RID self; @@ -839,19 +841,19 @@ protected: bool use_xy_normalmap; float point_size; Transform uv_xform; - VS::FixedMaterialLightShader light_shader; + VS::FixedSpatialMaterialLightShader light_shader; RID texture[VS::FIXED_MATERIAL_PARAM_MAX]; Variant param[VS::FIXED_MATERIAL_PARAM_MAX]; - VS::FixedMaterialTexCoordMode texture_tc[VS::FIXED_MATERIAL_PARAM_MAX]; + VS::FixedSpatialMaterialTexCoordMode texture_tc[VS::FIXED_MATERIAL_PARAM_MAX]; - SelfList dirty_list; + SelfList dirty_list; - FixedMaterialShaderKey current_key; + FixedSpatialMaterialShaderKey current_key; - _FORCE_INLINE_ FixedMaterialShaderKey get_key() const { + _FORCE_INLINE_ FixedSpatialMaterialShaderKey get_key() const { - FixedMaterialShaderKey k; + FixedSpatialMaterialShaderKey k; k.key=0; k.use_alpha=use_alpha; k.use_color_array=use_color_array; @@ -872,7 +874,7 @@ protected: } - FixedMaterial() : dirty_list(this) { + FixedSpatialMaterial() : dirty_list(this) { use_alpha=false; use_color_array=false; @@ -904,9 +906,9 @@ protected: StringName _fixed_material_uv_xform_name; StringName _fixed_material_point_size_name; - Map fixed_materials; + Map fixed_materials; - SelfList::List fixed_material_dirty_list; + SelfList::List fixed_material_dirty_list; protected: void _update_fixed_materials(); @@ -993,23 +995,23 @@ public: virtual RID fixed_material_create(); - virtual void fixed_material_set_flag(RID p_material, VS::FixedMaterialFlags p_flag, bool p_enabled); - virtual bool fixed_material_get_flag(RID p_material, VS::FixedMaterialFlags p_flag) const; + virtual void fixed_material_set_flag(RID p_material, VS::FixedSpatialMaterialFlags p_flag, bool p_enabled); + virtual bool fixed_material_get_flag(RID p_material, VS::FixedSpatialMaterialFlags p_flag) const; - virtual void fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value); - virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value); + virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; - virtual void fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture); - virtual RID fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture); + virtual RID fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; - virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode); - virtual VS::FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const; + virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode); + virtual VS::FixedSpatialMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const; virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform); virtual Transform fixed_material_get_uv_transform(RID p_material) const; - virtual void fixed_material_set_light_shader(RID p_material,VS::FixedMaterialLightShader p_shader); - virtual VS::FixedMaterialLightShader fixed_material_get_light_shader(RID p_material) const; + virtual void fixed_material_set_light_shader(RID p_material,VS::FixedSpatialMaterialLightShader p_shader); + virtual VS::FixedSpatialMaterialLightShader fixed_material_get_light_shader(RID p_material) const; virtual void fixed_material_set_point_size(RID p_material,float p_size); virtual float fixed_material_get_point_size(RID p_material) const; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 065bb4d31a..357546e595 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -260,11 +260,11 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[]={ {TK_UNIFORM,"uniform"}, {TK_VARYING,"varying"}, {TK_RENDER_MODE,"render_mode"}, - {TK_HINT_WHITE_TEXTURE,"white"}, - {TK_HINT_BLACK_TEXTURE,"black"}, - {TK_HINT_NORMAL_TEXTURE,"normal"}, - {TK_HINT_ALBEDO_TEXTURE,"albedo"}, - {TK_HINT_COLOR,"color"}, + {TK_HINT_WHITE_TEXTURE,"hint_white"}, + {TK_HINT_BLACK_TEXTURE,"hint_black"}, + {TK_HINT_NORMAL_TEXTURE,"hint_normal"}, + {TK_HINT_ALBEDO_TEXTURE,"hint_albedo"}, + {TK_HINT_COLOR,"hint_color"}, {TK_HINT_RANGE,"hint_range"}, {TK_ERROR,NULL} @@ -604,7 +604,7 @@ String ShaderLanguage::token_debug(const String& p_code) { Token tk = _get_token(); while(tk.type!=TK_EOF && tk.type!=TK_ERROR) { - print_line(get_token_text(tk)); + output+=itos(tk_line)+": "+get_token_text(tk)+"\n"; tk = _get_token(); } @@ -2232,9 +2232,7 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const Node *expr=NULL; TkPos prepos = _get_tkpos(); Token tk = _get_token(); - TkPos pos = _get_tkpos(); - - print_line("in expr: "+get_token_text(tk)); + TkPos pos = _get_tkpos(); if (tk.type==TK_PARENTHESIS_OPEN) { @@ -2301,8 +2299,6 @@ ShaderLanguage::Node* ShaderLanguage::_parse_expression(BlockNode* p_block,const } else if (is_token_nonvoid_datatype(tk.type)) { //basic type constructor - print_line("parse constructor"); - OperatorNode *func = alloc_node(); func->op=OP_CONSTRUCT; @@ -3193,17 +3189,17 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Maprender_modes.find(tk.text)!=-1) { - _set_error("Duplicate render mode: '"+String(tk.text)+"'"); + if (shader->render_modes.find(mode)!=-1) { + _set_error("Duplicate render mode: '"+String(mode)+"'"); return ERR_PARSE_ERROR; } - shader->render_modes.push_back(tk.text); + shader->render_modes.push_back(mode); tk = _get_token(); if (tk.type==TK_COMMA) { @@ -3262,7 +3258,7 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Mapuniforms.size(); + if (is_sampler_type(type)) { uniform.texture_order=texture_uniforms++; uniform.order=-1; @@ -3331,7 +3327,7 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map >::Element *E=p_functions.front();E;E=E->next()) { r_options->push_back(E->key()); @@ -3635,7 +3629,6 @@ Error ShaderLanguage::complete(const String& p_code,const Map< StringName, Map matches; @@ -3709,7 +3702,6 @@ Error ShaderLanguage::complete(const String& p_code,const Map< StringName, Mapfunctions.size();i++) { if (!shader->functions[i].callable) continue; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 767d11bc84..8c54ef11fb 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -136,16 +136,16 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POINT_COORD"]=ShaderLanguage::TYPE_VEC2; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["TIME"]=ShaderLanguage::TYPE_FLOAT; - shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_transform"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("skip_transform"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mix"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_add"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_sub"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_mul"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("blend_premul_alpha"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_mix"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_add"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_sub"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_mul"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_premul_alpha"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("light_only"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("unshaded"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("light_only"); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 70abfe2361..bbad460f4f 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -405,33 +405,33 @@ RID VisualServerRaster::fixed_material_create() { return rasterizer->fixed_material_create(); } -void VisualServerRaster::fixed_material_set_flag(RID p_material, FixedMaterialFlags p_flag, bool p_enabled) { +void VisualServerRaster::fixed_material_set_flag(RID p_material, FixedSpatialMaterialFlags p_flag, bool p_enabled) { rasterizer->fixed_material_set_flag(p_material,p_flag,p_enabled); } -bool VisualServerRaster::fixed_material_get_flag(RID p_material, FixedMaterialFlags p_flag) const { +bool VisualServerRaster::fixed_material_get_flag(RID p_material, FixedSpatialMaterialFlags p_flag) const { return rasterizer->fixed_material_get_flag(p_material,p_flag); } -void VisualServerRaster::fixed_material_set_param(RID p_material, FixedMaterialParam p_parameter, const Variant& p_value) { +void VisualServerRaster::fixed_material_set_param(RID p_material, FixedSpatialMaterialParam p_parameter, const Variant& p_value) { VS_CHANGED; rasterizer->fixed_material_set_parameter(p_material,p_parameter,p_value); } -Variant VisualServerRaster::fixed_material_get_param(RID p_material,FixedMaterialParam p_parameter) const { +Variant VisualServerRaster::fixed_material_get_param(RID p_material,FixedSpatialMaterialParam p_parameter) const { return rasterizer->fixed_material_get_parameter(p_material,p_parameter); } -void VisualServerRaster::fixed_material_set_texture(RID p_material,FixedMaterialParam p_parameter, RID p_texture) { +void VisualServerRaster::fixed_material_set_texture(RID p_material,FixedSpatialMaterialParam p_parameter, RID p_texture) { VS_CHANGED; rasterizer->fixed_material_set_texture(p_material,p_parameter,p_texture); } -RID VisualServerRaster::fixed_material_get_texture(RID p_material,FixedMaterialParam p_parameter) const { +RID VisualServerRaster::fixed_material_get_texture(RID p_material,FixedSpatialMaterialParam p_parameter) const { return rasterizer->fixed_material_get_texture(p_material,p_parameter); } @@ -439,12 +439,12 @@ RID VisualServerRaster::fixed_material_get_texture(RID p_material,FixedMaterialP -void VisualServerRaster::fixed_material_set_texcoord_mode(RID p_material,FixedMaterialParam p_parameter, FixedMaterialTexCoordMode p_mode) { +void VisualServerRaster::fixed_material_set_texcoord_mode(RID p_material,FixedSpatialMaterialParam p_parameter, FixedSpatialMaterialTexCoordMode p_mode) { VS_CHANGED; rasterizer->fixed_material_set_texcoord_mode(p_material,p_parameter,p_mode); } -VS::FixedMaterialTexCoordMode VisualServerRaster::fixed_material_get_texcoord_mode(RID p_material,FixedMaterialParam p_parameter) const { +VS::FixedSpatialMaterialTexCoordMode VisualServerRaster::fixed_material_get_texcoord_mode(RID p_material,FixedSpatialMaterialParam p_parameter) const { return rasterizer->fixed_material_get_texcoord_mode(p_material,p_parameter); } @@ -471,14 +471,14 @@ Transform VisualServerRaster::fixed_material_get_uv_transform(RID p_material) co return rasterizer->fixed_material_get_uv_transform(p_material); } -void VisualServerRaster::fixed_material_set_light_shader(RID p_material,FixedMaterialLightShader p_shader) { +void VisualServerRaster::fixed_material_set_light_shader(RID p_material,FixedSpatialMaterialLightShader p_shader) { VS_CHANGED; rasterizer->fixed_material_set_light_shader(p_material,p_shader); } -VisualServerRaster::FixedMaterialLightShader VisualServerRaster::fixed_material_get_light_shader(RID p_material) const{ +VisualServerRaster::FixedSpatialMaterialLightShader VisualServerRaster::fixed_material_get_light_shader(RID p_material) const{ return rasterizer->fixed_material_get_light_shader(p_material); } diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index a2502e89f9..655ce410bc 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -620,7 +620,7 @@ public: BIND1RC(uint32_t,texture_get_width,RID) BIND1RC(uint32_t,texture_get_height,RID) BIND3(texture_set_size_override,RID,int,int) - BIND3RC(RID,texture_create_pbr_cubemap,RID,PBRCubeMapMode,int) + BIND2RC(RID,texture_create_radiance_cubemap,RID,int) @@ -854,7 +854,7 @@ public: BIND0R(RID,environment_create) BIND2(environment_set_background,RID ,EnvironmentBG ) - BIND4(environment_set_skybox,RID,RID ,int,int ) + BIND3(environment_set_skybox,RID,RID ,int ) BIND2(environment_set_skybox_scale,RID,float) BIND2(environment_set_bg_color,RID,const Color& ) BIND2(environment_set_bg_energy,RID,float ) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 8fdf3d160d..2f0f8f263f 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -337,8 +337,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ light->D=NULL; } VSG::scene_render->free(light->instance); - - } + } break; } if (instance->base_data) { @@ -492,12 +491,12 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ light->instance = VSG::scene_render->light_instance_create(p_base); instance->base_data=light; - } + } break; case VS::INSTANCE_MESH: { InstanceGeometryData *geom = memnew( InstanceGeometryData ); instance->base_data=geom; - } + } break; } @@ -596,7 +595,7 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ instance->scenario->directional_lights.erase( light->D ); light->D=NULL; } - } + } break; } instance->scenario=NULL; @@ -623,7 +622,7 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ if (VSG::storage->light_get_type(instance->base)==VS::LIGHT_DIRECTIONAL) { light->D = scenario->directional_lights.push_back(instance); } - } + } break; } _instance_queue_update(instance,true,true); @@ -711,12 +710,59 @@ Vector VisualServerScene::instances_cull_convex(const Vector& p void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFlags p_flags,bool p_enabled){ + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + switch(p_flags) { + + case VS::INSTANCE_FLAG_VISIBLE: { + + instance->visible=p_enabled; + + } break; + case VS::INSTANCE_FLAG_BILLBOARD: { + + instance->billboard=p_enabled; + + } break; + case VS::INSTANCE_FLAG_BILLBOARD_FIX_Y: { + + instance->billboard_y=p_enabled; + + } break; + case VS::INSTANCE_FLAG_CAST_SHADOW: { + /*if (p_enabled == true) { + instance->cast_shadows = SHADOW_CASTING_SETTING_ON; + } + else { + instance->cast_shadows = SHADOW_CASTING_SETTING_OFF; + }*/ + + } break; + case VS::INSTANCE_FLAG_DEPH_SCALE: { + + instance->depth_scale=p_enabled; + + } break; + case VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS: { + + instance->visible_in_all_rooms=p_enabled; + + } break; + + } } void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) { } void VisualServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material){ + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + instance->material_override=p_material; + + } @@ -1151,7 +1197,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp //failure } else if (ins->base_type==VS::INSTANCE_LIGHT && ins->visible) { - if (light_cull_countvisible && light_cull_count(ins->base_data); @@ -1253,6 +1300,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp geom->lighting_dirty=false; } + ins->depth = near_plane.distance_to(ins->transform.origin); + } if (!keep) { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 97825c172b..95636d2bc7 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1036,30 +1036,23 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } } - print_line("type "+itos(i)+" size: "+itos(elem_size)+" offset "+itos(total_elem_size)); offsets[i]=total_elem_size; total_elem_size+=elem_size; } - print_line("total elemn size: "+itos(total_elem_size)); - uint32_t mask = (1< vertex_array; vertex_array.resize(array_size); int index_array_size = offsets[VS::ARRAY_INDEX]*index_array_len; - print_line("index array size: "+itos(index_array_size)); - DVector index_array; index_array.resize(index_array_size); diff --git a/servers/visual_server.h b/servers/visual_server.h index 11828c7d26..bbe6c2c683 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -125,12 +125,7 @@ public: virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0; - enum PBRCubeMapMode { - PBR_CUBEMAP_RADIANCE, - PBR_CUBEMAP_IRRADIANCE, - }; - - virtual RID texture_create_pbr_cubemap(RID p_source,PBRCubeMapMode p_mode,int p_resolution=-1) const=0; + virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; struct TextureInfo { RID texture; @@ -349,7 +344,9 @@ public: LIGHT_PARAM_ENERGY, LIGHT_PARAM_SPECULAR, LIGHT_PARAM_RANGE, + LIGHT_PARAM_ATTENUATION, LIGHT_PARAM_SPOT_ANGLE, + LIGHT_PARAM_SPOT_ATTENUATION, LIGHT_PARAM_SHADOW_MAX_DISTANCE, LIGHT_PARAM_SHADOW_DARKNESS, LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, @@ -357,10 +354,8 @@ public: LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET, LIGHT_PARAM_SHADOW_NORMAL_BIAS, - LIGHT_PARAM_SHADOW_BIAS_1, - LIGHT_PARAM_SHADOW_BIAS_2, - LIGHT_PARAM_SHADOW_BIAS_3, - LIGHT_PARAM_SHADOW_BIAS_4, + LIGHT_PARAM_SHADOW_BIAS, + LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE, LIGHT_PARAM_MAX }; @@ -494,12 +489,12 @@ public: }; virtual void environment_set_background(RID p_env,EnvironmentBG p_bg)=0; - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size,int p_irradiance_size)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size)=0; virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; - virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_energy=0.0)=0; + virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0)=0; //set default SSAO options //set default SSR options diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 6b1873d49a..e8207c9575 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -377,7 +377,7 @@ Error ColladaImport::_create_material(const String& p_target) { ERR_FAIL_COND_V(!collada.state.effect_map.has(src_mat.instance_effect),ERR_INVALID_PARAMETER); Collada::Effect &effect=collada.state.effect_map[src_mat.instance_effect]; - Ref material= memnew( FixedMaterial ); + Ref material= memnew( FixedSpatialMaterial ); if (src_mat.name!="") material->set_name(src_mat.name); @@ -394,14 +394,14 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// material->set_texture(FixedMaterial::PARAM_DIFFUSE,texture); -// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); +// material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,texture); +// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedMaterial::PARAM_DIFFUSE,effect.diffuse.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,effect.diffuse.color); } // SPECULAR @@ -414,15 +414,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// material->set_texture(FixedMaterial::PARAM_SPECULAR,texture); -// material->set_parameter(FixedMaterial::PARAM_SPECULAR,Color(1,1,1,1)); +// material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedMaterial::PARAM_SPECULAR,effect.specular.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color); } // EMISSION @@ -435,15 +435,15 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// material->set_texture(FixedMaterial::PARAM_EMISSION,texture); -// material->set_parameter(FixedMaterial::PARAM_EMISSION,Color(1,1,1,1)); +// material->set_texture(FixedSpatialMaterial::PARAM_EMISSION,texture); +// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { // missing_textures.push_back(texfile.get_file()); } } } else { -// material->set_parameter(FixedMaterial::PARAM_EMISSION,effect.emission.color); +// material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color); } // NORMAL @@ -456,7 +456,7 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { - // material->set_texture(FixedMaterial::PARAM_NORMAL,texture); + // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); }else { // missing_textures.push_back(texfile.get_file()); } @@ -465,7 +465,7 @@ Error ColladaImport::_create_material(const String& p_target) { } -// material->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,effect.shininess); +// material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); // material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); // material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); @@ -1042,7 +1042,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con { - Ref material; + Ref material; //find material Mesh::PrimitiveType primitive=Mesh::PRIMITIVE_TRIANGLES; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 9d68807c46..41b245eb7d 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1392,7 +1392,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map::Element *E=pl.front();E;E=E->next()) { if (E->get().type==Variant::OBJECT || E->get().type==Variant::ARRAY || E->get().type==Variant::DICTIONARY) { - if (E->get().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { + if (E->get().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/diffuse" || E->get().name=="textures/detail" || E->get().name=="textures/emission")) { Ref tex =res->get(E->get().name); if (tex.is_valid()) { @@ -1400,14 +1400,14 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Mapget().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/normal")) { + } else if (E->get().type==Variant::OBJECT && res->cast_to() && (E->get().name=="textures/normal")) { Ref tex =res->get(E->get().name); if (tex.is_valid()) { image_map.insert(tex,TEXTURE_ROLE_NORMALMAP); //if (p_flags&SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY) - // res->cast_to()->set_fixed_flag(FixedMaterial::FLAG_USE_XY_NORMALMAP,true); + // res->cast_to()->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_XY_NORMALMAP,true); }// @@ -1514,12 +1514,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref fm = m->surface_get_material(i); if (fm.is_valid()) { // fm->set_flag(Material::FLAG_UNSHADED,true); // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1537,18 +1537,18 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map for(int i=0;iget_surface_count();i++) { - Ref mat = m->surface_get_material(i); + Ref mat = m->surface_get_material(i); if (!mat.is_valid()) continue; if (p_flags&SCENE_FLAG_DETECT_ALPHA && _teststr(mat->get_name(),"alpha")) { - // mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); // mat->set_name(_fixstr(mat->get_name(),"alpha")); } if (p_flags&SCENE_FLAG_DETECT_VCOLOR && _teststr(mat->get_name(),"vcol")) { - //mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + //mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); //mat->set_name(_fixstr(mat->get_name(),"vcol")); } @@ -1623,12 +1623,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref fm = m->surface_get_material(i); if (fm.is_valid()) { // fm->set_flag(Material::FLAG_UNSHADED,true); // fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); // fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - // fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + // fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } } @@ -1671,12 +1671,12 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map Ref m = mi->get_mesh(); for(int i=0;iget_surface_count();i++) { - Ref fm = m->surface_get_material(i); + Ref fm = m->surface_get_material(i); if (fm.is_valid()) { fm->set_flag(Material::FLAG_UNSHADED,true); fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true); - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); } } }*/ @@ -2044,16 +2044,16 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map for(int i=0;iget_surface_count();i++) { - Ref fm = mesh->surface_get_material(i); + Ref fm = mesh->surface_get_material(i); if (fm.is_valid()) { String name = fm->get_name(); /* if (_teststr(name,"alpha")) { - fm->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); name=_fixstr(name,"alpha"); } if (_teststr(name,"vcol")) { - fm->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); name=_fixstr(name,"vcol"); }*/ fm->set_name(name); diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index f117182365..a954db829d 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -482,29 +482,29 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) { ERR_CONTINUE(!material.has("id")); String id = _id(material["id"]); - Ref mat = memnew( FixedMaterial ); + Ref mat = memnew( FixedSpatialMaterial ); if (material.has("diffuse")) { - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"])); } if (material.has("specular")) { - mat->set_parameter(FixedMaterial::PARAM_SPECULAR,_get_color(material["specular"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,_get_color(material["specular"])); } if (material.has("emissive")) { - mat->set_parameter(FixedMaterial::PARAM_EMISSION,_get_color(material["emissive"])); + mat->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,_get_color(material["emissive"])); } if (material.has("shininess")) { float exp = material["shininess"]; - mat->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,exp); + mat->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,exp); } if (material.has("opacity")) { - Color c = mat->get_parameter(FixedMaterial::PARAM_DIFFUSE); + Color c = mat->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE); c.a=material["opacity"]; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,c); + mat->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,c); } @@ -536,15 +536,15 @@ void EditorSceneImporterFBXConv::_parse_materials(State& state) { String type=texture["type"]; if (type=="DIFFUSE") - mat->set_texture(FixedMaterial::PARAM_DIFFUSE,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,tex); else if (type=="SPECULAR") - mat->set_texture(FixedMaterial::PARAM_SPECULAR,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,tex); else if (type=="SHININESS") - mat->set_texture(FixedMaterial::PARAM_SPECULAR_EXP,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_SPECULAR_EXP,tex); else if (type=="NORMAL") - mat->set_texture(FixedMaterial::PARAM_NORMAL,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_NORMAL,tex); else if (type=="EMISSIVE") - mat->set_texture(FixedMaterial::PARAM_EMISSION,tex); + mat->set_texture(FixedSpatialMaterial::PARAM_EMISSION,tex); } } diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 5cdae6aff3..f31c8adf86 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -143,18 +143,18 @@ void BakedLightBaker::_add_mesh(const Ref& p_mesh,const Ref& p_m MeshMaterial mm; - Ref fm = mat; + Ref fm = mat; if (fm.is_valid()) { //fixed route - mm.diffuse.color=fm->get_parameter(FixedMaterial::PARAM_DIFFUSE); + mm.diffuse.color=fm->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE); if (linear_color) mm.diffuse.color=mm.diffuse.color.to_linear(); - mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_DIFFUSE)); - mm.specular.color=fm->get_parameter(FixedMaterial::PARAM_SPECULAR); + mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_DIFFUSE)); + mm.specular.color=fm->get_parameter(FixedSpatialMaterial::PARAM_SPECULAR); if (linear_color) mm.specular.color=mm.specular.color.to_linear(); - mm.specular.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_SPECULAR)); + mm.specular.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_SPECULAR)); } else { mm.diffuse.color=Color(1,1,1,1); diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index ccec7eaed1..472ada116d 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -570,25 +570,25 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) { imgeom->set_transform(Transform(Matrix3(),Vector3(0,0,0.00001))); - line_material = Ref( memnew( FixedMaterial )); + line_material = Ref( memnew( FixedSpatialMaterial )); line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle_material = Ref( memnew( FixedMaterial )); + handle_material = Ref( memnew( FixedSpatialMaterial )); handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true); - handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); + handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); Ref handle=editor->get_gui_base()->get_icon("Editor3DHandle","EditorIcons"); handle_material->set_point_size(handle->get_width()); - handle_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle); + handle_material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,handle); pointsm = memnew( MeshInstance ); imgeom->add_child(pointsm); diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.h b/tools/editor/plugins/collision_polygon_editor_plugin.h index 4c1f45eca9..ed371e81b2 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_editor_plugin.h @@ -62,8 +62,8 @@ class CollisionPolygonEditor : public HBoxContainer { ToolButton *button_edit; - Ref line_material; - Ref handle_material; + Ref line_material; + Ref handle_material; EditorNode *editor; Panel *panel; diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index aa7071298a..c56d526de8 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -523,16 +523,16 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { editor=p_node; singleton=this; - path_material = Ref( memnew( FixedMaterial )); - path_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) ); - path_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + path_material = Ref( memnew( FixedSpatialMaterial )); + path_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) ); + path_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); path_material->set_line_width(3); path_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); path_material->set_flag(Material::FLAG_UNSHADED,true); - path_thin_material = Ref( memnew( FixedMaterial )); - path_thin_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) ); - path_thin_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + path_thin_material = Ref( memnew( FixedSpatialMaterial )); + path_thin_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) ); + path_thin_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); path_thin_material->set_line_width(1); path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); path_thin_material->set_flag(Material::FLAG_UNSHADED,true); diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h index ee2196b47f..ab9474f38d 100644 --- a/tools/editor/plugins/path_editor_plugin.h +++ b/tools/editor/plugins/path_editor_plugin.h @@ -79,8 +79,8 @@ public: Path *get_edited_path() { return path; } static PathEditorPlugin* singleton; - Ref path_material; - Ref path_thin_material; + Ref path_material; + Ref path_thin_material; virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event); // virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); } diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 38a7706acc..7a24ab4180 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2548,11 +2548,11 @@ void SpatialEditor::_generate_selection_box() { } - Ref mat = memnew( FixedMaterial ); - /*mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);*/ + Ref mat = memnew( FixedSpatialMaterial ); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + mat->set_albedo(Color(1,1,1)); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); st->set_material(mat); selection_box = st->commit(); } @@ -3139,11 +3139,11 @@ void SpatialEditor::_init_indicators() { { - indicator_mat = VisualServer::get_singleton()->material_create(); - /*VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true ); - VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false ); - VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);*/ + indicator_mat.instance();; + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + indicator_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); DVector grid_colors[3]; DVector grid_points[3]; @@ -3186,7 +3186,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_VERTEX]=grid_points[i]; d[VisualServer::ARRAY_COLOR]=grid_colors[i]; VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); + VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat->get_rid()); grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); grid_visible[i]=false; @@ -3205,7 +3205,7 @@ void SpatialEditor::_init_indicators() { d[VisualServer::ARRAY_COLOR]=origin_colors; VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat); + VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat->get_rid()); // origin = VisualServer::get_singleton()->poly_create(); @@ -3236,17 +3236,15 @@ void SpatialEditor::_init_indicators() { cursor_points.push_back(Vector3(0,-cs,0)); cursor_points.push_back(Vector3(0,0,+cs)); cursor_points.push_back(Vector3(0,0,-cs)); - cursor_material=VisualServer::get_singleton()->material_create(); - /*VisualServer::get_singleton()->fixed_material_set_param(cursor_material,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0,1,1)); - VisualServer::get_singleton()->material_set_flag( cursor_material, VisualServer::MATERIAL_FLAG_UNSHADED, true ); - VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true); - VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);*/ + cursor_material.instance(); + cursor_material->set_albedo(Color(0,1,1)); + cursor_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); Array d; d.resize(VS::ARRAY_MAX); d[VS::ARRAY_VERTEX]=cursor_points; VisualServer::get_singleton()->mesh_add_surface_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d); - VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material); + VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material->get_rid()); cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<get("3d_editor/manipulator_gizmo_opacity"); - gizmo_hl = Ref( memnew( FixedMaterial ) ); - /* gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); - gizmo_hl->set_flag(Material::FLAG_ONTOP, true); - gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f));*/ + gizmo_hl = Ref( memnew( FixedSpatialMaterial ) ); + gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); + gizmo_hl->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + gizmo_hl->set_albedo(Color(1,1,1,gizmo_alph+0.2f)); for(int i=0;i<3;i++) { @@ -3276,14 +3274,14 @@ void SpatialEditor::_init_indicators() { rotate_gizmo[i]=Ref( memnew( Mesh ) ); - Ref mat = memnew( FixedMaterial ); - /* mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_flag(Material::FLAG_ONTOP, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + Ref mat = memnew( FixedSpatialMaterial ); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); Color col; col[i]=1.0; col.a= gizmo_alph; - mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col);*/ + mat->set_albedo(col); gizmo_color[i]=mat; @@ -3429,8 +3427,6 @@ void SpatialEditor::_finish_indicators() { VisualServer::get_singleton()->free(cursor_instance); VisualServer::get_singleton()->free(cursor_mesh); - VisualServer::get_singleton()->free(indicator_mat); - VisualServer::get_singleton()->free(cursor_material); } void SpatialEditor::_instance_scene() { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 4751cf7071..8c8a80bc3a 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -331,8 +331,8 @@ private: bool grid_enabled; Ref move_gizmo[3], rotate_gizmo[3]; - Ref gizmo_color[3]; - Ref gizmo_hl; + Ref gizmo_color[3]; + Ref gizmo_hl; int over_gizmo_handle; @@ -344,8 +344,8 @@ private: RID indicators_instance; RID cursor_mesh; RID cursor_instance; - RID indicator_mat; - RID cursor_material; + Ref indicator_mat; + Ref cursor_material; /* struct Selected { diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 716b03b7b7..bc76f6c20c 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2976,25 +2976,25 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { } -Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { +Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); line_material->set_flag(Material::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,p_base_color); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); return line_material; } -Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { +Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { - Ref line_material = Ref( memnew( FixedMaterial )); + Ref line_material = Ref( memnew( FixedSpatialMaterial )); line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,p_base_color); + line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); return line_material; @@ -3004,50 +3004,50 @@ SpatialEditorGizmos::SpatialEditorGizmos() { singleton=this; - handle_material = Ref( memnew( FixedMaterial )); + handle_material = Ref( memnew( FixedSpatialMaterial )); handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); + handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); - handle2_material = Ref( memnew( FixedMaterial )); + handle2_material = Ref( memnew( FixedSpatialMaterial )); handle2_material->set_flag(Material::FLAG_UNSHADED, true); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true); + handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); handle_t = SpatialEditor::get_singleton()->get_icon("Editor3DHandle","EditorIcons"); handle2_material->set_point_size(handle_t->get_width()); - handle2_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle_t); - handle2_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - handle2_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); + handle2_material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,handle_t); + handle2_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); + handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); light_material = create_line_material(Color(1,1,0.2)); - light_material_omni_icon = Ref( memnew( FixedMaterial )); + light_material_omni_icon = Ref( memnew( FixedSpatialMaterial )); light_material_omni_icon->set_flag(Material::FLAG_UNSHADED, true); light_material_omni_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); light_material_omni_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_omni_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - light_material_omni_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_omni_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); + light_material_omni_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + light_material_omni_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + light_material_omni_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); - light_material_directional_icon = Ref( memnew( FixedMaterial )); + light_material_directional_icon = Ref( memnew( FixedSpatialMaterial )); light_material_directional_icon->set_flag(Material::FLAG_UNSHADED, true); light_material_directional_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); light_material_directional_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_directional_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - light_material_directional_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_directional_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); + light_material_directional_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + light_material_directional_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + light_material_directional_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); camera_material = create_line_material(Color(1.0,0.5,1.0)); navmesh_edge_material = create_line_material(Color(0.1,0.8,1.0)); navmesh_solid_material = create_solid_material(Color(0.1,0.8,1.0,0.4)); - navmesh_edge_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); + navmesh_edge_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); navmesh_solid_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); navmesh_edge_material_disabled = create_line_material(Color(1.0,0.8,0.1)); navmesh_solid_material_disabled = create_solid_material(Color(1.0,0.8,0.1,0.4)); - navmesh_edge_material_disabled->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false); + navmesh_edge_material_disabled->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); navmesh_solid_material_disabled->set_flag(Material::FLAG_DOUBLE_SIDED,true); skeleton_material = create_line_material(Color(0.6,1.0,0.3)); @@ -3077,10 +3077,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5,0.5,1,0.7)); cursor_colors.push_back(Color(0.5,0.5,1,0.7)); - Ref mat = memnew( FixedMaterial ); + Ref mat = memnew( FixedSpatialMaterial ); mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3100,10 +3100,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); - Ref mat = memnew(FixedMaterial); + Ref mat = memnew(FixedSpatialMaterial); mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); - mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3114,13 +3114,13 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } - sample_player_icon = Ref( memnew( FixedMaterial )); + sample_player_icon = Ref( memnew( FixedSpatialMaterial )); sample_player_icon->set_flag(Material::FLAG_UNSHADED, true); sample_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); sample_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - sample_player_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - sample_player_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - sample_player_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); + sample_player_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + sample_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + sample_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); room_material = create_line_material(Color(1.0,0.6,0.9)); portal_material = create_line_material(Color(1.0,0.8,0.6)); @@ -3129,29 +3129,29 @@ SpatialEditorGizmos::SpatialEditorGizmos() { visibility_notifier_material = create_line_material(Color(1.0,0.5,1.0)); joint_material = create_line_material(Color(0.6,0.8,1.0)); - stream_player_icon = Ref( memnew( FixedMaterial )); + stream_player_icon = Ref( memnew( FixedSpatialMaterial )); stream_player_icon->set_flag(Material::FLAG_UNSHADED, true); stream_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); stream_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - stream_player_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - stream_player_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - stream_player_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); + stream_player_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + stream_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + stream_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); - visibility_notifier_icon = Ref( memnew( FixedMaterial )); + visibility_notifier_icon = Ref( memnew( FixedSpatialMaterial )); visibility_notifier_icon->set_flag(Material::FLAG_UNSHADED, true); visibility_notifier_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); visibility_notifier_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - visibility_notifier_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - visibility_notifier_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - visibility_notifier_icon->set_texture(FixedMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); + visibility_notifier_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + visibility_notifier_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); + visibility_notifier_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); - listener_icon = Ref(memnew(FixedMaterial)); + listener_icon = Ref(memnew(FixedSpatialMaterial)); listener_icon->set_flag(Material::FLAG_UNSHADED, true); listener_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); listener_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - listener_icon->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); - listener_icon->set_parameter(FixedMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); - listener_icon->set_texture(FixedMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); + listener_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + listener_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); + listener_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); { diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index a7a6af4b18..64c6a6e824 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -464,34 +464,34 @@ public: class SpatialEditorGizmos { public: - Ref create_line_material(const Color& p_base_color); - Ref create_solid_material(const Color& p_base_color); - Ref handle2_material; - Ref handle_material; - Ref light_material; - Ref light_material_omni_icon; - Ref light_material_directional_icon; - Ref camera_material; - Ref skeleton_material; - Ref room_material; - Ref portal_material; - Ref raycast_material; - Ref visibility_notifier_material; - Ref car_wheel_material; - Ref joint_material; - - Ref navmesh_edge_material; - Ref navmesh_solid_material; - Ref navmesh_edge_material_disabled; - Ref navmesh_solid_material_disabled; - - Ref listener_icon; - - Ref sample_player_icon; - Ref stream_player_icon; - Ref visibility_notifier_icon; - - Ref shape_material; + Ref create_line_material(const Color& p_base_color); + Ref create_solid_material(const Color& p_base_color); + Ref handle2_material; + Ref handle_material; + Ref light_material; + Ref light_material_omni_icon; + Ref light_material_directional_icon; + Ref camera_material; + Ref skeleton_material; + Ref room_material; + Ref portal_material; + Ref raycast_material; + Ref visibility_notifier_material; + Ref car_wheel_material; + Ref joint_material; + + Ref navmesh_edge_material; + Ref navmesh_solid_material; + Ref navmesh_edge_material_disabled; + Ref navmesh_solid_material_disabled; + + Ref listener_icon; + + Ref sample_player_icon; + Ref stream_player_icon; + Ref visibility_notifier_icon; + + Ref shape_material; Ref handle_t; Ref pos3d_mesh; -- cgit v1.2.3 From d6567010bf1c65abcbe09b959cde63664778d923 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 29 Oct 2016 20:48:09 -0300 Subject: -Many many fixes -Gizmos work again --- drivers/gles3/rasterizer_canvas_gles3.cpp | 23 +- drivers/gles3/rasterizer_gles3.cpp | 6 +- drivers/gles3/rasterizer_scene_gles3.cpp | 310 ++++++++++++++++++++----- drivers/gles3/rasterizer_scene_gles3.h | 17 +- drivers/gles3/rasterizer_storage_gles3.cpp | 214 +++++++++-------- drivers/gles3/rasterizer_storage_gles3.h | 40 ++-- drivers/gles3/shader_compiler_gles3.cpp | 88 +++++-- drivers/gles3/shader_compiler_gles3.h | 2 + drivers/gles3/shaders/copy.glsl | 27 ++- drivers/gles3/shaders/cubemap_filter.glsl | 2 +- drivers/gles3/shaders/scene.glsl | 70 ++++-- methods.py | 1 + scene/3d/visual_instance.h | 1 + scene/resources/environment.cpp | 224 ++++++++++++++++++ scene/resources/environment.h | 69 ++++++ scene/resources/material.cpp | 69 +++++- scene/resources/material.h | 16 +- servers/visual/rasterizer.h | 9 +- servers/visual/visual_server_raster.h | 11 +- servers/visual/visual_server_scene.cpp | 76 +++++- servers/visual/visual_server_scene.h | 2 +- servers/visual_server.h | 13 +- tools/editor/editor_node.cpp | 2 +- tools/editor/plugins/spatial_editor_plugin.cpp | 9 +- tools/editor/plugins/spatial_editor_plugin.h | 2 +- tools/editor/spatial_editor_gizmos.cpp | 173 +++++++------- tools/editor/spatial_editor_gizmos.h | 3 +- 27 files changed, 1135 insertions(+), 344 deletions(-) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b2228a6cfa..c10c5fee65 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -914,6 +914,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const } + if (shader_ptr && shader_ptr!=shader_cache) { state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id); @@ -925,6 +926,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const int tc = material_ptr->textures.size(); RID* textures = material_ptr->textures.ptr(); + ShaderLanguage::ShaderNode::Uniform::Hint* texture_hints = shader_ptr->texture_hints.ptr(); for(int i=0;itexture_owner.getornull( textures[i] ); if (!t) { + + switch(texture_hints[i]) { + case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { + glBindTexture(GL_TEXTURE_2D,storage->resources.black_tex); + } break; + case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { + glBindTexture(GL_TEXTURE_2D,storage->resources.normal_tex); + } break; + default: { + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + } break; + } + //check hints - glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + continue; } + if (storage->config.srgb_decode_supported && t->using_srgb) { + //no srgb in 2D + glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + t->using_srgb=false; + } + glBindTexture(t->target,t->tex_id); } diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 83c40edc1d..e838020c45 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -253,10 +253,8 @@ void RasterizerGLES3::make_current() { void RasterizerGLES3::register_config() { - GLOBAL_DEF("rendering/gles3/framebuffer_format",RasterizerStorageGLES3::FBO_FORMAT_FLOAT); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/framebuffer_format",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"16 Bits,32 Bits,Half Float")); - GLOBAL_DEF("rendering/gles3/lighting_technique",1); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/lighting_technique",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"Forward,Deferred")); + GLOBAL_DEF("rendering/gles3/render_architecture",0); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/render_architecture",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"Desktop,Mobile")); GLOBAL_DEF("rendering/gles3/use_nearest_mipmap_filter",false); GLOBAL_DEF("rendering/gles3/anisotropic_filter_level",4.0); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index aadf9e6336..f7baf1a30b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -150,27 +150,19 @@ void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_b } -void RasterizerSceneGLES3::environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper){ +void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, bool p_enable, float p_exposure, float p_white, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale, VS::EnvironmentToneMapper p_tone_mapper){ } -void RasterizerSceneGLES3::environment_set_brightness(RID p_env,bool p_enable,float p_brightness){ -} -void RasterizerSceneGLES3::environment_set_contrast(RID p_env,bool p_enable,float p_contrast){ +void RasterizerSceneGLES3::environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp) { -} -void RasterizerSceneGLES3::environment_set_saturation(RID p_env,bool p_enable,float p_saturation){ } -void RasterizerSceneGLES3::environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp){ - -} - - RID RasterizerSceneGLES3::light_instance_create(RID p_light) { + print_line("hello light"); LightInstance *light_instance = memnew( LightInstance ); light_instance->light=p_light; @@ -204,6 +196,29 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m glEnable(GL_CULL_FACE); } + if (state.current_line_width!=p_material->line_width) { + glLineWidth(p_material->line_width); + state.current_line_width=p_material->line_width; + } + + if (state.current_depth_draw!=p_material->shader->spatial.depth_draw_mode) { + switch(p_material->shader->spatial.depth_draw_mode) { + case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS: + case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_OPAQUE: { + + glDepthMask(!p_alpha_pass); + } break; + case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALWAYS: { + glDepthMask(GL_TRUE); + } break; + case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_NEVER: { + glDepthMask(GL_FALSE); + } break; + } + + state.current_depth_draw=p_material->shader->spatial.depth_draw_mode; + } + //glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); /* @@ -216,7 +231,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m //if (p_material->line_width) // glLineWidth(p_material->line_width); - +#if 0 //blend mode if (state.current_blend_mode!=p_material->shader->spatial.blend_mode) { @@ -256,7 +271,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m state.current_blend_mode=p_material->shader->spatial.blend_mode; } - +#endif //material parameters @@ -273,6 +288,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m int tc = p_material->textures.size(); RID* textures = p_material->textures.ptr(); + ShaderLanguage::ShaderNode::Uniform::Hint* texture_hints = p_material->shader->texture_hints.ptr(); for(int i=0;itexture_owner.getornull( textures[i] ); if (!t) { //check hints + switch(texture_hints[i]) { + case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { + glBindTexture(GL_TEXTURE_2D,storage->resources.black_tex); + } break; + case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { + glBindTexture(GL_TEXTURE_2D,storage->resources.normal_tex); + } break; + default: { + glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + } break; + } glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); continue; } + if (storage->config.srgb_decode_supported) { + //if SRGB decode extension is present, simply switch the texture to whathever is needed + bool must_srgb=false; + + if (t->srgb && texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO) { + must_srgb=true; + } + + if (t->using_srgb!=must_srgb) { + if (must_srgb) { + glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); +#ifdef TOOLS_ENABLED + if (!(t->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { + t->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; + //notify that texture must be set to linear beforehand, so it works in other platforms when exported + } +#endif + + } else { + glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + } + t->using_srgb=must_srgb; + } + } + + glBindTexture(t->target,t->tex_id); } @@ -348,7 +401,60 @@ void RasterizerSceneGLES3::_setup_light(LightInstance *p_light) { glBindBufferBase(GL_UNIFORM_BUFFER,3,p_light->light_ubo); //bind light uniform } +void RasterizerSceneGLES3::_setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection) { + + if (p_instance->billboard || p_instance->billboard_y || p_instance->depth_scale) { + + Transform xf=p_instance->transform; + if (p_instance->depth_scale) { + + if (p_projection.matrix[3][3]) { + //orthogonal matrix, try to do about the same + //with viewport size + //real_t w = Math::abs( 1.0/(2.0*(p_projection.matrix[0][0])) ); + real_t h = Math::abs( 1.0/(2.0*p_projection.matrix[1][1]) ); + float sc = (h*2.0); //consistent with Y-fov + xf.basis.scale( Vector3(sc,sc,sc)); + } else { + //just scale by depth + real_t sc = Plane(p_view_transform.origin,-p_view_transform.get_basis().get_axis(2)).distance_to(xf.origin); + xf.basis.scale( Vector3(sc,sc,sc)); + } + } + + if (p_instance->billboard) { + + Vector3 scale = xf.basis.get_scale(); + + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { + xf.set_look_at(xf.origin, xf.origin + p_view_transform.get_basis().get_axis(2), -p_view_transform.get_basis().get_axis(1)); + } else { + xf.set_look_at(xf.origin, xf.origin + p_view_transform.get_basis().get_axis(2), p_view_transform.get_basis().get_axis(1)); + } + + xf.basis.scale(scale); + } + + if (p_instance->billboard_y) { + + Vector3 scale = xf.basis.get_scale(); + Vector3 look_at = p_view_transform.get_origin(); + look_at.y = 0.0; + Vector3 look_at_norm = look_at.normalized(); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, -1.0, 0.0)); + } else { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, 1.0, 0.0)); + } + xf.basis.scale(scale); + } + state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, xf); + + } else { + state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, p_instance->transform); + } +} void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass) { @@ -372,12 +478,18 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); glBindTexture(p_base_env->target,p_base_env->tex_id); state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,true); + } else { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + } + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); state.current_blend_mode=-1; + state.current_line_width=-1; + state.current_depth_draw=-1; glDisable(GL_BLEND); @@ -390,6 +502,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e int prev_blend=-1; int current_blend_mode=-1; + bool prev_additive=false; + for (int i=0;imirror,p_reverse_cull); state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror?-1.0:1.0); - state.scene_shader.set_uniform(SceneShaderGLES3::WORLD_TRANSFORM, e->instance->transform); + + _setup_transform(e->instance,p_view_transform,p_projection); // _render(e->geometry, material, skeleton,e->owner,e->instance->transform); @@ -567,6 +687,10 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e prev_material=material; prev_base_type=e->instance->base_type; prev_geometry=e->geometry; + prev_additive=additive; + prev_light_type=light_type; + prev_light_index=light_index; + } //print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count)); @@ -824,6 +948,19 @@ void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,CameraMatrix& p_projection, glActiveTexture(GL_TEXTURE0); glBindTexture(tex->target,tex->tex_id); + + if (storage->config.srgb_decode_supported && tex->srgb && !tex->using_srgb) { + + glTexParameteri(tex->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + tex->using_srgb=true; +#ifdef TOOLS_ENABLED + if (!(tex->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { + tex->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; + //notify that texture must be set to linear beforehand, so it works in other platforms when exported + } +#endif + } + glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); @@ -876,6 +1013,7 @@ void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,CameraMatrix& p_projection, glDrawArrays(GL_TRIANGLE_FAN,0,4); glBindVertexArray(0); + glColorMask(1,1,1,1); storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_CUBEMAP,false); @@ -977,9 +1115,10 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu ERR_FAIL_COND( directional_light_instance_count >= RenderList::MAX_LIGHTS); directional_light_instances[directional_light_instance_count++]=li; - li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; - li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; - li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + Color linear_col = li->light_ptr->color.to_linear(); + li->light_ubo_data.light_color_energy[0]=linear_col.r; + li->light_ubo_data.light_color_energy[1]=linear_col.g; + li->light_ubo_data.light_color_energy[2]=linear_col.b; li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; //omni, keep at 0 @@ -1018,9 +1157,10 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } break; case VS::LIGHT_OMNI: { - li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; - li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; - li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + Color linear_col = li->light_ptr->color.to_linear(); + li->light_ubo_data.light_color_energy[0]=linear_col.r; + li->light_ubo_data.light_color_energy[1]=linear_col.g; + li->light_ubo_data.light_color_energy[2]=linear_col.b; li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); @@ -1050,9 +1190,10 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } break; case VS::LIGHT_SPOT: { - li->light_ubo_data.light_color_energy[0]=li->light_ptr->color.r; - li->light_ubo_data.light_color_energy[1]=li->light_ptr->color.g; - li->light_ubo_data.light_color_energy[2]=li->light_ptr->color.b; + Color linear_col = li->light_ptr->color.to_linear(); + li->light_ubo_data.light_color_energy[0]=linear_col.r; + li->light_ubo_data.light_color_energy[1]=linear_col.g; + li->light_ubo_data.light_color_energy[2]=linear_col.b; li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); @@ -1108,6 +1249,51 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } +void RasterizerSceneGLES3::_copy_screen() { + + glBindVertexArray(storage->resources.quadie_array); + glDrawArrays(GL_TRIANGLE_FAN,0,4); + glBindVertexArray(0); + +} + +void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) { + + //copy to front buffer + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + + glDepthMask(GL_FALSE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDepthFunc(GL_LEQUAL); + glColorMask(1,1,1,1); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,true); + + if (!env) { + //no environment, simply convert from linear to srgb + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,true); + } else { + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,true); + + } + + storage->shaders.copy.bind(); + + _copy_screen(); + + + //turn off everything used + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,false); + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,false); + + +} + void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment){ //first of all, make a new render pass @@ -1125,6 +1311,8 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM current_material_index=0; + bool use_mrt=false; + //fill list for(int i=0;iframe.current_rt->buffers.fbo); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,true); + + Color black(0,0,0,0); + glClearBufferfv(GL_COLOR,1,black.components); // specular + glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough + + } else { + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + + } + + glClearDepth(1.0); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glClear(GL_DEPTH_BUFFER_BIT); - RasterizerStorageGLES3::Texture* env_radiance_tex; + Color clear_color(0,0,0,0); if (!env || env->bg_mode==VS::ENV_BG_CLEAR_COLOR) { if (storage->frame.clear_request) { - glClearColor( storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a ); - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + clear_color = storage->frame.clear_request_color.to_linear(); storage->frame.clear_request=false; } } else if (env->bg_mode==VS::ENV_BG_COLOR) { - - glClearColor( env->bg_color.r, env->bg_color.g, env->bg_color.b, env->bg_color.a ); - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + clear_color = env->bg_color.to_linear(); storage->frame.clear_request=false; } else if (env->bg_mode==VS::ENV_BG_SKYBOX) { if (env->skybox_radiance.is_valid()) { env_radiance_tex = storage->texture_owner.getornull(env->skybox_radiance); } - glClear(GL_DEPTH_BUFFER_BIT); storage->frame.clear_request=false; } else { - glClear(GL_DEPTH_BUFFER_BIT); storage->frame.clear_request=false; - } - state.current_depth_test=true; - state.current_depth_mask=true; + glClearBufferfv(GL_COLOR,0,clear_color.components); // specular + + state.texscreen_copied=false; glBlendEquation(GL_FUNC_ADD); @@ -1214,43 +1417,33 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM } glDisable(GL_BLEND); - //current_blend_mode=VS::MATERIAL_BLEND_MODE_MIX; - render_list.sort_by_key(false); - //_render_list_forward(&opaque_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting); -/* - if (draw_tex_background) { - - //most 3D vendors recommend drawing a texture bg or skybox here, - //after opaque geometry has been drawn - //so the zbuffer can get rid of most pixels - _draw_tex_bg(); - } -*/ if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } -// glDisable(GL_BLEND); -// current_blend_mode=VS::MATERIAL_BLEND_MODE_MIX; -// state.scene_shader.set_conditional(SceneShaderGLES3::USE_GLOW,false); -// if (current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]) { -// glColorMask(1,1,1,0); //don't touch alpha -// } - - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { + if (use_mrt) { + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters + } + _draw_skybox(env->skybox_color,p_cam_projection,p_cam_transform,storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); } + + + + //_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); //glColorMask(1,1,1,1); @@ -1261,12 +1454,14 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); render_list.sort_by_depth(true); - _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false); + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true); + + _copy_to_front_buffer(env); #if 0 if (use_fb) { @@ -1418,6 +1613,7 @@ bool RasterizerSceneGLES3::free(RID p_rid) { if (light_instance_owner.owns(p_rid)) { + print_line("bye light"); LightInstance *light_instance = light_instance_owner.getptr(p_rid); glDeleteBuffers(1,&light_instance->light_ubo); light_instance_owner.free(p_rid); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 4b1b77f13c..5457b5cde3 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -18,10 +18,11 @@ public: struct State { - bool current_depth_test; - bool current_depth_mask; + bool texscreen_copied; int current_blend_mode; + float current_line_width; + int current_depth_draw; SceneShaderGLES3 scene_shader; @@ -57,6 +58,8 @@ public: GLuint skybox_verts; GLuint skybox_array; + + } state; @@ -109,11 +112,8 @@ public: virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper); - virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness); - virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast); - virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation); - virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp); + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper); + virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp); /* LIGHT INSTANCE */ @@ -314,6 +314,7 @@ public: RenderList render_list; _FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material* p_material,bool p_alpha_pass); + _FORCE_INLINE_ void _setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection); _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); _FORCE_INLINE_ void _setup_light(LightInstance *p_light); @@ -327,6 +328,8 @@ public: void _setup_environment(Environment *env,CameraMatrix& p_cam_projection, const Transform& p_cam_transform); void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform); + void _copy_screen(); + void _copy_to_front_buffer(Environment *env); virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 1141a605c5..a678c460f5 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -57,9 +57,6 @@ #define _EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#define _TEXTURE_SRGB_DECODE_EXT 0x8A48 -#define _DECODE_EXT 0x8A49 -#define _SKIP_DECODE_EXT 0x8A4A #define _GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE @@ -679,8 +676,10 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image if (texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + texture->using_srgb=true; } else { glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + texture->using_srgb=false; } } @@ -892,8 +891,10 @@ void RasterizerStorageGLES3::texture_set_flags(RID p_texture,uint32_t p_flags) { if (texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR) { glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + texture->using_srgb=true; } else { glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + texture->using_srgb=false; } } @@ -1024,6 +1025,19 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_r glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); + if (config.srgb_decode_supported && texture->srgb && !texture->using_srgb) { + + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + texture->using_srgb=true; +#ifdef TOOLS_ENABLED + if (!(texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { + texture->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; + //notify that texture must be set to linear beforehand, so it works in other platforms when exported + } +#endif + } + + glActiveTexture(GL_TEXTURE1); GLuint new_cubemap; glGenTextures(1, &new_cubemap); @@ -1302,6 +1316,7 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { p_shader->ubo_size=gen_code.uniform_total_size; p_shader->ubo_offsets=gen_code.uniform_offsets; p_shader->texture_count=gen_code.texture_uniforms.size(); + p_shader->texture_hints=gen_code.texture_hints; //all materials using this shader will have to be invalidated, unfortunately @@ -1510,7 +1525,17 @@ Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringN return Variant(); } -_FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataType type, const Variant& value, uint8_t *data) { +void RasterizerStorageGLES3::material_set_line_width(RID p_material, float p_width) { + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND(!material); + + material->line_width=p_width; + + +} + +_FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataType type, const Variant& value, uint8_t *data,bool p_linear_color) { switch(type) { case ShaderLanguage::TYPE_BOOL: { @@ -1683,6 +1708,10 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy if (value.get_type()==Variant::COLOR) { Color v=value; + if (p_linear_color) { + v=v.to_linear(); + } + gui[0]=v.r; gui[1]=v.g; gui[2]=v.b; @@ -2019,7 +2048,7 @@ void RasterizerStorageGLES3::_update_material(Material* material) { if (V) { //user provided - _fill_std140_variant_ubo_value(E->get().type,V->get(),data); + _fill_std140_variant_ubo_value(E->get().type,V->get(),data,material->shader->mode==VS::SHADER_SPATIAL); } else if (E->get().default_value.size()){ //default value _fill_std140_ubo_value(E->get().type,E->get().default_value,data); @@ -2641,9 +2670,7 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND(surface->index_array_len==0); - - glDeleteBuffers(1,&surface->array_id); + glDeleteBuffers(1,&surface->vertex_id); if (surface->index_id) { glDeleteBuffers(1,&surface->index_id); } @@ -3211,14 +3238,14 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->back.fbo=0; } - if (rt->deferred.fbo) { - glDeleteFramebuffers(1,&rt->deferred.fbo); - glDeleteFramebuffers(1,&rt->deferred.fbo_color); - glDeleteTextures(1,&rt->deferred.albedo_ao); - glDeleteTextures(1,&rt->deferred.normal_special); - glDeleteTextures(1,&rt->deferred.metal_rough_motion); - rt->deferred.fbo=0; - rt->deferred.fbo_color=0; + if (rt->buffers.fbo) { + glDeleteFramebuffers(1,&rt->buffers.fbo); + glDeleteFramebuffers(1,&rt->buffers.alpha_fbo); + glDeleteTextures(1,&rt->buffers.diffuse); + glDeleteTextures(1,&rt->buffers.specular); + glDeleteTextures(1,&rt->buffers.normal_sr); + rt->buffers.fbo=0; + rt->buffers.alpha_fbo=0; } if (rt->depth) { @@ -3239,26 +3266,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ if (rt->width<=0 || rt->height<=0) return; - glActiveTexture(GL_TEXTURE0); - - glGenFramebuffers(1, &rt->front.fbo); - glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo); - - - glGenRenderbuffers(1, &rt->depth); - glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); - if (config.fbo_format==FBO_FORMAT_16_BITS) { - glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH_COMPONENT16, rt->width, rt->height); - } else { - glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8, rt->width, rt->height); - } - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); - glBindRenderbuffer(GL_RENDERBUFFER, 0 ); - - - glGenTextures(1, &rt->front.color); - glBindTexture(GL_TEXTURE_2D, rt->front.color); - GLuint color_internal_format; GLuint color_format; @@ -3266,21 +3273,8 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ Image::Format image_format; - if (config.fbo_format==FBO_FORMAT_16_BITS) { - if (rt->flags[RENDER_TARGET_TRANSPARENT]) { - color_internal_format=GL_RGB5_A1; - color_format=GL_RGBA; - color_type=GL_UNSIGNED_SHORT_5_5_5_1; - image_format=Image::FORMAT_RGBA5551; - } else { - color_internal_format=GL_RGB565; - color_format=GL_RGB; - color_type=GL_UNSIGNED_SHORT_5_6_5; - image_format=Image::FORMAT_RGB565; - } - - } else if (config.fbo_format==FBO_FORMAT_32_BITS || (config.fbo_format==FBO_FORMAT_FLOAT && rt->flags[RENDER_TARGET_NO_3D])) { + if (config.render_arch==RENDER_ARCH_MOBILE || rt->flags[RENDER_TARGET_NO_3D]) { if (rt->flags[RENDER_TARGET_TRANSPARENT]) { color_internal_format=GL_RGBA8; @@ -3293,53 +3287,75 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ color_type=GL_UNSIGNED_INT_2_10_10_10_REV; image_format=Image::FORMAT_RGBA8;//todo } - } else if (config.fbo_format==FBO_FORMAT_FLOAT) { - + } else { color_internal_format=GL_RGBA16F; color_format=GL_RGBA; color_type=GL_HALF_FLOAT; image_format=Image::FORMAT_RGBAH; } - glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); + { + /* FRONT FBO */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->front.color, 0); + glActiveTexture(GL_TEXTURE0); + + glGenFramebuffers(1, &rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo); + + + glGenRenderbuffers(1, &rt->depth); + glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); + + + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8, rt->width, rt->height); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + glBindRenderbuffer(GL_RENDERBUFFER, 0 ); + + + glGenTextures(1, &rt->front.color); + glBindTexture(GL_TEXTURE_2D, rt->front.color); + + glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->front.color, 0); - { GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); - } - Texture *tex = texture_owner.get(rt->texture); - tex->format=image_format; - tex->gl_format_cache=color_format; - tex->gl_type_cache=color_type; - tex->gl_internal_format_cache=color_internal_format; - tex->tex_id=rt->front.color; - tex->width=rt->width; - tex->alloc_width=rt->width; - tex->height=rt->height; - tex->alloc_height=rt->height; + Texture *tex = texture_owner.get(rt->texture); + tex->format=image_format; + tex->gl_format_cache=color_format; + tex->gl_type_cache=color_type; + tex->gl_internal_format_cache=color_internal_format; + tex->tex_id=rt->front.color; + tex->width=rt->width; + tex->alloc_width=rt->width; + tex->height=rt->height; + tex->alloc_height=rt->height; + + texture_set_flags(rt->texture,tex->flags); + + } - texture_set_flags(rt->texture,tex->flags); + + /* BACK FBO */ if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) { glGenFramebuffers(1, &rt->back.fbo); glBindFramebuffer(GL_FRAMEBUFFER, rt->back.fbo); - + glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); glGenTextures(1, &rt->back.color); glBindTexture(GL_TEXTURE_2D, rt->back.color); - glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -3357,43 +3373,42 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ } } + if (config.render_arch==RENDER_ARCH_DESKTOP && !rt->flags[RENDER_TARGET_NO_3D]) { - if (config.fbo_deferred && !rt->flags[RENDER_TARGET_NO_3D]) { - //regular fbo - glGenFramebuffers(1, &rt->deferred.fbo); - glBindFramebuffer(GL_FRAMEBUFFER, rt->deferred.fbo); + glGenFramebuffers(1, &rt->buffers.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); - glGenTextures(1, &rt->deferred.albedo_ao); - glBindTexture(GL_TEXTURE_2D, rt->deferred.albedo_ao); + glGenTextures(1, &rt->buffers.diffuse); + glBindTexture(GL_TEXTURE_2D, rt->buffers.diffuse); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->deferred.albedo_ao, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0); - glGenTextures(1, &rt->deferred.metal_rough_motion); - glBindTexture(GL_TEXTURE_2D, rt->deferred.metal_rough_motion); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glGenTextures(1, &rt->buffers.specular); + glBindTexture(GL_TEXTURE_2D, rt->buffers.specular); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, rt->width, rt->height, 0, GL_RGBA, GL_HALF_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->deferred.metal_rough_motion, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->buffers.specular, 0); - glGenTextures(1, &rt->deferred.normal_special); - glBindTexture(GL_TEXTURE_2D, rt->deferred.normal_special); + glGenTextures(1, &rt->buffers.normal_sr); + glBindTexture(GL_TEXTURE_2D, rt->buffers.normal_sr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->deferred.normal_special, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->buffers.normal_sr, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -3402,19 +3417,15 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ if (status != GL_FRAMEBUFFER_COMPLETE) { _render_target_clear(rt); ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); - } + } - //regular fbo with color attachment (needed for emission or objects rendered as forward) - glGenFramebuffers(1, &rt->deferred.fbo_color); - glBindFramebuffer(GL_FRAMEBUFFER, rt->deferred.fbo_color); + //alpha fbo + glGenFramebuffers(1, &rt->buffers.alpha_fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.alpha_fbo); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->deferred.albedo_ao, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->deferred.metal_rough_motion, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->deferred.normal_special, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, rt->front.color, 0); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0); status = glCheckFramebufferStatus(GL_FRAMEBUFFER); glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); @@ -3423,6 +3434,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ _render_target_clear(rt); ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); } + } @@ -3797,8 +3809,8 @@ bool RasterizerStorageGLES3::free(RID p_rid){ void RasterizerStorageGLES3::initialize() { - config.fbo_format=FBOFormat(int(Globals::get_singleton()->get("rendering/gles3/framebuffer_format"))); - config.fbo_deferred=int(Globals::get_singleton()->get("rendering/gles3/lighting_technique")); + config.render_arch=RENDER_ARCH_DESKTOP; + //config.fbo_deferred=int(Globals::get_singleton()->get("rendering/gles3/lighting_technique")); config.system_fbo=0; @@ -3925,10 +3937,10 @@ void RasterizerStorageGLES3::initialize() { glGenVertexArrays(1,&resources.quadie_array); glBindVertexArray(resources.quadie_array); glBindBuffer(GL_ARRAY_BUFFER,resources.quadie); - glVertexAttribPointer(0,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,0); + glVertexAttribPointer(VS::ARRAY_VERTEX,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,0); glEnableVertexAttribArray(0); - glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,((uint8_t*)NULL)+8); - glEnableVertexAttribArray(1); + glVertexAttribPointer(VS::ARRAY_TEX_UV,2,GL_FLOAT,GL_FALSE,sizeof(float)*4,((uint8_t*)NULL)+8); + glEnableVertexAttribArray(4); glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER,0); //unbind } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index f052aa8019..b12c2d93b6 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -13,6 +13,9 @@ class RasterizerCanvasGLES3; class RasterizerSceneGLES3; +#define _TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define _DECODE_EXT 0x8A49 +#define _SKIP_DECODE_EXT 0x8A4A class RasterizerStorageGLES3 : public RasterizerStorage { public: @@ -20,16 +23,15 @@ public: RasterizerCanvasGLES3 *canvas; RasterizerSceneGLES3 *scene; - enum FBOFormat { - FBO_FORMAT_16_BITS, - FBO_FORMAT_32_BITS, - FBO_FORMAT_FLOAT, + enum RenderArchitecture { + RENDER_ARCH_MOBILE, + RENDER_ARCH_DESKTOP, }; struct Config { - FBOFormat fbo_format; - bool fbo_deferred; + RenderArchitecture render_arch; + GLuint system_fbo; //on some devices, such as apple, screen is rendered to yet another fbo. bool shrink_textures_x2; @@ -135,12 +137,15 @@ public: bool active; GLuint tex_id; + bool using_srgb; + uint16_t stored_cube_sides; RenderTarget *render_target; Texture() { + using_srgb=false; stored_cube_sides=0; ignore_mipmaps=false; render_target=NULL; @@ -218,6 +223,8 @@ public: Map default_textures; + Vector texture_hints; + bool valid; String path; @@ -319,12 +326,14 @@ public: SelfList list; SelfList dirty_list; Vector textures; + float line_width; uint32_t index; uint64_t last_pass; Material() : list(this), dirty_list(this) { shader=NULL; + line_width=1.0; ubo_id=0; ubo_size=0; last_pass=0; @@ -346,6 +355,8 @@ public: virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value); virtual Variant material_get_param(RID p_material, const StringName& p_param) const; + virtual void material_set_line_width(RID p_material, float p_width); + void _update_material(Material* material); void update_dirty_materials(); @@ -655,14 +666,13 @@ public: GLuint depth; - struct Deferred { + struct Buffers { GLuint fbo; - GLuint fbo_color; - - GLuint albedo_ao; - GLuint metal_rough_motion; - GLuint normal_special; - } deferred; + GLuint alpha_fbo; //single buffer, just diffuse (for alpha pass) + GLuint specular; + GLuint diffuse; + GLuint normal_sr; + } buffers; int width,height; @@ -679,8 +689,8 @@ public: depth=0; front.fbo=0; back.fbo=0; - deferred.fbo=0; - deferred.fbo_color=0; + buffers.fbo=0; + buffers.alpha_fbo=0; used_in_frame=false; flags[RENDER_TARGET_VFLIP]=false; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index da8f6689d0..0dff53bfb9 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -75,25 +75,81 @@ static String _mkid(const String& p_id) { return "m_"+p_id; } +static String f2sp0(float p_float) { + + if (int(p_float)==p_float) + return itos(p_float)+".0"; + else + return rtoss(p_float); +} + static String get_constant_text(SL::DataType p_type, const Vector& p_values) { switch(p_type) { case SL::TYPE_BOOL: return p_values[0].boolean?"true":"false"; - case SL::TYPE_BVEC2: return String()+"bvec2("+(p_values[0].boolean?"true":"false")+(p_values[1].boolean?"true":"false")+")"; - case SL::TYPE_BVEC3: return String()+"bvec3("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+")"; - case SL::TYPE_BVEC4: return String()+"bvec4("+(p_values[0].boolean?"true":"false")+","+(p_values[1].boolean?"true":"false")+","+(p_values[2].boolean?"true":"false")+","+(p_values[3].boolean?"true":"false")+")"; - case SL::TYPE_INT: return rtos(p_values[0].sint); - case SL::TYPE_IVEC2: return String()+"ivec2("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+")"; - case SL::TYPE_IVEC3: return String()+"ivec3("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+")"; - case SL::TYPE_IVEC4: return String()+"ivec4("+rtos(p_values[0].sint)+","+rtos(p_values[1].sint)+","+rtos(p_values[2].sint)+","+rtos(p_values[3].sint)+")"; - case SL::TYPE_UINT: return rtos(p_values[0].real); - case SL::TYPE_UVEC2: return String()+"uvec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; - case SL::TYPE_UVEC3: return String()+"uvec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; - case SL::TYPE_UVEC4: return String()+"uvec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; - case SL::TYPE_FLOAT: return rtos(p_values[0].real); - case SL::TYPE_VEC2: return String()+"vec2("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+")"; - case SL::TYPE_VEC3: return String()+"vec3("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+")"; - case SL::TYPE_VEC4: return String()+"vec4("+rtos(p_values[0].real)+","+rtos(p_values[1].real)+","+rtos(p_values[2].real)+","+rtos(p_values[3].real)+")"; + case SL::TYPE_BVEC2: + case SL::TYPE_BVEC3: + case SL::TYPE_BVEC4: { + + + String text="bvec"+itos(p_type-SL::TYPE_BOOL+1)+"("; + for(int i=0;i0) + text+=","; + + text+=p_values[i].boolean?"true":"false"; + } + text+=")"; + return text; + } + + case SL::TYPE_INT: return itos(p_values[0].sint); + case SL::TYPE_IVEC2: + case SL::TYPE_IVEC3: + case SL::TYPE_IVEC4: { + + String text="ivec"+itos(p_type-SL::TYPE_INT+1)+"("; + for(int i=0;i0) + text+=","; + + text+=itos(p_values[i].sint); + } + text+=")"; + return text; + + } break; + case SL::TYPE_UINT: return itos(p_values[0].uint)+"u"; + case SL::TYPE_UVEC2: + case SL::TYPE_UVEC3: + case SL::TYPE_UVEC4: { + + String text="uvec"+itos(p_type-SL::TYPE_UINT+1)+"("; + for(int i=0;i0) + text+=","; + + text+=itos(p_values[i].uint)+"u"; + } + text+=")"; + return text; + } break; + case SL::TYPE_FLOAT: return f2sp0(p_values[0].real)+"f"; + case SL::TYPE_VEC2: + case SL::TYPE_VEC3: + case SL::TYPE_VEC4: { + + String text="vec"+itos(p_type-SL::TYPE_FLOAT+1)+"("; + for(int i=0;i0) + text+=","; + + text+=f2sp0(p_values[i].real); + } + text+=")"; + return text; + + } break; default: ERR_FAIL_V(String()); } } @@ -189,6 +245,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener } r_gen_code.texture_uniforms.resize(max_texture_uniforms); + r_gen_code.texture_hints.resize(max_texture_uniforms); Vector uniform_sizes; uniform_sizes.resize(max_uniforms); @@ -209,6 +266,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener r_gen_code.vertex_global+=ucode; r_gen_code.fragment_global+=ucode; r_gen_code.texture_uniforms[E->get().texture_order]=_mkid(E->key()); + r_gen_code.texture_hints[E->get().texture_order]=E->get().hint; } else { if (r_gen_code.uniforms.empty()) { diff --git a/drivers/gles3/shader_compiler_gles3.h b/drivers/gles3/shader_compiler_gles3.h index ad51b99927..dcea82d773 100644 --- a/drivers/gles3/shader_compiler_gles3.h +++ b/drivers/gles3/shader_compiler_gles3.h @@ -21,6 +21,8 @@ public: Vector defines; Vector texture_uniforms; + Vector texture_hints; + Vector uniform_offsets; uint32_t uniform_total_size; String uniforms; diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index eb58d66431..79982ecf25 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -5,9 +5,9 @@ layout(location=0) in highp vec4 vertex_attrib; #ifdef USE_CUBEMAP layout(location=4) in vec3 cube_in; #else -layout(location=4) in vec2 uv_in; // attrib:4 +layout(location=4) in vec2 uv_in; #endif -layout(location=5) in vec2 uv2_in; // attrib:5 +layout(location=5) in vec2 uv2_in; #ifdef USE_CUBEMAP out vec3 cube_interp; @@ -40,6 +40,15 @@ uniform sampler2D source; //texunit:0 #endif +float sRGB_gamma_correct(float c){ + float a = 0.055; + if(c < 0.0031308) + return 12.92*c; + else + return (1.0+a)*pow(c, 1.0/2.4) - a; +} + + uniform float stuff; in vec2 uv2_interp; @@ -57,6 +66,20 @@ void main() { vec4 color = texture( source, uv_interp ); #endif +#ifdef LINEAR_TO_SRGB + //regular Linear -> SRGB conversion + vec3 a = vec3(0.055); + color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); +#endif + +#ifdef DEBUG_GRADIENT + color.rg=uv_interp; + color.b=0.0; +#endif + +#ifdef DISABLE_ALPHA + color.a=1.0; +#endif frag_color = color; } diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index d3d4cbd435..998a59833e 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -3,7 +3,7 @@ layout(location=0) in highp vec2 vertex; -layout(location=1) in highp vec2 uv; +layout(location=4) in highp vec2 uv; out highp vec2 uv_interp; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 3f94252606..60ac015a17 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -269,11 +269,16 @@ in vec3 normal_interp; /* PBR CHANNELS */ +//used on forward mainly +uniform bool no_ambient_light; + + #ifdef USE_RADIANCE_CUBEMAP uniform sampler2D brdf_texture; //texunit:-1 uniform samplerCube radiance_cube; //texunit:-2 + layout(std140) uniform Radiance { //ubo:2 mat4 radiance_inverse_xform; @@ -346,8 +351,18 @@ in mediump vec4 forward_shadow_pos4; #endif +#ifdef USE_MULTIPLE_RENDER_TARGETS + +layout(location=0) out vec4 diffuse_buffer; +layout(location=1) out vec4 specular_buffer; +layout(location=2) out vec4 normal_mr_buffer; + +#else + layout(location=0) out vec4 frag_color; +#endif + // GGX Specular // Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl @@ -470,39 +485,46 @@ FRAGMENT_SHADER_CODE /////////////////////// LIGHTING ////////////////////////////// vec3 specular_light = vec3(0.0,0.0,0.0); - vec3 ambient_light = ambient_light_color.rgb; + vec3 ambient_light; vec3 diffuse_light = vec3(0.0,0.0,0.0); vec3 eye_vec = -normalize( vertex_interp ); #ifdef USE_RADIANCE_CUBEMAP - { + if (no_ambient_light) { + ambient_light=vec3(0.0,0.0,0.0); + } else { + { - float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); - vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; + float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); + vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; - float lod = roughness * 5.0; - vec3 r = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); - r=normalize((radiance_inverse_xform * vec4(r,0.0)).xyz); - vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); + float lod = roughness * 5.0; + vec3 r = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); + r=normalize((radiance_inverse_xform * vec4(r,0.0)).xyz); + vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); - specular_light=mix(albedo,radiance,specular); + specular_light=mix(albedo,radiance,specular); - } + } - { + { - vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); - vec3 env_ambient=textureLod(radiance_cube, ambient_dir, 5.0).xyz; + vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); + vec3 env_ambient=textureLod(radiance_cube, ambient_dir, 5.0).xyz; - ambient_light=mix(ambient_light,env_ambient,radiance_ambient_contribution); + ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution); + } } - #else - ambient_light=albedo; + if (no_ambient_light){ + ambient_light=vec3(0.0,0.0,0.0); + } else { + ambient_light=ambient_light_color.rgb; + } #endif @@ -538,11 +560,25 @@ LIGHT_SHADER_CODE } #endif -#ifdef SHADELESS +#ifdef USE_MULTIPLE_RENDER_TARGETS + + //approximate ambient scale for SSAO, since we will lack full ambient + float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b)); + float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b)); + float total_ambient = max_ambient+max_diffuse; + float ambient_scale = (total_ambient>0.0) ? max_ambient/total_ambient : 0.0; + diffuse_buffer=vec4(diffuse_light+ambient_light,ambient_scale); + specular_buffer=vec4(specular_light,0.0); + normal_mr_buffer=vec4(normal.x,normal.y,max(specular.r,max(specular.g,specular.b)),roughness); + +#else + +#ifdef SHADELESS frag_color=vec4(albedo,alpha); #else frag_color=vec4(ambient_light+diffuse_light+specular_light,alpha); +#endif #endif diff --git a/methods.py b/methods.py index 7ad42a559a..f6bae4a64e 100755 --- a/methods.py +++ b/methods.py @@ -233,6 +233,7 @@ def build_glsl_header( filename ): fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n"); fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n "); + fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value?1:0); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index eb0587815f..b168bcbfe5 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -97,6 +97,7 @@ public: FLAG_MAX=VS::INSTANCE_FLAG_MAX, }; + enum ShadowCastingSetting { SHADOW_CASTING_SETTING_OFF=VS::SHADOW_CASTING_SETTING_OFF, SHADOW_CASTING_SETTING_ON = VS::SHADOW_CASTING_SETTING_ON, diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 3897c86d5b..47f4370cc2 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -134,6 +134,151 @@ float Environment::get_ambient_light_skybox_contribution() const{ +void Environment::set_tonemapper(ToneMapper p_tone_mapper) { + + tone_mapper=p_tone_mapper; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); +} + +Environment::ToneMapper Environment::get_tonemapper() const{ + + return tone_mapper; +} + +void Environment::set_tonemap_exposure(float p_exposure){ + + tonemap_exposure=p_exposure; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); +} + +float Environment::get_tonemap_exposure() const{ + + return get_tonemap_auto_exposure(); +} + +void Environment::set_tonemap_white(float p_white){ + + tonemap_white=p_white; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +float Environment::get_tonemap_white() const { + + return tonemap_white; +} + +void Environment::set_tonemap_auto_exposure(bool p_enabled) { + + tonemap_auto_exposure=p_enabled; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +bool Environment::get_tonemap_auto_exposure() const { + + return tonemap_auto_exposure; +} + +void Environment::set_tonemap_auto_exposure_max(float p_auto_exposure_max) { + + tonemap_auto_exposure_max=p_auto_exposure_max; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +float Environment::get_tonemap_auto_exposure_max() const { + + return tonemap_auto_exposure_max; +} + +void Environment::set_tonemap_auto_exposure_min(float p_auto_exposure_min) { + + tonemap_auto_exposure_min=p_auto_exposure_min; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +float Environment::get_tonemap_auto_exposure_min() const { + + return tonemap_auto_exposure_min; +} + +void Environment::set_tonemap_auto_exposure_speed(float p_auto_exposure_speed) { + + tonemap_auto_exposure_speed=p_auto_exposure_speed; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +float Environment::get_tonemap_auto_exposure_speed() const { + + return tonemap_auto_exposure_speed; +} + +void Environment::set_tonemap_auto_exposure_scale(float p_auto_exposure_scale) { + + tonemap_auto_exposure_scale=p_auto_exposure_scale; + VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + +} +float Environment::get_tonemap_auto_exposure_scale() const { + + return tonemap_auto_exposure_scale; +} + +void Environment::set_adjustment_enable(bool p_enable) { + + adjustment_enabled=p_enable; + VS::get_singleton()->environment_set_adjustment(environment,adjustment_enabled,adjustment_brightness,adjustment_contrast,adjustment_saturation,adjustment_color_correction.is_valid()?adjustment_color_correction->get_rid():RID()); +} + +bool Environment::is_adjustment_enabled() const { + + return adjustment_enabled; +} + + +void Environment::set_adjustment_brightness(float p_brightness) { + + adjustment_brightness=p_brightness; + VS::get_singleton()->environment_set_adjustment(environment,adjustment_enabled,adjustment_brightness,adjustment_contrast,adjustment_saturation,adjustment_color_correction.is_valid()?adjustment_color_correction->get_rid():RID()); + +} +float Environment::get_adjustment_brightness() const { + + return adjustment_brightness; +} + +void Environment::set_adjustment_contrast(float p_contrast) { + + adjustment_contrast=p_contrast; + VS::get_singleton()->environment_set_adjustment(environment,adjustment_enabled,adjustment_brightness,adjustment_contrast,adjustment_saturation,adjustment_color_correction.is_valid()?adjustment_color_correction->get_rid():RID()); + +} +float Environment::get_adjustment_contrast() const { + + return adjustment_contrast; +} + +void Environment::set_adjustment_saturation(float p_saturation) { + + adjustment_saturation=p_saturation; + VS::get_singleton()->environment_set_adjustment(environment,adjustment_enabled,adjustment_brightness,adjustment_contrast,adjustment_saturation,adjustment_color_correction.is_valid()?adjustment_color_correction->get_rid():RID()); + +} +float Environment::get_adjustment_saturation() const { + + return adjustment_saturation; +} + +void Environment::set_adjustment_color_correction(const Ref& p_ramp) { + + adjustment_color_correction=p_ramp; + VS::get_singleton()->environment_set_adjustment(environment,adjustment_enabled,adjustment_brightness,adjustment_contrast,adjustment_saturation,adjustment_color_correction.is_valid()?adjustment_color_correction->get_rid():RID()); + +} +Ref Environment::get_adjustment_color_correction() const { + + return adjustment_color_correction; +} + + void Environment::_validate_property(PropertyInfo& property) const { if (property.name=="background/skybox" || property.name=="background/skybox_scale" || property.name=="ambient_light/skybox_contribution") { @@ -190,6 +335,61 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") ); + ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); + ObjectTypeDB::bind_method(_MD("get_tonemapper"),&Environment::get_tonemapper); + + ObjectTypeDB::bind_method(_MD("set_tonemap_exposure","exposure"),&Environment::set_tonemap_exposure); + ObjectTypeDB::bind_method(_MD("get_tonemap_exposure"),&Environment::get_tonemap_exposure); + + ObjectTypeDB::bind_method(_MD("set_tonemap_white","white"),&Environment::set_tonemap_white); + ObjectTypeDB::bind_method(_MD("get_tonemap_white"),&Environment::get_tonemap_white); + + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure","auto_exposure"),&Environment::set_tonemap_auto_exposure); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure"),&Environment::get_tonemap_auto_exposure); + + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_max","exposure_max"),&Environment::set_tonemap_auto_exposure_max); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_max"),&Environment::get_tonemap_auto_exposure_max); + + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_min","exposure_min"),&Environment::set_tonemap_auto_exposure_min); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_min"),&Environment::get_tonemap_auto_exposure_min); + + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_speed","exposure_speed"),&Environment::set_tonemap_auto_exposure_speed); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_speed"),&Environment::get_tonemap_auto_exposure_speed); + + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_scale","exposure_scale"),&Environment::set_tonemap_auto_exposure_scale); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_scale"),&Environment::get_tonemap_auto_exposure_scale); + + ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Log,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_exposure/enable"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_scale"),_SCS("get_tonemap_auto_exposure_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/min_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_min"),_SCS("get_tonemap_auto_exposure_min") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/max_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_max"),_SCS("get_tonemap_auto_exposure_max") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/speed",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_speed"),_SCS("get_tonemap_auto_exposure_speed") ); + + ObjectTypeDB::bind_method(_MD("set_adjustment_enable","enabled"),&Environment::set_adjustment_enable); + ObjectTypeDB::bind_method(_MD("is_adjustment_enabled"),&Environment::is_adjustment_enabled); + + ObjectTypeDB::bind_method(_MD("set_adjustment_brightness","brightness"),&Environment::set_adjustment_brightness); + ObjectTypeDB::bind_method(_MD("get_adjustment_brightness"),&Environment::get_adjustment_brightness); + + ObjectTypeDB::bind_method(_MD("set_adjustment_contrast","contrast"),&Environment::set_adjustment_contrast); + ObjectTypeDB::bind_method(_MD("get_adjustment_contrast"),&Environment::get_adjustment_contrast); + + ObjectTypeDB::bind_method(_MD("set_adjustment_saturation","saturation"),&Environment::set_adjustment_saturation); + ObjectTypeDB::bind_method(_MD("get_adjustment_saturation"),&Environment::get_adjustment_saturation); + + ObjectTypeDB::bind_method(_MD("set_adjustment_color_correction","color_correction"),&Environment::set_adjustment_color_correction); + ObjectTypeDB::bind_method(_MD("get_adjustment_color_correction"),&Environment::get_adjustment_color_correction); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"adjustment/enabled"),_SCS("set_adjustment_enable"),_SCS("is_adjustment_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/brightness",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_brightness"),_SCS("get_adjustment_brightness") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/contrast",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_contrast"),_SCS("get_adjustment_contrast") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"adjustment/saturation",PROPERTY_HINT_RANGE,"0.01,8,0.01"),_SCS("set_adjustment_saturation"),_SCS("get_adjustment_saturation") ); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"adjustment/color_correction",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_adjustment_color_correction"),_SCS("get_adjustment_color_correction") ); + + GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution",256); GLOBAL_DEF("rendering/skybox/radiance_cube_resolution",64); @@ -203,6 +403,12 @@ void Environment::_bind_methods() { BIND_CONSTANT(GLOW_BLEND_MODE_SCREEN); BIND_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); BIND_CONSTANT(GLOW_BLEND_MODE_DISABLED); + BIND_CONSTANT(TONE_MAPPER_LINEAR); + BIND_CONSTANT(TONE_MAPPER_LOG); + BIND_CONSTANT(TONE_MAPPER_REINHARDT); + BIND_CONSTANT(TONE_MAPPER_FILMIC); + BIND_CONSTANT(TONE_MAPPER_ACES_FILMIC); + } @@ -216,6 +422,24 @@ Environment::Environment() { ambient_skybox_contribution=0; + tone_mapper=TONE_MAPPER_LINEAR; + tonemap_exposure=1.0; + tonemap_white=1.0; + tonemap_auto_exposure=false; + tonemap_auto_exposure_max=8; + tonemap_auto_exposure_min=0.4; + tonemap_auto_exposure_speed=0.5; + tonemap_auto_exposure_scale=0.4; + + set_tonemapper(tone_mapper); //update + + adjustment_enabled=false; + adjustment_contrast=1.0; + adjustment_saturation=1.0; + adjustment_brightness=1.0; + + set_adjustment_enable(adjustment_enabled); //update + environment = VS::get_singleton()->environment_create(); } diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 6478f6420f..394b67dadf 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -55,6 +55,16 @@ public: GLOW_BLEND_MODE_DISABLED, }; + enum ToneMapper { + TONE_MAPPER_LINEAR, + TONE_MAPPER_LOG, + TONE_MAPPER_REINHARDT, + TONE_MAPPER_FILMIC, + TONE_MAPPER_ACES_FILMIC + }; + + + private: RID environment; @@ -68,6 +78,21 @@ private: float ambient_energy; float ambient_skybox_contribution; + ToneMapper tone_mapper; + float tonemap_exposure; + float tonemap_white; + bool tonemap_auto_exposure; + float tonemap_auto_exposure_max; + float tonemap_auto_exposure_min; + float tonemap_auto_exposure_speed; + float tonemap_auto_exposure_scale; + + bool adjustment_enabled; + float adjustment_contrast; + float adjustment_saturation; + float adjustment_brightness; + Ref adjustment_color_correction; + protected: static void _bind_methods(); @@ -97,14 +122,58 @@ public: float get_ambient_light_skybox_contribution() const; + void set_tonemapper(ToneMapper p_tone_mapper); + ToneMapper get_tonemapper() const; + + void set_tonemap_exposure(float p_exposure); + float get_tonemap_exposure() const; + + void set_tonemap_white(float p_white); + float get_tonemap_white() const; + + void set_tonemap_auto_exposure(bool p_enabled); + bool get_tonemap_auto_exposure() const; + + void set_tonemap_auto_exposure_max(float p_auto_exposure_max); + float get_tonemap_auto_exposure_max() const; + + void set_tonemap_auto_exposure_min(float p_auto_exposure_min); + float get_tonemap_auto_exposure_min() const; + + void set_tonemap_auto_exposure_speed(float p_auto_exposure_speed); + float get_tonemap_auto_exposure_speed() const; + + void set_tonemap_auto_exposure_scale(float p_auto_exposure_scale); + float get_tonemap_auto_exposure_scale() const; + + void set_adjustment_enable(bool p_enable); + bool is_adjustment_enabled() const; + + void set_adjustment_brightness(float p_brightness); + float get_adjustment_brightness() const; + + void set_adjustment_contrast(float p_contrast); + float get_adjustment_contrast() const; + + void set_adjustment_saturation(float p_saturation); + float get_adjustment_saturation() const; + + void set_adjustment_color_correction(const Ref& p_ramp); + Ref get_adjustment_color_correction() const; + + virtual RID get_rid() const; Environment(); ~Environment(); }; + + + VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::GlowBlendMode) +VARIANT_ENUM_CAST(Environment::ToneMapper) #endif // ENVIRONMENT_H diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index e3df1461c7..3c7b0fbe6c 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -74,6 +74,7 @@ void FixedSpatialMaterial::init_shaders() { shader_names->subsurface_scattering="subsurface_scattering"; shader_names->refraction="refraction"; shader_names->refraction_roughness="refraction_roughness"; + shader_names->point_size="point_size"; shader_names->texture_names[TEXTURE_ALBEDO]="texture_albedo"; shader_names->texture_names[TEXTURE_SPECULAR]="texture_specular"; @@ -166,15 +167,33 @@ void FixedSpatialMaterial::_update_shader() { code+="uniform vec4 albedo : hint_color;\n"; - code+="uniform sampler2D albedo_texture : hint_albedo;\n"; + code+="uniform sampler2D texture_albedo : hint_albedo;\n"; code+="uniform vec4 specular : hint_color;\n"; code+="uniform float roughness : hint_range(0,1);\n"; - code+="uniform sampler2D specular_texture : hint_white;\n"; + code+="uniform float point_size : hint_range(0,128);\n"; + code+="uniform sampler2D texture_specular : hint_white;\n"; code+="\n\n"; + code+="void vertex() {\n"; + + if (flags[FLAG_SRGB_VERTEX_COLOR]) { + + code+="\tCOLOR.rgb = mix( pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), COLOR.rgb* (1.0 / 12.92), lessThan(COLOR.rgb,vec3(0.04045)) );\n"; + } + if (flags[FLAG_USE_POINT_SIZE]) { + + code+="\tPOINT_SIZE=point_size;\n"; + } + + code+="}\n"; code+="\n\n"; code+="void fragment() {\n"; - code+="\tvec4 albedo_tex = texture(albedo_texture,UV);\n"; + + if (flags[FLAG_USE_POINT_SIZE]) { + code+="\tvec4 albedo_tex = texture(texture_albedo,POINT_COORD);\n"; + } else { + code+="\tvec4 albedo_tex = texture(texture_albedo,UV);\n"; + } if (flags[FLAG_ALBEDO_FROM_VERTEX_COLOR]) { code+="\talbedo_tex *= COLOR;\n"; @@ -184,7 +203,7 @@ void FixedSpatialMaterial::_update_shader() { if (features[FEATURE_TRANSPARENT]) { code+="\tALPHA = albedo.a * albedo_tex.a;\n"; } - code+="\tvec4 specular_tex = texture(specular_texture,UV);\n"; + code+="\tvec4 specular_tex = texture(texture_specular,UV);\n"; code+="\tSPECULAR = specular.rgb * specular_tex.rgb;\n"; code+="\tROUGHNESS = specular.a * roughness;\n"; code+="}\n"; @@ -526,7 +545,8 @@ void FixedSpatialMaterial::set_texture(TextureParam p_param, const Ref ERR_FAIL_INDEX(p_param,TEXTURE_MAX); textures[p_param]=p_texture; - VS::get_singleton()->material_set_param(_get_material(),shader_names->texture_names[p_param],p_texture); + RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); + VS::get_singleton()->material_set_param(_get_material(),shader_names->texture_names[p_param],rid); } Ref FixedSpatialMaterial::get_texture(TextureParam p_param) const { @@ -540,6 +560,7 @@ void FixedSpatialMaterial::_validate_feature(const String& text, Feature feature if (property.name.begins_with(text) && property.name!=text+"/enabled" && !features[feature]) { property.usage=0; } + } void FixedSpatialMaterial::_validate_property(PropertyInfo& property) const { @@ -555,6 +576,28 @@ void FixedSpatialMaterial::_validate_property(PropertyInfo& property) const { } +void FixedSpatialMaterial::set_line_width(float p_line_width) { + + line_width=p_line_width; + VS::get_singleton()->material_set_line_width(_get_material(),line_width); +} + +float FixedSpatialMaterial::get_line_width() const { + + return line_width; +} + +void FixedSpatialMaterial::set_point_size(float p_point_size) { + + point_size=p_point_size; + VS::get_singleton()->material_set_param(_get_material(),shader_names->point_size,p_point_size); +} + +float FixedSpatialMaterial::get_point_size() const { + + return point_size; +} + void FixedSpatialMaterial::_bind_methods() { @@ -600,6 +643,12 @@ void FixedSpatialMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_refraction_roughness","refraction_roughness"),&FixedSpatialMaterial::set_refraction_roughness); ObjectTypeDB::bind_method(_MD("get_refraction_roughness"),&FixedSpatialMaterial::get_refraction_roughness); + ObjectTypeDB::bind_method(_MD("set_line_width","line_width"),&FixedSpatialMaterial::set_line_width); + ObjectTypeDB::bind_method(_MD("get_line_width"),&FixedSpatialMaterial::get_line_width); + + ObjectTypeDB::bind_method(_MD("set_point_size","point_size"),&FixedSpatialMaterial::set_point_size); + ObjectTypeDB::bind_method(_MD("get_point_size"),&FixedSpatialMaterial::get_point_size); + ObjectTypeDB::bind_method(_MD("set_detail_uv","detail_uv"),&FixedSpatialMaterial::set_detail_uv); ObjectTypeDB::bind_method(_MD("get_detail_uv"),&FixedSpatialMaterial::get_detail_uv); @@ -630,12 +679,16 @@ void FixedSpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/transparent"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_TRANSPARENT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/unshaded"),_SCS("set_flag"),_SCS("get_flag"),FLAG_UNSHADED); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/on_top"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ONTOP); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/vcol_albedo"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ALBEDO_FROM_VERTEX_COLOR); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/use_point_size"),_SCS("set_flag"),_SCS("get_flag"),FLAG_USE_POINT_SIZE); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color/use_as_albedo"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ALBEDO_FROM_VERTEX_COLOR); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"vertex_color/is_srgb"),_SCS("set_flag"),_SCS("get_flag"),FLAG_SRGB_VERTEX_COLOR); ADD_PROPERTY(PropertyInfo(Variant::INT,"params/diffuse_mode",PROPERTY_HINT_ENUM,"Labert,Lambert Wrap,Oren Nayar,Burley"),_SCS("set_diffuse_mode"),_SCS("get_diffuse_mode")); ADD_PROPERTY(PropertyInfo(Variant::INT,"params/blend_mode",PROPERTY_HINT_ENUM,"Mix,Add,Sub,Mul"),_SCS("set_blend_mode"),_SCS("get_blend_mode")); ADD_PROPERTY(PropertyInfo(Variant::INT,"params/cull_mode",PROPERTY_HINT_ENUM,"Back,Front,Disabled"),_SCS("set_cull_mode"),_SCS("get_cull_mode")); ADD_PROPERTY(PropertyInfo(Variant::INT,"params/depth_draw_mode",PROPERTY_HINT_ENUM,"Opaque Only,Always,Never,Opaque Pre-Pass"),_SCS("set_depth_draw_mode"),_SCS("get_depth_draw_mode")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"params/line_width",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_line_width"),_SCS("get_line_width")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"params/point_size",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_point_size"),_SCS("get_point_size")); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo/color"),_SCS("set_albedo"),_SCS("get_albedo")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); @@ -737,6 +790,8 @@ void FixedSpatialMaterial::_bind_methods() { BIND_CONSTANT( FLAG_UNSHADED ); BIND_CONSTANT( FLAG_ONTOP ); BIND_CONSTANT( FLAG_ALBEDO_FROM_VERTEX_COLOR ); + BIND_CONSTANT( FLAG_SRGB_VERTEX_COLOR ) + BIND_CONSTANT( FLAG_USE_POINT_SIZE ) BIND_CONSTANT( FLAG_MAX ); BIND_CONSTANT( DIFFUSE_LAMBERT ); @@ -763,6 +818,8 @@ FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { set_subsurface_scattering(0); set_refraction(0); set_refraction_roughness(0); + set_line_width(1); + set_point_size(1); detail_uv=DETAIL_UV_1; blend_mode=BLEND_MODE_MIX; diff --git a/scene/resources/material.h b/scene/resources/material.h index 0f0bf48025..35f01d4756 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -132,6 +132,8 @@ public: FLAG_UNSHADED, FLAG_ONTOP, FLAG_ALBEDO_FROM_VERTEX_COLOR, + FLAG_SRGB_VERTEX_COLOR, + FLAG_USE_POINT_SIZE, FLAG_MAX }; @@ -146,12 +148,12 @@ private: union MaterialKey { struct { - uint32_t feature_mask : 16; + uint32_t feature_mask : 15; uint32_t detail_uv : 1; uint32_t blend_mode : 2; uint32_t depth_draw_mode : 2; uint32_t cull_mode : 2; - uint32_t flags : 3; + uint32_t flags : 5; uint32_t detail_blend_mode : 2; uint32_t diffuse_mode : 2; uint32_t invalid_key : 1; @@ -213,7 +215,9 @@ private: StringName subsurface_scattering; StringName refraction; StringName refraction_roughness; + StringName point_size; StringName texture_names[TEXTURE_MAX]; + }; static Mutex *material_mutex; @@ -240,6 +244,8 @@ private: float subsurface_scattering; float refraction; float refraction_roughness; + float line_width; + float point_size; DetailUV detail_uv; @@ -306,6 +312,12 @@ public: void set_refraction_roughness(float p_refraction_roughness); float get_refraction_roughness() const; + void set_line_width(float p_line_width); + float get_line_width() const; + + void set_point_size(float p_point_size); + float get_point_size() const; + void set_detail_uv(DetailUV p_detail_uv); DetailUV get_detail_uv() const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 78757c799f..b61a2d0a46 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -54,11 +54,8 @@ public: virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,VS::EnvironmentToneMapper p_tone_mapper)=0; - virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0; - virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0; - virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0; - virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0; + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; struct InstanceBase : RID_Data { @@ -176,6 +173,8 @@ public: virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0; virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0; + virtual void material_set_line_width(RID p_material, float p_width)=0; + /* MESH API */ virtual RID mesh_create()=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 655ce410bc..6c7048bd62 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -658,6 +658,10 @@ public: BIND3(material_set_param,RID, const StringName&, const Variant& ) BIND2RC(Variant,material_get_param,RID, const StringName& ) + BIND2(material_set_line_width,RID, float ) + + + /* MESH API */ BIND0R(RID,mesh_create) @@ -864,11 +868,8 @@ public: BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) - BIND8(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float ,EnvironmentToneMapper ) - BIND3(environment_set_brightness,RID,bool ,float ) - BIND3(environment_set_contrast,RID,bool ,float ) - BIND3(environment_set_saturation,RID,bool ,float ) - BIND3(environment_set_color_correction,RID,bool ,RID ) + BIND9(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float,float ,EnvironmentToneMapper ) + BIND6(environment_set_adjustment,RID,bool ,float ,float ,float ,RID ) /* SCENARIO API */ diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 2f0f8f263f..d958ea4bdb 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -692,21 +692,81 @@ void VisualServerScene::instance_set_extra_visibility_margin( RID p_instance, re } -// don't use these in a game! -Vector VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const{ +Vector VisualServerScene::instances_cull_aabb(const AABB& p_aabb, RID p_scenario) const { - return Vector(); -} -Vector VisualServerScene::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{ + Vector instances; + Scenario *scenario=scenario_owner.get(p_scenario); + ERR_FAIL_COND_V(!scenario,instances); + + const_cast(this)->update_dirty_instances(); // check dirty instances before culling + + int culled=0; + Instance *cull[1024]; + culled=scenario->octree.cull_AABB(p_aabb,cull,1024); - return Vector(); + for (int i=0;iobject_ID==0) + continue; + + instances.push_back(instance->object_ID); + } + + return instances; } -Vector VisualServerScene::instances_cull_convex(const Vector& p_convex, RID p_scenario) const { +Vector VisualServerScene::instances_cull_ray(const Vector3& p_from, const Vector3& p_to, RID p_scenario) const{ + + Vector instances; + Scenario *scenario=scenario_owner.get(p_scenario); + ERR_FAIL_COND_V(!scenario,instances); + const_cast(this)->update_dirty_instances(); // check dirty instances before culling + + int culled=0; + Instance *cull[1024]; + culled=scenario->octree.cull_segment(p_from,p_to*10000,cull,1024); + + + for (int i=0;iobject_ID==0) + continue; + + instances.push_back(instance->object_ID); + } + + return instances; - return Vector(); } +Vector VisualServerScene::instances_cull_convex(const Vector& p_convex, RID p_scenario) const{ + + Vector instances; + Scenario *scenario=scenario_owner.get(p_scenario); + ERR_FAIL_COND_V(!scenario,instances); + const_cast(this)->update_dirty_instances(); // check dirty instances before culling + + int culled=0; + Instance *cull[1024]; + + + culled=scenario->octree.cull_convex(p_convex,cull,1024); + for (int i=0;iobject_ID==0) + continue; + + instances.push_back(instance->object_ID); + } + + return instances; + +} void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFlags p_flags,bool p_enabled){ diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 515d52db7b..10a159f27a 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -162,7 +162,7 @@ public: Scenario() { debug=VS::SCENARIO_DEBUG_DISABLED; } }; - RID_Owner scenario_owner; + mutable RID_Owner scenario_owner; static void* _instance_pair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int); static void _instance_unpair(void *p_self, OctreeElementID, Instance *p_A,int, OctreeElementID, Instance *p_B,int,void*); diff --git a/servers/visual_server.h b/servers/visual_server.h index bbe6c2c683..78769c17f7 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -172,6 +172,8 @@ public: virtual void material_set_param(RID p_material, const StringName& p_param, const Variant& p_value)=0; virtual Variant material_get_param(RID p_material, const StringName& p_param) const=0; + virtual void material_set_line_width(RID p_material, float p_width)=0; + /* MESH API */ enum ArrayType { @@ -512,15 +514,14 @@ public: enum EnvironmentToneMapper { ENV_TONE_MAPPER_LINEAR, + ENV_TONE_MAPPER_LOG, ENV_TONE_MAPPER_REINHARDT, - ENV_TONE_MAPPER_FILMIC + ENV_TONE_MAPPER_FILMIC, + ENV_TONE_MAPPER_ACES_FILMIC }; - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,EnvironmentToneMapper p_tone_mapper)=0; - virtual void environment_set_brightness(RID p_env,bool p_enable,float p_brightness)=0; - virtual void environment_set_contrast(RID p_env,bool p_enable,float p_contrast)=0; - virtual void environment_set_saturation(RID p_env,bool p_enable,float p_saturation)=0; - virtual void environment_set_color_correction(RID p_env,bool p_enable,RID p_ramp)=0; + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; /* SCENARIO API */ diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index a4ee102aed..99c2b468fa 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -4144,7 +4144,7 @@ void EditorNode::register_editor_types() { ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); -// ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 7a24ab4180..13c69692c7 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2553,6 +2553,7 @@ void SpatialEditor::_generate_selection_box() { mat->set_albedo(Color(1,1,1)); mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); st->set_material(mat); selection_box = st->commit(); } @@ -3143,6 +3144,8 @@ void SpatialEditor::_init_indicators() { indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + indicator_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); DVector grid_colors[3]; @@ -3543,7 +3546,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - //gizmos = memnew( SpatialEditorGizmos ); + gizmos = memnew( SpatialEditorGizmos ); _init_indicators(); _update_default_light_angle(); } @@ -3551,7 +3554,7 @@ void SpatialEditor::_notification(int p_what) { if (p_what==NOTIFICATION_EXIT_TREE) { _finish_indicators(); -// memdelete( gizmos ); + memdelete( gizmos ); } } @@ -3597,7 +3600,7 @@ void SpatialEditor::_request_gizmo(Object* p_obj) { } if (!seg.is_valid()) { - // seg = gizmos->get_gizmo(sp); + seg = gizmos->get_gizmo(sp); } if (seg.is_valid()) { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 8c8a80bc3a..1617acaefb 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -467,7 +467,7 @@ private: static SpatialEditor *singleton; void _node_removed(Node* p_node); - //SpatialEditorGizmos *gizmos; + SpatialEditorGizmos *gizmos; SpatialEditor(); void _update_ambient_light_color(const Color& p_color); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index bc76f6c20c..b1accac762 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -41,7 +41,7 @@ // Keep small children away from this file. // It's so ugly it will eat them alive -#if 0 + #define HANDLE_HALF_SIZE 0.05 @@ -84,7 +84,6 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) { if (extra_margin) VS::get_singleton()->instance_set_extra_visibility_margin(instance,1); VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance,VS::SHADOW_CASTING_SETTING_OFF); - VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_RECEIVE_SHADOWS,false); VS::get_singleton()->instance_set_layer_mask(instance,1<get_parameter(Light::PARAM_RADIUS); + return light->get_param(Light::PARAM_RANGE); if (p_idx==1) - return light->get_parameter(Light::PARAM_SPOT_ANGLE); + return light->get_param(Light::PARAM_SPOT_ANGLE); return Variant(); } @@ -729,7 +728,7 @@ void LightSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_p if (d<0) d=0; - light->set_parameter(Light::PARAM_RADIUS,d); + light->set_param(Light::PARAM_RANGE,d); } else if (light->cast_to()) { Plane cp=Plane( gt.origin, p_camera->get_transform().basis.get_axis(2)); @@ -738,15 +737,15 @@ void LightSpatialGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_p if (cp.intersects_ray(ray_from,ray_dir,&inters)) { float r = inters.distance_to(gt.origin); - light->set_parameter(Light::PARAM_RADIUS,r); + light->set_param(Light::PARAM_RANGE,r); } } } else if (p_idx==1) { - float a = _find_closest_angle_to_half_pi_arc(s[0],s[1],light->get_parameter(Light::PARAM_RADIUS),gt); - light->set_parameter(Light::PARAM_SPOT_ANGLE,CLAMP(a,0.01,89.99)); + float a = _find_closest_angle_to_half_pi_arc(s[0],s[1],light->get_param(Light::PARAM_RANGE),gt); + light->set_param(Light::PARAM_SPOT_ANGLE,CLAMP(a,0.01,89.99)); } } @@ -754,21 +753,21 @@ void LightSpatialGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_ if (p_cancel) { - light->set_parameter(p_idx==0?Light::PARAM_RADIUS:Light::PARAM_SPOT_ANGLE,p_restore); + light->set_param(p_idx==0?Light::PARAM_RANGE:Light::PARAM_SPOT_ANGLE,p_restore); } else if (p_idx==0) { UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Light Radius")); - ur->add_do_method(light,"set_parameter",Light::PARAM_RADIUS,light->get_parameter(Light::PARAM_RADIUS)); - ur->add_undo_method(light,"set_parameter",Light::PARAM_RADIUS,p_restore); + ur->add_do_method(light,"set_param",Light::PARAM_RANGE,light->get_param(Light::PARAM_RANGE)); + ur->add_undo_method(light,"set_param",Light::PARAM_RANGE,p_restore); ur->commit_action(); } else if (p_idx==1) { UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); ur->create_action(TTR("Change Light Radius")); - ur->add_do_method(light,"set_parameter",Light::PARAM_SPOT_ANGLE,light->get_parameter(Light::PARAM_SPOT_ANGLE)); - ur->add_undo_method(light,"set_parameter",Light::PARAM_SPOT_ANGLE,p_restore); + ur->add_do_method(light,"set_param",Light::PARAM_SPOT_ANGLE,light->get_param(Light::PARAM_SPOT_ANGLE)); + ur->add_undo_method(light,"set_param",Light::PARAM_SPOT_ANGLE,p_restore); ur->commit_action(); } @@ -831,7 +830,7 @@ void LightSpatialGizmo::redraw() { OmniLight *on = light->cast_to(); - float r = on->get_parameter(Light::PARAM_RADIUS); + float r = on->get_param(Light::PARAM_RANGE); Vector points; @@ -871,9 +870,9 @@ void LightSpatialGizmo::redraw() { Vector points; SpotLight *on = light->cast_to(); - float r = on->get_parameter(Light::PARAM_RADIUS); - float w = r*Math::sin(Math::deg2rad(on->get_parameter(Light::PARAM_SPOT_ANGLE))); - float d = r*Math::cos(Math::deg2rad(on->get_parameter(Light::PARAM_SPOT_ANGLE))); + float r = on->get_param(Light::PARAM_RANGE); + float w = r*Math::sin(Math::deg2rad(on->get_param(Light::PARAM_SPOT_ANGLE))); + float d = r*Math::cos(Math::deg2rad(on->get_param(Light::PARAM_SPOT_ANGLE))); @@ -1543,7 +1542,7 @@ void RayCastSpatialGizmo::redraw() { } -RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast){ +RayCastSpatialGizmo::RayCastSpatialGizmo(RayCast* p_raycast) { set_spatial_node(p_raycast); raycast=p_raycast; @@ -2979,11 +2978,12 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { Ref SpatialEditorGizmos::create_line_material(const Color& p_base_color) { Ref line_material = Ref( memnew( FixedSpatialMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); line_material->set_line_width(3.0); - line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); + line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_albedo(p_base_color); return line_material; @@ -2992,9 +2992,9 @@ Ref SpatialEditorGizmos::create_line_material(const Color& Ref SpatialEditorGizmos::create_solid_material(const Color& p_base_color) { Ref line_material = Ref( memnew( FixedSpatialMaterial )); - line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,p_base_color); + line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_albedo(p_base_color); return line_material; @@ -3005,56 +3005,59 @@ SpatialEditorGizmos::SpatialEditorGizmos() { singleton=this; handle_material = Ref( memnew( FixedSpatialMaterial )); - handle_material->set_flag(Material::FLAG_UNSHADED, true); - handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.8,0.8,0.8)); + handle_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + handle_material->set_albedo(Color(0.8,0.8,0.8)); handle2_material = Ref( memnew( FixedSpatialMaterial )); - handle2_material->set_flag(Material::FLAG_UNSHADED, true); - handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true); handle_t = SpatialEditor::get_singleton()->get_icon("Editor3DHandle","EditorIcons"); handle2_material->set_point_size(handle_t->get_width()); - handle2_material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,handle_t); - handle2_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1)); - handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - handle2_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); + handle2_material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,handle_t); + handle2_material->set_albedo(Color(1,1,1)); + handle2_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + handle2_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); light_material = create_line_material(Color(1,1,0.2)); light_material_omni_icon = Ref( memnew( FixedSpatialMaterial )); - light_material_omni_icon->set_flag(Material::FLAG_UNSHADED, true); - light_material_omni_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - light_material_omni_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_omni_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - light_material_omni_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_omni_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); + light_material_omni_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + light_material_omni_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + light_material_omni_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + light_material_omni_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + light_material_omni_icon->set_albedo(Color(1,1,1,0.9)); + light_material_omni_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoLight","EditorIcons")); light_material_directional_icon = Ref( memnew( FixedSpatialMaterial )); - light_material_directional_icon->set_flag(Material::FLAG_UNSHADED, true); - light_material_directional_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - light_material_directional_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - light_material_directional_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - light_material_directional_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - light_material_directional_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); + light_material_directional_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + light_material_directional_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + light_material_directional_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + light_material_directional_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + light_material_directional_icon->set_albedo(Color(1,1,1,0.9)); + light_material_directional_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight","EditorIcons")); camera_material = create_line_material(Color(1.0,0.5,1.0)); navmesh_edge_material = create_line_material(Color(0.1,0.8,1.0)); navmesh_solid_material = create_solid_material(Color(0.1,0.8,1.0,0.4)); - navmesh_edge_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); - navmesh_solid_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); + navmesh_edge_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, false); + navmesh_edge_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, false); + navmesh_solid_material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); navmesh_edge_material_disabled = create_line_material(Color(1.0,0.8,0.1)); navmesh_solid_material_disabled = create_solid_material(Color(1.0,0.8,0.1,0.4)); - navmesh_edge_material_disabled->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false); - navmesh_solid_material_disabled->set_flag(Material::FLAG_DOUBLE_SIDED,true); + navmesh_edge_material_disabled->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, false); + navmesh_edge_material_disabled->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, false); + navmesh_solid_material_disabled->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); skeleton_material = create_line_material(Color(0.6,1.0,0.3)); - skeleton_material->set_flag(Material::FLAG_DOUBLE_SIDED,true); - skeleton_material->set_flag(Material::FLAG_UNSHADED,true); - skeleton_material->set_flag(Material::FLAG_ONTOP,true); - skeleton_material->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + skeleton_material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + skeleton_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + skeleton_material->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); + skeleton_material->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); //position 3D Shared mesh @@ -3078,9 +3081,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5,0.5,1,0.7)); Ref mat = memnew( FixedSpatialMaterial ); - mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3101,9 +3105,10 @@ SpatialEditorGizmos::SpatialEditorGizmos() { cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); Ref mat = memnew(FixedSpatialMaterial); - mat->set_flag(Material::FLAG_UNSHADED, true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - mat->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); + mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); mat->set_line_width(3); Array d; d.resize(VS::ARRAY_MAX); @@ -3115,12 +3120,12 @@ SpatialEditorGizmos::SpatialEditorGizmos() { sample_player_icon = Ref( memnew( FixedSpatialMaterial )); - sample_player_icon->set_flag(Material::FLAG_UNSHADED, true); - sample_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - sample_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - sample_player_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - sample_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - sample_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); + sample_player_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + sample_player_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + sample_player_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + sample_player_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + sample_player_icon->set_albedo(Color(1,1,1,0.9)); + sample_player_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer","EditorIcons")); room_material = create_line_material(Color(1.0,0.6,0.9)); portal_material = create_line_material(Color(1.0,0.8,0.6)); @@ -3130,28 +3135,28 @@ SpatialEditorGizmos::SpatialEditorGizmos() { joint_material = create_line_material(Color(0.6,0.8,1.0)); stream_player_icon = Ref( memnew( FixedSpatialMaterial )); - stream_player_icon->set_flag(Material::FLAG_UNSHADED, true); - stream_player_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - stream_player_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - stream_player_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - stream_player_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - stream_player_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); + stream_player_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + stream_player_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + stream_player_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + stream_player_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + stream_player_icon->set_albedo(Color(1,1,1,0.9)); + stream_player_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("GizmoSpatialStreamPlayer","EditorIcons")); visibility_notifier_icon = Ref( memnew( FixedSpatialMaterial )); - visibility_notifier_icon->set_flag(Material::FLAG_UNSHADED, true); - visibility_notifier_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - visibility_notifier_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - visibility_notifier_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - visibility_notifier_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,0.9)); - visibility_notifier_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); + visibility_notifier_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + visibility_notifier_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + visibility_notifier_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + visibility_notifier_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + visibility_notifier_icon->set_albedo(Color(1,1,1,0.9)); + visibility_notifier_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,SpatialEditor::get_singleton()->get_icon("Visible","EditorIcons")); listener_icon = Ref(memnew(FixedSpatialMaterial)); - listener_icon->set_flag(Material::FLAG_UNSHADED, true); - listener_icon->set_flag(Material::FLAG_DOUBLE_SIDED, true); - listener_icon->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); - listener_icon->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true); - listener_icon->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE, Color(1, 1, 1, 0.9)); - listener_icon->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); + listener_icon->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); + listener_icon->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + listener_icon->set_depth_draw_mode(FixedSpatialMaterial::DEPTH_DRAW_DISABLED); + listener_icon->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); + listener_icon->set_albedo( Color(1, 1, 1, 0.9)); + listener_icon->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO, SpatialEditor::get_singleton()->get_icon("GizmoListener", "EditorIcons")); { @@ -3200,4 +3205,4 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } -#endif + diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 64c6a6e824..2c0033cdca 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -52,7 +52,7 @@ class Camera; -#if 0 + class EditorSpatialGizmo : public SpatialEditorGizmo { OBJ_TYPE(EditorSpatialGizmo,SpatialGizmo); @@ -505,5 +505,4 @@ public: SpatialEditorGizmos(); }; -#endif #endif // SPATIAL_EDITOR_GIZMOS_H -- cgit v1.2.3 From acfa606915416a85106817974e5ba2ec3518c203 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 29 Oct 2016 22:11:05 -0300 Subject: resolved reflection cubemap blending --- drivers/gles3/rasterizer_storage_gles3.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a678c460f5..4b2c607297 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -57,7 +57,7 @@ #define _EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE - +#define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #define _GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define _GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF @@ -3946,6 +3946,8 @@ void RasterizerStorageGLES3::initialize() { } shaders.cubemap_filter.init(); + + glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); } void RasterizerStorageGLES3::finalize() { -- cgit v1.2.3 From 6b2a27bbe5fa112365fc88b9b4678a61293bcb53 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 31 Oct 2016 08:47:46 -0300 Subject: shadow atlas allocation (work in progress) --- drivers/gles3/rasterizer_scene_gles3.cpp | 433 ++++++++++++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 62 ++++- drivers/gles3/shadow_atlas_gles3.cpp | 2 + drivers/gles3/shadow_atlas_gles3.h | 8 + servers/visual/rasterizer.h | 4 + servers/visual/visual_server_scene.cpp | 4 + 6 files changed, 501 insertions(+), 12 deletions(-) create mode 100644 drivers/gles3/shadow_atlas_gles3.cpp create mode 100644 drivers/gles3/shadow_atlas_gles3.h diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index f7baf1a30b..93dc01d473 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1,6 +1,6 @@ #include "rasterizer_scene_gles3.h" #include "globals.h" - +#include "os/os.h" @@ -55,7 +55,351 @@ static _FORCE_INLINE_ void store_camera(const CameraMatrix& p_mtx, float* p_arra } } +/* SHADOW ATLAS API */ + +RID RasterizerSceneGLES3::shadow_atlas_create() { + + ShadowAtlas *shadow_atlas = memnew( ShadowAtlas ); + shadow_atlas->fbo=0; + shadow_atlas->depth=0; + shadow_atlas->size=0; + shadow_atlas->smallest_subdiv=0; + + for(int i=0;i<4;i++) { + shadow_atlas->size_order[i]=i; + } + + + return shadow_atlas_owner.make_rid(shadow_atlas); +} + +void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas); + ERR_FAIL_COND(!shadow_atlas); + ERR_FAIL_COND(p_size<0); + if (p_size==shadow_atlas->size) + return; + + if (shadow_atlas->fbo) { + glDeleteTextures(1,&shadow_atlas->depth); + glDeleteFramebuffers(1,&shadow_atlas->fbo); + + shadow_atlas->depth=0; + shadow_atlas->fbo=0; + } + for(int i=0;i<4;i++) { + //clear subdivisions + shadow_atlas->quadrants[i].shadows.resize(0); + shadow_atlas->quadrants[i].shadows.resize( 1<quadrants[i].subdivision ); + } + + //erase shadow atlas reference from lights + for (Map::Element *E=shadow_atlas->shadow_owners.front();E;E=E->next()) { + LightInstance *li = light_instance_owner.getornull(E->key()); + ERR_CONTINUE(!li); + li->shadow_atlases.erase(p_atlas); + } + + //clear owners + shadow_atlas->shadow_owners.clear(); + + shadow_atlas->size=nearest_power_of_2(p_size); + + if (shadow_atlas->size) { + glGenFramebuffers(1, &shadow_atlas->fbo); + glBindFramebuffer(GL_FRAMEBUFFER, shadow_atlas->fbo); + + // Create a texture for storing the depth + glActiveTexture(GL_TEXTURE0); + glGenTextures(1, &shadow_atlas->depth); + glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_atlas->size, shadow_atlas->size, 0, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + + //interpola nearest (though nvidia can improve this) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + // Remove artifact on the edges of the shadowmap + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // We'll use a depth texture to store the depths in the shadow map + // Attach the depth texture to FBO depth attachment point + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, shadow_atlas->depth, 0); + } +} + + +void RasterizerSceneGLES3::shadow_atlas_set_quadrant_subdivision(RID p_atlas,int p_quadrant,int p_subdivision){ + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas); + ERR_FAIL_COND(!shadow_atlas); + ERR_FAIL_INDEX(p_quadrant,4); + ERR_FAIL_INDEX(p_subdivision,16384); + + + uint32_t subdiv = nearest_power_of_2(p_subdivision); + if (subdiv&0xaaaaaaaa) { //sqrt(subdiv) must be integer + subdiv<<=1; + } + + subdiv=int(Math::sqrt(subdiv)); + + //obtain the number that will be x*x + + if (shadow_atlas->quadrants[p_quadrant].subdivision==subdiv) + return; + + //erase all data from quadrant + for(int i=0;iquadrants[p_quadrant].shadows.size();i++) { + + if (shadow_atlas->quadrants[p_quadrant].shadows[i].owner.is_valid()) { + shadow_atlas->shadow_owners.erase(shadow_atlas->quadrants[p_quadrant].shadows[i].owner); + LightInstance *li = light_instance_owner.getornull(shadow_atlas->quadrants[p_quadrant].shadows[i].owner); + ERR_CONTINUE(!li); + li->shadow_atlases.erase(p_atlas); + } + } + + shadow_atlas->quadrants[p_quadrant].shadows.resize(0); + shadow_atlas->quadrants[p_quadrant].shadows.resize(subdiv*subdiv); + shadow_atlas->quadrants[p_quadrant].subdivision=subdiv; + + //cache the smallest subdiv (for faster allocation in light update) + + shadow_atlas->smallest_subdiv=1<<30; + + for(int i=0;i<4;i++) { + if (shadow_atlas->quadrants[i].subdivision) { + shadow_atlas->smallest_subdiv=MIN(shadow_atlas->smallest_subdiv,shadow_atlas->quadrants[i].subdivision); + } + } + + if (shadow_atlas->smallest_subdiv==1<<30) { + shadow_atlas->smallest_subdiv=0; + } + + //resort the size orders, simple bublesort for 4 elements.. + + int swaps=0; + do { + swaps=0; + + for(int i=0;i<3;i++) { + if (shadow_atlas->quadrants[shadow_atlas->size_order[i]].subdivision > shadow_atlas->quadrants[shadow_atlas->size_order[i+1]].subdivision) { + SWAP(shadow_atlas->size_order[i],shadow_atlas->size_order[i+1]); + swaps++; + } + } + } while(swaps>0); + + + + + +} + +bool RasterizerSceneGLES3::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas,int *p_in_quadrants,int p_quadrant_count,int p_current_subdiv,uint64_t p_tick,int &r_quadrant,int &r_shadow) { + + + for(int i=p_quadrant_count-1;i>=0;i--) { + int qidx = p_in_quadrants[i]; + + if (shadow_atlas->quadrants[qidx].subdivision==p_current_subdiv) { + return false; + } + + //look for an empty space + int sc = shadow_atlas->quadrants[qidx].shadows.size(); + ShadowAtlas::Quadrant::Shadow *sarr = shadow_atlas->quadrants[qidx].shadows.ptr(); + + int found_free_idx=-1; //found a free one + int found_used_idx=-1; //found existing one, must steal it + uint64_t min_pass; // pass of the existing one, try to use the least recently used one (LRU fashion) + + for(int j=0;jlast_scene_pass!=scene_pass) { + + //was just allocated, don't kill it so soon, wait a bit.. + if (p_tick-sarr[j].alloc_tick < shadow_atlas_realloc_tolerance_msec) + continue; + + if (found_used_idx==-1 || sli->last_scene_passlast_scene_pass; + } + } + } + + if (found_free_idx==-1 && found_used_idx==-1) + continue; //nothing found + + if (found_free_idx==-1 && found_used_idx!=-1) { + found_free_idx=found_used_idx; + } + + r_quadrant=qidx; + r_shadow=found_free_idx; + + return true; + } + + return false; + +} + + +uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version){ + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas); + ERR_FAIL_COND_V(!shadow_atlas,ShadowAtlas::SHADOW_INVALID); + + LightInstance *li = light_instance_owner.getornull(p_light_intance); + ERR_FAIL_COND_V(!li,ShadowAtlas::SHADOW_INVALID); + + if (shadow_atlas->size==0 || shadow_atlas->smallest_subdiv==0) { + return ShadowAtlas::SHADOW_INVALID; + } + + uint32_t quad_size = shadow_atlas->size>>1; + int desired_fit = MAX(quad_size/shadow_atlas->smallest_subdiv,nearest_power_of_2(quad_size*p_coverage)); + + int valid_quadrants[4]; + int valid_quadrant_count=0; + int best_size=-1; //best size found + int best_subdiv=-1; //subdiv for the best size + + //find the quadrants this fits into, and the best possible size it can fit into + for(int i=0;i<4;i++) { + int q = shadow_atlas->size_order[i]; + int sd = shadow_atlas->quadrants[q].subdivision; + if (sd==0) + continue; //unused + + int max_fit = quad_size / sd; + + if (best_size!=-1 && max_fit>best_size) + break; //too large + + valid_quadrants[valid_quadrant_count++]=q; + best_subdiv=sd; + + if (max_fit>=desired_fit) { + best_size=max_fit; + } + } + + + ERR_FAIL_COND_V(valid_quadrant_count==0,ShadowAtlas::SHADOW_INVALID); + + uint64_t tick = OS::get_singleton()->get_ticks_msec(); + + + //see if it already exists + + if (shadow_atlas->shadow_owners.has(p_light_intance)) { + //it does! + uint32_t key = shadow_atlas->shadow_owners[p_light_intance]; + uint32_t q = (key>>ShadowAtlas::QUADRANT_SHIFT)&0x3; + uint32_t s = key&ShadowAtlas::SHADOW_INDEX_MASK; + + bool should_realloc=shadow_atlas->quadrants[q].subdivision!=best_subdiv && (shadow_atlas->quadrants[q].shadows[s].alloc_tick-tick > shadow_atlas_realloc_tolerance_msec); + bool should_redraw=shadow_atlas->quadrants[q].shadows[s].version!=p_light_version; + + if (!should_realloc) { + //already existing, see if it should redraw or it's just OK + if (should_redraw) { + key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; + } + + return key; + } + + int new_quadrant,new_shadow; + + //find a better place + if (_shadow_atlas_find_shadow(shadow_atlas,valid_quadrants,valid_quadrant_count,shadow_atlas->quadrants[q].subdivision,tick,new_quadrant,new_shadow)) { + //found a better place! + ShadowAtlas::Quadrant::Shadow *sh = &shadow_atlas->quadrants[new_quadrant].shadows[new_shadow]; + if (sh->owner.is_valid()) { + //is taken, but is invalid, erasing it + shadow_atlas->shadow_owners.erase(sh->owner); + LightInstance *sli = light_instance_owner.get(sh->owner); + sli->shadow_atlases.erase(p_atlas); + } + + sh->owner=p_light_intance; + sh->alloc_tick=tick; + sh->version=p_light_version; + + //make new key + key=new_quadrant<shadow_owners[p_light_intance]=key; + //make it dirty, as it should redraw anyway + key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; + + return key; + } + + //no better place for this shadow found, keep current + + //already existing, see if it should redraw or it's just OK + if (should_redraw) { + key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; + } + + return key; + } + + int new_quadrant,new_shadow; + + //find a better place + if (_shadow_atlas_find_shadow(shadow_atlas,valid_quadrants,valid_quadrant_count,-1,tick,new_quadrant,new_shadow)) { + //found a better place! + ShadowAtlas::Quadrant::Shadow *sh = &shadow_atlas->quadrants[new_quadrant].shadows[new_shadow]; + if (sh->owner.is_valid()) { + //is taken, but is invalid, erasing it + shadow_atlas->shadow_owners.erase(sh->owner); + LightInstance *sli = light_instance_owner.get(sh->owner); + sli->shadow_atlases.erase(p_atlas); + } + + sh->owner=p_light_intance; + sh->alloc_tick=tick; + sh->version=p_light_version; + + //make new key + uint32_t key=new_quadrant<shadow_owners[p_light_intance]=key; + //make it dirty, as it should redraw anyway + key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; + + return key; + } + + //no place to allocate this light, apologies + + return ShadowAtlas::SHADOW_INVALID; + + + + +} /* ENVIRONMENT API */ @@ -162,9 +506,12 @@ void RasterizerSceneGLES3::environment_set_adjustment(RID p_env,bool p_enable,fl RID RasterizerSceneGLES3::light_instance_create(RID p_light) { - print_line("hello light"); + LightInstance *light_instance = memnew( LightInstance ); + light_instance->last_pass=0; + light_instance->last_scene_pass=0; + light_instance->light=p_light; light_instance->light_ptr=storage->light_owner.getornull(p_light); @@ -187,6 +534,18 @@ void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance,con light_instance->transform=p_transform; } +void RasterizerSceneGLES3::light_instance_mark_visible(RID p_light_instance) { + + LightInstance *light_instance = light_instance_owner.getornull(p_light_instance); + ERR_FAIL_COND(!light_instance); + + light_instance->last_scene_pass=scene_pass; +} + + +//////////////////////////// +//////////////////////////// +//////////////////////////// bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_material,bool p_alpha_pass) { @@ -851,13 +1210,13 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g if (shadow || m->shader->spatial.unshaded /*|| current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { - e->sort_key=RenderList::SORT_KEY_LIGHT_INDEX_UNSHADED; + e->sort_key|=RenderList::SORT_KEY_LIGHT_INDEX_UNSHADED; e->sort_key|=uint64_t(0xF)<sort_key|=uint64_t(0xFFFF)<additive_ptr=&e->additive; + ec->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; ec->sort_key|=uint64_t(directional_light_instances[i]->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; ec->sort_key|=uint64_t(VS::LIGHT_DIRECTIONAL) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; - lighted=true; + lit=true; } @@ -922,14 +1282,16 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g ec->additive_ptr=&e->additive; + ec->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; ec->sort_key|=uint64_t(li->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; ec->sort_key|=uint64_t(li->light_ptr->type) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; - lighted=true; + lit=true; } - if (!lighted) { + if (!lit) { + e->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; e->sort_key|=uint64_t(0xE)<sort_key|=uint64_t(0xFFFF)< lpercent; + for(int i=0;i=RenderList::MAX_LIGHTS ); @@ -1140,6 +1504,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu + #if 0 if (li->light_ptr->shadow_enabled) { CameraMatrix bias; @@ -1181,6 +1546,26 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu li->light_ubo_data.light_params[2]=0; li->light_ubo_data.light_params[3]=0; +#if 0 + + Transform ai = p_camera_inverse_transform.affine_inverse(); + float zn = p_camera_projection.get_z_near(); + Plane p (ai.origin + ai.basis.get_axis(2) * -zn, -ai.basis.get_axis(2) ); + + Vector3 point1 = li->transform.origin; + Vector3 point2 = li->transform.origin+p_camera_inverse_transform.affine_inverse().basis.get_axis(1).normalized()*li->light_ptr->param[VS::LIGHT_PARAM_RANGE]; + + p.intersects_segment(ai.origin,point1,&point1); + p.intersects_segment(ai.origin,point2,&point2); + float r = point1.distance_to(point2); + + float vp_w,vp_h; + p_camera_projection.get_viewport_size(vp_w,vp_h); + + lpercent.push_back(r*2/((vp_h+vp_w)*0.5)); + +#endif + #if 0 if (li->light_ptr->shadow_enabled) { li->shadow_projection[0] = Transform(camera_transform_inverse * li->transform).inverse(); @@ -1245,8 +1630,8 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu glBindBuffer(GL_UNIFORM_BUFFER, 0); light_instances[i]=li; + light_instance_count++; } - } void RasterizerSceneGLES3::_copy_screen() { @@ -1305,7 +1690,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM _setup_environment(env,p_cam_projection,p_cam_transform); - _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse()); + _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection); render_list.clear(); @@ -1609,16 +1994,40 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM #endif } +void RasterizerSceneGLES3::set_scene_pass(uint64_t p_pass) { + scene_pass=p_pass; +} + bool RasterizerSceneGLES3::free(RID p_rid) { if (light_instance_owner.owns(p_rid)) { - print_line("bye light"); + LightInstance *light_instance = light_instance_owner.getptr(p_rid); + + //remove from shadow atlases.. + for(Set::Element *E=light_instance->shadow_atlases.front();E;E=E->next()) { + ShadowAtlas *shadow_atlas = shadow_atlas_owner.get(E->get()); + ERR_CONTINUE(!shadow_atlas->shadow_owners.has(p_rid)); + uint32_t key = shadow_atlas->shadow_owners[p_rid]; + uint32_t q = (key>>ShadowAtlas::QUADRANT_SHIFT)&0x3; + uint32_t s = key&ShadowAtlas::SHADOW_INDEX_MASK; + + shadow_atlas->quadrants[q].shadows[s].owner=RID(); + shadow_atlas->shadow_owners.erase(p_rid); + } + + glDeleteBuffers(1,&light_instance->light_ubo); light_instance_owner.free(p_rid); memdelete(light_instance); + } else if (shadow_atlas_owner.owns(p_rid)) { + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.get(p_rid); + shadow_atlas_set_size(p_rid,0); + shadow_atlas_owner.free(p_rid); + memdelete(shadow_atlas); } else { return false; @@ -1800,6 +2209,8 @@ void RasterizerSceneGLES3::initialize() { } render_list.init(); _generate_brdf(); + + shadow_atlas_realloc_tolerance_msec=500; } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 5457b5cde3..9df6315e45 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -7,7 +7,11 @@ class RasterizerSceneGLES3 : public RasterizerScene { public: + uint64_t shadow_atlas_realloc_tolerance_msec; + + uint64_t render_pass; + uint64_t scene_pass; uint32_t current_material_index; uint32_t current_geometry_index; @@ -62,8 +66,58 @@ public: } state; + /* SHADOW ATLAS API */ + + struct ShadowAtlas : public RID_Data { + + enum { + SHADOW_INDEX_DIRTY_BIT=(1<<31), + QUADRANT_SHIFT=27, + SHADOW_INDEX_MASK=(1< shadows; + Quadrant() { + subdivision=0; //not in use + } + + } quadrants[4]; + + int size_order[4]; + uint32_t smallest_subdiv; + + int size; + + GLuint fbo; + GLuint depth; + + Map shadow_owners; + }; + + RID_Owner shadow_atlas_owner; + + RID shadow_atlas_create(); + void shadow_atlas_set_size(RID p_atlas,int p_size); + void shadow_atlas_set_quadrant_subdivision(RID p_atlas,int p_quadrant,int p_subdivision); + bool _shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow); + uint32_t shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version); /* ENVIRONMENT API */ @@ -159,6 +213,7 @@ public: GLuint light_ubo; uint64_t shadow_pass; + uint64_t last_scene_pass; uint64_t last_pass; uint16_t light_index; @@ -166,6 +221,7 @@ public: CameraMatrix shadow_projection[4]; + Set shadow_atlases; //shadow atlases where this light is registered LightInstance() { } @@ -175,6 +231,7 @@ public: virtual RID light_instance_create(RID p_light); virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform); + virtual void light_instance_mark_visible(RID p_light_instance); /* RENDER LIST */ @@ -190,6 +247,7 @@ public: SORT_KEY_LIGHT_TYPE_SHIFT=54, //type is most important SORT_KEY_LIGHT_INDEX_SHIFT=38, //type is most important SORT_KEY_LIGHT_INDEX_UNSHADED=uint64_t(0xF) << SORT_KEY_LIGHT_TYPE_SHIFT, //type is most important + SORT_KEY_LIGHT_MASK=(uint64_t(0xFFFFF) << SORT_KEY_LIGHT_INDEX_SHIFT), //type is most important SORT_KEY_MATERIAL_INDEX_SHIFT=22, SORT_KEY_GEOMETRY_INDEX_SHIFT=6, SORT_KEY_GEOMETRY_TYPE_SHIFT=2, @@ -327,7 +385,7 @@ public: void _draw_skybox(RID p_skybox, CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); void _setup_environment(Environment *env,CameraMatrix& p_cam_projection, const Transform& p_cam_transform); - void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform); + void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform,const CameraMatrix& p_camera_projection); void _copy_screen(); void _copy_to_front_buffer(Environment *env); @@ -337,6 +395,8 @@ public: void _generate_brdf(); + virtual void set_scene_pass(uint64_t p_pass); + void initialize(); void finalize(); RasterizerSceneGLES3(); diff --git a/drivers/gles3/shadow_atlas_gles3.cpp b/drivers/gles3/shadow_atlas_gles3.cpp new file mode 100644 index 0000000000..38dee8bcea --- /dev/null +++ b/drivers/gles3/shadow_atlas_gles3.cpp @@ -0,0 +1,2 @@ +#include "shadow_atlas_gles3.h" + diff --git a/drivers/gles3/shadow_atlas_gles3.h b/drivers/gles3/shadow_atlas_gles3.h new file mode 100644 index 0000000000..46eaf581cb --- /dev/null +++ b/drivers/gles3/shadow_atlas_gles3.h @@ -0,0 +1,8 @@ +#ifndef SHADOW_ATLAS_GLES3_H +#define SHADOW_ATLAS_GLES3_H + +#include "rasterizer_storage_gles3.h" + + + +#endif // SHADOW_ATLAS_GLES3_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index b61a2d0a46..feaac38acb 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -109,9 +109,13 @@ public: virtual RID light_instance_create(RID p_light)=0; virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform)=0; + virtual void light_instance_mark_visible(RID p_light_instance)=0; + virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment)=0; + virtual void set_scene_pass(uint64_t p_pass)=0; + virtual bool free(RID p_rid)=0; virtual ~RasterizerScene() {} diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index d958ea4bdb..e7900bdcc9 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1107,6 +1107,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp render_pass++; uint32_t camera_layer_mask=camera->visible_layers; + VSG::scene_render->set_scene_pass(render_pass); + /* STEP 1 - SETUP CAMERA */ CameraMatrix camera_matrix; @@ -1266,6 +1268,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp //do not add this light if no geometry is affected by it.. light_cull_result[light_cull_count]=ins; light_instance_cull_result[light_cull_count]=light->instance; + VSG::scene_render->light_instance_mark_visible(light->instance); //mark it visible for shadow allocation later light_cull_count++; } @@ -1488,6 +1491,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp #endif + VSG::scene_render->render_scene(camera->transform, camera_matrix,ortho,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count,directional_light_ptr,directional_light_count,environment); } -- cgit v1.2.3 From cacf9ebb7fd8df8845daca9da2fe55456cc179aa Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 9 Nov 2016 23:55:06 -0300 Subject: all light types and shadows are working, pending a lot of clean-up --- core/math/camera_matrix.cpp | 22 + core/math/camera_matrix.h | 2 + core/math/math_funcs.h | 2 +- drivers/gles3/rasterizer_canvas_gles3.cpp | 2 - drivers/gles3/rasterizer_scene_gles3.cpp | 1043 +++++++++++++++++---- drivers/gles3/rasterizer_scene_gles3.h | 74 +- drivers/gles3/rasterizer_storage_gles3.cpp | 324 ++++++- drivers/gles3/rasterizer_storage_gles3.h | 101 +- drivers/gles3/shader_compiler_gles3.cpp | 15 +- drivers/gles3/shader_compiler_gles3.h | 7 + drivers/gles3/shaders/SCsub | 1 + drivers/gles3/shaders/cube_to_dp.glsl | 79 ++ drivers/gles3/shaders/scene.glsl | 341 +++++-- main/main.cpp | 23 +- scene/3d/light.cpp | 91 +- scene/3d/light.h | 71 +- scene/3d/navigation_mesh.cpp | 2 +- scene/main/scene_main_loop.cpp | 2 +- scene/main/viewport.cpp | 61 ++ scene/main/viewport.h | 24 +- scene/resources/material.cpp | 2 +- scene/resources/mesh.cpp | 102 +- scene/resources/mesh.h | 4 +- scene/resources/mesh_data_tool.cpp | 2 +- scene/resources/shape.cpp | 2 +- scene/resources/surface_tool.cpp | 2 +- servers/visual/rasterizer.h | 37 +- servers/visual/shader_types.cpp | 2 +- servers/visual/visual_server_raster.h | 10 +- servers/visual/visual_server_scene.cpp | 638 ++++++++++++- servers/visual/visual_server_scene.h | 19 +- servers/visual/visual_server_viewport.cpp | 27 +- servers/visual/visual_server_viewport.h | 7 + servers/visual_server.cpp | 450 ++++++++- servers/visual_server.h | 28 +- tools/editor/io_plugins/editor_import_collada.cpp | 2 +- tools/editor/plugins/spatial_editor_plugin.cpp | 14 + tools/editor/spatial_editor_gizmos.cpp | 12 +- 38 files changed, 3235 insertions(+), 412 deletions(-) create mode 100644 drivers/gles3/shaders/cube_to_dp.glsl diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index f7dd8839b8..3e3cd1af4f 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -495,6 +495,28 @@ void CameraMatrix::set_light_bias() { } +void CameraMatrix::set_light_atlas_rect(const Rect2& p_rect) { + + float *m=&matrix[0][0]; + + m[0]=p_rect.size.width, + m[1]=0.0, + m[2]=0.0, + m[3]=0.0, + m[4]=0.0, + m[5]=p_rect.size.height, + m[6]=0.0, + m[7]=0.0, + m[8]=0.0, + m[9]=0.0, + m[10]=1.0, + m[11]=0.0, + m[12]=p_rect.pos.x, + m[13]=p_rect.pos.y, + m[14]=0.0, + m[15]=1.0; +} + CameraMatrix::operator String() const { String str; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index d192b1fef1..bf8cf3592e 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -30,6 +30,7 @@ #define CAMERA_MATRIX_H #include "transform.h" +#include "math_2d.h" /** @author Juan Linietsky */ @@ -53,6 +54,7 @@ struct CameraMatrix { void set_identity(); void set_zero(); void set_light_bias(); + void set_light_atlas_rect(const Rect2& p_rect); void set_perspective(float p_fovy_degrees, float p_aspect, float p_z_near, float p_z_far,bool p_flip_fov=false); void set_orthogonal(float p_left, float p_right, float p_bottom, float p_top, float p_znear, float p_zfar); void set_orthogonal(float p_size, float p_aspect, float p_znear, float p_zfar,bool p_flip_fov=false); diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index c8ced0b306..9d7e881c65 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -208,7 +208,7 @@ public: } } - static _FORCE_INLINE_ float halfptr_to_float(uint16_t *h) { + static _FORCE_INLINE_ float halfptr_to_float(const uint16_t *h) { union { uint32_t u32; diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index c10c5fee65..c455d4bd11 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -824,8 +824,6 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const bool prev_distance_field=false; - - while(p_item_list) { Item *ci=p_item_list; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 93dc01d473..287801b597 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1,8 +1,18 @@ #include "rasterizer_scene_gles3.h" #include "globals.h" #include "os/os.h" +#include "rasterizer_canvas_gles3.h" +static const GLenum _cube_side_enum[6]={ + GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + +}; static _FORCE_INLINE_ void store_matrix32(const Matrix32& p_mtx, float* p_array) { @@ -78,6 +88,9 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas); ERR_FAIL_COND(!shadow_atlas); ERR_FAIL_COND(p_size<0); + + p_size = nearest_power_of_2(p_size); + if (p_size==shadow_atlas->size) return; @@ -104,7 +117,7 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ //clear owners shadow_atlas->shadow_owners.clear(); - shadow_atlas->size=nearest_power_of_2(p_size); + shadow_atlas->size=p_size; if (shadow_atlas->size) { glGenFramebuffers(1, &shadow_atlas->fbo); @@ -188,7 +201,7 @@ void RasterizerSceneGLES3::shadow_atlas_set_quadrant_subdivision(RID p_atlas,int swaps=0; for(int i=0;i<3;i++) { - if (shadow_atlas->quadrants[shadow_atlas->size_order[i]].subdivision > shadow_atlas->quadrants[shadow_atlas->size_order[i+1]].subdivision) { + if (shadow_atlas->quadrants[shadow_atlas->size_order[i]].subdivision < shadow_atlas->quadrants[shadow_atlas->size_order[i+1]].subdivision) { SWAP(shadow_atlas->size_order[i],shadow_atlas->size_order[i+1]); swaps++; } @@ -260,20 +273,22 @@ bool RasterizerSceneGLES3::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas,i } -uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version){ +bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version){ + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_atlas); - ERR_FAIL_COND_V(!shadow_atlas,ShadowAtlas::SHADOW_INVALID); + ERR_FAIL_COND_V(!shadow_atlas,false); LightInstance *li = light_instance_owner.getornull(p_light_intance); - ERR_FAIL_COND_V(!li,ShadowAtlas::SHADOW_INVALID); + ERR_FAIL_COND_V(!li,false); if (shadow_atlas->size==0 || shadow_atlas->smallest_subdiv==0) { - return ShadowAtlas::SHADOW_INVALID; + return false; } uint32_t quad_size = shadow_atlas->size>>1; - int desired_fit = MAX(quad_size/shadow_atlas->smallest_subdiv,nearest_power_of_2(quad_size*p_coverage)); + int desired_fit = MIN(quad_size/shadow_atlas->smallest_subdiv,nearest_power_of_2(quad_size*p_coverage)); + int valid_quadrants[4]; int valid_quadrant_count=0; @@ -300,8 +315,7 @@ uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_ligh } } - - ERR_FAIL_COND_V(valid_quadrant_count==0,ShadowAtlas::SHADOW_INVALID); + ERR_FAIL_COND_V(valid_quadrant_count==0,false); uint64_t tick = OS::get_singleton()->get_ticks_msec(); @@ -317,13 +331,12 @@ uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_ligh bool should_realloc=shadow_atlas->quadrants[q].subdivision!=best_subdiv && (shadow_atlas->quadrants[q].shadows[s].alloc_tick-tick > shadow_atlas_realloc_tolerance_msec); bool should_redraw=shadow_atlas->quadrants[q].shadows[s].version!=p_light_version; + + if (!should_realloc) { + shadow_atlas->quadrants[q].shadows[s].version=p_light_version; //already existing, see if it should redraw or it's just OK - if (should_redraw) { - key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; - } - - return key; + return should_redraw; } int new_quadrant,new_shadow; @@ -339,6 +352,10 @@ uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_ligh sli->shadow_atlases.erase(p_atlas); } + //erase previous + shadow_atlas->quadrants[q].shadows[s].version=0; + shadow_atlas->quadrants[q].shadows[s].owner=RID(); + sh->owner=p_light_intance; sh->alloc_tick=tick; sh->version=p_light_version; @@ -349,19 +366,16 @@ uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_ligh //update it in map shadow_atlas->shadow_owners[p_light_intance]=key; //make it dirty, as it should redraw anyway - key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; - - return key; + return true; } //no better place for this shadow found, keep current //already existing, see if it should redraw or it's just OK - if (should_redraw) { - key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; - } - return key; + shadow_atlas->quadrants[q].shadows[s].version=p_light_version; + + return should_redraw; } int new_quadrant,new_shadow; @@ -387,20 +401,49 @@ uint32_t RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_ligh //update it in map shadow_atlas->shadow_owners[p_light_intance]=key; //make it dirty, as it should redraw anyway - key|=ShadowAtlas::SHADOW_INDEX_DIRTY_BIT; - return key; + return true; } //no place to allocate this light, apologies - return ShadowAtlas::SHADOW_INVALID; + return false; } +void RasterizerSceneGLES3::set_directional_shadow_count(int p_count) { + + directional_shadow.light_count=p_count; + directional_shadow.current_light=0; +} + +int RasterizerSceneGLES3::get_directional_light_shadow_size(RID p_light_intance) { + + ERR_FAIL_COND_V(directional_shadow.light_count==0,0); + + int shadow_size; + + if (directional_shadow.light_count==1) { + shadow_size = directional_shadow.size; + } else { + shadow_size = directional_shadow.size/2; //more than 4 not supported anyway + } + + LightInstance *light_instance = light_instance_owner.getornull(p_light_intance); + ERR_FAIL_COND_V(!light_instance,0); + + switch(light_instance->light_ptr->directional_shadow_mode) { + case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: break; //none + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: shadow_size/=2; break; + } + + return shadow_size; + +} /* ENVIRONMENT API */ @@ -511,6 +554,7 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) { light_instance->last_pass=0; light_instance->last_scene_pass=0; + light_instance->last_scene_shadow_pass=0; light_instance->light=p_light; light_instance->light_ptr=storage->light_owner.getornull(p_light); @@ -520,10 +564,11 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) { glBufferData(GL_UNIFORM_BUFFER, sizeof(LightInstance::LightDataUBO), NULL, GL_DYNAMIC_DRAW); glBindBuffer(GL_UNIFORM_BUFFER, 0); - ERR_FAIL_COND_V(!light_instance->light_ptr,RID()); - return light_instance_owner.make_rid(light_instance); + light_instance->self=light_instance_owner.make_rid(light_instance); + + return light_instance->self; } void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance,const Transform& p_transform){ @@ -534,6 +579,25 @@ void RasterizerSceneGLES3::light_instance_set_transform(RID p_light_instance,con light_instance->transform=p_transform; } +void RasterizerSceneGLES3::light_instance_set_shadow_transform(RID p_light_instance,const CameraMatrix& p_projection,const Transform& p_transform,float p_far,float p_split,int p_pass) { + + LightInstance *light_instance = light_instance_owner.getornull(p_light_instance); + ERR_FAIL_COND(!light_instance); + + if (light_instance->light_ptr->type!=VS::LIGHT_DIRECTIONAL) { + p_pass=0; + } + + ERR_FAIL_INDEX(p_pass,4); + + light_instance->shadow_transform[p_pass].camera=p_projection; + light_instance->shadow_transform[p_pass].transform=p_transform; + light_instance->shadow_transform[p_pass].far=p_far; + light_instance->shadow_transform[p_pass].split=p_split; + +} + + void RasterizerSceneGLES3::light_instance_mark_visible(RID p_light_instance) { LightInstance *light_instance = light_instance_owner.getornull(p_light_instance); @@ -542,7 +606,6 @@ void RasterizerSceneGLES3::light_instance_mark_visible(RID p_light_instance) { light_instance->last_scene_pass=scene_pass; } - //////////////////////////// //////////////////////////// //////////////////////////// @@ -757,9 +820,10 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { void RasterizerSceneGLES3::_setup_light(LightInstance *p_light) { - glBindBufferBase(GL_UNIFORM_BUFFER,3,p_light->light_ubo); //bind light uniform } + + void RasterizerSceneGLES3::_setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection) { if (p_instance->billboard || p_instance->billboard_y || p_instance->depth_scale) { @@ -815,7 +879,22 @@ void RasterizerSceneGLES3::_setup_transform(InstanceBase *p_instance,const Trans } } -void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass) { +void RasterizerSceneGLES3::_set_cull(bool p_front,bool p_reverse_cull) { + + bool front = p_front; + if (p_reverse_cull) + front=!front; + + if (front!=state.cull_front) { + + glCullFace(front?GL_FRONT:GL_BACK); + state.cull_front=front; + } +} + + + +void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass,bool p_shadow) { if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { //p_reverse_cull=!p_reverse_cull; @@ -824,25 +903,30 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glFrontFace(GL_CW); } - bool shadow=false; - glBindBufferBase(GL_UNIFORM_BUFFER,0,state.scene_ubo); //bind globals ubo - glBindBufferBase(GL_UNIFORM_BUFFER,2,state.env_radiance_ubo); //bind environment radiance info - glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-1); - glBindTexture(GL_TEXTURE_2D,state.brdf_texture); + if (!p_shadow) { + glBindBufferBase(GL_UNIFORM_BUFFER,2,state.env_radiance_ubo); //bind environment radiance info + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-1); + glBindTexture(GL_TEXTURE_2D,state.brdf_texture); - if (p_base_env) { - glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); - glBindTexture(p_base_env->target,p_base_env->tex_id); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,true); + if (p_base_env) { + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); + glBindTexture(p_base_env->target,p_base_env->tex_id); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,true); + } else { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + + } } else { - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); } + state.cull_front=false; + glCullFace(GL_BACK); state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); @@ -875,28 +959,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e bool additive=false; - if (!shadow) { -#if 0 - if (texscreen_used && !texscreen_copied && material->shader_cache && material->shader_cache->valid && material->shader_cache->has_texscreen) { - texscreen_copied=true; - _copy_to_texscreen(); - - //force reset state - prev_material=NULL; - prev_light=0x777E; - prev_geometry_cmp=NULL; - prev_light_type=0xEF; - prev_skeleton =NULL; - prev_sort_flags=0xFF; - prev_morph_values=NULL; - prev_receive_shadows_state=-1; - glEnable(GL_BLEND); - glDepthMask(GL_TRUE); - glEnable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); + if (!p_shadow) { - } -#endif if (light_type!=prev_light_type /* || receive_shadows_state!=prev_receive_shadows_state*/) { if (material->shader->spatial.unshaded/* || current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { @@ -905,27 +969,38 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + //state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); } else { state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,light_type!=0xF); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,light_type==VS::LIGHT_DIRECTIONAL); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,light_type==VS::LIGHT_OMNI); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,light_type==VS::LIGHT_SPOT); - /* - if (receive_shadows_state==1) { - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_SHADOW,(light_type&0x8)); - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM,(light_type&0x10)); - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,(light_type&0x20)); - } - else { - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_SHADOW,false); - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM,false); - state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,(light_type&3)==VS::LIGHT_DIRECTIONAL); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,(light_type&0xF)==VS::LIGHT_OMNI); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,(light_type&0xF)==VS::LIGHT_SPOT); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + + if ((light_type&3)==VS::LIGHT_DIRECTIONAL) { + + if (light_instances[light_index]->light_ptr->shadow) { + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,true); + + switch(light_instances[light_index]->light_ptr->directional_shadow_mode) { + case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: break; //none + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,true); break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,true); break; + } + } } - state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); - */ + + } rebind=true; @@ -1007,14 +1082,16 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e current_blend_mode=desired_blend_mode; } - } - if (light_index!=prev_light_index) { - if (light_index!=0xFFFF) { //not unshaded - _setup_light(light_instances[light_index]); + if (light_index!=prev_light_index) { + if (light_index!=0xFFFF) { //not unshaded + _setup_light(light_instances[light_index]); + } } + } + if (material!=prev_material || rebind) { rebind = _setup_material(material,p_alpha_pass); @@ -1027,20 +1104,17 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e _setup_geometry(e); } - if (rebind || prev_additive!=additive) { + if (!p_shadow && (rebind || prev_additive!=additive)) { state.scene_shader.set_uniform(SceneShaderGLES3::NO_AMBIENT_LIGHT, additive); } -// _set_cull(e->mirror,p_reverse_cull); + _set_cull(e->sort_key&RenderList::SORT_KEY_MIRROR_FLAG,p_reverse_cull); state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror?-1.0:1.0); _setup_transform(e->instance,p_view_transform,p_projection); - -// _render(e->geometry, material, skeleton,e->owner,e->instance->transform); - _render_geometry(e); prev_material=material; @@ -1052,15 +1126,26 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } - //print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count)); glFrontFace(GL_CW); glBindVertexArray(0); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); + } -void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material) { + +void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material,bool p_shadow) { RasterizerStorageGLES3::Material *m=NULL; RID m_src=p_instance->material_override.is_valid() ? p_instance->material_override :(p_material>=0?p_instance->materials[p_material]:p_geometry->material); @@ -1096,57 +1181,29 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g bool has_alpha = has_base_alpha || has_blend_alpha; bool shadow = false; -#if 0 - if (shadow) { + bool mirror = p_instance->mirror; - if (has_blend_alpha || (has_base_alpha && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) + if (m->shader->spatial.cull_mode==RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { + mirror=!mirror; + } + + if (p_shadow) { + + if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode!=RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) return; //bye - if (!m->shader_cache || (!m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) { + if (!m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode!=RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //shader does not use discard and does not write a vertex position, use generic material if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) - m = shadow_mat_double_sided_ptr; + m = storage->material_owner.getptr(default_material_twosided); else - m = shadow_mat_ptr; - if (m->last_pass!=frame) { - - if (m->shader.is_valid()) { - - m->shader_cache=shader_owner.get(m->shader); - if (m->shader_cache) { - - - if (!m->shader_cache->valid) - m->shader_cache=NULL; - } else { - m->shader=RID(); - } - - } else { - m->shader_cache=NULL; - } - - m->last_pass=frame; - } + m = storage->material_owner.getptr(default_material); } - render_list = &opaque_render_list; - /* notyet - if (!m->shader_cache || m->shader_cache->can_zpass) - render_list = &alpha_render_list; - } else { - render_list = &opaque_render_list; - }*/ - - } else { - if (has_alpha) { - render_list = &alpha_render_list; - } else { - render_list = &opaque_render_list; + has_alpha=false; - } } -#endif + RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element(); @@ -1161,50 +1218,49 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g e->additive_ptr=&e->additive; e->sort_key=0; - if (e->geometry->last_pass!=render_pass) { e->geometry->last_pass=render_pass; e->geometry->index=current_geometry_index++; } + e->sort_key|=uint64_t(e->geometry->index)<sort_key|=uint64_t(e->instance->base_type)<material->last_pass!=render_pass) { - e->material->last_pass=render_pass; - e->material->index=current_material_index++; - } + if (!p_shadow) { - e->sort_key|=uint64_t(e->material->index)<sort_key|=uint64_t(e->instance->depth_layer)<geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) - // e->sort_flags|=RenderList::SORT_FLAG_INSTANCING; + if (e->material->last_pass!=render_pass) { + e->material->last_pass=render_pass; + e->material->index=current_material_index++; + } - bool mirror = e->instance->mirror; + e->sort_key|=uint64_t(e->material->index)<sort_key|=uint64_t(e->instance->depth_layer)<shader->spatial.cull_mode==RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { - mirror=!mirror; - } + if (!has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode==RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { - if (mirror) { - e->sort_key|=RenderList::SORT_KEY_MIRROR_FLAG; - } + //if nothing exists, add this element as opaque too + RenderList::Element *oe = render_list.add_element(); - //e->light_type=0xFF; // no lights! + if (!oe) + return; - if (!shadow && !has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode==RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + copymem(oe,e,sizeof(RenderList::Element)); + oe->additive_ptr=&oe->additive; + } + } - //if nothing exists, add this element as opaque too - RenderList::Element *oe = render_list.add_element(); + //if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) + // e->sort_flags|=RenderList::SORT_FLAG_INSTANCING; - if (!oe) - return; - copymem(oe,e,sizeof(RenderList::Element)); - oe->additive_ptr=&oe->additive; + if (mirror) { + e->sort_key|=RenderList::SORT_KEY_MIRROR_FLAG; } + //e->light_type=0xFF; // no lights! + @@ -1246,7 +1302,12 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g ec->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; ec->sort_key|=uint64_t(directional_light_instances[i]->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; - ec->sort_key|=uint64_t(VS::LIGHT_DIRECTIONAL) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; + ec->sort_key|=uint64_t(VS::LIGHT_DIRECTIONAL) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; //this is zero byt whathever + + if (directional_light_instances[i]->light_ptr->shadow) { + //add proper flags for directional shadow mode + ec->sort_key|=uint64_t(directional_light_instances[i]->light_ptr->directional_shadow_mode+1) << (RenderList::SORT_KEY_LIGHT_TYPE_SHIFT+2); + } lit=true; } @@ -1302,7 +1363,7 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g } -void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { +void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,const CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_skybox); @@ -1382,7 +1443,7 @@ void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,CameraMatrix& p_projection, } -void RasterizerSceneGLES3::_setup_environment(Environment *env,CameraMatrix& p_cam_projection,const Transform& p_cam_transform) { +void RasterizerSceneGLES3::_setup_environment(Environment *env,const CameraMatrix& p_cam_projection,const Transform& p_cam_transform) { //store camera into ubo @@ -1444,6 +1505,20 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,CameraMatrix& p_c } + { + //directional shadow + + state.ubo_data.shadow_directional_pixel_size[0]=1.0/directional_shadow.size; + state.ubo_data.shadow_directional_pixel_size[1]=1.0/directional_shadow.size; + + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-4); + glBindTexture(GL_TEXTURE_2D,directional_shadow.depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LESS); + } + + + glBindBuffer(GL_UNIFORM_BUFFER, state.scene_ubo); glBufferSubData(GL_UNIFORM_BUFFER, 0,sizeof(State::SceneDataUBO), &state.ubo_data); glBindBuffer(GL_UNIFORM_BUFFER, 0); @@ -1459,13 +1534,14 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,CameraMatrix& p_c } -void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cull_count,const Transform& p_camera_inverse_transform,const CameraMatrix& p_camera_projection) { +void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cull_count,const Transform& p_camera_inverse_transform,const CameraMatrix& p_camera_projection,RID p_shadow_atlas) { + + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); directional_light_instance_count=0; light_instance_count=0; - Vector lpercent; - for(int i=0;i=RenderList::MAX_LIGHTS ); @@ -1502,23 +1578,90 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu li->light_ubo_data.light_params[2]=0; li->light_ubo_data.light_params[3]=0; + if (li->light_ptr->shadow) { + int shadow_count=0; + switch(li->light_ptr->directional_shadow_mode) { + case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: { + shadow_count=1; + } break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: { + shadow_count=2; + } break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: { + shadow_count=4; + } break; -#if 0 - if (li->light_ptr->shadow_enabled) { - CameraMatrix bias; - bias.set_light_bias(); + } + + for(int j=0;jdirectional_rect.pos.x; + uint32_t y=li->directional_rect.pos.y; + uint32_t width=li->directional_rect.size.x; + uint32_t height=li->directional_rect.size.y; + + + + if (li->light_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) { + + + width/=2; + height/=2; + + if (j==0) { + + } else if (j==1) { + x+=width; + } else if (j==2) { + y+=height; + } else if (j==3) { + x+=width; + y+=height; + + } + + + + } else if (li->light_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) { - int passes=light_instance_get_shadow_passes(p_light_instance); + height/=2; + + if (j==0) { + + } else { + y+=height; + } + + } + + li->light_ubo_data.shadow_split_offsets[j]=1.0/li->shadow_transform[j].split; + + Transform modelview = (p_camera_inverse_transform * li->shadow_transform[j].transform).inverse(); + + CameraMatrix bias; + bias.set_light_bias(); + CameraMatrix rectm; + Rect2 atlas_rect = Rect2(float(x)/directional_shadow.size,float(y)/directional_shadow.size,float(width)/directional_shadow.size,float(height)/directional_shadow.size); + rectm.set_light_atlas_rect(atlas_rect); + +// print_line("atlas rect: "+atlas_rect); + + CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview; + + store_camera(shadow_mtx,&li->light_ubo_data.shadow_matrix1[16*j]); + + li->light_ubo_data.light_clamp[0]=atlas_rect.pos.x; + li->light_ubo_data.light_clamp[1]=atlas_rect.pos.y; + li->light_ubo_data.light_clamp[2]=atlas_rect.size.x; + li->light_ubo_data.light_clamp[3]=atlas_rect.size.y; - for(int i=0;icustom_transform[i]).inverse(); - li->shadow_projection[i] = bias * li->custom_projection[i] * modelview; } - lights_use_shadow=true; + } -#endif + } break; case VS::LIGHT_OMNI: { @@ -1542,29 +1685,57 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; li->light_ubo_data.light_params[0]=0; - li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; - li->light_ubo_data.light_params[2]=0; + li->light_ubo_data.light_params[1]=0; + li->light_ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; li->light_ubo_data.light_params[3]=0; -#if 0 - Transform ai = p_camera_inverse_transform.affine_inverse(); - float zn = p_camera_projection.get_z_near(); - Plane p (ai.origin + ai.basis.get_axis(2) * -zn, -ai.basis.get_axis(2) ); + if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { + // fill in the shadow information - Vector3 point1 = li->transform.origin; - Vector3 point2 = li->transform.origin+p_camera_inverse_transform.affine_inverse().basis.get_axis(1).normalized()*li->light_ptr->param[VS::LIGHT_PARAM_RANGE]; + uint32_t key = shadow_atlas->shadow_owners[li->self]; - p.intersects_segment(ai.origin,point1,&point1); - p.intersects_segment(ai.origin,point2,&point2); - float r = point1.distance_to(point2); + uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT)&0x3; + uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; + + ERR_CONTINUE(shadow>=shadow_atlas->quadrants[quadrant].shadows.size()); + + uint32_t atlas_size = shadow_atlas->size; + uint32_t quadrant_size = atlas_size>>1; + + uint32_t x=(quadrant&1)*quadrant_size; + uint32_t y=(quadrant>>1)*quadrant_size; + + uint32_t shadow_size = (quadrant_size / shadow_atlas->quadrants[quadrant].subdivision); + x+=(shadow % shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + y+=(shadow / shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + + uint32_t width=shadow_size; + uint32_t height=shadow_size; + + + if (li->light_ptr->omni_shadow_detail==VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) { + + height/=2; + } else { + width/=2; + + } + + Transform proj = (p_camera_inverse_transform * li->transform).inverse(); + + store_transform(proj,li->light_ubo_data.shadow_matrix1); + + li->light_ubo_data.light_params[3]=1.0; //means it has shadow + li->light_ubo_data.light_clamp[0]=float(x)/atlas_size; + li->light_ubo_data.light_clamp[1]=float(y)/atlas_size; + li->light_ubo_data.light_clamp[2]=float(width)/atlas_size; + li->light_ubo_data.light_clamp[3]=float(height)/atlas_size; + + } - float vp_w,vp_h; - p_camera_projection.get_viewport_size(vp_w,vp_h); - lpercent.push_back(r*2/((vp_h+vp_w)*0.5)); -#endif #if 0 if (li->light_ptr->shadow_enabled) { @@ -1596,10 +1767,54 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; li->light_ubo_data.light_params[0]=li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION]; - li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; - li->light_ubo_data.light_params[2]=0; + li->light_ubo_data.light_params[1]=Math::cos(Math::deg2rad(li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ANGLE])); + li->light_ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; li->light_ubo_data.light_params[3]=0; + if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { + // fill in the shadow information + + uint32_t key = shadow_atlas->shadow_owners[li->self]; + + uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT)&0x3; + uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; + + ERR_CONTINUE(shadow>=shadow_atlas->quadrants[quadrant].shadows.size()); + + uint32_t atlas_size = shadow_atlas->size; + uint32_t quadrant_size = atlas_size>>1; + + uint32_t x=(quadrant&1)*quadrant_size; + uint32_t y=(quadrant>>1)*quadrant_size; + + uint32_t shadow_size = (quadrant_size / shadow_atlas->quadrants[quadrant].subdivision); + x+=(shadow % shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + y+=(shadow / shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + + uint32_t width=shadow_size; + uint32_t height=shadow_size; + + Rect2 rect(float(x)/atlas_size,float(y)/atlas_size,float(width)/atlas_size,float(height)/atlas_size); + + li->light_ubo_data.light_params[3]=1.0; //means it has shadow + li->light_ubo_data.light_clamp[0]=rect.pos.x; + li->light_ubo_data.light_clamp[1]=rect.pos.y; + li->light_ubo_data.light_clamp[2]=rect.size.x; + li->light_ubo_data.light_clamp[3]=rect.size.y; + + Transform modelview = (p_camera_inverse_transform * li->transform).inverse(); + + CameraMatrix bias; + bias.set_light_bias(); + CameraMatrix rectm; + rectm.set_light_atlas_rect(rect); + + CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[0].camera * modelview; + + store_camera(shadow_mtx,li->light_ubo_data.shadow_matrix1); + + + } #if 0 if (li->light_ptr->shadow_enabled) { CameraMatrix bias; @@ -1679,24 +1894,39 @@ void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) { } -void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment){ +void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) { - //first of all, make a new render pass - render_pass++; + //copy to front buffer + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); - //fill up ubo + glDepthMask(GL_FALSE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDepthFunc(GL_LEQUAL); + glColorMask(1,1,1,1); - Environment *env = environment_owner.getornull(p_environment); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,p_texture); - _setup_environment(env,p_cam_projection,p_cam_transform); + glViewport(0,0,storage->frame.current_rt->width*0.5,storage->frame.current_rt->height*0.5); - _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection); + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,true); + storage->shaders.copy.bind(); - render_list.clear(); + _copy_screen(); - current_material_index=0; + //turn off everything used + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,false); + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,false); - bool use_mrt=false; + +} + +void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow){ + + current_geometry_index=0; + current_material_index=0; //fill list @@ -1716,7 +1946,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM int mat_idx = inst->materials[i].is_valid() ? i : -1; RasterizerStorageGLES3::Surface *s = mesh->surfaces[i]; - _add_geometry(s,inst,NULL,mat_idx); + _add_geometry(s,inst,NULL,mat_idx,p_shadow); } //mesh->last_pass=frame; @@ -1731,7 +1961,39 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM } } +} + + +void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas){ + + //first of all, make a new render pass + render_pass++; + + //fill up ubo + + Environment *env = environment_owner.getornull(p_environment); + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + + if (shadow_atlas && shadow_atlas->size) { + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-3); + glBindTexture(GL_TEXTURE_2D,shadow_atlas->depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LESS); + state.ubo_data.shadow_atlas_pixel_size[0]=1.0/shadow_atlas->size; + state.ubo_data.shadow_atlas_pixel_size[1]=1.0/shadow_atlas->size; + } + + _setup_environment(env,p_cam_projection,p_cam_transform); + + _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_shadow_atlas); + + render_list.clear(); + + bool use_mrt=false; + + + _fill_render_list(p_cull_result,p_cull_count,false); // @@ -1742,6 +2004,8 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM RasterizerStorageGLES3::Texture* env_radiance_tex=NULL; + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + if (use_mrt) { glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); @@ -1811,7 +2075,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); @@ -1843,11 +2107,34 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM render_list.sort_by_depth(true); - _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true); + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false); _copy_to_front_buffer(env); +/* if (shadow_atlas) { + + //_copy_texture_to_front_buffer(shadow_atlas->depth); + storage->canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,shadow_atlas->depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); + storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/2,storage->frame.current_rt->height/2),Rect2(0,0,1,1)); + + } +*/ + if (directional_shadow.fbo) { + + //_copy_texture_to_front_buffer(shadow_atlas->depth); + storage->canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,directional_shadow.depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); + storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/2,storage->frame.current_rt->height/2),Rect2(0,0,1,1)); + + } + + #if 0 if (use_fb) { @@ -1994,6 +2281,294 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,CameraM #endif } +void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count) { + + render_pass++; + + LightInstance *light_instance = light_instance_owner.getornull(p_light); + ERR_FAIL_COND(!light_instance); + RasterizerStorageGLES3::Light *light = storage->light_owner.getornull(light_instance->light); + ERR_FAIL_COND(!light); + + uint32_t x,y,width,height,vp_height; + + + float dp_direction=0.0; + float zfar=0; + bool flip_facing=false; + int custom_vp_size=0; + GLuint fbo; + int current_cubemap=-1; + float bias=0; + float normal_bias=0; + + CameraMatrix light_projection; + Transform light_transform; + + + if (light->type==VS::LIGHT_DIRECTIONAL) { + //set pssm stuff + if (light_instance->last_scene_shadow_pass!=scene_pass) { + //assign rect if unassigned + light_instance->light_directional_index = directional_shadow.current_light; + light_instance->last_scene_shadow_pass=scene_pass; + directional_shadow.current_light++; + + if (directional_shadow.light_count==1) { + light_instance->directional_rect=Rect2(0,0,directional_shadow.size,directional_shadow.size); + } else if (directional_shadow.light_count==2) { + light_instance->directional_rect=Rect2(0,0,directional_shadow.size,directional_shadow.size/2); + if (light_instance->light_directional_index==1) { + light_instance->directional_rect.pos.x+=light_instance->directional_rect.size.x; + } + } else { //3 and 4 + light_instance->directional_rect=Rect2(0,0,directional_shadow.size/2,directional_shadow.size/2); + if (light_instance->light_directional_index&1) { + light_instance->directional_rect.pos.x+=light_instance->directional_rect.size.x; + } + if (light_instance->light_directional_index/2) { + light_instance->directional_rect.pos.y+=light_instance->directional_rect.size.y; + } + } + } + + light_projection=light_instance->shadow_transform[p_pass].camera; + light_transform=light_instance->shadow_transform[p_pass].transform; + + x=light_instance->directional_rect.pos.x; + y=light_instance->directional_rect.pos.y; + width=light_instance->directional_rect.size.x; + height=light_instance->directional_rect.size.y; + + + + if (light->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) { + + + width/=2; + height/=2; + + if (p_pass==0) { + + } else if (p_pass==1) { + x+=width; + } else if (p_pass==2) { + y+=height; + } else if (p_pass==3) { + x+=width; + y+=height; + + } + + + + } else if (light->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) { + + height/=2; + + if (p_pass==0) { + + } else { + y+=height; + } + + } + + zfar=light->param[VS::LIGHT_PARAM_RANGE]; + bias=light->param[VS::LIGHT_PARAM_SHADOW_BIAS]; + normal_bias=light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS]; + fbo=directional_shadow.fbo; + vp_height=directional_shadow.size; + + } else { + //set from shadow atlas + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + ERR_FAIL_COND(!shadow_atlas); + ERR_FAIL_COND(!shadow_atlas->shadow_owners.has(p_light)); + + fbo=shadow_atlas->fbo; + vp_height=shadow_atlas->size; + + + uint32_t key = shadow_atlas->shadow_owners[p_light]; + + uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT)&0x3; + uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; + + ERR_FAIL_INDEX(shadow,shadow_atlas->quadrants[quadrant].shadows.size()); + + uint32_t quadrant_size = shadow_atlas->size>>1; + + x=(quadrant&1)*quadrant_size; + y=(quadrant>>1)*quadrant_size; + + uint32_t shadow_size = (quadrant_size / shadow_atlas->quadrants[quadrant].subdivision); + x+=(shadow % shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + y+=(shadow / shadow_atlas->quadrants[quadrant].subdivision) * shadow_size; + + width=shadow_size; + height=shadow_size; + + if (light->type==VS::LIGHT_OMNI) { + + + if (light->omni_shadow_mode==VS::LIGHT_OMNI_SHADOW_CUBE) { + + int cubemap_index=shadow_cubemaps.size()-1; + + for(int i=shadow_cubemaps.size()-1;i>=0;i--) { + //find appropriate cubemap to render to + if (shadow_cubemaps[i].size>shadow_size*2) + break; + + cubemap_index=i; + } + + fbo=shadow_cubemaps[cubemap_index].fbo_id[p_pass]; + light_projection=light_instance->shadow_transform[0].camera; + light_transform=light_instance->shadow_transform[0].transform; + custom_vp_size=shadow_cubemaps[cubemap_index].size; + zfar=light->param[VS::LIGHT_PARAM_RANGE]; + + current_cubemap=cubemap_index; + + + } else { + + light_projection=light_instance->shadow_transform[0].camera; + light_transform=light_instance->shadow_transform[0].transform; + + if (light->omni_shadow_detail==VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) { + + height/=2; + y+=p_pass*height; + } else { + width/=2; + x+=p_pass*width; + + } + + dp_direction = p_pass==0?1.0:-1.0; + flip_facing = (p_pass == 1); + zfar=light->param[VS::LIGHT_PARAM_RANGE]; + bias=light->param[VS::LIGHT_PARAM_SHADOW_BIAS]; + + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,true); + } + + } else if (light->type==VS::LIGHT_SPOT) { + + light_projection=light_instance->shadow_transform[0].camera; + light_transform=light_instance->shadow_transform[0].transform; + + dp_direction = 1.0; + flip_facing = false; + zfar=light->param[VS::LIGHT_PARAM_RANGE]; + bias=light->param[VS::LIGHT_PARAM_SHADOW_BIAS]; + normal_bias=light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS]; + } + + } + + //todo hacer que se redibuje cuando corresponde + + + render_list.clear(); + _fill_render_list(p_cull_result,p_cull_count,true); + + render_list.sort_by_depth(false); //shadow is front to back for performance + + glDepthMask(true); + glColorMask(0,0,0,0); + glDisable(GL_BLEND); + glDisable(GL_DITHER); + glEnable(GL_DEPTH_TEST); + + glBindFramebuffer(GL_FRAMEBUFFER,fbo); + + if (custom_vp_size) { + glViewport(0,0,custom_vp_size,custom_vp_size); + glScissor(0,0,custom_vp_size,custom_vp_size); + + } else { + glViewport(x,y,width,height); + glScissor(x,y,width,height); + } + + //glViewport(x,vp_height-(height+y),width,height); + //glScissor(x,vp_height-(height+y),width,height); + glEnable(GL_SCISSOR_TEST); + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); + glDisable(GL_SCISSOR_TEST); + + state.ubo_data.shadow_z_offset=bias; + state.ubo_data.shadow_slope_scale=normal_bias; + state.ubo_data.shadow_dual_paraboloid_render_side=dp_direction; + state.ubo_data.shadow_dual_paraboloid_render_zfar=zfar; + + _setup_environment(NULL,light_projection,light_transform); + + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,true); + + _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true); + + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,false); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,false); + + + if (light->type==VS::LIGHT_OMNI && light->omni_shadow_mode==VS::LIGHT_OMNI_SHADOW_CUBE && p_pass==5) { + //convert the chosen cubemap to dual paraboloid! + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + + glBindFramebuffer(GL_FRAMEBUFFER,shadow_atlas->fbo); + state.cube_to_dp_shader.bind(); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_CUBE_MAP,shadow_cubemaps[current_cubemap].cubemap); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_COMPARE_MODE, GL_NONE); + glDisable(GL_CULL_FACE); + + for(int i=0;i<2;i++) { + + state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES3::Z_FLIP,i==1); + state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES3::Z_NEAR,light_projection.get_z_near()); + state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES3::Z_FAR,light_projection.get_z_far()); + state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES3::BIAS,light->param[VS::LIGHT_PARAM_SHADOW_BIAS]); + + uint32_t local_width=width,local_height=height; + uint32_t local_x=x,local_y=y; + if (light->omni_shadow_detail==VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) { + + local_height/=2; + local_y+=i*local_height; + } else { + local_width/=2; + local_x+=i*local_width; + } + + glViewport(local_x,local_y,local_width,local_height); + glScissor(local_x,local_y,local_width,local_height); + glEnable(GL_SCISSOR_TEST); + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); + glDisable(GL_SCISSOR_TEST); + //glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + + _copy_screen(); + + } + + } + + glColorMask(1,1,1,1); + + +} + void RasterizerSceneGLES3::set_scene_pass(uint64_t p_pass) { scene_pass=p_pass; } @@ -2169,6 +2744,12 @@ void RasterizerSceneGLES3::initialize() { default_material = storage->material_create(); storage->material_set_shader(default_material,default_shader); + default_shader_twosided = storage->shader_create(VS::SHADER_SPATIAL); + default_material_twosided = storage->material_create(); + storage->shader_set_code(default_shader_twosided,"render_mode cull_disabled;\n"); + storage->material_set_shader(default_material_twosided,default_shader_twosided); + + glGenBuffers(1, &state.scene_ubo); glBindBuffer(GL_UNIFORM_BUFFER, state.scene_ubo); glBufferData(GL_UNIFORM_BUFFER, sizeof(State::SceneDataUBO), &state.scene_ubo, GL_DYNAMIC_DRAW); @@ -2208,9 +2789,77 @@ void RasterizerSceneGLES3::initialize() { glBindBuffer(GL_ARRAY_BUFFER,0); //unbind } render_list.init(); + state.cube_to_dp_shader.init(); _generate_brdf(); shadow_atlas_realloc_tolerance_msec=500; + + + + + + int max_shadow_cubemap_sampler_size=512; + + int cube_size = max_shadow_cubemap_sampler_size; + + glActiveTexture(GL_TEXTURE0); + + while(cube_size>=32) { + + ShadowCubeMap cube; + cube.size=cube_size; + + glGenTextures(1,&cube.cubemap); + glBindTexture(GL_TEXTURE_CUBE_MAP,cube.cubemap); + //gen cubemap first + for(int i=0;i<6;i++) { + + glTexImage2D(_cube_side_enum[i], 0, GL_DEPTH_COMPONENT, cube.size, cube.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + } + + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + // Remove artifact on the edges of the shadowmap + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + + //gen renderbuffers second, because it needs a complete cubemap + for(int i=0;i<6;i++) { + + glGenFramebuffers(1, &cube.fbo_id[i]); + glBindFramebuffer(GL_FRAMEBUFFER, cube.fbo_id[i]); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,_cube_side_enum[i], cube.cubemap, 0); + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); + } + + shadow_cubemaps.push_back(cube); + + cube_size>>=1; + } + + { + //directional light shadow + directional_shadow.light_count=0; + directional_shadow.size=nearest_power_of_2(GLOBAL_DEF("renderer/directional_shadow_size",2048)); + glGenFramebuffers(1,&directional_shadow.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,directional_shadow.fbo); + glGenTextures(1,&directional_shadow.depth); + glBindTexture(GL_TEXTURE_2D,directional_shadow.depth); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D, directional_shadow.depth, 0); + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status!=GL_FRAMEBUFFER_COMPLETE) { + ERR_PRINT("Directional shadow framebuffer status invalid"); + } + } } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 9df6315e45..d7beebbcf6 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -3,6 +3,7 @@ #include "rasterizer_storage_gles3.h" #include "drivers/gles3/shaders/scene.glsl.h" +#include "drivers/gles3/shaders/cube_to_dp.glsl.h" class RasterizerSceneGLES3 : public RasterizerScene { public: @@ -16,10 +17,13 @@ public: uint32_t current_geometry_index; RID default_material; + RID default_material_twosided; RID default_shader; + RID default_shader_twosided; RasterizerStorageGLES3 *storage; + struct State { @@ -29,6 +33,7 @@ public: int current_depth_draw; SceneShaderGLES3 scene_shader; + CubeToDpShaderGLES3 cube_to_dp_shader; struct SceneDataUBO { @@ -41,6 +46,12 @@ public: float bg_color[4]; float ambient_energy; float bg_energy; + float shadow_z_offset; + float shadow_slope_scale; + float shadow_dual_paraboloid_render_zfar; + float shadow_dual_paraboloid_render_side; + float shadow_atlas_pixel_size[2]; + float shadow_directional_pixel_size[2]; } ubo_data; @@ -62,7 +73,7 @@ public: GLuint skybox_verts; GLuint skybox_array; - + bool cull_front; } state; @@ -71,7 +82,6 @@ public: struct ShadowAtlas : public RID_Data { enum { - SHADOW_INDEX_DIRTY_BIT=(1<<31), QUADRANT_SHIFT=27, SHADOW_INDEX_MASK=(1< shadow_owners; }; + struct ShadowCubeMap { + + GLuint fbo_id[6]; + GLuint cubemap; + int size; + }; + + Vector shadow_cubemaps; + RID_Owner shadow_atlas_owner; RID shadow_atlas_create(); void shadow_atlas_set_size(RID p_atlas,int p_size); void shadow_atlas_set_quadrant_subdivision(RID p_atlas,int p_quadrant,int p_subdivision); bool _shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow); - uint32_t shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version); + bool shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version); + + + struct DirectionalShadow { + GLuint fbo; + GLuint depth; + int light_count; + int size; + int current_light; + } directional_shadow; + + virtual int get_directional_light_shadow_size(RID p_light_intance); + virtual void set_directional_shadow_count(int p_count); + /* ENVIRONMENT API */ @@ -174,12 +206,12 @@ public: struct LightInstance : public RID_Data { - struct SplitInfo { + struct ShadowTransform { CameraMatrix camera; Transform transform; - float near; float far; + float split; }; struct LightDataUBO { @@ -188,6 +220,7 @@ public: float light_direction_attenuation[4]; float light_color_energy[4]; float light_params[4]; //cone attenuation, specular, shadow darkening, + float light_clamp[4]; //cone attenuation, specular, shadow darkening, float shadow_split_offsets[4]; float shadow_matrix1[16]; float shadow_matrix2[16]; @@ -197,13 +230,11 @@ public: } light_ubo_data; - SplitInfo split_info[4]; + ShadowTransform shadow_transform[4]; + RID self; RID light; RasterizerStorageGLES3::Light *light_ptr; - - CameraMatrix shadow_matrix[4]; - Transform transform; Vector3 light_vector; @@ -214,12 +245,17 @@ public: uint64_t shadow_pass; uint64_t last_scene_pass; + uint64_t last_scene_shadow_pass; uint64_t last_pass; uint16_t light_index; + uint16_t light_directional_index; + + uint32_t current_shadow_atlas_key; Vector2 dp; - CameraMatrix shadow_projection[4]; + Rect2 directional_rect; + Set shadow_atlases; //shadow atlases where this light is registered @@ -231,6 +267,7 @@ public: virtual RID light_instance_create(RID p_light); virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform); + virtual void light_instance_set_shadow_transform(RID p_light_instance,const CameraMatrix& p_projection,const Transform& p_transform,float p_far,float p_split,int p_pass); virtual void light_instance_mark_visible(RID p_light_instance); /* RENDER LIST */ @@ -371,26 +408,31 @@ public: RenderList render_list; + _FORCE_INLINE_ void _set_cull(bool p_front,bool p_reverse_cull); + _FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material* p_material,bool p_alpha_pass); _FORCE_INLINE_ void _setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection); _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); _FORCE_INLINE_ void _setup_light(LightInstance *p_light); - void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass); + void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow); - _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material); + _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material,bool p_shadow); - void _draw_skybox(RID p_skybox, CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); + void _draw_skybox(RID p_skybox, const CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); - void _setup_environment(Environment *env,CameraMatrix& p_cam_projection, const Transform& p_cam_transform); - void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform,const CameraMatrix& p_camera_projection); + void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform& p_cam_transform); + void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix& p_camera_projection, RID p_shadow_atlas); void _copy_screen(); void _copy_to_front_buffer(Environment *env); + void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug - virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment); + void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow); + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas); + virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count); virtual bool free(RID p_rid); void _generate_brdf(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 4b2c607297..b988781e14 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1290,12 +1290,13 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { shaders.actions_scene.render_mode_values["cull_front"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_FRONT); shaders.actions_scene.render_mode_values["cull_back"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_BACK); - shaders.actions_scene.render_mode_values["cull_disable"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_DISABLED); + shaders.actions_scene.render_mode_values["cull_disabled"]=Pair(&p_shader->spatial.cull_mode,Shader::Spatial::CULL_MODE_DISABLED); shaders.actions_scene.render_mode_flags["unshaded"]=&p_shader->spatial.unshaded; shaders.actions_scene.render_mode_flags["ontop"]=&p_shader->spatial.ontop; shaders.actions_scene.usage_flag_pointers["ALPHA"]=&p_shader->spatial.uses_alpha; + shaders.actions_scene.usage_flag_pointers["VERTEX"]=&p_shader->spatial.uses_vertex; actions=&shaders.actions_scene; actions->uniforms=&p_shader->uniforms; @@ -1318,6 +1319,9 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { p_shader->texture_count=gen_code.texture_uniforms.size(); p_shader->texture_hints=gen_code.texture_hints; + p_shader->uses_vertex_time=gen_code.uses_vertex_time; + p_shader->uses_fragment_time=gen_code.uses_fragment_time; + //all materials using this shader will have to be invalidated, unfortunately for (SelfList* E = p_shader->materials.first();E;E=E->next() ) { @@ -1535,6 +1539,57 @@ void RasterizerStorageGLES3::material_set_line_width(RID p_material, float p_wid } +bool RasterizerStorageGLES3::material_is_animated(RID p_material) { + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND_V(!material,false); + if (material->dirty_list.in_list()) { + _update_material(material); + } + + return material->is_animated_cache; + +} +bool RasterizerStorageGLES3::material_casts_shadows(RID p_material) { + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND_V(!material,false); + if (material->dirty_list.in_list()) { + _update_material(material); + } + + return material->can_cast_shadow_cache; +} + +void RasterizerStorageGLES3::material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) { + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND(!material); + + Map::Element *E=material->instance_owners.find(p_instance); + if (E) { + E->get()++; + } else { + material->instance_owners[p_instance]=1; + } +} + +void RasterizerStorageGLES3::material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) { + + Material *material = material_owner.get( p_material ); + ERR_FAIL_COND(!material); + + Map::Element *E=material->instance_owners.find(p_instance); + ERR_FAIL_COND(!E); + E->get()--; + + if (E->get()==0) { + material->instance_owners.erase(E); + } +} + + + _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataType type, const Variant& value, uint8_t *data,bool p_linear_color) { switch(type) { case ShaderLanguage::TYPE_BOOL: { @@ -2011,6 +2066,48 @@ void RasterizerStorageGLES3::_update_material(Material* material) { if (material->dirty_list.in_list()) _material_dirty_list.remove( &material->dirty_list ); + + if (material->shader && material->shader->dirty_list.in_list()) { + _update_shader(material->shader); + } + //update caches + + { + bool can_cast_shadow = false; + bool is_animated = false; + + if (material->shader && material->shader->mode==VS::SHADER_SPATIAL) { + if (!material->shader->spatial.uses_alpha && material->shader->spatial.blend_mode==Shader::Spatial::BLEND_MODE_MIX) { + can_cast_shadow=true; + } + + if (material->shader->spatial.uses_discard && material->shader->uses_fragment_time) { + is_animated=true; + } + + if (material->shader->spatial.uses_vertex && material->shader->uses_vertex_time) { + is_animated=true; + } + + } + + if (can_cast_shadow!=material->can_cast_shadow_cache || is_animated!=material->is_animated_cache) { + material->can_cast_shadow_cache=can_cast_shadow; + material->is_animated_cache=is_animated; + + for(Map::Element *E=material->instantiable_owners.front();E;E=E->next()) { + E->key()->instance_material_change_notify(); + } + + for(Map::Element *E=material->instance_owners.front();E;E=E->next()) { + E->key()->base_material_changed(); + } + + } + + } + + //clear ubo if it needs to be cleared if (material->ubo_size) { @@ -2102,6 +2199,36 @@ void RasterizerStorageGLES3::_update_material(Material* material) { } +void RasterizerStorageGLES3::_material_add_instantiable(RID p_material,Instantiable *p_instantiable) { + + Material * material = material_owner.getornull(p_material); + ERR_FAIL_COND(!material); + + Map::Element *I = material->instantiable_owners.find(p_instantiable); + + if (I) { + I->get()++; + } else { + material->instantiable_owners[p_instantiable]=1; + } + +} + +void RasterizerStorageGLES3::_material_remove_instantiable(RID p_material,Instantiable *p_instantiable) { + + Material * material = material_owner.getornull(p_material); + ERR_FAIL_COND(!material); + + Map::Element *I = material->instantiable_owners.find(p_instantiable); + ERR_FAIL_COND(!I); + + I->get()--; + if (I->get()==0) { + material->instantiable_owners.erase(I); + } +} + + void RasterizerStorageGLES3::update_dirty_materials() { while( _material_dirty_list.first() ) { @@ -2406,6 +2533,8 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P surface->active=true; surface->array_len=p_vertex_count; surface->index_array_len=p_index_count; + surface->array_byte_size=p_array.size(); + surface->index_array_byte_size=p_index_array.size(); surface->primitive=p_primitive; surface->mesh=mesh; surface->format=p_format; @@ -2556,8 +2685,22 @@ void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface ERR_FAIL_COND(!mesh); ERR_FAIL_INDEX(p_surface,mesh->surfaces.size()); + if (mesh->surfaces[p_surface]->material==p_material) + return; + + if (mesh->surfaces[p_surface]->material.is_valid()) { + _material_remove_instantiable(mesh->surfaces[p_surface]->material,mesh); + } + mesh->surfaces[p_surface]->material=p_material; + if (mesh->surfaces[p_surface]->material.is_valid()) { + _material_add_instantiable(mesh->surfaces[p_surface]->material,mesh); + } + + mesh->instance_material_change_notify(); + + } RID RasterizerStorageGLES3::mesh_surface_get_material(RID p_mesh, int p_surface) const{ @@ -2595,17 +2738,17 @@ DVector RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int Surface *surface = mesh->surfaces[p_surface]; glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - void * data = glMapBufferRange(GL_ARRAY_BUFFER,0,surface->array_len,GL_MAP_READ_BIT); + void * data = glMapBufferRange(GL_ARRAY_BUFFER,0,surface->array_byte_size,GL_MAP_READ_BIT); ERR_FAIL_COND_V(!data,DVector()); DVector ret; - ret.resize(surface->array_len); + ret.resize(surface->array_byte_size); { DVector::Write w = ret.write(); - copymem(w.ptr(),data,surface->array_len); + copymem(w.ptr(),data,surface->array_byte_size); } glUnmapBuffer(GL_ARRAY_BUFFER); @@ -2622,18 +2765,18 @@ DVector RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_mesh ERR_FAIL_COND_V(surface->index_array_len==0,DVector()); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->vertex_id); - void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,surface->index_array_len,GL_MAP_READ_BIT); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); + void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,surface->index_array_byte_size,GL_MAP_READ_BIT); ERR_FAIL_COND_V(!data,DVector()); DVector ret; - ret.resize(surface->index_array_len); + ret.resize(surface->index_array_byte_size); { DVector::Write w = ret.write(); - copymem(w.ptr(),data,surface->index_array_len); + copymem(w.ptr(),data,surface->index_array_byte_size); } glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); @@ -2662,6 +2805,59 @@ VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_ return mesh->surfaces[p_surface]->primitive; } +AABB RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const { + + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,AABB()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),AABB()); + + return mesh->surfaces[p_surface]->aabb; + + +} +Vector > RasterizerStorageGLES3::mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const{ + + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,Vector >()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector >()); + + Vector > bsarr; + + for(int i=0;isurfaces[p_surface]->morph_targets.size();i++) { + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->morph_targets[i].vertex_id); + void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,mesh->surfaces[p_surface]->array_byte_size,GL_MAP_READ_BIT); + + ERR_FAIL_COND_V(!data,Vector >()); + + DVector ret; + ret.resize(mesh->surfaces[p_surface]->array_byte_size); + + { + + DVector::Write w = ret.write(); + copymem(w.ptr(),data,mesh->surfaces[p_surface]->array_byte_size); + } + + bsarr.push_back(ret); + + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); + } + + return bsarr; + +} +Vector RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const{ + + const Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND_V(!mesh,Vector()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector()); + + return mesh->surfaces[p_surface]->skeleton_bone_aabb; + +} + + void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ Mesh *mesh = mesh_owner.getornull(p_mesh); @@ -2670,6 +2866,10 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ Surface *surface = mesh->surfaces[p_surface]; + if (surface->material.is_valid()) { + _material_remove_instantiable(surface->material,mesh); + } + glDeleteBuffers(1,&surface->vertex_id); if (surface->index_id) { glDeleteBuffers(1,&surface->index_id); @@ -2683,6 +2883,8 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ glDeleteVertexArrays(1,&surface->morph_targets[i].array_id); } + mesh->instance_material_change_notify(); + memdelete(surface); mesh->surfaces.remove(p_surface); @@ -2971,7 +3173,6 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET]=0.1; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET]=0.3; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET]=0.6; - light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET]=1.0; light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS]=0.1; light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]=0.1; @@ -2981,6 +3182,10 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->negative=false; light->cull_mask=0xFFFFFFFF; light->directional_shadow_mode=VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; + light->omni_shadow_mode=VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID; + light->omni_shadow_detail=VS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL; + + light->version=0; return light_owner.make_rid(light); } @@ -2998,9 +3203,23 @@ void RasterizerStorageGLES3::light_set_param(RID p_light,VS::LightParam p_param, ERR_FAIL_COND(!light); ERR_FAIL_INDEX(p_param,VS::LIGHT_PARAM_MAX); - if (p_param==VS::LIGHT_PARAM_RANGE || p_param==VS::LIGHT_PARAM_SPOT_ANGLE) { - light->instance_change_notify(); + switch(p_param) { + case VS::LIGHT_PARAM_RANGE: + case VS::LIGHT_PARAM_SPOT_ANGLE: + case VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE: + case VS::LIGHT_PARAM_SHADOW_DARKNESS: + case VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET: + case VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET: + case VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET: + case VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS: + case VS::LIGHT_PARAM_SHADOW_BIAS: + case VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE: { + + light->version++; + light->instance_change_notify(); + } break; } + light->param[p_param]=p_value; } void RasterizerStorageGLES3::light_set_shadow(RID p_light,bool p_enabled){ @@ -3009,6 +3228,10 @@ void RasterizerStorageGLES3::light_set_shadow(RID p_light,bool p_enabled){ ERR_FAIL_COND(!light); light->shadow=p_enabled; + light->version++; + light->instance_change_notify(); + + } void RasterizerStorageGLES3::light_set_projector(RID p_light,RID p_texture){ @@ -3021,9 +3244,8 @@ void RasterizerStorageGLES3::light_set_attenuation_texure(RID p_light,RID p_text Light * light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); - - } + void RasterizerStorageGLES3::light_set_negative(RID p_light,bool p_enable){ Light * light = light_owner.getornull(p_light); @@ -3037,6 +3259,10 @@ void RasterizerStorageGLES3::light_set_cull_mask(RID p_light,uint32_t p_mask){ ERR_FAIL_COND(!light); light->cull_mask=p_mask; + + light->version++; + light->instance_change_notify(); + } void RasterizerStorageGLES3::light_set_shader(RID p_light,RID p_shader){ @@ -3045,22 +3271,92 @@ void RasterizerStorageGLES3::light_set_shader(RID p_light,RID p_shader){ } +void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode) { + + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + + light->omni_shadow_mode=p_mode; + + light->version++; + light->instance_change_notify(); + + +} + +VS::LightOmniShadowMode RasterizerStorageGLES3::light_omni_get_shadow_mode(RID p_light) { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,VS::LIGHT_OMNI_SHADOW_CUBE); + + return light->omni_shadow_mode; +} + + +void RasterizerStorageGLES3::light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail) { + + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + + light->omni_shadow_detail=p_detail; + light->version++; + light->instance_change_notify(); +} + void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode){ Light * light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); + light->directional_shadow_mode=p_mode; + light->version++; + light->instance_change_notify(); + +} + +VS::LightDirectionalShadowMode RasterizerStorageGLES3::light_directional_get_shadow_mode(RID p_light) { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL); + + return light->directional_shadow_mode; } + VS::LightType RasterizerStorageGLES3::light_get_type(RID p_light) const { const Light * light = light_owner.getornull(p_light); ERR_FAIL_COND_V(!light,VS::LIGHT_DIRECTIONAL); - return VS::LIGHT_DIRECTIONAL; + return light->type; } +float RasterizerStorageGLES3::light_get_param(RID p_light,VS::LightParam p_param) { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,VS::LIGHT_DIRECTIONAL); + + return light->param[p_param]; +} + +bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,VS::LIGHT_DIRECTIONAL); + + return light->shadow; +} + +uint64_t RasterizerStorageGLES3::light_get_version(RID p_light) const { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,0); + + return light->version; +} + + AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { const Light * light = light_owner.getornull(p_light); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b12c2d93b6..f8b34d6a16 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -99,6 +99,38 @@ public: + struct Instantiable : public RID_Data { + + SelfList::List instance_list; + + _FORCE_INLINE_ void instance_change_notify() { + + SelfList *instances = instance_list.first(); + while(instances) { + + instances->self()->base_changed(); + instances=instances->next(); + } + } + + _FORCE_INLINE_ void instance_material_change_notify() { + + SelfList *instances = instance_list.first(); + while(instances) { + + instances->self()->base_material_changed(); + instances=instances->next(); + } + } + + Instantiable() { } + virtual ~Instantiable() { + + while(instance_list.first()) { + instance_list.first()->self()->base_removed(); + } + } + }; @@ -282,9 +314,14 @@ public: bool uses_alpha; bool unshaded; bool ontop; + bool uses_vertex; + bool uses_discard; } spatial; + bool uses_vertex_time; + bool uses_fragment_time; + Shader() : dirty_list(this) { shader=NULL; @@ -315,6 +352,8 @@ public: void update_dirty_shaders(); + + /* COMMON MATERIAL API */ struct Material : public RID_Data { @@ -331,7 +370,15 @@ public: uint32_t index; uint64_t last_pass; + Map instantiable_owners; + Map instance_owners; + + bool can_cast_shadow_cache; + bool is_animated_cache; + Material() : list(this), dirty_list(this) { + can_cast_shadow_cache=false; + is_animated_cache=false; shader=NULL; line_width=1.0; ubo_id=0; @@ -343,6 +390,8 @@ public: mutable SelfList::List _material_dirty_list; void _material_make_dirty(Material *p_material) const; + void _material_add_instantiable(RID p_material,Instantiable *p_instantiable); + void _material_remove_instantiable(RID p_material, Instantiable *p_instantiable); mutable RID_Owner material_owner; @@ -357,34 +406,18 @@ public: virtual void material_set_line_width(RID p_material, float p_width); + virtual bool material_is_animated(RID p_material); + virtual bool material_casts_shadows(RID p_material); + + virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance); + virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance); + void _update_material(Material* material); void update_dirty_materials(); /* MESH API */ - struct Instantiable : public RID_Data { - - SelfList::List instance_list; - - _FORCE_INLINE_ void instance_change_notify() { - - SelfList *instances = instance_list.first(); - while(instances) { - - instances->self()->base_changed(); - instances=instances->next(); - } - } - - Instantiable() { } - virtual ~Instantiable() { - - while(instance_list.first()) { - instance_list.first()->self()->base_removed(); - } - } - }; struct Geometry : Instantiable { @@ -455,7 +488,8 @@ public: int index_array_len; int max_bone; - int array_bytes; + int array_byte_size; + int index_array_byte_size; VS::PrimitiveType primitive; @@ -464,7 +498,8 @@ public: Surface() { - array_bytes=0; + array_byte_size=0; + index_array_byte_size=0; mesh=NULL; format=0; array_id=0; @@ -526,6 +561,10 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const; + virtual Vector > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const; + virtual Vector mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; + virtual void mesh_remove_surface(RID p_mesh, int p_surface); virtual int mesh_get_surface_count(RID p_mesh) const; @@ -598,7 +637,10 @@ public: bool shadow; bool negative; uint32_t cull_mask; + VS::LightOmniShadowMode omni_shadow_mode; + VS::LightOmniShadowDetail omni_shadow_detail; VS::LightDirectionalShadowMode directional_shadow_mode; + uint64_t version; }; mutable RID_Owner light_owner; @@ -614,11 +656,22 @@ public: virtual void light_set_cull_mask(RID p_light,uint32_t p_mask); virtual void light_set_shader(RID p_light,RID p_shader); + virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode); + + virtual void light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail); virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode); + virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light); + virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light); + + virtual bool light_has_shadow(RID p_light) const; virtual VS::LightType light_get_type(RID p_light) const; + virtual float light_get_param(RID p_light,VS::LightParam p_param); + virtual AABB light_get_aabb(RID p_light) const; + virtual uint64_t light_get_version(RID p_light) const; + /* PROBE API */ virtual RID reflection_probe_create(); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 0dff53bfb9..dce52ecd93 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -330,6 +330,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener SL::FunctionNode *fnode=pnode->functions[i].function; + current_func_name=fnode->name; if (fnode->name=="vertex") { @@ -401,6 +402,14 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener else code=_mkid(vnode->name); + if (vnode->name==time_name) { + if (current_func_name==vertex_name) { + r_gen_code.uses_vertex_time=true; + } + if (current_func_name==fragment_name) { + r_gen_code.uses_fragment_time=true; + } + } } break; case SL::Node::TYPE_CONSTANT: { @@ -536,6 +545,8 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, r_gen_code.fragment=String(); r_gen_code.fragment_global=String(); r_gen_code.light=String(); + r_gen_code.uses_fragment_time=false; + r_gen_code.uses_vertex_time=false; @@ -645,7 +656,9 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { - + vertex_name="vertex"; + fragment_name="fragment"; + time_name="TIME"; diff --git a/drivers/gles3/shader_compiler_gles3.h b/drivers/gles3/shader_compiler_gles3.h index dcea82d773..3549526808 100644 --- a/drivers/gles3/shader_compiler_gles3.h +++ b/drivers/gles3/shader_compiler_gles3.h @@ -32,6 +32,9 @@ public: String fragment; String light; + bool uses_fragment_time; + bool uses_vertex_time; + }; private: @@ -49,6 +52,10 @@ private: String _dump_node_code(ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions& p_actions, const DefaultIdentifierActions& p_default_actions); + StringName current_func_name; + StringName vertex_name; + StringName fragment_name; + StringName time_name; Set used_name_defines; Set used_rmode_defines; diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index afffe10316..44d325b091 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -6,4 +6,5 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('canvas_shadow.glsl'); env.GLES3_GLSL('scene.glsl'); env.GLES3_GLSL('cubemap_filter.glsl'); + env.GLES3_GLSL('cube_to_dp.glsl'); diff --git a/drivers/gles3/shaders/cube_to_dp.glsl b/drivers/gles3/shaders/cube_to_dp.glsl new file mode 100644 index 0000000000..5ffc78c0b9 --- /dev/null +++ b/drivers/gles3/shaders/cube_to_dp.glsl @@ -0,0 +1,79 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; + +void main() { + + uv_interp = uv_in; + gl_Position = vertex_attrib; +} + +[fragment] + + +uniform highp samplerCube source_cube; //texunit:0 +in vec2 uv_interp; + +uniform bool z_flip; +uniform highp float z_far; +uniform highp float z_near; +uniform highp float bias; + +void main() { + + highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 ); +/* + if(z_flip) { + normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + } else { + normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + } +*/ + + //normal.z = sqrt(1.0-dot(normal.xy,normal.xy)); + //normal.xy*=1.0+normal.z; + + normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y)); + normal = normalize(normal); + +/* + normal.z=0.5; + normal=normalize(normal); +*/ + if (!z_flip) { + normal.z=-normal.z; + } + + //normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 )); + float depth = texture(source_cube,normal).r; + + // absolute values for direction cosines, bigger value equals closer to basis axis + vec3 unorm = abs(normal); + + if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) { + // x code + unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ; + } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { + // y code + unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ; + } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { + // z code + unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ; + } else { + // oh-no we messed up code + // has to be + unorm = vec3( 1.0, 0.0, 0.0 ); + } + + float depth_fix = 1.0 / dot(normal,unorm); + + + depth = 2.0 * depth - 1.0; + float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near)); + gl_FragDepth = (linear_depth*depth_fix+bias) / z_far; +} + diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 60ac015a17..de1591e8ff 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1,7 +1,6 @@ [vertex] -#define ENABLE_UV_INTERP /* from VisualServer: @@ -56,6 +55,15 @@ layout(std140) uniform SceneData { //ubo:0 highp vec4 bg_color; float ambient_energy; float bg_energy; + + float shadow_z_offset; + float shadow_z_slope_scale; + float shadow_dual_paraboloid_render_zfar; + float shadow_dual_paraboloid_render_side; + + vec2 shadow_atlas_pixel_size; + vec2 directional_shadow_pixel_size; + }; uniform highp mat4 world_transform; @@ -68,6 +76,7 @@ layout(std140) uniform LightData { //ubo:3 mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; mediump vec4 light_params; //cone attenuation, specular, shadow darkening, + mediump vec4 light_clamp; mediump vec4 shadow_split_offsets; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; @@ -75,19 +84,6 @@ layout(std140) uniform LightData { //ubo:3 highp mat4 shadow_matrix4; }; -#ifdef USE_FORWARD_1_SHADOW_MAP -out mediump vec4 forward_shadow_pos1; -#endif - -#ifdef USE_FORWARD_2_SHADOW_MAP -out mediump vec4 forward_shadow_pos2; -#endif - -#ifdef USE_FORWARD_4_SHADOW_MAP -out mediump vec4 forward_shadow_pos3; -out mediump vec4 forward_shadow_pos4; -#endif - #endif /* Varyings */ @@ -120,13 +116,6 @@ varying vec4 position_interp; #endif -#ifdef USE_SHADOW_PASS - -uniform highp float shadow_z_offset; -uniform highp float shadow_z_slope_scale; - -#endif - VERTEX_SHADER_GLOBALS @@ -141,6 +130,11 @@ MATERIAL_UNIFORMS #endif +#ifdef RENDER_SHADOW_DUAL_PARABOLOID + +out highp float dp_clip; + +#endif void main() { @@ -206,24 +200,49 @@ VERTEX_SHADER_CODE } + vertex_interp = vertex.xyz; + normal_interp = normal; + +#if defined(ENABLE_TANGENT_INTERP) + tangent_interp = tangent; + binormal_interp = binormal; +#endif + +#ifdef RENDER_SHADOW + + +#ifdef RENDER_SHADOW_DUAL_PARABOLOID + + vertex_interp.z*= shadow_dual_paraboloid_render_side; + normal_interp.z*= shadow_dual_paraboloid_render_side; -#ifdef USE_SHADOW_PASS + dp_clip=vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias + + //for dual paraboloid shadow mapping, this is the fastest but least correct way, as it curves straight edges + + highp vec3 vtx = vertex_interp+normalize(vertex_interp)*shadow_z_offset; + highp float distance = length(vtx); + vtx = normalize(vtx); + vtx.xy/=1.0-vtx.z; + vtx.z=(distance/shadow_dual_paraboloid_render_zfar); + vtx.z=vtx.z * 2.0 - 1.0; + + vertex.xyz=vtx; + vertex.w=1.0; + + +#else float z_ofs = shadow_z_offset; z_ofs += (1.0-abs(normal_interp.z))*shadow_z_slope_scale; vertex_interp.z-=z_ofs; -#endif +#endif //RENDER_SHADOW_DUAL_PARABOLOID - vertex_interp = vertex.xyz; - normal_interp = normal; +#endif //RENDER_SHADOW -#if defined(ENABLE_TANGENT_INTERP) - tangent_interp = tangent; - binormal_interp = binormal; -#endif -#if !defined(SKIP_TRANSFORM_USED) +#if !defined(SKIP_TRANSFORM_USED) && !defined(RENDER_SHADOW_DUAL_PARABOLOID) gl_Position = projection_matrix * vec4(vertex_interp,1.0); #else gl_Position = vertex; @@ -239,11 +258,6 @@ VERTEX_SHADER_CODE #define M_PI 3.14159265359 - -#define ENABLE_UV_INTERP -//hack to use uv if no uv present so it works with lightmap - - /* Varyings */ #if defined(ENABLE_COLOR_INTERP) @@ -318,6 +332,15 @@ layout(std140) uniform SceneData { highp vec4 bg_color; float ambient_energy; float bg_energy; + + float shadow_z_offset; + float shadow_z_slope_scale; + float shadow_dual_paraboloid_render_zfar; + float shadow_dual_paraboloid_render_side; + + vec2 shadow_atlas_pixel_size; + vec2 directional_shadow_pixel_size; + }; @@ -328,7 +351,8 @@ layout(std140) uniform LightData { highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, specular, shadow darkening, + mediump vec4 light_params; //cone attenuation, specular, shadow darkening, shadow enabled + mediump vec4 light_clamp; mediump vec4 shadow_split_offsets; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; @@ -336,20 +360,12 @@ layout(std140) uniform LightData { highp mat4 shadow_matrix4; }; -#ifdef USE_FORWARD_1_SHADOW_MAP -in mediump vec4 forward_shadow_pos1; #endif -#ifdef USE_FORWARD_2_SHADOW_MAP -in mediump vec4 forward_shadow_pos2; -#endif -#ifdef USE_FORWARD_4_SHADOW_MAP -in mediump vec4 forward_shadow_pos3; -in mediump vec4 forward_shadow_pos4; -#endif +uniform highp sampler2DShadow directional_shadow; //texunit:-4 +uniform highp sampler2DShadow shadow_atlas; //texunit:-3 -#endif #ifdef USE_MULTIPLE_RENDER_TARGETS @@ -408,10 +424,27 @@ void light_compute(vec3 normal, vec3 light_vec,vec3 eye_vec,vec3 diffuse_color, } +float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) { + + return textureProj(shadow,vec4(pos,depth,1.0)); +} + +#ifdef RENDER_SHADOW_DUAL_PARABOLOID + +in highp float dp_clip; + +#endif + void main() { +#ifdef RENDER_SHADOW_DUAL_PARABOLOID + + if (dp_clip>0.0) + discard; +#endif + //lay out everything, whathever is unused is optimized away anyway - vec3 vertex = vertex_interp; + highp vec3 vertex = vertex_interp; vec3 albedo = vec3(0.8,0.8,0.8); vec3 specular = vec3(0.2,0.2,0.2); float roughness = 1.0; @@ -528,27 +561,216 @@ FRAGMENT_SHADER_CODE #endif -#ifdef USE_FORWARD_LIGHTING - #ifdef USE_FORWARD_DIRECTIONAL - light_compute(normal,light_direction_attenuation.xyz,eye_vec,albedo,specular,roughness,1.0,diffuse_light,specular_light); + float light_attenuation=1.0; + +#ifdef LIGHT_DIRECTIONAL_SHADOW + + if (gl_FragCoord.w > shadow_split_offsets.w) { + + vec3 pssm_coord; + +#ifdef LIGHT_USE_PSSM_BLEND + float pssm_blend; + vec3 pssm_coord2; + bool use_blend=true; + vec3 light_pssm_split_inv = 1.0/shadow_split_offsets.xyz; + float w_inv = 1.0/gl_FragCoord.w; #endif + +#ifdef LIGHT_USE_PSSM4 + + + if (gl_FragCoord.w > shadow_split_offsets.y) { + + if (gl_FragCoord.w > shadow_split_offsets.x) { + + highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + ambient_light=vec3(1.0,0.4,0.4); + + +#if defined(LIGHT_USE_PSSM_BLEND) + + splane=(shadow_matrix2 * vec4(vertex,1.0)); + pssm_coord2=splane.xyz/splane.w; + pssm_blend=smoothstep(0.0,light_pssm_split_inv.x,w_inv); +#endif + + } else { + + highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + ambient_light=vec3(0.4,1.0,0.4); + +#if defined(LIGHT_USE_PSSM_BLEND) + splane=(shadow_matrix3 * vec4(vertex,1.0)); + pssm_coord2=splane.xyz/splane.w; + pssm_blend=smoothstep(light_pssm_split_inv.x,light_pssm_split_inv.y,w_inv); +#endif + + } + } else { + + + if (gl_FragCoord.w > shadow_split_offsets.z) { + + highp vec4 splane=(shadow_matrix3 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + ambient_light=vec3(0.4,0.4,1.0); + +#if defined(LIGHT_USE_PSSM_BLEND) + splane=(shadow_matrix4 * vec4(vertex,1.0)); + pssm_coord2=splane.xyz/splane.w; + pssm_blend=smoothstep(light_pssm_split_inv.y,light_pssm_split_inv.z,w_inv); +#endif + + } else { + highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + diffuse_light*=vec3(1.0,0.4,1.0); + +#if defined(LIGHT_USE_PSSM_BLEND) + use_blend=false; + +#endif + + } + } + +#endif //LIGHT_USE_PSSM4 + +#ifdef LIGHT_USE_PSSM2 + + if (gl_FragCoord.w > shadow_split_offsets.x) { + + highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + + +#if defined(LIGHT_USE_PSSM_BLEND) + + splane=(shadow_matrix2 * vec4(vertex,1.0)); + pssm_coord2=splane.xyz/splane.w; + pssm_blend=smoothstep(0.0,light_pssm_split_inv.x,w_inv); +#endif + + } else { + highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; +#if defined(LIGHT_USE_PSSM_BLEND) + use_blend=false; + +#endif + + } + +#endif //LIGHT_USE_PSSM2 + +#if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2) + { //regular orthogonal + highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); + pssm_coord=splane.xyz/splane.w; + } +#endif + + + //one one sample + light_attenuation=sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp); + + +#if defined(LIGHT_USE_PSSM_BLEND) + if (use_blend) { + float light_attenuation2=sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp); + light_attenuation=mix(light_attenuation,light_attenuation2,pssm_blend); + } +#endif + + } + +#endif //LIGHT_DIRECTIONAL_SHADOW + + light_compute(normal,-light_direction_attenuation.xyz,eye_vec,albedo,specular,roughness,light_attenuation,diffuse_light,specular_light); + + +#endif //USE_FORWARD_DIRECTIONAL + + #ifdef USE_FORWARD_OMNI vec3 light_rel_vec = light_pos_inv_radius.xyz-vertex; float normalized_distance = length( light_rel_vec )*light_pos_inv_radius.w; float light_attenuation = pow( max(1.0 - normalized_distance, 0.0), light_direction_attenuation.w ); + + if (light_params.w>0.5) { + //there is a shadowmap + + highp vec3 splane=(shadow_matrix1 * vec4(vertex,1.0)).xyz; + float shadow_len=length(splane); + splane=normalize(splane); + vec4 clamp_rect=light_clamp; + + if (splane.z>=0.0) { + + splane.z+=1.0; + + clamp_rect.y+=clamp_rect.w; + + } else { + + splane.z=1.0 - splane.z; + + //if (clamp_rect.z0.5) { + //there is a shadowmap + + highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); + splane.xyz/=splane.w; + // splane.xy=splane.xy*0.5+0.5; + + //splane.xy=light_clamp.xy+splane.xy*light_clamp.zw; + light_attenuation*=sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,light_clamp); + + } + + light_compute(normal,normalize(light_rel_vec),eye_vec,albedo,specular,roughness,light_attenuation,diffuse_light,specular_light); + +#endif //USE_FORWARD_SPOT -#endif #if defined(USE_LIGHT_SHADER_CODE) @@ -560,6 +782,11 @@ LIGHT_SHADER_CODE } #endif +#ifdef RENDER_SHADOW +//nothing happens, so a tree-ssa optimizer will result in no fragment shader :) +#else + + #ifdef USE_MULTIPLE_RENDER_TARGETS //approximate ambient scale for SSAO, since we will lack full ambient @@ -574,13 +801,17 @@ LIGHT_SHADER_CODE #else + #ifdef SHADELESS frag_color=vec4(albedo,alpha); #else frag_color=vec4(ambient_light+diffuse_light+specular_light,alpha); -#endif +#endif //SHADELESS + +#endif //USE_MULTIPLE_RENDER_TARGETS + +#endif //RENDER_SHADOW -#endif } diff --git a/main/main.cpp b/main/main.cpp index 912e8adf4f..bd4af2e79a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1296,6 +1296,17 @@ bool Main::start() { appname = TranslationServer::get_singleton()->translate(appname); OS::get_singleton()->set_window_title(appname); + int shadow_atlas_size = GLOBAL_DEF("rendering/shadow_atlas/size",2048); + int shadow_atlas_q0_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv",2); + int shadow_atlas_q1_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv",2); + int shadow_atlas_q2_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv",3); + int shadow_atlas_q3_subdiv = GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv",4); + + sml->get_root()->set_shadow_atlas_size(shadow_atlas_size); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q2_subdiv)); + sml->get_root()->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv)); } else { GLOBAL_DEF("display/stretch_mode","disabled"); @@ -1304,7 +1315,17 @@ bool Main::start() { Globals::get_singleton()->set_custom_property_info("display/stretch_aspect",PropertyInfo(Variant::STRING,"display/stretch_aspect",PROPERTY_HINT_ENUM,"ignore,keep,keep_width,keep_height")); sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit",true)); - + GLOBAL_DEF("rendering/shadow_atlas/size",2048); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size",PropertyInfo(Variant::INT,"rendering/shadow_atlas/size",PROPERTY_HINT_RANGE,"256,16384")); + + GLOBAL_DEF("rendering/shadow_atlas/quadrant_0_subdiv",2); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv",2); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv",3); + GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv",4); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_0_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_0_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_1_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_1_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_2_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_2_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_3_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_3_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); } diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 88ba7b3731..cfc829078d 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -202,7 +202,7 @@ void Light::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::BOOL, "light/negative"), _SCS("set_negative"), _SCS("is_negative")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/specular"), _SCS("set_param"), _SCS("get_param"), PARAM_SPECULAR); ADD_PROPERTY( PropertyInfo( Variant::INT, "light/cull_mask"), _SCS("set_cull_mask"), _SCS("get_cull_mask")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "shadow/enabled"), _SCS("set_shadow"), _SCS("has_shadow")); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow/enabled"), _SCS("set_shadow"), _SCS("has_shadow")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/darkness"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_DARKNESS); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/normal_bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_NORMAL_BIAS); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); @@ -222,7 +222,6 @@ void Light::_bind_methods() { BIND_CONSTANT( PARAM_SHADOW_SPLIT_1_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_2_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_3_OFFSET ); - BIND_CONSTANT( PARAM_SHADOW_SPLIT_4_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_NORMAL_BIAS ); BIND_CONSTANT( PARAM_SHADOW_BIAS ); BIND_CONSTANT( PARAM_SHADOW_BIAS_SPLIT_SCALE ); @@ -255,7 +254,6 @@ Light::Light(VisualServer::LightType p_type) { set_param(PARAM_SHADOW_SPLIT_1_OFFSET,0.1); set_param(PARAM_SHADOW_SPLIT_2_OFFSET,0.2); set_param(PARAM_SHADOW_SPLIT_3_OFFSET,0.5); - set_param(PARAM_SHADOW_SPLIT_4_OFFSET,1.0); set_param(PARAM_SHADOW_NORMAL_BIAS,0.1); set_param(PARAM_SHADOW_BIAS,0.1); set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE,0.1); @@ -279,36 +277,107 @@ Light::~Light() { } ///////////////////////////////////////// +void DirectionalLight::set_shadow_mode(ShadowMode p_mode) { + + shadow_mode=p_mode; + VS::get_singleton()->light_directional_set_shadow_mode(light,VS::LightDirectionalShadowMode(p_mode)); +} + +DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const { + + return shadow_mode; +} + +void DirectionalLight::set_blend_splits(bool p_enable) { + + blend_splits=p_enable; +} + +bool DirectionalLight::is_blend_splits_enabled() const { + + return blend_splits; +} + void DirectionalLight::_bind_methods() { + ObjectTypeDB::bind_method( _MD("set_shadow_mode","mode"),&DirectionalLight::set_shadow_mode); + ObjectTypeDB::bind_method( _MD("get_shadow_mode"),&DirectionalLight::get_shadow_mode); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_1_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_2"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_2_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_3"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_3_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "pssm/split_4"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_4_OFFSET); + ObjectTypeDB::bind_method( _MD("set_blend_splits","enabled"),&DirectionalLight::set_blend_splits); + ObjectTypeDB::bind_method( _MD("is_blend_splits_enabled"),&DirectionalLight::is_blend_splits_enabled); + + ADD_PROPERTY( PropertyInfo( Variant::INT, "directional/shadow_mode",PROPERTY_HINT_ENUM,"Orthogonal,PSSM 2 Splits,PSSM 4 Splits"), _SCS("set_shadow_mode"), _SCS("get_shadow_mode")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_1_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_2"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_2_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_3"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_3_OFFSET); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "directional/blend_splits"), _SCS("set_blend_splits"), _SCS("is_blend_splits_enabled")); + + BIND_CONSTANT( SHADOW_ORTHOGONAL ); + BIND_CONSTANT( SHADOW_PARALLEL_2_SPLITS ); + BIND_CONSTANT( SHADOW_PARALLEL_4_SPLITS ); } DirectionalLight::DirectionalLight() : Light( VisualServer::LIGHT_DIRECTIONAL ) { + set_shadow_mode(SHADOW_PARALLEL_4_SPLITS); + blend_splits=false; +} +void OmniLight::set_shadow_mode(ShadowMode p_mode) { + shadow_mode=p_mode; + VS::get_singleton()->light_omni_set_shadow_mode(light,VS::LightOmniShadowMode(p_mode)); } +OmniLight::ShadowMode OmniLight::get_shadow_mode() const{ + + return shadow_mode; +} + +void OmniLight::set_shadow_detail(ShadowDetail p_detail){ + + shadow_detail=p_detail; + VS::get_singleton()->light_omni_set_shadow_detail(light,VS::LightOmniShadowDetail(p_detail)); +} +OmniLight::ShadowDetail OmniLight::get_shadow_detail() const{ + + return shadow_detail; +} + + + void OmniLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); + ObjectTypeDB::bind_method( _MD("set_shadow_mode","mode"),&OmniLight::set_shadow_mode); + ObjectTypeDB::bind_method( _MD("get_shadow_mode"),&OmniLight::get_shadow_mode); + + ObjectTypeDB::bind_method( _MD("set_shadow_detail","detail"),&OmniLight::set_shadow_detail); + ObjectTypeDB::bind_method( _MD("get_shadow_detail"),&OmniLight::get_shadow_detail); + + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); + ADD_PROPERTY( PropertyInfo( Variant::INT, "omni/shadow_mode",PROPERTY_HINT_ENUM,"Dual Paraboloid,Cube"), _SCS("set_shadow_mode"), _SCS("get_shadow_mode")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "omni/shadow_detail",PROPERTY_HINT_ENUM,"Vertical,Horizontal"), _SCS("set_shadow_detail"), _SCS("get_shadow_detail")); + +} + +OmniLight::OmniLight() : Light( VisualServer::LIGHT_OMNI ) { + + set_shadow_mode(SHADOW_DUAL_PARABOLOID); + set_shadow_detail(SHADOW_DETAIL_HORIZONTAL); } void SpotLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/spot_angle"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ANGLE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/spot_attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ATTENUATION); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_angle"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ANGLE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ATTENUATION); } diff --git a/scene/3d/light.h b/scene/3d/light.h index 7da2d8e7ca..da28542817 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -45,22 +45,21 @@ class Light : public VisualInstance { public: enum Param { - PARAM_ENERGY, - PARAM_SPECULAR, - PARAM_RANGE, - PARAM_ATTENUATION, - PARAM_SPOT_ANGLE, - PARAM_SPOT_ATTENUATION, - PARAM_SHADOW_MAX_DISTANCE, - PARAM_SHADOW_DARKNESS, - PARAM_SHADOW_SPLIT_1_OFFSET, - PARAM_SHADOW_SPLIT_2_OFFSET, - PARAM_SHADOW_SPLIT_3_OFFSET, - PARAM_SHADOW_SPLIT_4_OFFSET, - PARAM_SHADOW_NORMAL_BIAS, - PARAM_SHADOW_BIAS, - PARAM_SHADOW_BIAS_SPLIT_SCALE, - PARAM_MAX + PARAM_ENERGY = VS::LIGHT_PARAM_ENERGY, + PARAM_SPECULAR = VS::LIGHT_PARAM_SPECULAR, + PARAM_RANGE = VS::LIGHT_PARAM_RANGE, + PARAM_ATTENUATION = VS::LIGHT_PARAM_ATTENUATION, + PARAM_SPOT_ANGLE = VS::LIGHT_PARAM_SPOT_ANGLE, + PARAM_SPOT_ATTENUATION = VS::LIGHT_PARAM_SPOT_ATTENUATION, + PARAM_SHADOW_MAX_DISTANCE = VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE, + PARAM_SHADOW_DARKNESS = VS::LIGHT_PARAM_SHADOW_DARKNESS, + PARAM_SHADOW_SPLIT_1_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, + PARAM_SHADOW_SPLIT_2_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, + PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, + PARAM_SHADOW_NORMAL_BIAS = VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS, + PARAM_SHADOW_BIAS = VS::LIGHT_PARAM_SHADOW_BIAS, + PARAM_SHADOW_BIAS_SPLIT_SCALE = VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE, + PARAM_MAX = VS::LIGHT_PARAM_MAX }; private: @@ -126,31 +125,69 @@ class DirectionalLight : public Light { public: + enum ShadowMode { + SHADOW_ORTHOGONAL, + SHADOW_PARALLEL_2_SPLITS, + SHADOW_PARALLEL_4_SPLITS + }; private: + bool blend_splits; + ShadowMode shadow_mode; protected: static void _bind_methods(); public: + void set_shadow_mode(ShadowMode p_mode); + ShadowMode get_shadow_mode() const; + + void set_blend_splits(bool p_enable); + bool is_blend_splits_enabled() const; DirectionalLight(); }; +VARIANT_ENUM_CAST(DirectionalLight::ShadowMode) class OmniLight : public Light { OBJ_TYPE( OmniLight, Light ); +public: + // omni light + enum ShadowMode { + SHADOW_DUAL_PARABOLOID, + SHADOW_CUBE, + }; + + // omni light + enum ShadowDetail { + SHADOW_DETAIL_VERTICAL, + SHADOW_DETAIL_HORIZONTAL + }; + +private: + + ShadowMode shadow_mode; + ShadowDetail shadow_detail; protected: static void _bind_methods(); public: + void set_shadow_mode(ShadowMode p_mode); + ShadowMode get_shadow_mode() const; - OmniLight() : Light( VisualServer::LIGHT_OMNI ) { } + void set_shadow_detail(ShadowDetail p_detail); + ShadowDetail get_shadow_detail() const; + + OmniLight(); }; +VARIANT_ENUM_CAST(OmniLight::ShadowMode) +VARIANT_ENUM_CAST(OmniLight::ShadowDetail) + class SpotLight : public Light { OBJ_TYPE( SpotLight, Light ); diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 386a0fab57..5e1bda3436 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -201,7 +201,7 @@ Ref NavigationMesh::get_debug_mesh() { arr.resize(Mesh::ARRAY_MAX); arr[Mesh::ARRAY_VERTEX]=varr; - debug_mesh->add_surface(Mesh::PRIMITIVE_LINES,arr); + debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,arr); return debug_mesh; } diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index cfc6753378..ef619244d0 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -845,7 +845,7 @@ Ref SceneTree::get_debug_contact_mesh() { arr[Mesh::ARRAY_INDEX]=indices; - debug_contact_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,arr); + debug_contact_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,arr); debug_contact_mesh->surface_set_material(0,mat); return debug_contact_mesh; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 35f72c5ce7..0ca72eaa2a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1297,6 +1297,39 @@ bool Viewport::get_clear_on_new_frame() const{ return clear_on_new_frame; } +void Viewport::set_shadow_atlas_size(int p_size) { + + shadow_atlas_size=p_size; + VS::get_singleton()->viewport_set_shadow_atlas_size(viewport,p_size); +} + +int Viewport::get_shadow_atlas_size() const{ + + return shadow_atlas_size; +} + +void Viewport::set_shadow_atlas_quadrant_subdiv(int p_quadrant,ShadowAtlasQuadrantSubdiv p_subdiv){ + + + ERR_FAIL_INDEX(p_quadrant,4); + ERR_FAIL_INDEX(p_subdiv,SHADOW_ATLAS_QUADRANT_SUBDIV_MAX); + + if (shadow_atlas_quadrant_subdiv[p_quadrant]==p_subdiv) + return; + + shadow_atlas_quadrant_subdiv[p_quadrant]=p_subdiv; + static const int subdiv[SHADOW_ATLAS_QUADRANT_SUBDIV_MAX]={0,1,4,16,64,256,1024}; + + VS::get_singleton()->viewport_set_shadow_atlas_quadrant_subdivision(viewport,p_quadrant,subdiv[p_subdiv]); + +} +Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(int p_quadrant) const{ + + ERR_FAIL_INDEX_V(p_quadrant,4,SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED); + return shadow_atlas_quadrant_subdiv[p_quadrant]; +} + + void Viewport::clear() { //clear=true; @@ -2661,6 +2694,12 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip); ObjectTypeDB::bind_method(_MD("_gui_remove_focus"), &Viewport::_gui_remove_focus); + ObjectTypeDB::bind_method(_MD("set_shadow_atlas_size","size"), &Viewport::set_shadow_atlas_size); + ObjectTypeDB::bind_method(_MD("get_shadow_atlas_size"), &Viewport::get_shadow_atlas_size); + + ObjectTypeDB::bind_method(_MD("set_shadow_atlas_quadrant_subdiv","quadrant","subdiv"), &Viewport::set_shadow_atlas_quadrant_subdiv); + ObjectTypeDB::bind_method(_MD("get_shadow_atlas_quadrant_subdiv","quadrant"), &Viewport::get_shadow_atlas_quadrant_subdiv); + ADD_PROPERTY( PropertyInfo(Variant::RECT2,"size"), _SCS("set_size"), _SCS("get_size") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"own_world"), _SCS("set_use_own_world"), _SCS("is_using_own_world") ); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") ); @@ -2674,6 +2713,11 @@ void Viewport::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::BOOL,"physics/object_picking"), _SCS("set_physics_object_picking"), _SCS("get_physics_object_picking") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gui/disable_input"), _SCS("set_disable_input"), _SCS("is_input_disabled") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"3d/disable_3d"), _SCS("set_disable_3d"), _SCS("is_3d_disabled") ); + ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow_atlas/size"), _SCS("set_shadow_atlas_size"), _SCS("get_shadow_atlas_size") ); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"shadow_atlas/quad_0",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), _SCS("set_shadow_atlas_quadrant_subdiv"), _SCS("get_shadow_atlas_quadrant_subdiv"),0 ); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"shadow_atlas/quad_1",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), _SCS("set_shadow_atlas_quadrant_subdiv"), _SCS("get_shadow_atlas_quadrant_subdiv"),1 ); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"shadow_atlas/quad_2",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), _SCS("set_shadow_atlas_quadrant_subdiv"), _SCS("get_shadow_atlas_quadrant_subdiv"),2 ); + ADD_PROPERTYI( PropertyInfo(Variant::INT,"shadow_atlas/quad_3",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), _SCS("set_shadow_atlas_quadrant_subdiv"), _SCS("get_shadow_atlas_quadrant_subdiv"),3 ); ADD_SIGNAL(MethodInfo("size_changed")); @@ -2682,6 +2726,14 @@ void Viewport::_bind_methods() { BIND_CONSTANT( UPDATE_WHEN_VISIBLE ); BIND_CONSTANT( UPDATE_ALWAYS ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_1 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_4 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_16 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_64 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_256 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_1024 ); + BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_MAX ); } @@ -2719,6 +2771,15 @@ Viewport::Viewport() { physics_object_over=0; physics_last_mousepos=Vector2(1e20,1e20); + shadow_atlas_size=0; + for(int i=0;i<4;i++) { + shadow_atlas_quadrant_subdiv[0]=SHADOW_ATLAS_QUADRANT_SUBDIV_MAX; + } + set_shadow_atlas_quadrant_subdiv(0,SHADOW_ATLAS_QUADRANT_SUBDIV_4); + set_shadow_atlas_quadrant_subdiv(1,SHADOW_ATLAS_QUADRANT_SUBDIV_4); + set_shadow_atlas_quadrant_subdiv(2,SHADOW_ATLAS_QUADRANT_SUBDIV_16); + set_shadow_atlas_quadrant_subdiv(3,SHADOW_ATLAS_QUADRANT_SUBDIV_64); + String id=itos(get_instance_ID()); input_group = "_vp_input"+id; diff --git a/scene/main/viewport.h b/scene/main/viewport.h index c5d61469dd..462ecff93e 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -86,6 +86,18 @@ public: UPDATE_ALWAYS }; + enum ShadowAtlasQuadrantSubdiv { + SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED, + SHADOW_ATLAS_QUADRANT_SUBDIV_1, + SHADOW_ATLAS_QUADRANT_SUBDIV_4, + SHADOW_ATLAS_QUADRANT_SUBDIV_16, + SHADOW_ATLAS_QUADRANT_SUBDIV_64, + SHADOW_ATLAS_QUADRANT_SUBDIV_256, + SHADOW_ATLAS_QUADRANT_SUBDIV_1024, + SHADOW_ATLAS_QUADRANT_SUBDIV_MAX, + + }; + private: friend class ViewportTexture; @@ -120,8 +132,6 @@ friend class ViewportTexture; RID contact_3d_debug_multimesh; RID contact_3d_debug_instance; - - bool size_override; bool size_override_stretch; Size2 size_override_size; @@ -175,6 +185,9 @@ friend class ViewportTexture; RID texture_rid; Ref texture; + int shadow_atlas_size; + ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4]; + struct GUI { // info used when this is a window @@ -347,6 +360,11 @@ public: UpdateMode get_update_mode() const; Ref get_texture() const; + void set_shadow_atlas_size(int p_size); + int get_shadow_atlas_size() const; + + void set_shadow_atlas_quadrant_subdiv(int p_quadrant,ShadowAtlasQuadrantSubdiv p_subdiv); + ShadowAtlasQuadrantSubdiv get_shadow_atlas_quadrant_subdiv(int p_quadrant) const; Vector2 get_camera_coords(const Vector2& p_viewport_coords) const; Vector2 get_camera_rect_size() const; @@ -393,4 +411,6 @@ public: }; VARIANT_ENUM_CAST(Viewport::UpdateMode); +VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv); + #endif diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 3c7b0fbe6c..cb55f4f030 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -152,7 +152,7 @@ void FixedSpatialMaterial::_update_shader() { switch(cull_mode) { case CULL_BACK: code+=",cull_back"; break; case CULL_FRONT: code+=",cull_front"; break; - case CULL_DISABLED: code+=",cull_disable"; break; + case CULL_DISABLED: code+=",cull_disabled"; break; } diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 132ec54e48..e737c5c37e 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -125,11 +125,61 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { //create Dictionary d=p_value; ERR_FAIL_COND_V(!d.has("primitive"),false); - ERR_FAIL_COND_V(!d.has("arrays"),false); - ERR_FAIL_COND_V(!d.has("morph_arrays"),false); + + if (d.has("arrays")) { + //old format + ERR_FAIL_COND_V(!d.has("morph_arrays"),false); + add_surface_from_arrays(PrimitiveType(int(d["primitive"])),d["arrays"],d["morph_arrays"]); + + } else if (d.has("array_data")) { + + DVector array_data = d["array_data"]; + DVector array_index_data; + if (d.has("array_index_data")) + array_index_data=d["array_index_data"]; + + ERR_FAIL_COND_V(!d.has("format"),false); + uint32_t format = d["format"]; + + ERR_FAIL_COND_V(!d.has("primitive"),false); + uint32_t primitive = d["primitive"]; + + ERR_FAIL_COND_V(!d.has("vertex_count"),false); + int vertex_count = d["vertex_count"]; + + int index_count=0; + if (d.has("index_count")) + index_count=d["index_count"]; + + Vector< DVector > morphs; + + if (d.has("morph_data")) { + Array morph_data=d["morph_data"]; + for(int i=0;i morph = morph_data[i]; + morphs.push_back(morph_data[i]); + } + } + + ERR_FAIL_COND_V(!d.has("aabb"),false); + AABB aabb = d["aabb"]; + + Vector bone_aabb; + if (d.has("bone_aabb")) { + Array baabb = d["bone_aabb"]; + bone_aabb.resize(baabb.size()); + + for(int i=0;imesh_surface_get_array(mesh,idx); + d["vertex_count"]=VS::get_singleton()->mesh_surface_get_array_len(mesh,idx); + d["array_index_data"]=VS::get_singleton()->mesh_surface_get_index_array(mesh,idx); + d["index_count"]=VS::get_singleton()->mesh_surface_get_array_index_len(mesh,idx); + d["primitive"]=VS::get_singleton()->mesh_surface_get_primitive_type(mesh,idx); + d["format"]=VS::get_singleton()->mesh_surface_get_format(mesh,idx); + d["aabb"]=VS::get_singleton()->mesh_surface_get_aabb(mesh,idx); + + Vector skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh,idx); + Array arr; + for(int i=0;i > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); + + Array md; + for(int i=0;i m = surface_get_material(idx); if (m.is_valid()) d["material"]=m; @@ -234,7 +306,17 @@ void Mesh::_recompute_aabb() { } -void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes) { +void Mesh::add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes,const Vector& p_bone_aabbs) { + + Surface s; + s.aabb=p_aabb; + surfaces.push_back(s); + + VisualServer::get_singleton()->mesh_add_surface(mesh,p_format,(VS::PrimitiveType)p_primitive,p_array,p_vertex_count,p_index_array,p_index_count,p_aabb,p_blend_shapes,p_bone_aabbs); + +} + +void Mesh::add_surface_from_arrays(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes) { ERR_FAIL_COND(p_arrays.size()!=ARRAY_MAX); @@ -279,8 +361,7 @@ void Mesh::add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Arr Array Mesh::surface_get_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface,surfaces.size(),Array()); - //return VisualServer::get_singleton()->mesh_get_surface_arrays(mesh,p_surface); - return Array(); + return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh,p_surface); } Array Mesh::surface_get_morph_arrays(int p_surface) const { @@ -929,7 +1010,7 @@ Ref Mesh::create_outline(float p_margin) const { Ref newmesh = memnew( Mesh ); - newmesh->add_surface(PRIMITIVE_TRIANGLES,arrays); + newmesh->add_surface_from_arrays(PRIMITIVE_TRIANGLES,arrays); return newmesh; } @@ -943,6 +1024,7 @@ void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); ObjectTypeDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); + ObjectTypeDB::bind_method(_MD("add_surface_from_arrays","primitive","arrays","blend_shapes"),&Mesh::add_surface_from_arrays,DEFVAL(Array())); ObjectTypeDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); ObjectTypeDB::bind_method(_MD("surface_remove","surf_idx"),&Mesh::surface_remove); ObjectTypeDB::bind_method(_MD("surface_get_array_len","surf_idx"),&Mesh::surface_get_array_len); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index e329c353a0..2b28f1187e 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -122,7 +122,9 @@ protected: public: - void add_surface(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array()); + void add_surface_from_arrays(PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array()); + void add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector()); + Array surface_get_arrays(int p_surface) const; virtual Array surface_get_morph_arrays(int p_surface) const; diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index fb0fc2a247..758d78e513 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -328,7 +328,7 @@ Error MeshDataTool::commit_to_surface(const Ref& p_mesh) { Ref ncmesh=p_mesh; int sc = ncmesh->get_surface_count(); - ncmesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,arr); + ncmesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,arr); ncmesh->surface_set_material(sc,material); return OK; diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index a71e414f61..778764a832 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -77,7 +77,7 @@ Ref Shape::get_debug_mesh() { SceneTree *st=OS::get_singleton()->get_main_loop()->cast_to(); - debug_mesh_cache->add_surface(Mesh::PRIMITIVE_LINES,arr); + debug_mesh_cache->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,arr); if (st) { debug_mesh_cache->surface_set_material(0,st->get_debug_collision_material()); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index e1769d099b..6f08d69221 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -410,7 +410,7 @@ Ref SurfaceTool::commit(const Ref& p_existing) { } - mesh->add_surface(primitive,a); + mesh->add_surface_from_arrays(primitive,a); if (material.is_valid()) mesh->surface_set_material(surface,material); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index feaac38acb..d87cc0fd8c 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -39,6 +39,16 @@ class RasterizerScene { public: + /* SHADOW ATLAS API */ + + virtual RID shadow_atlas_create()=0; + virtual void shadow_atlas_set_size(RID p_atlas,int p_size)=0; + virtual void shadow_atlas_set_quadrant_subdivision(RID p_atlas,int p_quadrant,int p_subdivision)=0; + virtual bool shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version)=0; + + virtual int get_directional_light_shadow_size(RID p_light_intance)=0; + virtual void set_directional_shadow_count(int p_count)=0; + /* ENVIRONMENT API */ virtual RID environment_create()=0; @@ -93,6 +103,7 @@ public: virtual void base_removed()=0; virtual void base_changed()=0; + virtual void base_material_changed()=0; InstanceBase() : dependency_item(this) { @@ -109,10 +120,11 @@ public: virtual RID light_instance_create(RID p_light)=0; virtual void light_instance_set_transform(RID p_light_instance,const Transform& p_transform)=0; + virtual void light_instance_set_shadow_transform(RID p_light_instance,const CameraMatrix& p_projection,const Transform& p_transform,float p_far,float p_split,int p_pass)=0; virtual void light_instance_mark_visible(RID p_light_instance)=0; - - virtual void render_scene(const Transform& p_cam_transform,CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_directional_lights,int p_directional_light_count,RID p_environment)=0; + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas)=0; + virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count)=0; virtual void set_scene_pass(uint64_t p_pass)=0; @@ -179,6 +191,12 @@ public: virtual void material_set_line_width(RID p_material, float p_width)=0; + virtual bool material_is_animated(RID p_material)=0; + virtual bool material_casts_shadows(RID p_material)=0; + + virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance)=0; + virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance)=0; + /* MESH API */ virtual RID mesh_create()=0; @@ -205,6 +223,10 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; + virtual Vector > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; + virtual Vector mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; + virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; virtual int mesh_get_surface_count(RID p_mesh) const=0; @@ -279,10 +301,21 @@ public: virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; virtual void light_set_shader(RID p_light,RID p_shader)=0; + virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode)=0; + virtual void light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail)=0; + virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode)=0; + virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light)=0; + virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light)=0; + + virtual bool light_has_shadow(RID p_light) const=0; + virtual VS::LightType light_get_type(RID p_light) const=0; virtual AABB light_get_aabb(RID p_light) const=0; + virtual float light_get_param(RID p_light,VS::LightParam p_param)=0; + virtual uint64_t light_get_version(RID p_light) const=0; + /* PROBE API */ diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 8c54ef11fb..8a0818c299 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -84,7 +84,7 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_front"); shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_back"); - shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disable"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("cull_disabled"); shader_modes[VS::SHADER_SPATIAL].modes.insert("unshaded"); shader_modes[VS::SHADER_SPATIAL].modes.insert("ontop"); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 6c7048bd62..7810cc9018 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -687,6 +687,10 @@ public: BIND2RC(uint32_t,mesh_surface_get_format,RID,int) BIND2RC(PrimitiveType,mesh_surface_get_primitive_type,RID,int) + BIND2RC(AABB,mesh_surface_get_aabb,RID,int) + BIND2RC(Vector >,mesh_surface_get_blend_shapes,RID,int) + BIND2RC(Vector,mesh_surface_get_skeleton_aabb,RID,int) + BIND2(mesh_remove_surface,RID,int) BIND1RC(int,mesh_get_surface_count,RID) @@ -759,6 +763,9 @@ public: BIND2(light_set_cull_mask,RID ,uint32_t ) BIND2(light_set_shader,RID ,RID ) + BIND2(light_omni_set_shadow_mode,RID,LightOmniShadowMode) + BIND2(light_omni_set_shadow_detail,RID,LightOmniShadowDetail) + BIND2(light_directional_set_shadow_mode,RID,LightDirectionalShadowMode) /* PROBE API */ @@ -847,7 +854,8 @@ public: BIND2(viewport_set_global_canvas_transform,RID,const Matrix32& ) BIND3(viewport_set_canvas_layer,RID ,RID ,int ) - + BIND2(viewport_set_shadow_atlas_size,RID ,int ) + BIND3(viewport_set_shadow_atlas_quadrant_subdivision,RID ,int, int ) /* ENVIRONMENT API */ diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index e7900bdcc9..e36e31e191 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -96,7 +96,10 @@ void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance List::Element *E = light->geometries.push_back(pinfo); - light->shadow_sirty=true; + if (geom->can_cast_shadows) { + + light->shadow_dirty=true; + } geom->lighting_dirty=true; return E; //this element should make freeing faster @@ -180,7 +183,9 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance geom->lighting.erase(E->get().L); light->geometries.erase(E); - light->shadow_sirty=true; + if (geom->can_cast_shadows) { + light->shadow_dirty=true; + } geom->lighting_dirty=true; @@ -346,6 +351,12 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ } instance->morph_values.clear(); + + for(int i=0;imaterials.size();i++) { + if (instance->materials[i].is_valid()) { + VSG::storage->material_remove_instance_owner(instance->materials[i],instance); + } + } instance->materials.clear(); #if 0 @@ -667,7 +678,16 @@ void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surfa ERR_FAIL_INDEX(p_surface,instance->materials.size()); + if (instance->materials[p_surface].is_valid()) { + VSG::storage->material_remove_instance_owner(instance->materials[p_surface],instance); + } instance->materials[p_surface]=p_material; + instance->base_material_changed(); + + if (instance->materials[p_surface].is_valid()) { + VSG::storage->material_add_instance_owner(instance->materials[p_surface],instance); + } + } @@ -791,12 +811,14 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFl } break; case VS::INSTANCE_FLAG_CAST_SHADOW: { - /*if (p_enabled == true) { - instance->cast_shadows = SHADOW_CASTING_SETTING_ON; + if (p_enabled == true) { + instance->cast_shadows = VS::SHADOW_CASTING_SETTING_ON; } else { - instance->cast_shadows = SHADOW_CASTING_SETTING_OFF; - }*/ + instance->cast_shadows = VS::SHADOW_CASTING_SETTING_OFF; + } + + instance->base_material_changed(); // to actually compute if shadows are visible or not } break; case VS::INSTANCE_FLAG_DEPH_SCALE: { @@ -820,8 +842,15 @@ void VisualServerScene::instance_geometry_set_material_override(RID p_instance, Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); + if (instance->material_override.is_valid()) { + VSG::storage->material_remove_instance_owner(instance->material_override,instance); + } instance->material_override=p_material; + instance->base_material_changed(); + if (instance->material_override.is_valid()) { + VSG::storage->material_add_instance_owner(instance->material_override,instance); + } } @@ -843,6 +872,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { InstanceLightData *light = static_cast(p_instance->base_data); VSG::scene_render->light_instance_set_transform( light->instance, p_instance->transform ); + light->shadow_dirty=true; } @@ -860,11 +890,13 @@ void VisualServerScene::_update_instance(Instance *p_instance) { if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { InstanceGeometryData *geom = static_cast(p_instance->base_data); - //make sure lights are updated + //make sure lights are updated if it casts shadow - for (List::Element *E=geom->lighting.front();E;E=E->next()) { - InstanceLightData *light = static_cast(E->get()->base_data); - light->shadow_sirty=true; + if (geom->can_cast_shadows) { + for (List::Element *E=geom->lighting.front();E;E=E->next()) { + InstanceLightData *light = static_cast(E->get()->base_data); + light->shadow_dirty=true; + } } } @@ -1095,9 +1127,371 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { -void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewport_size) { +void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camera* p_camera,RID p_shadow_atlas,Scenario* p_scenario,Size2 p_viewport_rect) { + + + InstanceLightData * light = static_cast(p_instance->base_data); + + switch(VSG::storage->light_get_type(p_instance->base)) { + + case VS::LIGHT_DIRECTIONAL: { + + float max_distance = p_camera->zfar; + float shadow_max = VSG::storage->light_get_param(p_instance->base,VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE); + if (shadow_max>0) { + max_distance=MIN(shadow_max,max_distance); + } + max_distance=MAX(max_distance,p_camera->znear+0.001); + + float range = max_distance-p_camera->znear; + + int splits=0; + switch(VSG::storage->light_directional_get_shadow_mode(p_instance->base)) { + case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: splits=1; break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: splits=2; break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: splits=4; break; + } + + float distances[5]; + + distances[0]=p_camera->znear; + for(int i=0;iznear+VSG::storage->light_get_param(p_instance->base,VS::LightParam(VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET+i))*range; + }; + + distances[splits]=max_distance; + + float texture_size=VSG::scene_render->get_directional_light_shadow_size(light->instance); + + bool overlap = false;//rasterizer->light_instance_get_pssm_shadow_overlap(p_light->light_info->instance); + + for (int i=0;itype) { + + case Camera::ORTHOGONAL: { + + camera_matrix.set_orthogonal( + p_camera->size, + p_viewport_rect.width / p_viewport_rect.height, + distances[(i==0 || !overlap )?i:i-1], + distances[i+1], + p_camera->vaspect + + ); + } break; + case Camera::PERSPECTIVE: { + + + camera_matrix.set_perspective( + p_camera->fov, + p_viewport_rect.width / (float)p_viewport_rect.height, + distances[(i==0 || !overlap )?i:i-1], + distances[i+1], + p_camera->vaspect + + ); + + } break; + } + + //obtain the frustum endpoints + + Vector3 endpoints[8]; // frustum plane endpoints + bool res = camera_matrix.get_endpoints(p_camera->transform,endpoints); + ERR_CONTINUE(!res); + + // obtain the light frustm ranges (given endpoints) + + Vector3 x_vec=p_instance->transform.basis.get_axis( Vector3::AXIS_X ).normalized(); + Vector3 y_vec=p_instance->transform.basis.get_axis( Vector3::AXIS_Y ).normalized(); + Vector3 z_vec=p_instance->transform.basis.get_axis( Vector3::AXIS_Z ).normalized(); + //z_vec points agsint the camera, like in default opengl + + float x_min,x_max; + float y_min,y_max; + float z_min,z_max; + + float x_min_cam,x_max_cam; + float y_min_cam,y_max_cam; + float z_min_cam,z_max_cam; + + + //used for culling + for(int j=0;j<8;j++) { + + float d_x=x_vec.dot(endpoints[j]); + float d_y=y_vec.dot(endpoints[j]); + float d_z=z_vec.dot(endpoints[j]); + + if (j==0 || d_xx_max) + x_max=d_x; + + if (j==0 || d_yy_max) + y_max=d_y; + + if (j==0 || d_zz_max) + z_max=d_z; + + + } + + + + + + { + //camera viewport stuff + //this trick here is what stabilizes the shadow (make potential jaggies to not move) + //at the cost of some wasted resolution. Still the quality increase is very well worth it + + + Vector3 center; + + for(int j=0;j<8;j++) { + + center+=endpoints[j]; + } + center/=8.0; + + //center=x_vec*(x_max-x_min)*0.5 + y_vec*(y_max-y_min)*0.5 + z_vec*(z_max-z_min)*0.5; + + float radius=0; + + for(int j=0;j<8;j++) { + + float d = center.distance_to(endpoints[j]); + if (d>radius) + radius=d; + } + + + radius *= texture_size/(texture_size-2.0); //add a texel by each side, so stepified texture will always fit + + x_max_cam=x_vec.dot(center)+radius; + x_min_cam=x_vec.dot(center)-radius; + y_max_cam=y_vec.dot(center)+radius; + y_min_cam=y_vec.dot(center)-radius; + z_max_cam=z_vec.dot(center)+radius; + z_min_cam=z_vec.dot(center)-radius; + + float unit = radius*2.0/texture_size; + + x_max_cam=Math::stepify(x_max_cam,unit); + x_min_cam=Math::stepify(x_min_cam,unit); + y_max_cam=Math::stepify(y_max_cam,unit); + y_min_cam=Math::stepify(y_min_cam,unit); + + } + + //now that we now all ranges, we can proceed to make the light frustum planes, for culling octree + + Vector light_frustum_planes; + light_frustum_planes.resize(6); + + //right/left + light_frustum_planes[0]=Plane( x_vec, x_max ); + light_frustum_planes[1]=Plane( -x_vec, -x_min ); + //top/bottom + light_frustum_planes[2]=Plane( y_vec, y_max ); + light_frustum_planes[3]=Plane( -y_vec, -y_min ); + //near/far + light_frustum_planes[4]=Plane( z_vec, z_max+1e6 ); + light_frustum_planes[5]=Plane( -z_vec, -z_min ); // z_min is ok, since casters further than far-light plane are not needed + + int cull_count = p_scenario->octree.cull_convex(light_frustum_planes,instance_shadow_cull_result,MAX_INSTANCE_CULL,VS::INSTANCE_GEOMETRY_MASK); + + // a pre pass will need to be needed to determine the actual z-near to be used + + + for (int j=0;jvisible || !((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) || !static_cast(instance->base_data)->can_cast_shadows) { + cull_count--; + SWAP(instance_shadow_cull_result[j],instance_shadow_cull_result[cull_count]); + j--; + + } + + instance->transformed_aabb.project_range_in_plane(Plane(z_vec,0),min,max); + if (max>z_max) + z_max=max; + } + + { + CameraMatrix ortho_camera; + real_t half_x = (x_max_cam-x_min_cam) * 0.5; + real_t half_y = (y_max_cam-y_min_cam) * 0.5; + + + ortho_camera.set_orthogonal( -half_x, half_x,-half_y,half_y, 0, (z_max-z_min_cam) ); + + Transform ortho_transform; + ortho_transform.basis=p_instance->transform.basis; + ortho_transform.origin=x_vec*(x_min_cam+half_x)+y_vec*(y_min_cam+half_y)+z_vec*z_max; + + VSG::scene_render->light_instance_set_shadow_transform(light->instance,ortho_camera,ortho_transform,0,distances[i+1],i); + } + + + + VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,i,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); + + } + + } break; + case VS::LIGHT_OMNI: { + + VS::LightOmniShadowMode shadow_mode = VSG::storage->light_omni_get_shadow_mode(p_instance->base); + + switch(shadow_mode) { + case VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID: { + + for(int i=0;i<2;i++) { + + //using this one ensures that raster deferred will have it + + float radius = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_RANGE); + + float z =i==0?-1:1; + Vector planes; + planes.resize(5); + planes[0]=p_instance->transform.xform(Plane(Vector3(0,0,z),radius)); + planes[1]=p_instance->transform.xform(Plane(Vector3(1,0,z).normalized(),radius)); + planes[2]=p_instance->transform.xform(Plane(Vector3(-1,0,z).normalized(),radius)); + planes[3]=p_instance->transform.xform(Plane(Vector3(0,1,z).normalized(),radius)); + planes[4]=p_instance->transform.xform(Plane(Vector3(0,-1,z).normalized(),radius)); + + + int cull_count = p_scenario->octree.cull_convex(planes,instance_shadow_cull_result,MAX_INSTANCE_CULL,VS::INSTANCE_GEOMETRY_MASK); + + for (int j=0;jvisible || !((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) || !static_cast(instance->base_data)->can_cast_shadows) { + cull_count--; + SWAP(instance_shadow_cull_result[j],instance_shadow_cull_result[cull_count]); + j--; + + } + } + + VSG::scene_render->light_instance_set_shadow_transform(light->instance,CameraMatrix(),p_instance->transform,radius,0,i); + VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,i,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); + } + } break; + case VS::LIGHT_OMNI_SHADOW_CUBE: { + + float radius = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_RANGE); + CameraMatrix cm; + cm.set_perspective(90,1,0.01,radius); + + for(int i=0;i<6;i++) { + + //using this one ensures that raster deferred will have it + + + + static const Vector3 view_normals[6]={ + Vector3(-1, 0, 0), + Vector3(+1, 0, 0), + Vector3( 0,-1, 0), + Vector3( 0,+1, 0), + Vector3( 0, 0,-1), + Vector3( 0, 0,+1) + }; + static const Vector3 view_up[6]={ + Vector3( 0,-1, 0), + Vector3( 0,-1, 0), + Vector3( 0, 0,-1), + Vector3( 0, 0,+1), + Vector3( 0,-1, 0), + Vector3( 0,-1, 0) + }; + + Transform xform = p_instance->transform * Transform().looking_at(view_normals[i],view_up[i]); + + + Vector planes = cm.get_projection_planes(xform); + + int cull_count = p_scenario->octree.cull_convex(planes,instance_shadow_cull_result,MAX_INSTANCE_CULL,VS::INSTANCE_GEOMETRY_MASK); + + for (int j=0;jvisible || !((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) || !static_cast(instance->base_data)->can_cast_shadows) { + cull_count--; + SWAP(instance_shadow_cull_result[j],instance_shadow_cull_result[cull_count]); + j--; + + } + } + + VSG::scene_render->light_instance_set_shadow_transform(light->instance,cm,xform,radius,0,i); + VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,i,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); + } + + //restore the regular DP matrix + VSG::scene_render->light_instance_set_shadow_transform(light->instance,CameraMatrix(),p_instance->transform,radius,0,0); + + } break; + } + + + } break; + case VS::LIGHT_SPOT: { + + + float radius = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_RANGE); + float angle = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_SPOT_ANGLE); + + CameraMatrix cm; + cm.set_perspective( 90, 1.0, 0.01, radius ); + print_line("perspective: "+cm); + + Vector planes = cm.get_projection_planes(p_instance->transform); + int cull_count = p_scenario->octree.cull_convex(planes,instance_shadow_cull_result,MAX_INSTANCE_CULL,VS::INSTANCE_GEOMETRY_MASK); + + for (int j=0;jvisible || !((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) || !static_cast(instance->base_data)->can_cast_shadows) { + cull_count--; + SWAP(instance_shadow_cull_result[j],instance_shadow_cull_result[cull_count]); + j--; + + } + } + + + print_line("MOMONGO"); + VSG::scene_render->light_instance_set_shadow_transform(light->instance,cm,p_instance->transform,radius,0,0); + VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,0,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); + + } break; + } + +} + + + + + +void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewport_size,RID p_shadow_atlas) { + Camera *camera = camera_owner.getornull(p_camera); ERR_FAIL_COND(!camera); @@ -1112,8 +1506,10 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp /* STEP 1 - SETUP CAMERA */ CameraMatrix camera_matrix; + Transform camera_inverse_xform = camera->transform.affine_inverse(); bool ortho=false; + switch(camera->type) { case Camera::ORTHOGONAL: { @@ -1268,12 +1664,14 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp //do not add this light if no geometry is affected by it.. light_cull_result[light_cull_count]=ins; light_instance_cull_result[light_cull_count]=light->instance; - VSG::scene_render->light_instance_mark_visible(light->instance); //mark it visible for shadow allocation later + if (p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(ins->base)) { + VSG::scene_render->light_instance_mark_visible(light->instance); //mark it visible for shadow allocation later + } light_cull_count++; } -// rasterizer->light_instance_set_active_hint(ins->light_info->instance); + } } else if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK && ins->visible && ins->cast_shadows!=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { @@ -1386,6 +1784,10 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp // directional lights { + + Instance** lights_with_shadow = (Instance**)alloca(sizeof(Instance*)*light_cull_count); + int directional_shadow_count=0; + for (List::Element *E=scenario->directional_lights.front();E;E=E->next()) { if (light_cull_count+directional_light_count>=MAX_LIGHTS_CULLED) { @@ -1401,42 +1803,142 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp //check shadow.. -/* if (light && light->light_info->enabled && rasterizer->light_has_shadow(light->base_rid)) { - //rasterizer->light_instance_set_active_hint(light->light_info->instance); - _light_instance_update_shadow(light,p_scenario,camera,cull_range); + if (light && VSG::storage->light_has_shadow(E->get()->base)) { + lights_with_shadow[directional_shadow_count++]=E->get(); + } -*/ //add to list - directional_light_ptr[directional_light_count++]=light->instance; + } + + VSG::scene_render->set_directional_shadow_count(directional_shadow_count); + + for(int i=0;i sorter; - sorter.sort(light_cull_result,light_cull_count); + + { //setup shadow maps + + //SortArray sorter; + //sorter.sort(light_cull_result,light_cull_count); for (int i=0;ilight_has_shadow(ins->base_rid) || !shadows_enabled) + if (!p_shadow_atlas.is_valid() || !VSG::storage->light_has_shadow(ins->base)) continue; - /* for far shadows? - if (ins->version == ins->light_info->last_version && rasterizer->light_instance_has_far_shadow(ins->light_info->instance)) - continue; // didn't change - */ + InstanceLightData * light = static_cast(ins->base_data); + + float coverage; + + { //compute coverage + + + Transform cam_xf = camera->transform; + float zn = camera_matrix.get_z_near(); + Plane p (cam_xf.origin + cam_xf.basis.get_axis(2) * -zn, -cam_xf.basis.get_axis(2) ); //camera near plane + + float vp_w,vp_h; //near plane size in screen coordinates + camera_matrix.get_viewport_size(vp_w,vp_h); + + + switch(VSG::storage->light_get_type(ins->base)) { + + case VS::LIGHT_OMNI: { + + float radius = VSG::storage->light_get_param(ins->base,VS::LIGHT_PARAM_RANGE); + + //get two points parallel to near plane + Vector3 points[2]={ + ins->transform.origin, + ins->transform.origin+cam_xf.basis.get_axis(0)*radius + }; + + if (!ortho) { + //if using perspetive, map them to near plane + for(int j=0;j<2;j++) { + if (p.distance_to(points[j]) < 0 ) { + points[j].z=-zn; //small hack to keep size constant when hitting the screen + + } + + p.intersects_segment(cam_xf.origin,points[j],&points[j]); //map to plane + } + + + } + + float screen_diameter = points[0].distance_to(points[1])*2; + coverage = screen_diameter / (vp_w+vp_h); + } break; + case VS::LIGHT_SPOT: { + + float radius = VSG::storage->light_get_param(ins->base,VS::LIGHT_PARAM_RANGE); + float angle = VSG::storage->light_get_param(ins->base,VS::LIGHT_PARAM_SPOT_ANGLE); + + + float w = radius*Math::sin(Math::deg2rad(angle)); + float d = radius*Math::cos(Math::deg2rad(angle)); + + + Vector3 base = ins->transform.origin-ins->transform.basis.get_axis(2).normalized()*d; + + Vector3 points[2]={ + base, + base+cam_xf.basis.get_axis(0)*w + }; + + if (!ortho) { + //if using perspetive, map them to near plane + for(int j=0;j<2;j++) { + if (p.distance_to(points[j]) < 0 ) { + points[j].z=-zn; //small hack to keep size constant when hitting the screen + + } + + p.intersects_segment(cam_xf.origin,points[j],&points[j]); //map to plane + } + + + } + + float screen_diameter = points[0].distance_to(points[1])*2; + coverage = screen_diameter / (vp_w+vp_h); + + + } break; + default: { + ERR_PRINT("Invalid Light Type"); + } + } + + } + + + if (light->shadow_dirty) { + light->last_version++; + light->shadow_dirty=false; + } + + + + bool redraw = VSG::scene_render->shadow_atlas_update_light(p_shadow_atlas,light->instance,coverage,light->last_version); + + if (redraw) { + //must redraw! + _light_instance_update_shadow(ins,camera,p_shadow_atlas,scenario,p_viewport_size); + } - _light_instance_update_shadow(ins,p_scenario,camera,cull_range); - ins->light_info->last_version=ins->version; } } -#endif + /* ENVIRONMENT */ RID environment; @@ -1492,7 +1994,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp - VSG::scene_render->render_scene(camera->transform, camera_matrix,ortho,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count,directional_light_ptr,directional_light_count,environment); + VSG::scene_render->render_scene(camera->transform, camera_matrix,ortho,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count+directional_light_count,environment,p_shadow_atlas); + } @@ -1505,9 +2008,77 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { _update_instance_aabb(p_instance); if (p_instance->update_materials) { + if (p_instance->base_type==VS::INSTANCE_MESH) { - p_instance->materials.resize(VSG::storage->mesh_get_surface_count(p_instance->base)); + //remove materials no longer used and un-own them + + int new_mat_count = VSG::storage->mesh_get_surface_count(p_instance->base); + for(int i=p_instance->materials.size()-1;i>=new_mat_count;i--) { + if (p_instance->materials[i].is_valid()) { + VSG::storage->material_remove_instance_owner(p_instance->materials[i],p_instance); + } + } + p_instance->materials.resize(new_mat_count); + } + + if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceGeometryData *geom = static_cast(p_instance->base_data); + + bool can_cast_shadows=true; + + if (p_instance->cast_shadows==VS::SHADOW_CASTING_SETTING_OFF) { + can_cast_shadows=false; + } else if (p_instance->material_override.is_valid()) { + can_cast_shadows=VSG::storage->material_casts_shadows(p_instance->material_override); + } else { + + RID mesh; + + if (p_instance->base_type==VS::INSTANCE_MESH) { + mesh=p_instance->base; + } else if (p_instance->base_type==VS::INSTANCE_MULTIMESH) { + + } + + if (mesh.is_valid()) { + + bool cast_shadows=false; + + for(int i=0;imaterials.size();i++) { + + + RID mat = p_instance->materials[i].is_valid()?p_instance->materials[i]:VSG::storage->mesh_surface_get_material(mesh,i); + + if (!mat.is_valid()) { + cast_shadows=true; + break; + } + + if (VSG::storage->material_casts_shadows(mat)) { + cast_shadows=true; + break; + } + } + + if (!cast_shadows) { + can_cast_shadows=false; + } + } + + } + + if (can_cast_shadows!=geom->can_cast_shadows) { + //ability to cast shadows change, let lights now + for (List::Element *E=geom->lighting.front();E;E=E->next()) { + InstanceLightData *light = static_cast(E->get()->base_data); + light->shadow_dirty=true; + } + + geom->can_cast_shadows=can_cast_shadows; + } } + } _update_instance(p_instance); @@ -1557,6 +2128,7 @@ bool VisualServerScene::free(RID p_rid) { instance_set_room(p_rid,RID()); instance_set_scenario(p_rid,RID()); instance_set_base(p_rid,RID()); + instance_geometry_set_material_override(p_rid,RID()); if (instance->skeleton.is_valid()) instance_attach_skeleton(p_rid,RID()); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 10a159f27a..1b62583dcf 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -195,6 +195,7 @@ public: //aabb stuff bool update_aabb; bool update_materials; + SelfList update_item; @@ -232,6 +233,11 @@ public: singleton->_instance_queue_update(this,true,true); } + virtual void base_material_changed() { + + singleton->_instance_queue_update(this,false,true); + } + Instance() : scenario_item(this), update_item(this), room_item(this) { @@ -282,10 +288,12 @@ public: List lighting; bool lighting_dirty; + bool can_cast_shadows; InstanceGeometryData() { lighting_dirty=false; + can_cast_shadows=true; } }; @@ -298,18 +306,18 @@ public: }; RID instance; - uint64_t last_hash; + uint64_t last_version; List::Element *D; // directional light in scenario - bool shadow_sirty; + bool shadow_dirty; List geometries; InstanceLightData() { - shadow_sirty=true; + shadow_dirty=true; D=NULL; - last_hash=0; + last_version=0; } }; @@ -360,8 +368,9 @@ public: _FORCE_INLINE_ void _update_instance_aabb(Instance *p_instance); _FORCE_INLINE_ void _update_dirty_instance(Instance *p_instance); + _FORCE_INLINE_ void _light_instance_update_shadow(Instance *p_instance,Camera* p_camera,RID p_shadow_atlas,Scenario* p_scenario,Size2 p_viewport_rect); - void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size); + void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas); void update_dirty_instances(); bool free(RID p_rid); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 583b42bfc1..18742aa21d 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -64,7 +64,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport) { if (!p_viewport->disable_3d && p_viewport->camera.is_valid()) { - VSG::scene->render_camera(p_viewport->camera,p_viewport->scenario,p_viewport->size); + VSG::scene->render_camera(p_viewport->camera,p_viewport->scenario,p_viewport->size,p_viewport->shadow_atlas); } if (!p_viewport->hide_canvas) { @@ -287,7 +287,8 @@ RID VisualServerViewport::viewport_create() { viewport->self=rid; viewport->hide_scenario=false; viewport->hide_canvas=false; - viewport->render_target=VSG::storage->render_target_create(); + viewport->render_target=VSG::storage->render_target_create(); + viewport->shadow_atlas=VSG::scene_render->shadow_atlas_create(); return rid; @@ -496,6 +497,27 @@ void VisualServerViewport::viewport_set_canvas_layer(RID p_viewport,RID p_canvas } +void VisualServerViewport::viewport_set_shadow_atlas_size(RID p_viewport,int p_size) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->shadow_atlas_size=p_size; + + VSG::scene_render->shadow_atlas_set_size( viewport->shadow_atlas, viewport->shadow_atlas_size); + +} + +void VisualServerViewport::viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport,int p_quadrant,int p_subdiv) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VSG::scene_render->shadow_atlas_set_quadrant_subdivision( viewport->shadow_atlas, p_quadrant, p_subdiv); + +} + + bool VisualServerViewport::free(RID p_rid) { Viewport * viewport = viewport_owner.getornull(p_rid); @@ -504,6 +526,7 @@ bool VisualServerViewport::free(RID p_rid) { VSG::storage->free( viewport->render_target ); + VSG::scene_render->free( viewport->shadow_atlas ); while(viewport->canvas_map.front()) { viewport_remove_canvas(p_rid,viewport->canvas_map.front()->key()); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index cba33a3b2d..a9b8fe4e94 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -36,6 +36,9 @@ public: bool disable_environment; bool disable_3d; + RID shadow_atlas; + int shadow_atlas_size; + VS::ViewportClearMode clear_mode; @@ -67,6 +70,7 @@ public: rendered_in_prev_frame=false; disable_environment=false; viewport_to_screen=0; + shadow_atlas_size=0; } }; @@ -129,6 +133,9 @@ public: void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform); void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer); + void viewport_set_shadow_atlas_size(RID p_viewport,int p_size); + void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport,int p_quadrant,int p_subdiv); + void draw_viewports(); bool free(RID p_rid); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 95636d2bc7..953448db52 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1021,7 +1021,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi break; } /* determine wether using 16 or 32 bits indices */ - if (array_len>(1<<16)) { + if (array_len>=(1<<16)) { elem_size=4; @@ -1089,6 +1089,454 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } +Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p_vertex_data,int p_vertex_len,DVector p_index_data,int p_index_len) const { + + + uint32_t offsets[ARRAY_MAX]; + + int total_elem_size=0; + + for (int i=0;i=(1<<16)) { + + elem_size=4; + + } else { + elem_size=2; + } + offsets[i]=elem_size; + continue; + } break; + default: { + ERR_FAIL_V( Array() ); + } + } + + offsets[i]=total_elem_size; + total_elem_size+=elem_size; + + + } + + Array ret; + ret.resize(VS::ARRAY_MAX); + + DVector::Read r = p_vertex_data.read(); + + for(int i=0;i arr_2d; + arr_2d.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_VERTEX) { + + DVector::Write w = arr_2d.write(); + + for(int j=0;j::Write w = arr_2d.write(); + + for(int j=0;j arr_3d; + arr_3d.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_VERTEX) { + + DVector::Write w = arr_3d.write(); + + for(int j=0;j::Write w = arr_3d.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_NORMAL) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len*4); + if (p_format&ARRAY_COMPRESS_TANGENT) { + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_COLOR) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_TEX_UV) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len); + + if (p_format&ARRAY_COMPRESS_TEX_UV2) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len*4); + if (p_format&ARRAY_COMPRESS_WEIGHTS) { + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j arr; + arr.resize(p_vertex_len*4); + if (p_format&ARRAY_FLAG_USE_16_BIT_BONES) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j::Read ir = p_index_data.read(); + + DVector arr; + arr.resize(p_index_len); + if (p_index_len<(1<<16)) { + + DVector::Write w = arr.write(); + + for(int j=0;j::Write w = arr.write(); + + for(int j=0;j vertex_data = mesh_surface_get_array(p_mesh,p_surface); + ERR_FAIL_COND_V(vertex_data.size()==0,Array()); + int vertex_len = mesh_surface_get_array_len(p_mesh,p_surface); + + DVector index_data = mesh_surface_get_index_array(p_mesh,p_surface); + int index_len = mesh_surface_get_array_index_len(p_mesh,p_surface); + + uint32_t format = mesh_surface_get_format(p_mesh,p_surface); + + + return _get_array_from_surface(format,vertex_data,vertex_len,index_data,index_len); + +} + void VisualServer::_bind_methods() { diff --git a/servers/visual_server.h b/servers/visual_server.h index 78769c17f7..c2d7aaecef 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -51,6 +51,8 @@ class VisualServer : public Object { DVector _shader_get_param_list(RID p_shader) const; void _camera_set_orthogonal(RID p_camera,float p_size,float p_z_near,float p_z_far); void _canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector& p_margins, const Color& p_modulate=Color(1,1,1)); + Array _get_array_from_surface(uint32_t p_format,DVector p_vertex_data,int p_vertex_len,DVector p_index_data,int p_index_len) const; + protected: RID _make_test_cube(); void _free_internal_rids(); @@ -258,10 +260,15 @@ public: virtual DVector mesh_surface_get_array(RID p_mesh, int p_surface) const=0; virtual DVector mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; + virtual Array mesh_surface_get_arrays(RID p_mesh,int p_surface) const; virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; + virtual Vector > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; + virtual Vector mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; + virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; virtual int mesh_get_surface_count(RID p_mesh) const=0; @@ -354,7 +361,6 @@ public: LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, - LIGHT_PARAM_SHADOW_SPLIT_4_OFFSET, LIGHT_PARAM_SHADOW_NORMAL_BIAS, LIGHT_PARAM_SHADOW_BIAS, LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE, @@ -372,10 +378,25 @@ public: virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; virtual void light_set_shader(RID p_light,RID p_shader)=0; + // omni light + enum LightOmniShadowMode { + LIGHT_OMNI_SHADOW_DUAL_PARABOLOID, + LIGHT_OMNI_SHADOW_CUBE, + }; + + virtual void light_omni_set_shadow_mode(RID p_light,LightOmniShadowMode p_mode)=0; + + // omni light + enum LightOmniShadowDetail { + LIGHT_OMNI_SHADOW_DETAIL_VERTICAL, + LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL + }; + + virtual void light_omni_set_shadow_detail(RID p_light,LightOmniShadowDetail p_detail)=0; + // directional light enum LightDirectionalShadowMode { LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL, - LIGHT_DIRECTIONAL_SHADOW_PERSPECTIVE, LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS, LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS }; @@ -475,6 +496,9 @@ public: virtual void viewport_set_global_canvas_transform(RID p_viewport,const Matrix32& p_transform)=0; virtual void viewport_set_canvas_layer(RID p_viewport,RID p_canvas,int p_layer)=0; + virtual void viewport_set_shadow_atlas_size(RID p_viewport,int p_size)=0; + virtual void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport,int p_quadrant,int p_subdiv)=0; + /* ENVIRONMENT API */ diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index e8207c9575..fa9e372eb3 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -1468,7 +1468,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con mr.push_back(a); } - p_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d,mr); + p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr); if (material.is_valid()) { p_mesh->surface_set_material(surface, material); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 13c69692c7..e5e8668df6 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1823,6 +1823,19 @@ void SpatialEditorViewport::_notification(int p_what) { surface->update(); } + + int shadowmap_size = Globals::get_singleton()->get("rendering/shadow_atlas/size"); + int atlas_q0 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); + int atlas_q1 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv"); + int atlas_q2 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); + int atlas_q3 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); + + viewport->set_shadow_atlas_size(shadowmap_size); + viewport->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0)); + viewport->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1)); + viewport->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2)); + viewport->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3)); + } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -2354,6 +2367,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed c->set_area_as_parent_rect(); viewport = memnew( Viewport ); viewport->set_disable_input(true); + c->add_child(viewport); surface = memnew( Control ); add_child(surface); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index b1accac762..cdd56bbac5 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -133,7 +133,7 @@ void EditorSpatialGizmo::add_lines(const Vector &p_lines, const Refadd_surface(Mesh::PRIMITIVE_LINES,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,a); mesh->surface_set_material(0,p_material); if (p_billboard) { @@ -182,7 +182,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref& p_material, a.resize(Mesh::ARRAY_MAX); a[Mesh::ARRAY_VERTEX]=vs; a[Mesh::ARRAY_TEX_UV]=uv; - mesh->add_surface(Mesh::PRIMITIVE_TRIANGLE_FAN,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLE_FAN,a); mesh->surface_set_material(0,p_material); if (true) { @@ -259,7 +259,7 @@ void EditorSpatialGizmo::add_handles(const Vector &p_handles, bool p_bi } a[VS::ARRAY_COLOR]=colors; - mesh->add_surface(Mesh::PRIMITIVE_POINTS,a); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_POINTS,a); mesh->surface_set_material(0,SpatialEditorGizmos::singleton->handle2_material); if (p_billboard) { @@ -2321,7 +2321,7 @@ void NavigationMeshSpatialGizmo::redraw() { Array a; a.resize(Mesh::ARRAY_MAX); a[0]=tmeshfaces; - m->add_surface(Mesh::PRIMITIVE_TRIANGLES,a); + m->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,a); m->surface_set_material(0,navmesh->is_enabled()?SpatialEditorGizmos::singleton->navmesh_solid_material:SpatialEditorGizmos::singleton->navmesh_solid_material_disabled); add_mesh(m); add_collision_segments(lines); @@ -3090,7 +3090,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { d.resize(VS::ARRAY_MAX); d[Mesh::ARRAY_VERTEX]=cursor_points; d[Mesh::ARRAY_COLOR]=cursor_colors; - pos3d_mesh->add_surface(Mesh::PRIMITIVE_LINES,d); + pos3d_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,d); pos3d_mesh->surface_set_material(0,mat); } @@ -3114,7 +3114,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { d.resize(VS::ARRAY_MAX); d[Mesh::ARRAY_VERTEX] = cursor_points; d[Mesh::ARRAY_COLOR] = cursor_colors; - listener_line_mesh->add_surface(Mesh::PRIMITIVE_LINES, d); + listener_line_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, d); listener_line_mesh->surface_set_material(0, mat); } -- cgit v1.2.3 From a7078a4be9f4c44a41e5c7e7a633169b53f78d48 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 11 Nov 2016 12:27:52 -0300 Subject: Done with lights and shadows (wonder if i'm missing something..) --- drivers/gles3/rasterizer_gles3.cpp | 2 +- drivers/gles3/rasterizer_scene_gles3.cpp | 786 ++++++++++++++++------------- drivers/gles3/rasterizer_scene_gles3.h | 91 ++-- drivers/gles3/rasterizer_storage_gles3.cpp | 41 +- drivers/gles3/rasterizer_storage_gles3.h | 11 +- drivers/gles3/shader_gles3.cpp | 9 + drivers/gles3/shader_gles3.h | 6 + drivers/gles3/shaders/scene.glsl | 254 ++++++---- scene/3d/light.cpp | 58 ++- scene/3d/light.h | 5 +- servers/visual/rasterizer.h | 7 +- servers/visual/visual_server_raster.h | 4 +- servers/visual/visual_server_scene.cpp | 2 +- servers/visual/visual_server_scene.h | 2 - servers/visual_server.h | 5 +- 15 files changed, 754 insertions(+), 529 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index e838020c45..c799cd12af 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -125,6 +125,7 @@ void RasterizerGLES3::begin_frame(){ storage->update_dirty_shaders(); storage->update_dirty_materials(); + scene->iteration(); } @@ -258,7 +259,6 @@ void RasterizerGLES3::register_config() { GLOBAL_DEF("rendering/gles3/use_nearest_mipmap_filter",false); GLOBAL_DEF("rendering/gles3/anisotropic_filter_level",4.0); - } RasterizerGLES3::RasterizerGLES3() diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 287801b597..4ae257abc4 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -131,8 +131,10 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); //interpola nearest (though nvidia can improve this) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Remove artifact on the edges of the shadowmap glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -559,11 +561,6 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) { light_instance->light=p_light; light_instance->light_ptr=storage->light_owner.getornull(p_light); - glGenBuffers(1, &light_instance->light_ubo); - glBindBuffer(GL_UNIFORM_BUFFER, light_instance->light_ubo); - glBufferData(GL_UNIFORM_BUFFER, sizeof(LightInstance::LightDataUBO), NULL, GL_DYNAMIC_DRAW); - glBindBuffer(GL_UNIFORM_BUFFER, 0); - ERR_FAIL_COND_V(!light_instance->light_ptr,RID()); light_instance->self=light_instance_owner.make_rid(light_instance); @@ -818,9 +815,50 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } -void RasterizerSceneGLES3::_setup_light(LightInstance *p_light) { +void RasterizerSceneGLES3::_setup_light(RenderList::Element *e) { + + int omni_indices[16]; + int omni_count=0; + int spot_indices[16]; + int spot_count=0; + + int maxobj = MIN(16,state.max_forward_lights_per_object); + + int lc = e->instance->light_instances.size(); + if (lc) { + + const RID* lights=e->instance->light_instances.ptr(); + + for(int i=0;ilast_pass!=render_pass) //not visible + continue; + + if (li->light_ptr->type==VS::LIGHT_OMNI) { + if (omni_countinstance->layer_mask&li->light_ptr->cull_mask) { + omni_indices[omni_count++]=li->light_index; + } + } + + if (li->light_ptr->type==VS::LIGHT_SPOT) { + if (spot_countinstance->layer_mask&li->light_ptr->cull_mask) { + spot_indices[spot_count++]=li->light_index; + } + } + } + } + + state.scene_shader.set_uniform(SceneShaderGLES3::OMNI_LIGHT_COUNT,omni_count); + + if (omni_count) { + glUniform1iv(state.scene_shader.get_uniform(SceneShaderGLES3::OMNI_LIGHT_INDICES),omni_count,omni_indices); + } + + state.scene_shader.set_uniform(SceneShaderGLES3::SPOT_LIGHT_COUNT,spot_count); + if (spot_count) { + glUniform1iv(state.scene_shader.get_uniform(SceneShaderGLES3::SPOT_LIGHT_INDICES),spot_count,spot_indices); + } - glBindBufferBase(GL_UNIFORM_BUFFER,3,p_light->light_ubo); //bind light uniform } @@ -894,7 +932,7 @@ void RasterizerSceneGLES3::_set_cull(bool p_front,bool p_reverse_cull) { -void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass,bool p_shadow) { +void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass,bool p_shadow,bool p_directional_add) { if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { //p_reverse_cull=!p_reverse_cull; @@ -906,7 +944,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glBindBufferBase(GL_UNIFORM_BUFFER,0,state.scene_ubo); //bind globals ubo - if (!p_shadow) { + if (!p_shadow && !p_directional_add) { glBindBufferBase(GL_UNIFORM_BUFFER,2,state.env_radiance_ubo); //bind environment radiance info glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-1); glBindTexture(GL_TEXTURE_2D,state.brdf_texture); @@ -934,160 +972,147 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.current_line_width=-1; state.current_depth_draw=-1; - glDisable(GL_BLEND); - RasterizerStorageGLES3::Material* prev_material=NULL; RasterizerStorageGLES3::Geometry* prev_geometry=NULL; VS::InstanceType prev_base_type = VS::INSTANCE_MAX; - int prev_light_type=-1; - int prev_light_index=-1; - int prev_blend=-1; int current_blend_mode=-1; - bool prev_additive=false; + int prev_shading=-1; + + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); //by default unshaded (easier to set) + + bool first=true; for (int i=0;imaterial; - bool rebind=i==0; - - int light_type=(e->sort_key>>RenderList::SORT_KEY_LIGHT_TYPE_SHIFT)&0xF; - int light_index=(e->sort_key>>RenderList::SORT_KEY_LIGHT_INDEX_SHIFT)&0xFFFF; + bool rebind=first; - bool additive=false; + int shading = (e->sort_key>>RenderList::SORT_KEY_SHADING_SHIFT)&RenderList::SORT_KEY_SHADING_MASK; if (!p_shadow) { - if (light_type!=prev_light_type /* || receive_shadows_state!=prev_receive_shadows_state*/) { - if (material->shader->spatial.unshaded/* || current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,false); + + if (p_directional_add) { + if (e->sort_key&RenderList::SORT_KEY_UNSHADED_FLAG || !(e->instance->layer_mask&directional_light->light_ptr->cull_mask)) { + continue; + } + + shading&=~1; //ignore the ignore directional for base pass + } + + if (shading!=prev_shading) { + + if (e->sort_key&RenderList::SORT_KEY_UNSHADED_FLAG) { + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13,false); + //state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); } else { state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,light_type!=0xF); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,(light_type&3)==VS::LIGHT_DIRECTIONAL); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,(light_type&0xF)==VS::LIGHT_OMNI); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,(light_type&0xF)==VS::LIGHT_SPOT); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,!p_directional_add); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5,shadow_filter_mode==SHADOW_FILTER_PCF5); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13,shadow_filter_mode==SHADOW_FILTER_PCF13); - if ((light_type&3)==VS::LIGHT_DIRECTIONAL) { - if (light_instances[light_index]->light_ptr->shadow) { + if (p_directional_add || (directional_light && (e->sort_key&RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG)==0)) { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,true); + + if (directional_light->light_ptr->shadow) { state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,true); - switch(light_instances[light_index]->light_ptr->directional_shadow_mode) { + switch(directional_light->light_ptr->directional_shadow_mode) { case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: break; //none - case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,true); break; - case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,true); break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,true); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,directional_light->light_ptr->directional_blend_splits); + break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,true); + state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,directional_light->light_ptr->directional_blend_splits); + break; } } - } + } } rebind=true; } - - if (!*e->additive_ptr) { - - additive=false; - *e->additive_ptr=true; - } else { - additive=true; - } - - bool desired_blend=false; - int desired_blend_mode=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX; - - if (additive) { - desired_blend=true; - desired_blend_mode=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD; - } else { - desired_blend=p_alpha_pass; - desired_blend_mode=material->shader->spatial.blend_mode; - } - - if (prev_blend!=desired_blend) { - - if (desired_blend) { - glEnable(GL_BLEND); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { - glColorMask(1,1,1,0); - } + if (p_alpha_pass || p_directional_add) { + int desired_blend_mode; + if (p_directional_add) { + desired_blend_mode=RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD; } else { - glDisable(GL_BLEND); - glColorMask(1,1,1,1); + desired_blend_mode=material->shader->spatial.blend_mode; } - prev_blend=desired_blend; - } + if (desired_blend_mode!=current_blend_mode) { - if (desired_blend && desired_blend_mode!=current_blend_mode) { + switch(desired_blend_mode) { - switch(desired_blend_mode) { + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { - glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: { - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: { + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE); - glBlendEquation(GL_FUNC_ADD); - glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE); + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: { - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: { + glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); + glBlendFunc(GL_SRC_ALPHA,GL_ONE); + } break; + case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { + glBlendEquation(GL_FUNC_ADD); + if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + else { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } - glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - glBlendFunc(GL_SRC_ALPHA,GL_ONE); - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { - glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } + } break; - } break; + } + current_blend_mode=desired_blend_mode; } - current_blend_mode=desired_blend_mode; } - if (light_index!=prev_light_index) { - if (light_index!=0xFFFF) { //not unshaded - _setup_light(light_instances[light_index]); - } - } } @@ -1098,17 +1123,16 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e // _rinfo.mat_change_count++; } + if (!(e->sort_key&RenderList::SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) { + _setup_light(e); + } + if (prev_base_type != e->instance->base_type || prev_geometry!=e->geometry) { _setup_geometry(e); } - if (!p_shadow && (rebind || prev_additive!=additive)) { - state.scene_shader.set_uniform(SceneShaderGLES3::NO_AMBIENT_LIGHT, additive); - - } - _set_cull(e->sort_key&RenderList::SORT_KEY_MIRROR_FLAG,p_reverse_cull); state.scene_shader.set_uniform(SceneShaderGLES3::NORMAL_MULT, e->instance->mirror?-1.0:1.0); @@ -1120,9 +1144,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e prev_material=material; prev_base_type=e->instance->base_type; prev_geometry=e->geometry; - prev_additive=additive; - prev_light_type=light_type; - prev_light_index=light_index; + prev_shading=shading; + first=false; } @@ -1133,14 +1156,14 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_DIRECTIONAL,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_OMNI,false); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_SPOT,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM4,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM2,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5,false); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13,false); } @@ -1214,8 +1237,6 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g e->material=m; e->instance=p_instance; e->owner=p_owner; - e->additive=false; - e->additive_ptr=&e->additive; e->sort_key=0; if (e->geometry->last_pass!=render_pass) { @@ -1223,6 +1244,9 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g e->geometry->index=current_geometry_index++; } + if (!p_shadow && directional_light && (directional_light->light_ptr->cull_mask&e->instance->layer_mask)==0) { + e->sort_key|=RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG; + } e->sort_key|=uint64_t(e->geometry->index)<sort_key|=uint64_t(e->instance->base_type)<additive_ptr=&oe->additive; } } @@ -1261,106 +1284,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g //e->light_type=0xFF; // no lights! - - - if (shadow || m->shader->spatial.unshaded /*|| current_debug==VS::SCENARIO_DEBUG_SHADELESS*/) { - e->sort_key|=RenderList::SORT_KEY_LIGHT_INDEX_UNSHADED; - e->sort_key|=uint64_t(0xF)<sort_key|=uint64_t(0xFFFF)<base->shadow_enabled) { - light_type|=0x8; - if (directional_lights[i]->base->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) - light_type|=0x10; - else if (directional_lights[i]->base->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) - light_type|=0x30; - - } -*/ - - RenderList::Element *ec; - if (duplicate) { - ec = render_list.add_element(); - copymem(ec,e,sizeof(RenderList::Element)); - } else { - - ec=e; - duplicate=true; - } - - ec->additive_ptr=&e->additive; - - ec->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; - ec->sort_key|=uint64_t(directional_light_instances[i]->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; - ec->sort_key|=uint64_t(VS::LIGHT_DIRECTIONAL) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; //this is zero byt whathever - - if (directional_light_instances[i]->light_ptr->shadow) { - //add proper flags for directional shadow mode - ec->sort_key|=uint64_t(directional_light_instances[i]->light_ptr->directional_shadow_mode+1) << (RenderList::SORT_KEY_LIGHT_TYPE_SHIFT+2); - } - - lit=true; - } - - - const RID *liptr = p_instance->light_instances.ptr(); - int ilc=p_instance->light_instances.size(); - - - - for(int i=0;ilast_pass!=render_pass) //lit by light not in visible scene - continue; - - -// if (li->base->shadow_enabled) { -// light_type|=0x8; -// } - - RenderList::Element *ec; - if (duplicate) { - - ec = render_list.add_element(); - copymem(ec,e,sizeof(RenderList::Element)); - } else { - - duplicate=true; - ec=e; - } - - ec->additive_ptr=&e->additive; - - ec->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; - ec->sort_key|=uint64_t(li->light_index) << RenderList::SORT_KEY_LIGHT_INDEX_SHIFT; - ec->sort_key|=uint64_t(li->light_ptr->type) << RenderList::SORT_KEY_LIGHT_TYPE_SHIFT; - - lit=true; - } - - - if (!lit) { - e->sort_key&=~RenderList::SORT_KEY_LIGHT_MASK; - e->sort_key|=uint64_t(0xE)<sort_key|=uint64_t(0xFFFF)<sort_key|=RenderList::SORT_KEY_UNSHADED_FLAG; } - - } void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,const CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { @@ -1534,161 +1461,202 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,const CameraMatri } -void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cull_count,const Transform& p_camera_inverse_transform,const CameraMatrix& p_camera_projection,RID p_shadow_atlas) { +void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& p_camera_inverse_transform) { + LightInstance *li = directional_lights[p_index]; - ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + LightDataUBO ubo_data; //used for filling - directional_light_instance_count=0; - light_instance_count=0; + float sign = li->light_ptr->negative?-1:1; - for(int i=0;ilight_ptr->color.to_linear(); + ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[3]=0; - ERR_BREAK( i>=RenderList::MAX_LIGHTS ); + //omni, keep at 0 + ubo_data.light_pos_inv_radius[0]=0.0; + ubo_data.light_pos_inv_radius[1]=0.0; + ubo_data.light_pos_inv_radius[2]=0.0; + ubo_data.light_pos_inv_radius[3]=0.0; - LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]); + Vector3 direction = p_camera_inverse_transform.basis.xform(li->transform.basis.xform(Vector3(0,0,-1))).normalized(); + ubo_data.light_direction_attenuation[0]=direction.x; + ubo_data.light_direction_attenuation[1]=direction.y; + ubo_data.light_direction_attenuation[2]=direction.z; + ubo_data.light_direction_attenuation[3]=1.0; - switch(li->light_ptr->type) { + ubo_data.light_params[0]=0; + ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + ubo_data.light_params[2]=0; + ubo_data.light_params[3]=0; - case VS::LIGHT_DIRECTIONAL: { + Color shadow_color = li->light_ptr->shadow_color.to_linear(); + ubo_data.light_shadow_color[0]=shadow_color.r; + ubo_data.light_shadow_color[1]=shadow_color.g; + ubo_data.light_shadow_color[2]=shadow_color.b; + ubo_data.light_shadow_color[3]=1.0; - ERR_FAIL_COND( directional_light_instance_count >= RenderList::MAX_LIGHTS); - directional_light_instances[directional_light_instance_count++]=li; - Color linear_col = li->light_ptr->color.to_linear(); - li->light_ubo_data.light_color_energy[0]=linear_col.r; - li->light_ubo_data.light_color_energy[1]=linear_col.g; - li->light_ubo_data.light_color_energy[2]=linear_col.b; - li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + if (li->light_ptr->shadow) { - //omni, keep at 0 - li->light_ubo_data.light_pos_inv_radius[0]=0.0; - li->light_ubo_data.light_pos_inv_radius[1]=0.0; - li->light_ubo_data.light_pos_inv_radius[2]=0.0; - li->light_ubo_data.light_pos_inv_radius[3]=0.0; + int shadow_count=0; - Vector3 direction = p_camera_inverse_transform.basis.xform(li->transform.basis.xform(Vector3(0,0,-1))).normalized(); - li->light_ubo_data.light_direction_attenuation[0]=direction.x; - li->light_ubo_data.light_direction_attenuation[1]=direction.y; - li->light_ubo_data.light_direction_attenuation[2]=direction.z; - li->light_ubo_data.light_direction_attenuation[3]=1.0; + switch(li->light_ptr->directional_shadow_mode) { + case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: { + shadow_count=1; + } break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: { + shadow_count=2; + } break; + case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: { + shadow_count=4; + } break; - li->light_ubo_data.light_params[0]=0; - li->light_ubo_data.light_params[1]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; - li->light_ubo_data.light_params[2]=0; - li->light_ubo_data.light_params[3]=0; + } - if (li->light_ptr->shadow) { + for(int j=0;jlight_ptr->directional_shadow_mode) { - case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: { - shadow_count=1; - } break; - case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: { - shadow_count=2; - } break; - case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: { - shadow_count=4; - } break; + uint32_t x=li->directional_rect.pos.x; + uint32_t y=li->directional_rect.pos.y; + uint32_t width=li->directional_rect.size.x; + uint32_t height=li->directional_rect.size.y; - } - for(int j=0;jlight_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) { - uint32_t x=li->directional_rect.pos.x; - uint32_t y=li->directional_rect.pos.y; - uint32_t width=li->directional_rect.size.x; - uint32_t height=li->directional_rect.size.y; + width/=2; + height/=2; + if (j==0) { - if (li->light_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) { + } else if (j==1) { + x+=width; + } else if (j==2) { + y+=height; + } else if (j==3) { + x+=width; + y+=height; + } - width/=2; - height/=2; - if (j==0) { - } else if (j==1) { - x+=width; - } else if (j==2) { - y+=height; - } else if (j==3) { - x+=width; - y+=height; + } else if (li->light_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) { - } + height/=2; + if (j==0) { + } else { + y+=height; + } - } else if (li->light_ptr->directional_shadow_mode==VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) { + } - height/=2; + ubo_data.shadow_split_offsets[j]=1.0/li->shadow_transform[j].split; - if (j==0) { + Transform modelview = (p_camera_inverse_transform * li->shadow_transform[j].transform).inverse(); - } else { - y+=height; - } + CameraMatrix bias; + bias.set_light_bias(); + CameraMatrix rectm; + Rect2 atlas_rect = Rect2(float(x)/directional_shadow.size,float(y)/directional_shadow.size,float(width)/directional_shadow.size,float(height)/directional_shadow.size); + rectm.set_light_atlas_rect(atlas_rect); - } +// print_line("atlas rect: "+atlas_rect); - li->light_ubo_data.shadow_split_offsets[j]=1.0/li->shadow_transform[j].split; + CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview; - Transform modelview = (p_camera_inverse_transform * li->shadow_transform[j].transform).inverse(); + store_camera(shadow_mtx,&ubo_data.shadow_matrix1[16*j]); - CameraMatrix bias; - bias.set_light_bias(); - CameraMatrix rectm; - Rect2 atlas_rect = Rect2(float(x)/directional_shadow.size,float(y)/directional_shadow.size,float(width)/directional_shadow.size,float(height)/directional_shadow.size); - rectm.set_light_atlas_rect(atlas_rect); + ubo_data.light_clamp[0]=atlas_rect.pos.x; + ubo_data.light_clamp[1]=atlas_rect.pos.y; + ubo_data.light_clamp[2]=atlas_rect.size.x; + ubo_data.light_clamp[3]=atlas_rect.size.y; -// print_line("atlas rect: "+atlas_rect); + } - CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview; + } - store_camera(shadow_mtx,&li->light_ubo_data.shadow_matrix1[16*j]); + glBindBuffer(GL_UNIFORM_BUFFER, state.directional_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(LightDataUBO), &ubo_data); + glBindBuffer(GL_UNIFORM_BUFFER, 0); - li->light_ubo_data.light_clamp[0]=atlas_rect.pos.x; - li->light_ubo_data.light_clamp[1]=atlas_rect.pos.y; - li->light_ubo_data.light_clamp[2]=atlas_rect.size.x; - li->light_ubo_data.light_clamp[3]=atlas_rect.size.y; + directional_light=li; - } + glBindBufferBase(GL_UNIFORM_BUFFER,3,state.directional_ubo); +} + +void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cull_count,const Transform& p_camera_inverse_transform,const CameraMatrix& p_camera_projection,RID p_shadow_atlas) { + + + state.omni_light_count=0; + state.spot_light_count=0; + state.directional_light_count=0; + + directional_light=NULL; + + ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + + + for(int i=0;i=RenderList::MAX_LIGHTS ); + + LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]); + + LightDataUBO ubo_data; //used for filling + + switch(li->light_ptr->type) { + + case VS::LIGHT_DIRECTIONAL: { + + if (state.directional_light_countlight_ptr->negative?-1:1; + Color linear_col = li->light_ptr->color.to_linear(); - li->light_ubo_data.light_color_energy[0]=linear_col.r; - li->light_ubo_data.light_color_energy[1]=linear_col.g; - li->light_ubo_data.light_color_energy[2]=linear_col.b; - li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[3]=0; + Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); //directional, keep at 0 - li->light_ubo_data.light_pos_inv_radius[0]=pos.x; - li->light_ubo_data.light_pos_inv_radius[1]=pos.y; - li->light_ubo_data.light_pos_inv_radius[2]=pos.z; - li->light_ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); - - li->light_ubo_data.light_direction_attenuation[0]=0; - li->light_ubo_data.light_direction_attenuation[1]=0; - li->light_ubo_data.light_direction_attenuation[2]=0; - li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; - - li->light_ubo_data.light_params[0]=0; - li->light_ubo_data.light_params[1]=0; - li->light_ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; - li->light_ubo_data.light_params[3]=0; - + ubo_data.light_pos_inv_radius[0]=pos.x; + ubo_data.light_pos_inv_radius[1]=pos.y; + ubo_data.light_pos_inv_radius[2]=pos.z; + ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); + + ubo_data.light_direction_attenuation[0]=0; + ubo_data.light_direction_attenuation[1]=0; + ubo_data.light_direction_attenuation[2]=0; + ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; + + ubo_data.light_params[0]=0; + ubo_data.light_params[1]=0; + ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + ubo_data.light_params[3]=0; + + Color shadow_color = li->light_ptr->shadow_color.to_linear(); + ubo_data.light_shadow_color[0]=shadow_color.r; + ubo_data.light_shadow_color[1]=shadow_color.g; + ubo_data.light_shadow_color[2]=shadow_color.b; + ubo_data.light_shadow_color[3]=1.0; if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { // fill in the shadow information @@ -1724,17 +1692,21 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu Transform proj = (p_camera_inverse_transform * li->transform).inverse(); - store_transform(proj,li->light_ubo_data.shadow_matrix1); + store_transform(proj,ubo_data.shadow_matrix1); - li->light_ubo_data.light_params[3]=1.0; //means it has shadow - li->light_ubo_data.light_clamp[0]=float(x)/atlas_size; - li->light_ubo_data.light_clamp[1]=float(y)/atlas_size; - li->light_ubo_data.light_clamp[2]=float(width)/atlas_size; - li->light_ubo_data.light_clamp[3]=float(height)/atlas_size; + ubo_data.light_params[3]=1.0; //means it has shadow + ubo_data.light_clamp[0]=float(x)/atlas_size; + ubo_data.light_clamp[1]=float(y)/atlas_size; + ubo_data.light_clamp[2]=float(width)/atlas_size; + ubo_data.light_clamp[3]=float(height)/atlas_size; } + li->light_index=state.omni_light_count; + copymem(&state.omni_array_tmp[li->light_index*state.ubo_light_size],&ubo_data,state.ubo_light_size); + state.omni_light_count++; + #if 0 @@ -1746,30 +1718,38 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } break; case VS::LIGHT_SPOT: { + float sign = li->light_ptr->negative?-1:1; + Color linear_col = li->light_ptr->color.to_linear(); - li->light_ubo_data.light_color_energy[0]=linear_col.r; - li->light_ubo_data.light_color_energy[1]=linear_col.g; - li->light_ubo_data.light_color_energy[2]=linear_col.b; - li->light_ubo_data.light_color_energy[3]=li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + ubo_data.light_color_energy[0]=linear_col.r*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[1]=linear_col.g*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[2]=linear_col.b*sign*li->light_ptr->param[VS::LIGHT_PARAM_ENERGY];; + ubo_data.light_color_energy[3]=0; Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); //directional, keep at 0 - li->light_ubo_data.light_pos_inv_radius[0]=pos.x; - li->light_ubo_data.light_pos_inv_radius[1]=pos.y; - li->light_ubo_data.light_pos_inv_radius[2]=pos.z; - li->light_ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); + ubo_data.light_pos_inv_radius[0]=pos.x; + ubo_data.light_pos_inv_radius[1]=pos.y; + ubo_data.light_pos_inv_radius[2]=pos.z; + ubo_data.light_pos_inv_radius[3]=1.0/MAX(0.001,li->light_ptr->param[VS::LIGHT_PARAM_RANGE]); Vector3 direction = p_camera_inverse_transform.basis.xform(li->transform.basis.xform(Vector3(0,0,-1))).normalized(); - li->light_ubo_data.light_direction_attenuation[0]=direction.x; - li->light_ubo_data.light_direction_attenuation[1]=direction.y; - li->light_ubo_data.light_direction_attenuation[2]=direction.z; - li->light_ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; - - li->light_ubo_data.light_params[0]=li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION]; - li->light_ubo_data.light_params[1]=Math::cos(Math::deg2rad(li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ANGLE])); - li->light_ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; - li->light_ubo_data.light_params[3]=0; + ubo_data.light_direction_attenuation[0]=direction.x; + ubo_data.light_direction_attenuation[1]=direction.y; + ubo_data.light_direction_attenuation[2]=direction.z; + ubo_data.light_direction_attenuation[3]=li->light_ptr->param[VS::LIGHT_PARAM_ATTENUATION]; + + ubo_data.light_params[0]=li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION]; + ubo_data.light_params[1]=Math::cos(Math::deg2rad(li->light_ptr->param[VS::LIGHT_PARAM_SPOT_ANGLE])); + ubo_data.light_params[2]=li->light_ptr->param[VS::LIGHT_PARAM_SPECULAR]; + ubo_data.light_params[3]=0; + + Color shadow_color = li->light_ptr->shadow_color.to_linear(); + ubo_data.light_shadow_color[0]=shadow_color.r; + ubo_data.light_shadow_color[1]=shadow_color.g; + ubo_data.light_shadow_color[2]=shadow_color.b; + ubo_data.light_shadow_color[3]=1.0; if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { // fill in the shadow information @@ -1796,11 +1776,11 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu Rect2 rect(float(x)/atlas_size,float(y)/atlas_size,float(width)/atlas_size,float(height)/atlas_size); - li->light_ubo_data.light_params[3]=1.0; //means it has shadow - li->light_ubo_data.light_clamp[0]=rect.pos.x; - li->light_ubo_data.light_clamp[1]=rect.pos.y; - li->light_ubo_data.light_clamp[2]=rect.size.x; - li->light_ubo_data.light_clamp[3]=rect.size.y; + ubo_data.light_params[3]=1.0; //means it has shadow + ubo_data.light_clamp[0]=rect.pos.x; + ubo_data.light_clamp[1]=rect.pos.y; + ubo_data.light_clamp[2]=rect.size.x; + ubo_data.light_clamp[3]=rect.size.y; Transform modelview = (p_camera_inverse_transform * li->transform).inverse(); @@ -1811,10 +1791,15 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[0].camera * modelview; - store_camera(shadow_mtx,li->light_ubo_data.shadow_matrix1); + store_camera(shadow_mtx,ubo_data.shadow_matrix1); } + + li->light_index=state.spot_light_count; + copymem(&state.spot_array_tmp[li->light_index*state.ubo_light_size],&ubo_data,state.ubo_light_size); + state.spot_light_count++; + #if 0 if (li->light_ptr->shadow_enabled) { CameraMatrix bias; @@ -1829,24 +1814,34 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } - /* make light hash */ + li->last_pass=render_pass; - // actually, not really a hash, but helps to sort the lights - // and avoid recompiling redudant shader versions + //update UBO for forward rendering, blit to texture for clustered + } - li->last_pass=render_pass; - li->light_index=i; - //update UBO for forward rendering, blit to texture for clustered - glBindBuffer(GL_UNIFORM_BUFFER, li->light_ubo); - glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(LightInstance::LightDataUBO), &li->light_ubo_data); + if (state.omni_light_count) { + + glBindBuffer(GL_UNIFORM_BUFFER, state.omni_array_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, state.omni_light_count*state.ubo_light_size, state.omni_array_tmp); glBindBuffer(GL_UNIFORM_BUFFER, 0); - light_instances[i]=li; - light_instance_count++; + glBindBufferBase(GL_UNIFORM_BUFFER,4,state.omni_array_ubo); } + + if (state.spot_light_count) { + + glBindBuffer(GL_UNIFORM_BUFFER, state.spot_array_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, state.spot_light_count*state.ubo_light_size, state.spot_array_tmp); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + glBindBufferBase(GL_UNIFORM_BUFFER,5,state.spot_array_ubo); + } + + + } void RasterizerSceneGLES3::_copy_screen() { @@ -1969,6 +1964,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C //first of all, make a new render pass render_pass++; + //fill up ubo Environment *env = environment_owner.getornull(p_environment); @@ -2075,7 +2071,20 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false); + if (state.directional_light_count==0) { + directional_light=NULL; + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,false); + } else { + for(int i=0;i0) { + glEnable(GL_BLEND); + } + _setup_directional_light(i,p_cam_transform.affine_inverse()); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,i>0); + + } + } state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); @@ -2107,9 +2116,20 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C render_list.sort_by_depth(true); - _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false); + if (state.directional_light_count==0) { + directional_light=NULL; + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false,false); + } else { + for(int i=0;i0); + + } + } + _copy_to_front_buffer(env); /* if (shadow_atlas) { @@ -2123,7 +2143,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } */ - if (directional_shadow.fbo) { + if (false && directional_shadow.fbo) { //_copy_texture_to_front_buffer(shadow_atlas->depth); storage->canvas->canvas_begin(); @@ -2285,6 +2305,8 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa render_pass++; + directional_light=NULL; + LightInstance *light_instance = light_instance_owner.getornull(p_light); ERR_FAIL_COND(!light_instance); RasterizerStorageGLES3::Light *light = storage->light_owner.getornull(light_instance->light); @@ -2512,7 +2534,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,true); - _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true); + _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,false); @@ -2593,7 +2615,6 @@ bool RasterizerSceneGLES3::free(RID p_rid) { } - glDeleteBuffers(1,&light_instance->light_ubo); light_instance_owner.free(p_rid); memdelete(light_instance); @@ -2860,6 +2881,53 @@ void RasterizerSceneGLES3::initialize() { ERR_PRINT("Directional shadow framebuffer status invalid"); } } + + { + //spot and omni ubos + + int max_ubo_size; + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE,&max_ubo_size); + const int ubo_light_size=160; + state.ubo_light_size=ubo_light_size; + state.max_ubo_lights=max_ubo_size/ubo_light_size; + + state.spot_array_tmp = (uint8_t*)memalloc(ubo_light_size*state.max_ubo_lights); + state.omni_array_tmp = (uint8_t*)memalloc(ubo_light_size*state.max_ubo_lights); + + + glGenBuffers(1, &state.spot_array_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.spot_array_ubo); + glBufferData(GL_UNIFORM_BUFFER, ubo_light_size*state.max_ubo_lights, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + glGenBuffers(1, &state.omni_array_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.omni_array_ubo); + glBufferData(GL_UNIFORM_BUFFER, ubo_light_size*state.max_ubo_lights, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + glGenBuffers(1, &state.directional_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.directional_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(LightDataUBO), NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + state.max_forward_lights_per_object=8; + + state.scene_shader.add_custom_define("#define MAX_LIGHT_DATA_STRUCTS "+itos(state.max_ubo_lights)+"\n"); + state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS "+itos(state.max_forward_lights_per_object)+"\n"); + + + + } + + GLOBAL_DEF("rendering/gles3/shadow_filter_mode",1); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/shadow_filter_mode",PropertyInfo(Variant::INT,"rendering/gles3/shadow_filter_mode",PROPERTY_HINT_ENUM,"Disabled,PCF5,PCF13")); + shadow_filter_mode=SHADOW_FILTER_NEAREST; + +} + +void RasterizerSceneGLES3::iteration() { + + shadow_filter_mode=ShadowFilterMode(int(Globals::get_singleton()->get("rendering/gles3/shadow_filter_mode"))); } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index d7beebbcf6..24b6a36fcc 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -8,6 +8,15 @@ class RasterizerSceneGLES3 : public RasterizerScene { public: + enum ShadowFilterMode { + SHADOW_FILTER_NEAREST, + SHADOW_FILTER_PCF5, + SHADOW_FILTER_PCF13, + }; + + + ShadowFilterMode shadow_filter_mode; + uint64_t shadow_atlas_realloc_tolerance_msec; @@ -27,6 +36,7 @@ public: struct State { + bool texscreen_copied; int current_blend_mode; float current_line_width; @@ -73,6 +83,22 @@ public: GLuint skybox_verts; GLuint skybox_array; + GLuint directional_ubo; + + GLuint spot_array_ubo; + GLuint omni_array_ubo; + + uint32_t ubo_light_size; + uint8_t *spot_array_tmp; + uint8_t *omni_array_tmp; + + int max_ubo_lights; + int max_forward_lights_per_object; + + int spot_light_count; + int omni_light_count; + int directional_light_count; + bool cull_front; } state; @@ -204,6 +230,22 @@ public: /* LIGHT INSTANCE */ + struct LightDataUBO { + + float light_pos_inv_radius[4]; + float light_direction_attenuation[4]; + float light_color_energy[4]; + float light_params[4]; //spot attenuation, spot angle, specular, shadow enabled + float light_clamp[4]; + float light_shadow_color[4]; + float shadow_matrix1[16]; //up to here for spot and omni, rest is for directional + float shadow_matrix2[16]; + float shadow_matrix3[16]; + float shadow_matrix4[16]; + float shadow_split_offsets[4]; + + }; + struct LightInstance : public RID_Data { struct ShadowTransform { @@ -214,20 +256,6 @@ public: float split; }; - struct LightDataUBO { - - float light_pos_inv_radius[4]; - float light_direction_attenuation[4]; - float light_color_energy[4]; - float light_params[4]; //cone attenuation, specular, shadow darkening, - float light_clamp[4]; //cone attenuation, specular, shadow darkening, - float shadow_split_offsets[4]; - float shadow_matrix1[16]; - float shadow_matrix2[16]; - float shadow_matrix3[16]; - float shadow_matrix4[16]; - - } light_ubo_data; ShadowTransform shadow_transform[4]; @@ -241,8 +269,6 @@ public: Vector3 spot_vector; float linear_att; - GLuint light_ubo; - uint64_t shadow_pass; uint64_t last_scene_pass; uint64_t last_scene_shadow_pass; @@ -280,14 +306,16 @@ public: SORT_FLAG_INSTANCING=2, MAX_DIRECTIONAL_LIGHTS=16, MAX_LIGHTS=4096, - SORT_KEY_DEPTH_LAYER_SHIFT=58, - SORT_KEY_LIGHT_TYPE_SHIFT=54, //type is most important - SORT_KEY_LIGHT_INDEX_SHIFT=38, //type is most important - SORT_KEY_LIGHT_INDEX_UNSHADED=uint64_t(0xF) << SORT_KEY_LIGHT_TYPE_SHIFT, //type is most important - SORT_KEY_LIGHT_MASK=(uint64_t(0xFFFFF) << SORT_KEY_LIGHT_INDEX_SHIFT), //type is most important - SORT_KEY_MATERIAL_INDEX_SHIFT=22, - SORT_KEY_GEOMETRY_INDEX_SHIFT=6, - SORT_KEY_GEOMETRY_TYPE_SHIFT=2, + + + SORT_KEY_DEPTH_LAYER_SHIFT=60, + SORT_KEY_UNSHADED_FLAG=uint64_t(1)<<59, + SORT_KEY_NO_DIRECTIONAL_FLAG=uint64_t(1)<<58, + SORT_KEY_SHADING_SHIFT=58, + SORT_KEY_SHADING_MASK=3, + SORT_KEY_MATERIAL_INDEX_SHIFT=40, + SORT_KEY_GEOMETRY_INDEX_SHIFT=20, + SORT_KEY_GEOMETRY_TYPE_SHIFT=15, SORT_KEY_SKELETON_FLAG=2, SORT_KEY_MIRROR_FLAG=1 @@ -302,8 +330,6 @@ public: RasterizerStorageGLES3::Material *material; RasterizerStorageGLES3::GeometryOwner *owner; uint64_t sort_key; - bool *additive_ptr; - bool additive; }; @@ -314,6 +340,7 @@ public: int element_count; int alpha_element_count; + void clear() { element_count=0; @@ -399,12 +426,10 @@ public: }; + LightInstance *directional_light; + LightInstance *directional_lights[RenderList::MAX_DIRECTIONAL_LIGHTS]; - LightInstance *directional_light_instances[RenderList::MAX_DIRECTIONAL_LIGHTS]; - int directional_light_instance_count; - LightInstance *light_instances[RenderList::MAX_LIGHTS]; - int light_instance_count; RenderList render_list; @@ -414,9 +439,9 @@ public: _FORCE_INLINE_ void _setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection); _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); - _FORCE_INLINE_ void _setup_light(LightInstance *p_light); + _FORCE_INLINE_ void _setup_light(RenderList::Element *e); - void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow); + void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add); _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material,bool p_shadow); @@ -424,6 +449,7 @@ public: void _draw_skybox(RID p_skybox, const CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform& p_cam_transform); + void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform); void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix& p_camera_projection, RID p_shadow_atlas); void _copy_screen(); void _copy_to_front_buffer(Environment *env); @@ -439,6 +465,7 @@ public: virtual void set_scene_pass(uint64_t p_pass); + void iteration(); void initialize(); void finalize(); RasterizerSceneGLES3(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b988781e14..6e278e563b 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -3169,7 +3169,6 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->param[VS::LIGHT_PARAM_RANGE]=1.0; light->param[VS::LIGHT_PARAM_SPOT_ANGLE]=45; light->param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE]=0; - light->param[VS::LIGHT_PARAM_SHADOW_DARKNESS]=0; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET]=0.1; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET]=0.3; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET]=0.6; @@ -3184,6 +3183,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->directional_shadow_mode=VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; light->omni_shadow_mode=VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID; light->omni_shadow_detail=VS::LIGHT_OMNI_SHADOW_DETAIL_VERTICAL; + light->directional_blend_splits=false; light->version=0; @@ -3207,7 +3207,6 @@ void RasterizerStorageGLES3::light_set_param(RID p_light,VS::LightParam p_param, case VS::LIGHT_PARAM_RANGE: case VS::LIGHT_PARAM_SPOT_ANGLE: case VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE: - case VS::LIGHT_PARAM_SHADOW_DARKNESS: case VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET: case VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET: case VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET: @@ -3230,20 +3229,22 @@ void RasterizerStorageGLES3::light_set_shadow(RID p_light,bool p_enabled){ light->version++; light->instance_change_notify(); - - } -void RasterizerStorageGLES3::light_set_projector(RID p_light,RID p_texture){ + +void RasterizerStorageGLES3::light_set_shadow_color(RID p_light,const Color& p_color) { Light * light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); - + light->shadow_color=p_color; } -void RasterizerStorageGLES3::light_set_attenuation_texure(RID p_light,RID p_texture){ + +void RasterizerStorageGLES3::light_set_projector(RID p_light,RID p_texture){ Light * light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); + + light->projector=p_texture; } void RasterizerStorageGLES3::light_set_negative(RID p_light,bool p_enable){ @@ -3263,12 +3264,6 @@ void RasterizerStorageGLES3::light_set_cull_mask(RID p_light,uint32_t p_mask){ light->version++; light->instance_change_notify(); -} -void RasterizerStorageGLES3::light_set_shader(RID p_light,RID p_shader){ - - Light * light = light_owner.getornull(p_light); - ERR_FAIL_COND(!light); - } void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode) { @@ -3315,6 +3310,26 @@ void RasterizerStorageGLES3::light_directional_set_shadow_mode(RID p_light,VS::L } +void RasterizerStorageGLES3::light_directional_set_blend_splits(RID p_light,bool p_enable) { + + Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + + light->directional_blend_splits=p_enable; + light->version++; + light->instance_change_notify(); + +} + + +bool RasterizerStorageGLES3::light_directional_get_blend_splits(RID p_light) const { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,false); + + return light->directional_blend_splits; +} + VS::LightDirectionalShadowMode RasterizerStorageGLES3::light_directional_get_shadow_mode(RID p_light) { const Light * light = light_owner.getornull(p_light); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index f8b34d6a16..0e3d47b61f 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -634,12 +634,15 @@ public: VS::LightType type; float param[VS::LIGHT_PARAM_MAX]; Color color; + Color shadow_color; + RID projector; bool shadow; bool negative; uint32_t cull_mask; VS::LightOmniShadowMode omni_shadow_mode; VS::LightOmniShadowDetail omni_shadow_detail; VS::LightDirectionalShadowMode directional_shadow_mode; + bool directional_blend_splits; uint64_t version; }; @@ -650,17 +653,19 @@ public: virtual void light_set_color(RID p_light,const Color& p_color); virtual void light_set_param(RID p_light,VS::LightParam p_param,float p_value); virtual void light_set_shadow(RID p_light,bool p_enabled); + virtual void light_set_shadow_color(RID p_light,const Color& p_color); virtual void light_set_projector(RID p_light,RID p_texture); - virtual void light_set_attenuation_texure(RID p_light,RID p_texture); virtual void light_set_negative(RID p_light,bool p_enable); virtual void light_set_cull_mask(RID p_light,uint32_t p_mask); - virtual void light_set_shader(RID p_light,RID p_shader); - virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode); + virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode); virtual void light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail); virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode); + virtual void light_directional_set_blend_splits(RID p_light,bool p_enable); + virtual bool light_directional_get_blend_splits(RID p_light) const; + virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light); virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 052c915241..6f0616035a 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -228,8 +228,15 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { #endif + int define_line_ofs=1; + for(int i=0;i custom_defines; + int base_material_tex_index; Version * get_current_version(); @@ -357,6 +359,10 @@ public: void set_base_material_tex_index(int p_idx); + void add_custom_define(const String& p_define) { + custom_defines.push_back(p_define.utf8()); + } + virtual ~ShaderGLES3(); }; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index de1591e8ff..ceb5a72118 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -68,24 +68,26 @@ layout(std140) uniform SceneData { //ubo:0 uniform highp mat4 world_transform; -#ifdef USE_FORWARD_LIGHTING +#ifdef USE_LIGHT_DIRECTIONAL -layout(std140) uniform LightData { //ubo:3 +layout(std140) uniform DirectionalLightData { //ubo:3 highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, specular, shadow darkening, + mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; - mediump vec4 shadow_split_offsets; + mediump vec4 shadow_color; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; highp mat4 shadow_matrix3; highp mat4 shadow_matrix4; + mediump vec4 shadow_split_offsets; }; #endif + /* Varyings */ out highp vec3 vertex_interp; @@ -343,30 +345,71 @@ layout(std140) uniform SceneData { }; +//directional light data -#ifdef USE_FORWARD_LIGHTING +#ifdef USE_LIGHT_DIRECTIONAL -layout(std140) uniform LightData { +layout(std140) uniform DirectionalLightData { highp vec4 light_pos_inv_radius; mediump vec4 light_direction_attenuation; mediump vec4 light_color_energy; - mediump vec4 light_params; //cone attenuation, specular, shadow darkening, shadow enabled + mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; - mediump vec4 shadow_split_offsets; + mediump vec4 shadow_color; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; highp mat4 shadow_matrix3; highp mat4 shadow_matrix4; + mediump vec4 shadow_split_offsets; }; + +uniform highp sampler2DShadow directional_shadow; //texunit:-4 + #endif +//omni and spot + +struct LightData { + + highp vec4 light_pos_inv_radius; + mediump vec4 light_direction_attenuation; + mediump vec4 light_color_energy; + mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, + mediump vec4 light_clamp; + mediump vec4 shadow_color; + highp mat4 shadow_matrix; + +}; + + +layout(std140) uniform OmniLightData { //ubo:4 + + LightData omni_lights[MAX_LIGHT_DATA_STRUCTS]; +}; + +layout(std140) uniform SpotLightData { //ubo:5 + + LightData spot_lights[MAX_LIGHT_DATA_STRUCTS]; +}; + -uniform highp sampler2DShadow directional_shadow; //texunit:-4 uniform highp sampler2DShadow shadow_atlas; //texunit:-3 +#ifdef USE_FORWARD_LIGHTING + +uniform int omni_light_indices[MAX_FORWARD_LIGHTS]; +uniform int omni_light_count; + +uniform int spot_light_indices[MAX_FORWARD_LIGHTS]; +uniform int spot_light_count; + +#endif + + + #ifdef USE_MULTIPLE_RENDER_TARGETS layout(location=0) out vec4 diffuse_buffer; @@ -415,18 +458,51 @@ float specularGGX(vec3 N, vec3 V, vec3 L, float roughness, float F0) return dotNL * D * F * vis; } -void light_compute(vec3 normal, vec3 light_vec,vec3 eye_vec,vec3 diffuse_color, vec3 specular_color, float roughness, float attenuation, inout vec3 diffuse, inout vec3 specular) { +void light_compute(vec3 normal, vec3 light_vec,vec3 eye_vec,vec3 light_color,vec3 diffuse_color, vec3 specular_color, float roughness, inout vec3 diffuse, inout vec3 specular) { - diffuse += max(0.0,dot(normal,light_vec)) * diffuse_color * attenuation; + diffuse += max(0.0,dot(normal,light_vec)) * light_color * diffuse_color; //specular += specular_ggx( roughness, max(0.0,dot(normal,eye_vec)) ) * specular_color * attenuation; float s = roughness > 0.0 ? specularGGX(normal,eye_vec,light_vec,roughness,1.0) : 0.0; - specular += s * specular_color * attenuation; + specular += s * light_color * specular_color; } float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) { +#ifdef SHADOW_MODE_PCF_13 + + float avg=textureProj(shadow,vec4(pos,depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x*2.0,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x*2.0,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y*2.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y*2.0),depth,1.0)); + return avg*(1.0/13.0); + +#endif + +#ifdef SHADOW_MODE_PCF_5 + + float avg=textureProj(shadow,vec4(pos,depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0)); + avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0)); + return avg*(1.0/5.0); +#endif + +#if !defined(SHADOW_MODE_PCF_5) && !defined(SHADOW_MODE_PCF_13) + return textureProj(shadow,vec4(pos,depth,1.0)); +#endif + } #ifdef RENDER_SHADOW_DUAL_PARABOLOID @@ -435,6 +511,73 @@ in highp float dp_clip; #endif +void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 albedo, vec3 specular, float roughness, inout vec3 diffuse_light, inout vec3 specular_light) { + + vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; + float normalized_distance = length( light_rel_vec )*omni_lights[idx].light_pos_inv_radius.w; + vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w )); + + if (omni_lights[idx].light_params.w>0.5) { + //there is a shadowmap + + highp vec3 splane=(omni_lights[idx].shadow_matrix * vec4(vertex,1.0)).xyz; + float shadow_len=length(splane); + splane=normalize(splane); + vec4 clamp_rect=omni_lights[idx].light_clamp; + + if (splane.z>=0.0) { + + splane.z+=1.0; + + clamp_rect.y+=clamp_rect.w; + + } else { + + splane.z=1.0 - splane.z; + + //if (clamp_rect.z0.5) { + //there is a shadowmap + highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0)); + splane.xyz/=splane.w; + light_attenuation*=mix(spot_lights[idx].shadow_color.rgb,vec3(1.0),sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp)); + } + + light_compute(normal,normalize(light_rel_vec),eye_vec,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,roughness,diffuse_light,specular_light); + +} + void main() { #ifdef RENDER_SHADOW_DUAL_PARABOLOID @@ -561,9 +704,9 @@ FRAGMENT_SHADER_CODE #endif -#ifdef USE_FORWARD_DIRECTIONAL +#ifdef USE_LIGHT_DIRECTIONAL - float light_attenuation=1.0; + vec3 light_attenuation=vec3(1.0); #ifdef LIGHT_DIRECTIONAL_SHADOW @@ -589,7 +732,6 @@ FRAGMENT_SHADER_CODE highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); pssm_coord=splane.xyz/splane.w; - ambient_light=vec3(1.0,0.4,0.4); #if defined(LIGHT_USE_PSSM_BLEND) @@ -603,7 +745,6 @@ FRAGMENT_SHADER_CODE highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); pssm_coord=splane.xyz/splane.w; - ambient_light=vec3(0.4,1.0,0.4); #if defined(LIGHT_USE_PSSM_BLEND) splane=(shadow_matrix3 * vec4(vertex,1.0)); @@ -619,7 +760,6 @@ FRAGMENT_SHADER_CODE highp vec4 splane=(shadow_matrix3 * vec4(vertex,1.0)); pssm_coord=splane.xyz/splane.w; - ambient_light=vec3(0.4,0.4,1.0); #if defined(LIGHT_USE_PSSM_BLEND) splane=(shadow_matrix4 * vec4(vertex,1.0)); @@ -678,12 +818,12 @@ FRAGMENT_SHADER_CODE //one one sample - light_attenuation=sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp); + light_attenuation=mix(shadow_color.rgb,vec3(1.0),sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp)); #if defined(LIGHT_USE_PSSM_BLEND) if (use_blend) { - float light_attenuation2=sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp); + vec3 light_attenuation2=mix(shadow_color.rgb,vec3(1.0),sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp)); light_attenuation=mix(light_attenuation,light_attenuation2,pssm_blend); } #endif @@ -692,84 +832,24 @@ FRAGMENT_SHADER_CODE #endif //LIGHT_DIRECTIONAL_SHADOW - light_compute(normal,-light_direction_attenuation.xyz,eye_vec,albedo,specular,roughness,light_attenuation,diffuse_light,specular_light); - - -#endif //USE_FORWARD_DIRECTIONAL - + light_compute(normal,-light_direction_attenuation.xyz,eye_vec,light_color_energy.rgb*light_attenuation,albedo,specular,roughness,diffuse_light,specular_light); -#ifdef USE_FORWARD_OMNI - vec3 light_rel_vec = light_pos_inv_radius.xyz-vertex; - float normalized_distance = length( light_rel_vec )*light_pos_inv_radius.w; - float light_attenuation = pow( max(1.0 - normalized_distance, 0.0), light_direction_attenuation.w ); +#endif //#USE_LIGHT_DIRECTIONAL - if (light_params.w>0.5) { - //there is a shadowmap - - highp vec3 splane=(shadow_matrix1 * vec4(vertex,1.0)).xyz; - float shadow_len=length(splane); - splane=normalize(splane); - vec4 clamp_rect=light_clamp; - - if (splane.z>=0.0) { - - splane.z+=1.0; - clamp_rect.y+=clamp_rect.w; - - } else { - - splane.z=1.0 - splane.z; - - //if (clamp_rect.z0.5) { - //there is a shadowmap - - highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0)); - splane.xyz/=splane.w; - // splane.xy=splane.xy*0.5+0.5; - - //splane.xy=light_clamp.xy+splane.xy*light_clamp.zw; - light_attenuation*=sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,light_clamp); - + for(int i=0;ilight_set_shadow_color(light,p_shadow_color); +} + +Color Light::get_shadow_color() const{ + + return shadow_color; +} + AABB Light::get_aabb() const { @@ -197,18 +208,18 @@ void Light::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_color","color"), &Light::set_color ); ObjectTypeDB::bind_method(_MD("get_color"), &Light::get_color ); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "light/color"), _SCS("set_color"), _SCS("get_color")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/energy"), _SCS("set_param"), _SCS("get_param"), PARAM_ENERGY); + ObjectTypeDB::bind_method(_MD("set_shadow_color","shadow_color"), &Light::set_shadow_color ); + ObjectTypeDB::bind_method(_MD("get_shadow_color"), &Light::get_shadow_color ); + + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "light/color",PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_color"), _SCS("get_color")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_ENERGY); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "light/negative"), _SCS("set_negative"), _SCS("is_negative")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/specular"), _SCS("set_param"), _SCS("get_param"), PARAM_SPECULAR); - ADD_PROPERTY( PropertyInfo( Variant::INT, "light/cull_mask"), _SCS("set_cull_mask"), _SCS("get_cull_mask")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "light/specular",PROPERTY_HINT_RANGE,"0,1,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SPECULAR); + ADD_PROPERTY( PropertyInfo( Variant::INT, "light/cull_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_cull_mask"), _SCS("get_cull_mask")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow/enabled"), _SCS("set_shadow"), _SCS("has_shadow")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/darkness"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_DARKNESS); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/normal_bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_NORMAL_BIAS); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias_split_scale"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS_SPLIT_SCALE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/max_distance"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_MAX_DISTANCE); - + ADD_PROPERTY( PropertyInfo( Variant::COLOR, "shadow/color",PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_shadow_color"), _SCS("get_shadow_color")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/max_distance",PROPERTY_HINT_RANGE,"0,65536,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_MAX_DISTANCE); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "editor/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); BIND_CONSTANT( PARAM_ENERGY ); @@ -218,7 +229,6 @@ void Light::_bind_methods() { BIND_CONSTANT( PARAM_SPOT_ANGLE ); BIND_CONSTANT( PARAM_SPOT_ATTENUATION ); BIND_CONSTANT( PARAM_SHADOW_MAX_DISTANCE ); - BIND_CONSTANT( PARAM_SHADOW_DARKNESS ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_1_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_2_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_3_OFFSET ); @@ -250,7 +260,6 @@ Light::Light(VisualServer::LightType p_type) { set_param(PARAM_SPOT_ANGLE,45); set_param(PARAM_SPOT_ATTENUATION,1); set_param(PARAM_SHADOW_MAX_DISTANCE,0); - set_param(PARAM_SHADOW_DARKNESS,0); set_param(PARAM_SHADOW_SPLIT_1_OFFSET,0.1); set_param(PARAM_SHADOW_SPLIT_2_OFFSET,0.2); set_param(PARAM_SHADOW_SPLIT_3_OFFSET,0.5); @@ -291,6 +300,7 @@ DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const { void DirectionalLight::set_blend_splits(bool p_enable) { blend_splits=p_enable; + VS::get_singleton()->light_directional_set_blend_splits(light,p_enable); } bool DirectionalLight::is_blend_splits_enabled() const { @@ -307,11 +317,13 @@ void DirectionalLight::_bind_methods() { ObjectTypeDB::bind_method( _MD("set_blend_splits","enabled"),&DirectionalLight::set_blend_splits); ObjectTypeDB::bind_method( _MD("is_blend_splits_enabled"),&DirectionalLight::is_blend_splits_enabled); - ADD_PROPERTY( PropertyInfo( Variant::INT, "directional/shadow_mode",PROPERTY_HINT_ENUM,"Orthogonal,PSSM 2 Splits,PSSM 4 Splits"), _SCS("set_shadow_mode"), _SCS("get_shadow_mode")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_1_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_2"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_2_OFFSET); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional/split_3"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_3_OFFSET); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "directional/blend_splits"), _SCS("set_blend_splits"), _SCS("is_blend_splits_enabled")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "directional_shadow/mode",PROPERTY_HINT_ENUM,"Orthogonal,PSSM 2 Splits,PSSM 4 Splits"), _SCS("set_shadow_mode"), _SCS("get_shadow_mode")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional_shadow/split_1",PROPERTY_HINT_RANGE,"0,1,0.001"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_1_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional_shadow/split_2",PROPERTY_HINT_RANGE,"0,1,0.001"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_2_OFFSET); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional_shadow/split_3",PROPERTY_HINT_RANGE,"0,1,0.001"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_SPLIT_3_OFFSET); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "directional_shadow/blend_splits"), _SCS("set_blend_splits"), _SCS("is_blend_splits_enabled")); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional_shadow/normal_bias",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_NORMAL_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "directional_shadow/bias_split_scale",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS_SPLIT_SCALE); BIND_CONSTANT( SHADOW_ORTHOGONAL ); BIND_CONSTANT( SHADOW_PARALLEL_2_SPLITS ); @@ -358,8 +370,8 @@ void OmniLight::_bind_methods() { ObjectTypeDB::bind_method( _MD("set_shadow_detail","detail"),&OmniLight::set_shadow_detail); ObjectTypeDB::bind_method( _MD("get_shadow_detail"),&OmniLight::get_shadow_detail); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/range",PROPERTY_HINT_RANGE,"0,65536,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "omni/attenuation",PROPERTY_HINT_EXP_EASING), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); ADD_PROPERTY( PropertyInfo( Variant::INT, "omni/shadow_mode",PROPERTY_HINT_ENUM,"Dual Paraboloid,Cube"), _SCS("set_shadow_mode"), _SCS("get_shadow_mode")); ADD_PROPERTY( PropertyInfo( Variant::INT, "omni/shadow_detail",PROPERTY_HINT_ENUM,"Vertical,Horizontal"), _SCS("set_shadow_detail"), _SCS("get_shadow_detail")); @@ -374,10 +386,10 @@ OmniLight::OmniLight() : Light( VisualServer::LIGHT_OMNI ) { void SpotLight::_bind_methods() { - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/range"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_angle"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ANGLE); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_attenuation"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ATTENUATION); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/range",PROPERTY_HINT_RANGE,"0,65536,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_RANGE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/attenuation",PROPERTY_HINT_EXP_EASING), _SCS("set_param"), _SCS("get_param"), PARAM_ATTENUATION); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_angle",PROPERTY_HINT_RANGE,"0,180,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ANGLE); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "spot/spot_attenuation",PROPERTY_HINT_EXP_EASING), _SCS("set_param"), _SCS("get_param"), PARAM_SPOT_ATTENUATION); } diff --git a/scene/3d/light.h b/scene/3d/light.h index da28542817..fcf5ce90f9 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -52,7 +52,6 @@ public: PARAM_SPOT_ANGLE = VS::LIGHT_PARAM_SPOT_ANGLE, PARAM_SPOT_ATTENUATION = VS::LIGHT_PARAM_SPOT_ATTENUATION, PARAM_SHADOW_MAX_DISTANCE = VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE, - PARAM_SHADOW_DARKNESS = VS::LIGHT_PARAM_SHADOW_DARKNESS, PARAM_SHADOW_SPLIT_1_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, PARAM_SHADOW_SPLIT_2_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, @@ -66,6 +65,7 @@ private: Color color; float param[PARAM_MAX]; + Color shadow_color; bool shadow; bool negative; uint32_t cull_mask; @@ -107,6 +107,9 @@ public: void set_color(const Color& p_color); Color get_color() const; + void set_shadow_color(const Color& p_shadow_color); + Color get_shadow_color() const; + virtual AABB get_aabb() const; virtual DVector get_faces(uint32_t p_usage_flags) const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index d87cc0fd8c..06509c6fd0 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -78,6 +78,7 @@ public: Transform transform; int depth_layer; + uint32_t layer_mask; //RID sampled_light; @@ -114,6 +115,7 @@ public: billboard=false; billboard_y=false; depth_layer=0; + layer_mask=1; } }; @@ -295,16 +297,17 @@ public: virtual void light_set_color(RID p_light,const Color& p_color)=0; virtual void light_set_param(RID p_light,VS::LightParam p_param,float p_value)=0; virtual void light_set_shadow(RID p_light,bool p_enabled)=0; + virtual void light_set_shadow_color(RID p_light,const Color& p_color)=0; virtual void light_set_projector(RID p_light,RID p_texture)=0; - virtual void light_set_attenuation_texure(RID p_light,RID p_texture)=0; virtual void light_set_negative(RID p_light,bool p_enable)=0; virtual void light_set_cull_mask(RID p_light,uint32_t p_mask)=0; - virtual void light_set_shader(RID p_light,RID p_shader)=0; virtual void light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode)=0; virtual void light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail)=0; virtual void light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode)=0; + virtual void light_directional_set_blend_splits(RID p_light,bool p_enable)=0; + virtual bool light_directional_get_blend_splits(RID p_light) const=0; virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light)=0; virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 7810cc9018..4d8a46122c 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -757,16 +757,16 @@ public: BIND2(light_set_color,RID,const Color&) BIND3(light_set_param,RID ,LightParam ,float ) BIND2(light_set_shadow,RID ,bool ) + BIND2(light_set_shadow_color,RID ,const Color& ) BIND2(light_set_projector,RID,RID ) - BIND2(light_set_attenuation_texure,RID,RID ) BIND2(light_set_negative,RID,bool ) BIND2(light_set_cull_mask,RID ,uint32_t ) - BIND2(light_set_shader,RID ,RID ) BIND2(light_omni_set_shadow_mode,RID,LightOmniShadowMode) BIND2(light_omni_set_shadow_detail,RID,LightOmniShadowDetail) BIND2(light_directional_set_shadow_mode,RID,LightDirectionalShadowMode) + BIND2(light_directional_set_blend_splits,RID,bool) /* PROBE API */ diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index e36e31e191..e214374f4d 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1165,7 +1165,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer float texture_size=VSG::scene_render->get_directional_light_shadow_size(light->instance); - bool overlap = false;//rasterizer->light_instance_get_pssm_shadow_overlap(p_light->light_info->instance); + bool overlap = VSG::storage->light_directional_get_blend_splits(p_instance->base); for (int i=0;i Date: Sat, 19 Nov 2016 13:23:37 -0300 Subject: working reflection probes!! --- drivers/gles3/rasterizer_canvas_gles3.cpp | 4 - drivers/gles3/rasterizer_gles3.cpp | 2 + drivers/gles3/rasterizer_scene_gles3.cpp | 730 ++++++++++++++++++++++++++--- drivers/gles3/rasterizer_scene_gles3.h | 103 +++- drivers/gles3/rasterizer_storage_gles3.cpp | 333 ++++++++++++- drivers/gles3/rasterizer_storage_gles3.h | 57 ++- drivers/gles3/shaders/cubemap_filter.glsl | 40 +- drivers/gles3/shaders/scene.glsl | 206 +++++++- scene/3d/reflection_probe.cpp | 266 +++++++++++ scene/3d/reflection_probe.h | 92 ++++ scene/main/scene_main_loop.cpp | 7 + scene/register_scene_types.cpp | 5 + scene/resources/environment.cpp | 9 +- scene/resources/environment.h | 7 +- scene/resources/sky_box.cpp | 158 +++++++ scene/resources/sky_box.h | 71 +++ servers/visual/rasterizer.h | 43 +- servers/visual/visual_server_raster.cpp | 1 + servers/visual/visual_server_raster.h | 20 +- servers/visual/visual_server_scene.cpp | 366 +++++++++++---- servers/visual/visual_server_scene.h | 48 +- servers/visual/visual_server_viewport.cpp | 29 +- servers/visual_server.h | 28 +- tools/editor/spatial_editor_gizmos.cpp | 167 +++++++ tools/editor/spatial_editor_gizmos.h | 23 + 25 files changed, 2590 insertions(+), 225 deletions(-) create mode 100644 scene/3d/reflection_probe.cpp create mode 100644 scene/3d/reflection_probe.h create mode 100644 scene/resources/sky_box.cpp create mode 100644 scene/resources/sky_box.h diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index c455d4bd11..4573f94d22 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1382,10 +1382,6 @@ void RasterizerCanvasGLES3::reset_canvas() { glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); -#ifdef GLEW_ENABLED - glDisable(GL_POINT_SPRITE); - glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); -#endif glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index c799cd12af..dabb7918a9 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -122,11 +122,13 @@ void RasterizerGLES3::begin_frame(){ storage->frame.time[1]=Math::fmod(time_total,3600); storage->frame.time[2]=Math::fmod(time_total,900); storage->frame.time[3]=Math::fmod(time_total,60); + storage->frame.count++; storage->update_dirty_shaders(); storage->update_dirty_materials(); scene->iteration(); + } void RasterizerGLES3::set_current_render_target(RID p_render_target){ diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 4ae257abc4..e04908ea67 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -446,6 +446,338 @@ int RasterizerSceneGLES3::get_directional_light_shadow_size(RID p_light_intance) return shadow_size; } +////////////////////////////////////////////////////// + +RID RasterizerSceneGLES3::reflection_atlas_create() { + + ReflectionAtlas *reflection_atlas = memnew( ReflectionAtlas ); + reflection_atlas->subdiv=0; + reflection_atlas->color=0; + for(int i=0;i<6;i++) { + reflection_atlas->fbo[i]=0; + } + + return reflection_atlas_owner.make_rid(reflection_atlas); +} + +void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas,int p_size) { + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas); + ERR_FAIL_COND(!reflection_atlas); + + int size = nearest_power_of_2(p_size); + + if (size==reflection_atlas->size) + return; + if (reflection_atlas->size) { + for(int i=0;i<6;i++) { + glDeleteFramebuffers(1,&reflection_atlas->fbo[i]); + reflection_atlas->fbo[i]=0; + } + glDeleteTextures(1,&reflection_atlas->color); + reflection_atlas->color=0; + } + + reflection_atlas->size=size; + + for(int i=0;ireflections.size();i++) { + //erase probes reference to this + if (reflection_atlas->reflections[i].owner.is_valid()) { + ReflectionProbeInstance *reflection_probe_instance = reflection_probe_instance_owner.getornull(reflection_atlas->reflections[i].owner); + reflection_atlas->reflections[i].owner=RID(); + + ERR_CONTINUE(!reflection_probe_instance); + reflection_probe_instance->reflection_atlas_index=-1; + reflection_probe_instance->atlas=RID(); + reflection_probe_instance->render_step=-1; + } + } + + + if (reflection_atlas->size) { + + bool use_float=true; + + + GLenum internal_format = use_float?GL_RGBA16F:GL_RGB10_A2; + GLenum format = GL_RGBA; + GLenum type = use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV; + + + // Create a texture for storing the color + glActiveTexture(GL_TEXTURE0); + glGenTextures(1, &reflection_atlas->color); + glBindTexture(GL_TEXTURE_2D, reflection_atlas->color); + + int mmsize=reflection_atlas->size; + + for(int i=0;i<6;i++) { + glTexImage2D(GL_TEXTURE_2D, i, internal_format, mmsize, mmsize, 0, + format, type, NULL); + + mmsize>>=1; + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + mmsize=reflection_atlas->size; + + for(int i=0;i<6;i++) { + glGenFramebuffers(1, &reflection_atlas->fbo[i]); + glBindFramebuffer(GL_FRAMEBUFFER, reflection_atlas->fbo[i]); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, reflection_atlas->color, i); + glDisable(GL_SCISSOR_TEST); + glViewport(0,0,mmsize,mmsize); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); //it needs to be cleared, to avoid generating garbage + + mmsize>>=1; + + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + + } + + + +} +void RasterizerSceneGLES3::reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv) { + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas); + ERR_FAIL_COND(!reflection_atlas); + + uint32_t subdiv = nearest_power_of_2(p_subdiv); + if (subdiv&0xaaaaaaaa) { //sqrt(subdiv) must be integer + subdiv<<=1; + } + + subdiv=int(Math::sqrt(subdiv)); + + if (reflection_atlas->subdiv==subdiv) + return; + + + if (subdiv) { + + for(int i=0;ireflections.size();i++) { + //erase probes reference to this + if (reflection_atlas->reflections[i].owner.is_valid()) { + ReflectionProbeInstance *reflection_probe_instance = reflection_probe_instance_owner.getornull(reflection_atlas->reflections[i].owner); + reflection_atlas->reflections[i].owner=RID(); + + ERR_CONTINUE(!reflection_probe_instance); + reflection_probe_instance->reflection_atlas_index=-1; + reflection_probe_instance->atlas=RID(); + reflection_probe_instance->render_step=-1; + } + } + } + + reflection_atlas->subdiv=subdiv; + + reflection_atlas->reflections.resize(subdiv*subdiv); +} + + +//////////////////////////////////////////////////// + +RID RasterizerSceneGLES3::reflection_probe_instance_create(RID p_probe) { + + RasterizerStorageGLES3::ReflectionProbe *probe = storage->reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!probe,RID()); + + ReflectionProbeInstance *rpi = memnew( ReflectionProbeInstance ); + + rpi->probe_ptr=probe; + rpi->self=reflection_probe_instance_owner.make_rid(rpi); + rpi->probe=p_probe; + rpi->reflection_atlas_index=-1; + rpi->render_step=-1; + rpi->last_pass=0; + + return rpi->self; +} + +void RasterizerSceneGLES3::reflection_probe_instance_set_transform(RID p_instance,const Transform& p_transform) { + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND(!rpi); + rpi->transform=p_transform; + +} + +void RasterizerSceneGLES3::reflection_probe_release_atlas_index(RID p_instance) { + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND(!rpi); + if (rpi->reflection_atlas_index==-1) + return; + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(rpi->atlas); + ERR_FAIL_COND(!reflection_atlas); + + ERR_FAIL_INDEX(rpi->reflection_atlas_index,reflection_atlas->reflections.size()); + + ERR_FAIL_COND(reflection_atlas->reflections[rpi->reflection_atlas_index].owner!=rpi->self); + + reflection_atlas->reflections[rpi->reflection_atlas_index].owner=RID(); + + rpi->reflection_atlas_index=-1; + rpi->atlas=RID(); + rpi->render_step=-1; + +} + +bool RasterizerSceneGLES3::reflection_probe_instance_needs_redraw(RID p_instance) { + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND_V(!rpi,false); + + return rpi->reflection_atlas_index==-1 || rpi->probe_ptr->update_mode==VS::REFLECTION_PROBE_UPDATE_ALWAYS; +} + +bool RasterizerSceneGLES3::reflection_probe_instance_has_reflection(RID p_instance){ + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND_V(!rpi,false); + + return rpi->reflection_atlas_index!=-1; +} + +bool RasterizerSceneGLES3::reflection_probe_instance_begin_render(RID p_instance,RID p_reflection_atlas) { + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND_V(!rpi,false); + + rpi->render_step=0; + + if (rpi->reflection_atlas_index!=-1) { + return true; //got one already + } + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_reflection_atlas); + ERR_FAIL_COND_V(!reflection_atlas,false); + + + if (reflection_atlas->size==0 || reflection_atlas->subdiv==0) { + return false; + } + + + int best_free=-1; + int best_used=-1; + uint64_t best_used_frame; + + for(int i=0;ireflections.size();i++) { + if (reflection_atlas->reflections[i].owner==RID()) { + best_free=i; + break; + } + + if (rpi->render_step<0 && reflection_atlas->reflections[i].last_frameframe.count && + (best_used==-1 || reflection_atlas->reflections[i].last_framereflections[i].last_frame; + } + } + + if (best_free==-1 && best_used==-1) { + return false ;// sorry, can not do. Try again next frame. + } + + if (best_free==-1) { + //find best from what is used + best_free=best_used; + + ReflectionProbeInstance *victim_rpi = reflection_probe_instance_owner.getornull(reflection_atlas->reflections[best_free].owner); + ERR_FAIL_COND_V(!victim_rpi,false); + victim_rpi->atlas=RID(); + victim_rpi->reflection_atlas_index=-1; + + } + + reflection_atlas->reflections[best_free].owner=p_instance; + reflection_atlas->reflections[best_free].last_frame=storage->frame.count; + + rpi->reflection_atlas_index=best_free; + rpi->atlas=p_reflection_atlas; + rpi->render_step=0; + + return true; +} + +bool RasterizerSceneGLES3::reflection_probe_instance_postprocess_step(RID p_instance) { + + ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance); + ERR_FAIL_COND_V(!rpi,true); + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(rpi->atlas); + ERR_FAIL_COND_V(!reflection_atlas,false); + + ERR_FAIL_COND_V(rpi->render_step>=6,true); + + glBindFramebuffer(GL_FRAMEBUFFER,reflection_atlas->fbo[rpi->render_step]); + state.cube_to_dp_shader.bind(); + + int target_size=reflection_atlas->size/reflection_atlas->subdiv; + + int cubemap_index=reflection_cubemaps.size()-1; + + for(int i=reflection_cubemaps.size()-1;i>=0;i--) { + //find appropriate cubemap to render to + if (reflection_cubemaps[i].size>target_size*2) + break; + + cubemap_index=i; + } + + glDisable(GL_BLEND); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_CUBE_MAP,reflection_cubemaps[cubemap_index].cubemap); + glDisable(GL_CULL_FACE); + + storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID,true); + storage->shaders.cubemap_filter.bind(); + + int cell_size = reflection_atlas->size / reflection_atlas->subdiv; + for(int i=0;irender_step;i++) { + cell_size>>=1; //mipmaps! + } + int x = (rpi->reflection_atlas_index % reflection_atlas->subdiv) * cell_size; + int y = (rpi->reflection_atlas_index / reflection_atlas->subdiv) * cell_size; + int width=cell_size; + int height=cell_size; + + storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DIRECT_WRITE,rpi->render_step==0); + storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::LOW_QUALITY,rpi->probe_ptr->update_mode==VS::REFLECTION_PROBE_UPDATE_ALWAYS); + for(int i=0;i<2;i++) { + + storage->shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::Z_FLIP,i>0); + storage->shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS,rpi->render_step/5.0); + + uint32_t local_width=width,local_height=height; + uint32_t local_x=x,local_y=y; + + local_height/=2; + local_y+=i*local_height; + + glViewport(local_x,local_y,local_width,local_height); + + _copy_screen(); + } + storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DIRECT_WRITE,false); + storage->shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::LOW_QUALITY,false); + + + rpi->render_step++; + + return rpi->render_step==6; +} /* ENVIRONMENT API */ @@ -464,26 +796,12 @@ void RasterizerSceneGLES3::environment_set_background(RID p_env,VS::EnvironmentB env->bg_mode=p_bg; } -void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox, int p_radiance_size){ +void RasterizerSceneGLES3::environment_set_skybox(RID p_env, RID p_skybox){ Environment *env=environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (env->skybox_color.is_valid()) { - env->skybox_color=RID(); - } - if (env->skybox_radiance.is_valid()) { - storage->free(env->skybox_radiance); - env->skybox_radiance=RID(); - } - - - if (p_skybox.is_valid()) { - - env->skybox_color=p_skybox; - env->skybox_radiance=storage->texture_create_radiance_cubemap(p_skybox,p_radiance_size); - //env->skybox_irradiance=storage->texture_create_pbr_cubemap(p_skybox,VS::PBR_CUBEMAP_IRRADIANCE,p_irradiance_size); - } + env->skybox=p_skybox; } @@ -775,6 +1093,7 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); glBindVertexArray(s->array_id); // everything is so easy nowadays + } break; } @@ -821,6 +1140,8 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e) { int omni_count=0; int spot_indices[16]; int spot_count=0; + int reflection_indices[16]; + int reflection_count=0; int maxobj = MIN(16,state.max_forward_lights_per_object); @@ -859,6 +1180,32 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e) { glUniform1iv(state.scene_shader.get_uniform(SceneShaderGLES3::SPOT_LIGHT_INDICES),spot_count,spot_indices); } + + int rc = e->instance->reflection_probe_instances.size(); + + + if (rc) { + + + const RID* reflections=e->instance->reflection_probe_instances.ptr(); + + for(int i=0;ilast_pass!=render_pass) //not visible + continue; + + if (reflection_countreflection_index; + } + } + } + + state.scene_shader.set_uniform(SceneShaderGLES3::REFLECTION_COUNT,reflection_count); + if (reflection_count) { + glUniform1iv(state.scene_shader.get_uniform(SceneShaderGLES3::REFLECTION_INDICES),reflection_count,reflection_indices); + } + + } @@ -932,9 +1279,9 @@ void RasterizerSceneGLES3::_set_cull(bool p_front,bool p_reverse_cull) { -void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,RasterizerStorageGLES3::Texture* p_base_env,bool p_reverse_cull,bool p_alpha_pass,bool p_shadow,bool p_directional_add) { +void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_element_count,const Transform& p_view_transform,const CameraMatrix& p_projection,GLuint p_base_env,bool p_reverse_cull,bool p_alpha_pass,bool p_shadow,bool p_directional_add,bool p_directional_shadows) { - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) { //p_reverse_cull=!p_reverse_cull; glFrontFace(GL_CCW); } else { @@ -951,15 +1298,15 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e if (p_base_env) { glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-2); - glBindTexture(p_base_env->target,p_base_env->tex_id); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,true); + glBindTexture(GL_TEXTURE_2D,p_base_env); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,true); } else { - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,false); } } else { - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,false); } @@ -1038,7 +1385,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e if (p_directional_add || (directional_light && (e->sort_key&RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG)==0)) { state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,true); - if (directional_light->light_ptr->shadow) { + if (p_directional_shadows && directional_light->light_ptr->shadow) { state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,true); switch(directional_light->light_ptr->directional_shadow_mode) { @@ -1076,7 +1423,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { @@ -1097,7 +1444,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } break; case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { @@ -1154,7 +1501,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glFrontFace(GL_CW); glBindVertexArray(0); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_CUBEMAP,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_DIRECTIONAL_SHADOW,false); @@ -1290,9 +1637,12 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g } } -void RasterizerSceneGLES3::_draw_skybox(RID p_skybox,const CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { +void RasterizerSceneGLES3::_draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox,const CameraMatrix& p_projection,const Transform& p_transform,bool p_vflip,float p_scale) { + + if (!p_skybox) + return; - RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_skybox); + RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_skybox->cubemap); ERR_FAIL_COND(!tex); glActiveTexture(GL_TEXTURE0); @@ -1461,7 +1811,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,const CameraMatri } -void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& p_camera_inverse_transform) { +void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& p_camera_inverse_transform,bool p_use_shadows) { LightInstance *li = directional_lights[p_index]; @@ -1499,7 +1849,7 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& ubo_data.light_shadow_color[3]=1.0; - if (li->light_ptr->shadow) { + if (p_use_shadows && li->light_ptr->shadow) { int shadow_count=0; @@ -1568,7 +1918,6 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& Rect2 atlas_rect = Rect2(float(x)/directional_shadow.size,float(y)/directional_shadow.size,float(width)/directional_shadow.size,float(height)/directional_shadow.size); rectm.set_light_atlas_rect(atlas_rect); -// print_line("atlas rect: "+atlas_rect); CameraMatrix shadow_mtx = rectm * bias * li->shadow_transform[j].camera * modelview; @@ -1844,6 +2193,103 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu } +void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_result,int p_reflection_probe_cull_count,const Transform& p_camera_inverse_transform,const CameraMatrix& p_camera_projection,RID p_reflection_atlas,Environment *p_env) { + + state.reflection_probe_count=0; + + for(int i=0;ireflection_atlas_index<0); + + + if (state.reflection_probe_count>=state.max_ubo_reflections) + break; + + rpi->last_pass=render_pass; + + + ReflectionProbeDataUBO reflection_ubo; + + reflection_ubo.box_extents[0]=rpi->probe_ptr->extents.x; + reflection_ubo.box_extents[1]=rpi->probe_ptr->extents.y; + reflection_ubo.box_extents[2]=rpi->probe_ptr->extents.z; + reflection_ubo.box_extents[3]=0; + + + + reflection_ubo.box_ofs[0]=rpi->probe_ptr->origin_offset.x; + reflection_ubo.box_ofs[1]=rpi->probe_ptr->origin_offset.y; + reflection_ubo.box_ofs[2]=rpi->probe_ptr->origin_offset.z; + reflection_ubo.box_ofs[3]=0; + + reflection_ubo.params[0]=rpi->probe_ptr->intensity; + reflection_ubo.params[1]=0; + reflection_ubo.params[2]=rpi->probe_ptr->interior?1.0:0.0; + reflection_ubo.params[3]=rpi->probe_ptr->box_projection?1.0:0.0; + + if (rpi->probe_ptr->interior) { + Color ambient_linear = rpi->probe_ptr->interior_ambient.to_linear(); + reflection_ubo.ambient[0]=ambient_linear.r*rpi->probe_ptr->interior_ambient_energy; + reflection_ubo.ambient[1]=ambient_linear.g*rpi->probe_ptr->interior_ambient_energy; + reflection_ubo.ambient[2]=ambient_linear.b*rpi->probe_ptr->interior_ambient_energy; + reflection_ubo.ambient[3]=rpi->probe_ptr->interior_ambient_probe_contrib; + } else { + Color ambient_linear; + float contrib=0; + if (p_env) { + ambient_linear=p_env->ambient_color.to_linear(); + ambient_linear.r*=p_env->ambient_energy; + ambient_linear.g*=p_env->ambient_energy; + ambient_linear.b*=p_env->ambient_energy; + contrib=p_env->ambient_skybox_contribution; + } + + reflection_ubo.ambient[0]=ambient_linear.r; + reflection_ubo.ambient[1]=ambient_linear.g; + reflection_ubo.ambient[2]=ambient_linear.b; + reflection_ubo.ambient[3]=0; + } + + int cell_size = reflection_atlas->size / reflection_atlas->subdiv; + int x = (rpi->reflection_atlas_index % reflection_atlas->subdiv) * cell_size; + int y = (rpi->reflection_atlas_index / reflection_atlas->subdiv) * cell_size; + int width=cell_size; + int height=cell_size; + + reflection_ubo.atlas_clamp[0]=float(x)/reflection_atlas->size; + reflection_ubo.atlas_clamp[1]=float(y)/reflection_atlas->size; + reflection_ubo.atlas_clamp[2]=float(width)/reflection_atlas->size; + reflection_ubo.atlas_clamp[3]=float(height/2)/reflection_atlas->size; + + Transform proj = (p_camera_inverse_transform * rpi->transform).inverse(); + store_transform(proj,reflection_ubo.local_matrix); + + rpi->reflection_index=state.reflection_probe_count; + copymem(&state.reflection_array_tmp[rpi->reflection_index*sizeof(ReflectionProbeDataUBO)],&reflection_ubo,sizeof(ReflectionProbeDataUBO)); + state.reflection_probe_count++; + + } + + + if (state.reflection_probe_count) { + + + glBindBuffer(GL_UNIFORM_BUFFER, state.reflection_array_ubo); + glBufferSubData(GL_UNIFORM_BUFFER, 0, state.reflection_probe_count*sizeof(ReflectionProbeDataUBO), state.reflection_array_tmp); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + glBindBufferBase(GL_UNIFORM_BUFFER,6,state.reflection_array_ubo); + } + +} + + void RasterizerSceneGLES3::_copy_screen() { glBindVertexArray(storage->resources.quadie_array); @@ -1959,7 +2405,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_ } -void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas){ +void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){ //first of all, make a new render pass render_pass++; @@ -1969,6 +2415,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C Environment *env = environment_owner.getornull(p_environment); ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas); + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_reflection_atlas); if (shadow_atlas && shadow_atlas->size) { glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-3); @@ -1979,9 +2426,21 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C state.ubo_data.shadow_atlas_pixel_size[1]=1.0/shadow_atlas->size; } + + if (reflection_atlas && reflection_atlas->size) { + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-5); + glBindTexture(GL_TEXTURE_2D,reflection_atlas->color); + } + + if (p_reflection_probe.is_valid()) { + state.ubo_data.reflection_multiplier=0.0; + } else { + state.ubo_data.reflection_multiplier=1.0; + } _setup_environment(env,p_cam_projection,p_cam_transform); _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_shadow_atlas); + _setup_reflections(p_reflection_probe_cull_result,p_reflection_probe_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_reflection_atlas,env); render_list.clear(); @@ -1998,24 +2457,55 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - RasterizerStorageGLES3::Texture* env_radiance_tex=NULL; - glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + ReflectionProbeInstance *probe = reflection_probe_instance_owner.getornull(p_reflection_probe); + GLuint current_fbo; - if (use_mrt) { + if (probe) { - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); - state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,true); + ReflectionAtlas *ref_atlas = reflection_atlas_owner.getptr(probe->atlas); + ERR_FAIL_COND(!ref_atlas); - Color black(0,0,0,0); - glClearBufferfv(GL_COLOR,1,black.components); // specular - glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough + int target_size=ref_atlas->size/ref_atlas->subdiv; - } else { + int cubemap_index=reflection_cubemaps.size()-1; - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + for(int i=reflection_cubemaps.size()-1;i>=0;i--) { + //find appropriate cubemap to render to + if (reflection_cubemaps[i].size>target_size*2) + break; + + cubemap_index=i; + } + + current_fbo=reflection_cubemaps[cubemap_index].fbo_id[p_reflection_probe_pass]; + use_mrt=false; state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + glViewport(0,0,reflection_cubemaps[cubemap_index].size,reflection_cubemaps[cubemap_index].size); + glBindFramebuffer(GL_FRAMEBUFFER,current_fbo); + } else { + + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + + if (use_mrt) { + + current_fbo=storage->frame.current_rt->buffers.fbo; + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,true); + + Color black(0,0,0,0); + glClearBufferfv(GL_COLOR,1,black.components); // specular + glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough + + } else { + + current_fbo = storage->frame.current_rt->buffers.alpha_fbo; + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + + } } @@ -2024,6 +2514,9 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C Color clear_color(0,0,0,0); + RasterizerStorageGLES3::SkyBox *skybox=NULL; + GLuint env_radiance_tex=0; + if (!env || env->bg_mode==VS::ENV_BG_CLEAR_COLOR) { if (storage->frame.clear_request) { @@ -2039,8 +2532,10 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C storage->frame.clear_request=false; } else if (env->bg_mode==VS::ENV_BG_SKYBOX) { - if (env->skybox_radiance.is_valid()) { - env_radiance_tex = storage->texture_owner.getornull(env->skybox_radiance); + skybox = storage->skybox_owner.getornull(env->skybox); + + if (skybox) { + env_radiance_tex=skybox->radiance; } storage->frame.clear_request=false; @@ -2055,7 +2550,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -2065,23 +2560,25 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C render_list.sort_by_key(false); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { + if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } else { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } + + if (state.directional_light_count==0) { directional_light=NULL; - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,false); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,false,shadow_atlas!=NULL); } else { for(int i=0;i0) { glEnable(GL_BLEND); } - _setup_directional_light(i,p_cam_transform.affine_inverse()); - _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,i>0); + _setup_directional_light(i,p_cam_transform.affine_inverse(),shadow_atlas!=NULL); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,false,false,i>0,shadow_atlas!=NULL); } } @@ -2095,7 +2592,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters } - _draw_skybox(env->skybox_color,p_cam_projection,p_cam_transform,storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); + _draw_skybox(skybox,p_cam_projection,p_cam_transform,storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); } @@ -2112,24 +2609,30 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); - - render_list.sort_by_depth(true); + if (use_mrt) { + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + } + render_list.sort_by_depth(true); if (state.directional_light_count==0) { directional_light=NULL; - _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false,false); + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false,false,shadow_atlas!=NULL); } else { for(int i=0;i0); + _setup_directional_light(i,p_cam_transform.affine_inverse(),shadow_atlas!=NULL); + _render_list(&render_list.elements[render_list.max_elements-render_list.alpha_element_count],render_list.alpha_element_count,p_cam_transform,p_cam_projection,env_radiance_tex,false,true,false,i>0,shadow_atlas!=NULL); } } + if (probe) { + //rendering a probe, do no more! + return; + } + _copy_to_front_buffer(env); /* if (shadow_atlas) { @@ -2143,6 +2646,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } */ + + if (false && reflection_atlas && storage->frame.current_rt) { + + //_copy_texture_to_front_buffer(shadow_atlas->depth); + storage->canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,reflection_atlas->color); + storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/2,storage->frame.current_rt->height/2),Rect2(0,0,1,1)); + + } + if (false && directional_shadow.fbo) { //_copy_texture_to_front_buffer(shadow_atlas->depth); @@ -2154,6 +2668,16 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } + if (false && env_radiance_tex) { + + //_copy_texture_to_front_buffer(shadow_atlas->depth); + storage->canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,env_radiance_tex); + storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/2,storage->frame.current_rt->height/2),Rect2(0,0,1,1)); + + } + #if 0 if (use_fb) { @@ -2534,7 +3058,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,true); - _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true,false); + _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true,false,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,false); @@ -2624,6 +3148,19 @@ bool RasterizerSceneGLES3::free(RID p_rid) { shadow_atlas_set_size(p_rid,0); shadow_atlas_owner.free(p_rid); memdelete(shadow_atlas); + } else if (reflection_atlas_owner.owns(p_rid)) { + + ReflectionAtlas *reflection_atlas = reflection_atlas_owner.get(p_rid); + reflection_atlas_set_size(p_rid,0); + reflection_atlas_owner.free(p_rid); + memdelete(reflection_atlas); + } else if (reflection_probe_instance_owner.owns(p_rid)) { + + ReflectionProbeInstance *reflection_instance = reflection_probe_instance_owner.get(p_rid); + + reflection_probe_release_atlas_index(p_rid); + reflection_probe_instance_owner.free(p_rid); + memdelete(reflection_instance); } else { return false; @@ -2890,6 +3427,7 @@ void RasterizerSceneGLES3::initialize() { const int ubo_light_size=160; state.ubo_light_size=ubo_light_size; state.max_ubo_lights=max_ubo_size/ubo_light_size; + print_line("max ubo light: "+itos(state.max_ubo_lights)); state.spot_array_tmp = (uint8_t*)memalloc(ubo_light_size*state.max_ubo_lights); state.omni_array_tmp = (uint8_t*)memalloc(ubo_light_size*state.max_ubo_lights); @@ -2912,10 +3450,21 @@ void RasterizerSceneGLES3::initialize() { state.max_forward_lights_per_object=8; + state.scene_shader.add_custom_define("#define MAX_LIGHT_DATA_STRUCTS "+itos(state.max_ubo_lights)+"\n"); state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS "+itos(state.max_forward_lights_per_object)+"\n"); + state.max_ubo_reflections=max_ubo_size/sizeof(ReflectionProbeDataUBO); + print_line("max ubo reflections: "+itos(state.max_ubo_reflections)+" ubo size: "+itos(sizeof(ReflectionProbeDataUBO))); + state.reflection_array_tmp = (uint8_t*)memalloc(sizeof(ReflectionProbeDataUBO)*state.max_ubo_reflections); + + glGenBuffers(1, &state.reflection_array_ubo); + glBindBuffer(GL_UNIFORM_BUFFER, state.reflection_array_ubo); + glBufferData(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeDataUBO)*state.max_ubo_reflections, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + + state.scene_shader.add_custom_define("#define MAX_REFLECTION_DATA_STRUCTS "+itos(state.max_ubo_reflections)+"\n"); } @@ -2923,6 +3472,73 @@ void RasterizerSceneGLES3::initialize() { Globals::get_singleton()->set_custom_property_info("rendering/gles3/shadow_filter_mode",PropertyInfo(Variant::INT,"rendering/gles3/shadow_filter_mode",PROPERTY_HINT_ENUM,"Disabled,PCF5,PCF13")); shadow_filter_mode=SHADOW_FILTER_NEAREST; + { //reflection cubemaps + int max_reflection_cubemap_sampler_size=512; + + int cube_size = max_reflection_cubemap_sampler_size; + + glActiveTexture(GL_TEXTURE0); + + bool use_float=true; + + GLenum internal_format = use_float?GL_RGBA16F:GL_RGB10_A2; + GLenum format = GL_RGBA; + GLenum type = use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV; + + while(cube_size>=32) { + + ReflectionCubeMap cube; + cube.size=cube_size; + + glGenTextures(1,&cube.depth); + glBindTexture(GL_TEXTURE_2D,cube.depth); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, cube.size, cube.size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + + glGenTextures(1,&cube.cubemap); + glBindTexture(GL_TEXTURE_CUBE_MAP,cube.cubemap); + //gen cubemap first + for(int i=0;i<6;i++) { + + glTexImage2D(_cube_side_enum[i], 0, internal_format, cube.size, cube.size, 0, format, type, NULL); + } + + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + // Remove artifact on the edges of the reflectionmap + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + + //gen renderbuffers second, because it needs a complete cubemap + for(int i=0;i<6;i++) { + + glGenFramebuffers(1, &cube.fbo_id[i]); + glBindFramebuffer(GL_FRAMEBUFFER, cube.fbo_id[i]); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,_cube_side_enum[i], cube.cubemap, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D, cube.depth, 0); + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); + } + + reflection_cubemaps.push_back(cube); + + cube_size>>=1; + } + } + + +#ifdef GLEW_ENABLED +//"desktop" opengl needs this. + glEnable(GL_POINT_SPRITE); + glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + +#endif } void RasterizerSceneGLES3::iteration() { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 24b6a36fcc..81c13bdc08 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -62,6 +62,7 @@ public: float shadow_dual_paraboloid_render_side; float shadow_atlas_pixel_size[2]; float shadow_directional_pixel_size[2]; + float reflection_multiplier; } ubo_data; @@ -87,17 +88,23 @@ public: GLuint spot_array_ubo; GLuint omni_array_ubo; + GLuint reflection_array_ubo; uint32_t ubo_light_size; uint8_t *spot_array_tmp; uint8_t *omni_array_tmp; + uint8_t *reflection_array_tmp; int max_ubo_lights; int max_forward_lights_per_object; + int max_ubo_reflections; + + int spot_light_count; int omni_light_count; int directional_light_count; + int reflection_probe_count; bool cull_front; @@ -176,6 +183,87 @@ public: virtual int get_directional_light_shadow_size(RID p_light_intance); virtual void set_directional_shadow_count(int p_count); + /* REFLECTION PROBE ATLAS API */ + + struct ReflectionAtlas : public RID_Data { + + int subdiv; + int size; + + struct Reflection { + RID owner; + uint64_t last_frame; + }; + + GLuint fbo[6]; + GLuint color; + + Vector reflections; + }; + + mutable RID_Owner reflection_atlas_owner; + + virtual RID reflection_atlas_create(); + virtual void reflection_atlas_set_size(RID p_ref_atlas,int p_size); + virtual void reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv); + + /* REFLECTION CUBEMAPS */ + + struct ReflectionCubeMap { + + GLuint fbo_id[6]; + GLuint cubemap; + GLuint depth; + int size; + }; + + Vector reflection_cubemaps; + + /* REFLECTION PROBE INSTANCE */ + + struct ReflectionProbeInstance : public RID_Data { + + RasterizerStorageGLES3::ReflectionProbe *probe_ptr; + RID probe; + RID self; + RID atlas; + + int reflection_atlas_index; + + int render_step; + + + + uint64_t last_pass; + int reflection_index; + + Transform transform; + }; + + struct ReflectionProbeDataUBO { + + float box_extents[4]; + float box_ofs[4]; + float params[4]; // intensity, 0, 0, boxproject + float ambient[4]; //color, probe contrib + float atlas_clamp[4]; + float local_matrix[16]; //up to here for spot and omni, rest is for directional + //notes: for ambientblend, use distance to edge to blend between already existing global environment + }; + + + mutable RID_Owner reflection_probe_instance_owner; + + virtual RID reflection_probe_instance_create(RID p_probe); + virtual void reflection_probe_instance_set_transform(RID p_instance,const Transform& p_transform); + virtual void reflection_probe_release_atlas_index(RID p_instance); + virtual bool reflection_probe_instance_needs_redraw(RID p_instance); + virtual bool reflection_probe_instance_has_reflection(RID p_instance); + virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas); + virtual bool reflection_probe_instance_postprocess_step(RID p_instance); + + + /* ENVIRONMENT API */ @@ -183,8 +271,7 @@ public: VS::EnvironmentBG bg_mode; - RID skybox_color; - RID skybox_radiance; + RID skybox; float skybox_scale; Color bg_color; @@ -214,7 +301,7 @@ public: virtual RID environment_create(); virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg); - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size); + virtual void environment_set_skybox(RID p_env,RID p_skybox); virtual void environment_set_skybox_scale(RID p_env,float p_scale); virtual void environment_set_bg_color(RID p_env,const Color& p_color); virtual void environment_set_bg_energy(RID p_env,float p_energy); @@ -441,23 +528,25 @@ public: _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); _FORCE_INLINE_ void _setup_light(RenderList::Element *e); - void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, RasterizerStorageGLES3::Texture *p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add); + void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, GLuint p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add, bool p_directional_shadows); _FORCE_INLINE_ void _add_geometry( RasterizerStorageGLES3::Geometry* p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner,int p_material,bool p_shadow); - void _draw_skybox(RID p_skybox, const CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); + void _draw_skybox(RasterizerStorageGLES3::SkyBox *p_skybox, const CameraMatrix& p_projection, const Transform& p_transform, bool p_vflip, float p_scale); void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform& p_cam_transform); - void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform); + void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transformm, bool p_use_shadows); void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix& p_camera_projection, RID p_shadow_atlas); + void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform& p_camera_inverse_transform, const CameraMatrix& p_camera_projection, RID p_reflection_atlas, Environment *p_env); + void _copy_screen(); void _copy_to_front_buffer(Environment *env); void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow); - virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas); + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass); virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count); virtual bool free(RID p_rid); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 6e278e563b..8188fe3adb 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1015,10 +1015,6 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_r glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); -#ifdef GLEW_ENABLED - glDisable(GL_POINT_SPRITE); - glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); -#endif glDisable(GL_BLEND); @@ -1086,6 +1082,8 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_r size = p_resolution; + shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID,false); + while(mm_level) { for(int i=0;i<6;i++) { @@ -1156,6 +1154,147 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_r } +RID RasterizerStorageGLES3::skybox_create() { + + SkyBox *skybox = memnew( SkyBox ); + skybox->radiance=0; + return skybox_owner.make_rid(skybox); +} + +void RasterizerStorageGLES3::skybox_set_texture(RID p_skybox, RID p_cube_map, int p_radiance_size){ + + SkyBox *skybox = skybox_owner.getornull(p_skybox); + ERR_FAIL_COND(!skybox); + + if (skybox->cubemap.is_valid()) { + skybox->cubemap=RID(); + glDeleteTextures(1,&skybox->radiance); + skybox->radiance=0; + } + + skybox->cubemap=p_cube_map; + if (!skybox->cubemap.is_valid()) + return; //cleared + + Texture *texture = texture_owner.getornull(skybox->cubemap); + if (!texture || !(texture->flags&VS::TEXTURE_FLAG_CUBEMAP)) { + skybox->cubemap=RID(); + ERR_FAIL_COND(!texture || !(texture->flags&VS::TEXTURE_FLAG_CUBEMAP)); + } + + glBindVertexArray(0); + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + + glActiveTexture(GL_TEXTURE0); + glBindTexture(texture->target, texture->tex_id); + + if (config.srgb_decode_supported && texture->srgb && !texture->using_srgb) { + + glTexParameteri(texture->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + texture->using_srgb=true; +#ifdef TOOLS_ENABLED + if (!(texture->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { + texture->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; + //notify that texture must be set to linear beforehand, so it works in other platforms when exported + } +#endif + } + + + glActiveTexture(GL_TEXTURE1); + glGenTextures(1, &skybox->radiance); + glBindTexture(GL_TEXTURE_2D, skybox->radiance); + + GLuint tmp_fb; + + glGenFramebuffers(1, &tmp_fb); + glBindFramebuffer(GL_FRAMEBUFFER, tmp_fb); + + + int size = p_radiance_size; + + int lod=0; + + + int mipmaps=6; + + int mm_level=mipmaps; + + bool use_float=true; + + GLenum internal_format = use_float?GL_RGBA16F:GL_RGB10_A2; + GLenum format = GL_RGBA; + GLenum type = use_float?GL_HALF_FLOAT:GL_UNSIGNED_INT_2_10_10_10_REV; + + while(mm_level) { + + glTexImage2D(GL_TEXTURE_2D, lod, internal_format, size, size*2, 0, format, type, NULL); + lod++; + mm_level--; + + if (size>1) + size>>=1; + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod-1); + + lod=0; + mm_level=mipmaps; + + size = p_radiance_size; + + shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID,true); + shaders.cubemap_filter.bind(); + + while(mm_level) { + + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, skybox->radiance, lod); +#ifdef DEBUG_ENABLED + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); +#endif + + for(int i=0;i<2;i++) { + glViewport(0,i*size,size,size); + glBindVertexArray(resources.quadie_array); + + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::Z_FLIP,i>0); + shaders.cubemap_filter.set_uniform(CubemapFilterShaderGLES3::ROUGHNESS,lod/float(mipmaps-1)); + + + glDrawArrays(GL_TRIANGLE_FAN,0,4); + glBindVertexArray(0); + } + + if (size>1) + size>>=1; + lod++; + mm_level--; + + } + shaders.cubemap_filter.set_conditional(CubemapFilterShaderGLES3::USE_DUAL_PARABOLOID,false); + + + //restore ranges + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, lod-1); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + glDeleteFramebuffers(1, &tmp_fb); + +} + + /* SHADER API */ @@ -2144,7 +2283,7 @@ void RasterizerStorageGLES3::_update_material(Material* material) { Map::Element *V = material->params.find(E->key()); if (V) { - //user provided + //user provided _fill_std140_variant_ubo_value(E->get().type,V->get(),data,material->shader->mode==VS::SHADER_SPATIAL); } else if (E->get().default_value.size()){ //default value @@ -3405,46 +3544,197 @@ AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { RID RasterizerStorageGLES3::reflection_probe_create(){ - return RID(); + ReflectionProbe *reflection_probe = memnew( ReflectionProbe ); + + reflection_probe->intensity=1.0; + reflection_probe->interior_ambient=Color(); + reflection_probe->interior_ambient_energy=1.0; + reflection_probe->max_distance=0; + reflection_probe->extents=Vector3(1,1,1); + reflection_probe->origin_offset=Vector3(0,0,0); + reflection_probe->interior=false; + reflection_probe->box_projection=false; + reflection_probe->enable_shadows=false; + reflection_probe->cull_mask=(1<<20)-1; + reflection_probe->update_mode=VS::REFLECTION_PROBE_UPDATE_ONCE; + + return reflection_probe_owner.make_rid(reflection_probe); } -void RasterizerStorageGLES3::reflection_probe_set_intensity(RID p_probe, float p_intensity){ +void RasterizerStorageGLES3::reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) { + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->update_mode=p_mode; + reflection_probe->instance_change_notify(); } -void RasterizerStorageGLES3::reflection_probe_set_clip(RID p_probe, float p_near, float p_far){ +void RasterizerStorageGLES3::reflection_probe_set_intensity(RID p_probe, float p_intensity) { + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->intensity=p_intensity; + +} + +void RasterizerStorageGLES3::reflection_probe_set_interior_ambient(RID p_probe, const Color& p_ambient) { + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->interior_ambient=p_ambient; + +} + +void RasterizerStorageGLES3::reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) { + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->interior_ambient_energy=p_energy; } -void RasterizerStorageGLES3::reflection_probe_set_min_blend_distance(RID p_probe, float p_distance){ +void RasterizerStorageGLES3::reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) { + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->interior_ambient_probe_contrib=p_contrib; + +} + + +void RasterizerStorageGLES3::reflection_probe_set_max_distance(RID p_probe, float p_distance){ + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->max_distance=p_distance; + reflection_probe->instance_change_notify(); } void RasterizerStorageGLES3::reflection_probe_set_extents(RID p_probe, const Vector3& p_extents){ + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->extents=p_extents; + reflection_probe->instance_change_notify(); } void RasterizerStorageGLES3::reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset){ + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->origin_offset=p_offset; + reflection_probe->instance_change_notify(); } -void RasterizerStorageGLES3::reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable){ +void RasterizerStorageGLES3::reflection_probe_set_as_interior(RID p_probe, bool p_enable){ + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->interior=p_enable; } -void RasterizerStorageGLES3::reflection_probe_set_resolution(RID p_probe, int p_resolution){ +void RasterizerStorageGLES3::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable){ + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + reflection_probe->box_projection=p_enable; } -void RasterizerStorageGLES3::reflection_probe_set_hide_skybox(RID p_probe, bool p_hide){ +void RasterizerStorageGLES3::reflection_probe_set_enable_shadows(RID p_probe, bool p_enable){ + + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->enable_shadows=p_enable; + reflection_probe->instance_change_notify(); } void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers){ + ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!reflection_probe); + + reflection_probe->cull_mask=p_layers; + reflection_probe->instance_change_notify(); } +AABB RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const { + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,AABB()); + + AABB aabb; + aabb.pos=-reflection_probe->extents; + aabb.size=reflection_probe->extents*2.0; + + return aabb; + + +} +VS::ReflectionProbeUpdateMode RasterizerStorageGLES3::reflection_probe_get_update_mode(RID p_probe) const{ + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,VS::REFLECTION_PROBE_UPDATE_ALWAYS); + + return reflection_probe->update_mode; +} + +uint32_t RasterizerStorageGLES3::reflection_probe_get_cull_mask(RID p_probe) const { + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,0); + + return reflection_probe->cull_mask; + +} + +Vector3 RasterizerStorageGLES3::reflection_probe_get_extents(RID p_probe) const { + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,Vector3()); + + return reflection_probe->extents; + +} +Vector3 RasterizerStorageGLES3::reflection_probe_get_origin_offset(RID p_probe) const{ + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,Vector3()); + + return reflection_probe->origin_offset; + +} + +bool RasterizerStorageGLES3::reflection_probe_renders_shadows(RID p_probe) const { + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,false); + + return reflection_probe->enable_shadows; + +} + +float RasterizerStorageGLES3::reflection_probe_get_origin_max_distance(RID p_probe) const{ + + const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!reflection_probe,0); + + return reflection_probe->max_distance; + +} /* ROOM API */ @@ -3495,6 +3785,10 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: inst = mesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_REFLECTION_PROBE: { + inst = reflection_probe_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_LIGHT: { inst = light_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -3517,6 +3811,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_REFLECTION_PROBE: { + inst = reflection_probe_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_LIGHT: { inst = light_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -4005,6 +4303,9 @@ VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { if (light_owner.owns(p_rid)) { return VS::INSTANCE_LIGHT; } + if (reflection_probe_owner.owns(p_rid)) { + return VS::INSTANCE_REFLECTION_PROBE; + } return VS::INSTANCE_NONE; } @@ -4028,6 +4329,12 @@ bool RasterizerStorageGLES3::free(RID p_rid){ info.texture_mem-=texture->total_data_size; texture_owner.free(p_rid); memdelete(texture); + } else if (skybox_owner.owns(p_rid)) { + // delete the skybox + SkyBox *skybox = skybox_owner.get(p_rid); + skybox_set_texture(p_rid,RID(),256); + skybox_owner.free(p_rid); + memdelete(skybox); } else if (shader_owner.owns(p_rid)) { @@ -4259,6 +4566,8 @@ void RasterizerStorageGLES3::initialize() { shaders.cubemap_filter.init(); glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); + + frame.count=0; } void RasterizerStorageGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 0e3d47b61f..5f07efeb0a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -226,6 +226,19 @@ public: virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const; + /* SKYBOX API */ + + struct SkyBox : public RID_Data { + + RID cubemap; + GLuint radiance; + int radiance_size; + }; + + mutable RID_Owner skybox_owner; + + virtual RID skybox_create(); + virtual void skybox_set_texture(RID p_skybox,RID p_cube_map,int p_radiance_size); /* SHADER API */ @@ -679,18 +692,51 @@ public: /* PROBE API */ + struct ReflectionProbe : Instantiable { + + VS::ReflectionProbeUpdateMode update_mode; + float intensity; + Color interior_ambient; + float interior_ambient_energy; + float interior_ambient_probe_contrib; + float max_distance; + Vector3 extents; + Vector3 origin_offset; + bool interior; + bool box_projection; + bool enable_shadows; + uint32_t cull_mask; + + }; + + mutable RID_Owner reflection_probe_owner; + virtual RID reflection_probe_create(); + virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode); virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity); - virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far); - virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance); + virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color& p_ambient); + virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy); + virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib); + virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance); virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents); virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset); - virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable); - virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution); - virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide); + virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable); + virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable); + virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable); virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); + virtual AABB reflection_probe_get_aabb(RID p_probe) const; + virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const; + virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const; + + virtual Vector3 reflection_probe_get_extents(RID p_probe) const; + virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const; + virtual float reflection_probe_get_origin_max_distance(RID p_probe) const; + virtual bool reflection_probe_renders_shadows(RID p_probe) const; + + + /* ROOM API */ @@ -813,6 +859,7 @@ public: Color clear_request_color; int canvas_draw_commands; float time[4]; + uint64_t count; } frame; void initialize(); diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index 998a59833e..768d20ad22 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -151,14 +151,47 @@ vec2 Hammersley(uint i, uint N) { return vec2(float(i)/float(N), radicalInverse_VdC(i)); } -#define SAMPLE_COUNT 1024u + + +#ifdef LOW_QUALITY + +#define SAMPLE_COUNT 64u + +#else + +#define SAMPLE_COUNT 512u + +#endif + +uniform bool z_flip; void main() { +#ifdef USE_DUAL_PARABOLOID + + vec3 N = vec3( uv_interp * 2.0 - 1.0, 0.0 ); + N.z = 0.5 - 0.5*((N.x * N.x) + (N.y * N.y)); + N = normalize(N); + + if (!z_flip) { + N.y=-N.y; //y is flipped to improve blending between both sides + } else { + N.z=-N.z; + } + + +#else vec2 uv = (uv_interp * 2.0) - 1.0; vec3 N = texelCoordToVec(uv, face_id); - +#endif //vec4 color = color_interp; + +#ifdef USE_DIRECT_WRITE + + frag_color=vec4(texture(N,source_cube).rgb,1.0); + +#else + vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); for(uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) { @@ -178,5 +211,8 @@ void main() { sum /= sum.a; frag_color = vec4(sum.rgb, 1.0); + +#endif + } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index ceb5a72118..a923c130dc 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -64,6 +64,8 @@ layout(std140) uniform SceneData { //ubo:0 vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; + float reflection_multiplier; + }; uniform highp mat4 world_transform; @@ -288,11 +290,11 @@ in vec3 normal_interp; //used on forward mainly uniform bool no_ambient_light; +uniform sampler2D brdf_texture; //texunit:-1 -#ifdef USE_RADIANCE_CUBEMAP +#ifdef USE_RADIANCE_MAP -uniform sampler2D brdf_texture; //texunit:-1 -uniform samplerCube radiance_cube; //texunit:-2 +uniform sampler2D radiance_map; //texunit:-2 layout(std140) uniform Radiance { //ubo:2 @@ -343,6 +345,8 @@ layout(std140) uniform SceneData { vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; + float reflection_multiplier; + }; //directional light data @@ -398,6 +402,24 @@ layout(std140) uniform SpotLightData { //ubo:5 uniform highp sampler2DShadow shadow_atlas; //texunit:-3 +struct ReflectionData { + + mediump vec4 box_extents; + mediump vec4 box_offset; + mediump vec4 params; // intensity, 0, interior , boxproject + mediump vec4 ambient; //ambient color, energy + mediump vec4 atlas_clamp; + highp mat4 local_matrix; //up to here for spot and omni, rest is for directional + //notes: for ambientblend, use distance to edge to blend between already existing global environment +}; + +layout(std140) uniform ReflectionProbeData { //ubo:6 + + ReflectionData reflections[MAX_REFLECTION_DATA_STRUCTS]; +}; +uniform mediump sampler2D reflection_atlas; //texunit:-5 + + #ifdef USE_FORWARD_LIGHTING uniform int omni_light_indices[MAX_FORWARD_LIGHTS]; @@ -406,6 +428,9 @@ uniform int omni_light_count; uniform int spot_light_indices[MAX_FORWARD_LIGHTS]; uniform int spot_light_count; +uniform int reflection_indices[MAX_FORWARD_LIGHTS]; +uniform int reflection_count; + #endif @@ -578,6 +603,120 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 al } +void reflection_process(int idx, vec3 vertex, vec3 normal,float roughness,vec3 ambient,vec3 skybox,vec2 brdf, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) { + + vec3 ref_vec = normalize(reflect(vertex,normal)); + vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex,1.0)).xyz; + vec3 box_extents = reflections[idx].box_extents.xyz; + + if (any(greaterThan(abs(local_pos),box_extents))) { //out of the reflection box + return; + } + + vec3 inner_pos = abs(local_pos / box_extents); + float blend = max(inner_pos.x,max(inner_pos.y,inner_pos.z)); + //make blend more rounded + blend=mix(length(inner_pos),blend,blend); + blend*=blend; + blend=1.001-blend; + + if (reflections[idx].params.x>0.0){// compute reflection + + vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec,0.0)).xyz; + + if (reflections[idx].params.w > 0.5) { //box project + + vec3 nrdir = normalize(local_ref_vec); + vec3 rbmax = (box_extents - local_pos)/nrdir; + vec3 rbmin = (-box_extents - local_pos)/nrdir; + + + vec3 rbminmax = mix(rbmin,rbmax,greaterThan(nrdir,vec3(0.0,0.0,0.0))); + + float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z); + vec3 posonbox = local_pos + nrdir * fa; + local_ref_vec = posonbox - reflections[idx].box_offset.xyz; + } + + + + vec3 splane=normalize(local_ref_vec); + vec4 clamp_rect=reflections[idx].atlas_clamp; + + splane.z*=-1.0; + if (splane.z>=0.0) { + splane.z+=1.0; + clamp_rect.y+=clamp_rect.w; + } else { + splane.z=1.0 - splane.z; + splane.y=-splane.y; + } + + splane.xy/=splane.z; + splane.xy=splane.xy * 0.5 + 0.5; + + splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy; + splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw); + + highp vec4 reflection; + reflection.rgb = textureLod(reflection_atlas,splane.xy,roughness*5.0).rgb * ( brdf.x + brdf.y); + if (reflections[idx].params.z < 0.5) { + reflection.rgb = mix(skybox,reflection.rgb,blend); + } + reflection.rgb*=reflections[idx].params.x; + reflection.a = blend; + reflection.rgb*=reflection.a; + + reflection_accum+=reflection; + } + + if (reflections[idx].ambient.a>0.0) { //compute ambient using skybox + + + vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal,0.0)).xyz; + + vec3 splane=normalize(local_amb_vec); + vec4 clamp_rect=reflections[idx].atlas_clamp; + + splane.z*=-1.0; + if (splane.z>=0.0) { + splane.z+=1.0; + clamp_rect.y+=clamp_rect.w; + } else { + splane.z=1.0 - splane.z; + splane.y=-splane.y; + } + + splane.xy/=splane.z; + splane.xy=splane.xy * 0.5 + 0.5; + + splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy; + splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw); + + highp vec4 ambient_out; + ambient_out.a=blend; + ambient_out.rgb = textureLod(reflection_atlas,splane.xy,5.0).rgb; + ambient_out.rgb=mix(reflections[idx].ambient.rgb,ambient_out.rgb,reflections[idx].ambient.a); + if (reflections[idx].params.z < 0.5) { + ambient_out.rgb = mix(ambient,ambient_out.rgb,blend); + } + + ambient_out.rgb *= ambient_out.a; + ambient_accum+=ambient_out; + } else { + + highp vec4 ambient_out; + ambient_out.a=blend; + ambient_out.rgb=reflections[idx].ambient.rgb; + if (reflections[idx].params.z < 0.5) { + ambient_out.rgb = mix(ambient,ambient_out.rgb,blend); + } + ambient_out.rgb *= ambient_out.a; + ambient_accum+=ambient_out; + + } +} + void main() { #ifdef RENDER_SHADOW_DUAL_PARABOLOID @@ -666,31 +805,56 @@ FRAGMENT_SHADER_CODE vec3 eye_vec = -normalize( vertex_interp ); -#ifdef USE_RADIANCE_CUBEMAP +#ifndef RENDER_SHADOW + float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); + vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; +#endif + +#ifdef USE_RADIANCE_MAP if (no_ambient_light) { ambient_light=vec3(0.0,0.0,0.0); } else { { - float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); - vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; + float lod = roughness * 5.0; - vec3 r = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); - r=normalize((radiance_inverse_xform * vec4(r,0.0)).xyz); - vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); - specular_light=mix(albedo,radiance,specular); + { //read radiance from dual paraboloid + + vec3 ref_vec = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); + ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz); + + vec3 norm = normalize(ref_vec); + float y_ofs=0.0; + if (norm.z>=0.0) { + + norm.z+=1.0; + y_ofs+=0.5; + } else { + norm.z=1.0 - norm.z; + norm.y=-norm.y; + } + + norm.xy/=norm.z; + norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25+y_ofs); + vec3 radiance = textureLod(radiance_map, norm.xy, lod).xyz * ( brdf.x + brdf.y); + specular_light=mix(albedo,radiance,specular); + + } + //no longer a cubemap + //vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y); } { - vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); + /*vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz); vec3 env_ambient=textureLod(radiance_cube, ambient_dir, 5.0).xyz; - ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution); + ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution);*/ + ambient_light=vec3(0.0,0.0,0.0); } } @@ -840,6 +1004,21 @@ FRAGMENT_SHADER_CODE #ifdef USE_FORWARD_LIGHTING + highp vec4 reflection_accum = vec4(0.0,0.0,0.0,0.0); + highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0); + + for(int i=0;i0.0) { + specular_light=reflection_accum.rgb/reflection_accum.a; + specular_light*=specular; + } + if (ambient_accum.a>0.0) { + ambient_light=ambient_accum.rgb/ambient_accum.a; + } + for(int i=0;ireflection_probe_set_intensity(probe,p_intensity); +} + +float ReflectionProbe::get_intensity() const{ + + return intensity; +} + + +void ReflectionProbe::set_interior_ambient(Color p_ambient) { + + interior_ambient=p_ambient; + VS::get_singleton()->reflection_probe_set_interior_ambient(probe,p_ambient); +} + +void ReflectionProbe::set_interior_ambient_energy(float p_energy) { + interior_ambient_energy=p_energy; + VS::get_singleton()->reflection_probe_set_interior_ambient_energy(probe,p_energy); +} + +float ReflectionProbe::get_interior_ambient_energy() const{ + return interior_ambient_energy; +} + + +Color ReflectionProbe::get_interior_ambient() const{ + + return interior_ambient; +} + +void ReflectionProbe::set_interior_ambient_probe_contribution(float p_contribution) { + + interior_ambient_probe_contribution=p_contribution; + VS::get_singleton()->reflection_probe_set_interior_ambient_probe_contribution(probe,p_contribution); +} + +float ReflectionProbe::get_interior_ambient_probe_contribution() const{ + + return interior_ambient_probe_contribution; +} + + +void ReflectionProbe::set_max_distance(float p_distance){ + + max_distance=p_distance; + VS::get_singleton()->reflection_probe_set_max_distance(probe,p_distance); +} +float ReflectionProbe::get_max_distance() const{ + + return max_distance; +} + + +void ReflectionProbe::set_extents(const Vector3& p_extents){ + + extents=p_extents; + + for(int i=0;i<3;i++) { + if (extents[i]<0.01) { + extents[i]=0.01; + } + + if (extents[i]-0.01reflection_probe_set_extents(probe,extents); + VS::get_singleton()->reflection_probe_set_origin_offset(probe,origin_offset); + _change_notify("extents"); + update_gizmo(); + +} +Vector3 ReflectionProbe::get_extents() const{ + + return extents; +} + +void ReflectionProbe::set_origin_offset(const Vector3& p_extents){ + + origin_offset=p_extents; + + for(int i=0;i<3;i++) { + + if (extents[i]-0.01reflection_probe_set_extents(probe,extents); + VS::get_singleton()->reflection_probe_set_origin_offset(probe,origin_offset); + + _change_notify("origin_offset"); + update_gizmo(); +} +Vector3 ReflectionProbe::get_origin_offset() const{ + + return origin_offset; +} + +void ReflectionProbe::set_enable_box_projection(bool p_enable){ + + box_projection=p_enable; + VS::get_singleton()->reflection_probe_set_enable_box_projection(probe,p_enable); + +} +bool ReflectionProbe::is_box_projection_enabled() const{ + + return box_projection; +} + + +void ReflectionProbe::set_as_interior(bool p_enable) { + + interior=p_enable; + VS::get_singleton()->reflection_probe_set_as_interior(probe,interior); + _change_notify(); + +} + +bool ReflectionProbe::is_set_as_interior() const { + + return interior; +} + + + +void ReflectionProbe::set_enable_shadows(bool p_enable) { + + enable_shadows=p_enable; + VS::get_singleton()->reflection_probe_set_enable_shadows(probe,p_enable); +} +bool ReflectionProbe::are_shadows_enabled() const { + + return enable_shadows; +} + +void ReflectionProbe::set_cull_mask(uint32_t p_layers) { + + cull_mask=p_layers; + VS::get_singleton()->reflection_probe_set_enable_shadows(probe,p_layers); +} +uint32_t ReflectionProbe::get_cull_mask() const { + + return cull_mask; +} + +void ReflectionProbe::set_update_mode(UpdateMode p_mode) { + update_mode=p_mode; + VS::get_singleton()->reflection_probe_set_update_mode(probe,VS::ReflectionProbeUpdateMode(p_mode)); +} + +ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const { + return update_mode; +} + + +AABB ReflectionProbe::get_aabb() const { + + AABB aabb; + aabb.pos=-origin_offset; + aabb.size=origin_offset+extents; + return aabb; +} +DVector ReflectionProbe::get_faces(uint32_t p_usage_flags) const { + + return DVector(); +} + +void ReflectionProbe::_validate_property(PropertyInfo& property) const { + + if (property.name=="interior/ambient_color" || property.name=="interior/ambient_energy" || property.name=="interior/ambient_contrib") { + if (!interior) { + property.usage=PROPERTY_USAGE_NOEDITOR; + } + } +} + +void ReflectionProbe::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_intensity","intensity"),&ReflectionProbe::set_intensity); + ObjectTypeDB::bind_method(_MD("get_intensity"),&ReflectionProbe::get_intensity); + + ObjectTypeDB::bind_method(_MD("set_interior_ambient","ambient"),&ReflectionProbe::set_interior_ambient); + ObjectTypeDB::bind_method(_MD("get_interior_ambient"),&ReflectionProbe::get_interior_ambient); + + ObjectTypeDB::bind_method(_MD("set_interior_ambient_energy","ambient_energy"),&ReflectionProbe::set_interior_ambient_energy); + ObjectTypeDB::bind_method(_MD("get_interior_ambient_energy"),&ReflectionProbe::get_interior_ambient_energy); + + ObjectTypeDB::bind_method(_MD("set_interior_ambient_probe_contribution","ambient_probe_contribution"),&ReflectionProbe::set_interior_ambient_probe_contribution); + ObjectTypeDB::bind_method(_MD("get_interior_ambient_probe_contribution"),&ReflectionProbe::get_interior_ambient_probe_contribution); + + ObjectTypeDB::bind_method(_MD("set_max_distance","max_distance"),&ReflectionProbe::set_max_distance); + ObjectTypeDB::bind_method(_MD("get_max_distance"),&ReflectionProbe::get_max_distance); + + ObjectTypeDB::bind_method(_MD("set_extents","extents"),&ReflectionProbe::set_extents); + ObjectTypeDB::bind_method(_MD("get_extents"),&ReflectionProbe::get_extents); + + ObjectTypeDB::bind_method(_MD("set_origin_offset","origin_offset"),&ReflectionProbe::set_origin_offset); + ObjectTypeDB::bind_method(_MD("get_origin_offset"),&ReflectionProbe::get_origin_offset); + + ObjectTypeDB::bind_method(_MD("set_as_interior","enable"),&ReflectionProbe::set_as_interior); + ObjectTypeDB::bind_method(_MD("is_set_as_interior"),&ReflectionProbe::is_set_as_interior); + + ObjectTypeDB::bind_method(_MD("set_enable_box_projection","enable"),&ReflectionProbe::set_enable_box_projection); + ObjectTypeDB::bind_method(_MD("is_box_projection_enabled"),&ReflectionProbe::is_box_projection_enabled); + + + ObjectTypeDB::bind_method(_MD("set_enable_shadows","enable"),&ReflectionProbe::set_enable_shadows); + ObjectTypeDB::bind_method(_MD("are_shadows_enabled"),&ReflectionProbe::are_shadows_enabled); + + ObjectTypeDB::bind_method(_MD("set_cull_mask","layers"),&ReflectionProbe::set_cull_mask); + ObjectTypeDB::bind_method(_MD("get_cull_mask"),&ReflectionProbe::get_cull_mask); + + ObjectTypeDB::bind_method(_MD("set_update_mode","mode"),&ReflectionProbe::set_update_mode); + ObjectTypeDB::bind_method(_MD("get_update_mode"),&ReflectionProbe::get_update_mode); + + ADD_PROPERTY( PropertyInfo(Variant::INT,"update_mode",PROPERTY_HINT_ENUM,"Once,Always"),_SCS("set_update_mode"),_SCS("get_update_mode")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"intensity",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_intensity"),_SCS("get_intensity")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"max_distance",PROPERTY_HINT_RANGE,"0,16384,0.1"),_SCS("set_max_distance"),_SCS("get_max_distance")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"extents"),_SCS("set_extents"),_SCS("get_extents")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"origin_offset"),_SCS("set_origin_offset"),_SCS("get_origin_offset")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"box_projection"),_SCS("set_enable_box_projection"),_SCS("is_box_projection_enabled")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"enable_shadows"),_SCS("set_enable_shadows"),_SCS("are_shadows_enabled")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"cull_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_cull_mask"),_SCS("get_cull_mask")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior/enable"),_SCS("set_as_interior"),_SCS("is_set_as_interior")); + ADD_PROPERTY( PropertyInfo(Variant::COLOR,"interior/ambient_color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_interior_ambient"),_SCS("get_interior_ambient")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"interior/ambient_energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_interior_ambient_energy"),_SCS("get_interior_ambient_energy")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"interior/ambient_contrib",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_interior_ambient_probe_contribution"),_SCS("get_interior_ambient_probe_contribution")); + + + BIND_CONSTANT( UPDATE_ONCE ); + BIND_CONSTANT( UPDATE_ALWAYS ); + +} + +ReflectionProbe::ReflectionProbe() { + + intensity=1.0; + interior_ambient=Color(0,0,0); + interior_ambient_probe_contribution=0; + interior_ambient_energy=1.0; + max_distance=0; + extents=Vector3(1,1,1); + origin_offset=Vector3(0,0,0); + box_projection=false; + interior=false; + enable_shadows=false; + cull_mask=(1<<20)-1; + update_mode=UPDATE_ONCE; + + probe=VisualServer::get_singleton()->reflection_probe_create(); + VS::get_singleton()->instance_set_base(get_instance(),probe); +} + +ReflectionProbe::~ReflectionProbe() { + + VS::get_singleton()->free(probe); +} diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h new file mode 100644 index 0000000000..5ea41a91c9 --- /dev/null +++ b/scene/3d/reflection_probe.h @@ -0,0 +1,92 @@ +#ifndef REFLECTIONPROBE_H +#define REFLECTIONPROBE_H + +#include "scene/3d/visual_instance.h" +#include "scene/resources/texture.h" +#include "scene/resources/sky_box.h" +#include "servers/visual_server.h" + +class ReflectionProbe : public VisualInstance { + OBJ_TYPE(ReflectionProbe,VisualInstance); + +public: + + enum UpdateMode { + UPDATE_ONCE, + UPDATE_ALWAYS, + }; + + +private: + + RID probe; + float intensity; + float max_distance; + Vector3 extents; + Vector3 origin_offset; + bool box_projection; + bool enable_shadows; + bool interior; + Color interior_ambient; + float interior_ambient_energy; + float interior_ambient_probe_contribution; + + uint32_t cull_mask; + UpdateMode update_mode; + +protected: + + static void _bind_methods(); + void _validate_property(PropertyInfo& property) const; + +public: + + void set_intensity(float p_intensity); + float get_intensity() const; + + void set_interior_ambient(Color p_ambient); + Color get_interior_ambient() const; + + void set_interior_ambient_energy(float p_energy); + float get_interior_ambient_energy() const; + + void set_interior_ambient_probe_contribution(float p_contribution); + float get_interior_ambient_probe_contribution() const; + + void set_max_distance(float p_distance); + float get_max_distance() const; + + void set_extents(const Vector3& p_extents); + Vector3 get_extents() const; + + void set_origin_offset(const Vector3& p_extents); + Vector3 get_origin_offset() const; + + void set_as_interior(bool p_enable); + bool is_set_as_interior() const; + + void set_enable_box_projection(bool p_enable); + bool is_box_projection_enabled() const; + + void set_enable_shadows(bool p_enable); + bool are_shadows_enabled() const; + + void set_cull_mask(uint32_t p_layers); + uint32_t get_cull_mask() const; + + void set_update_mode(UpdateMode p_mode); + UpdateMode get_update_mode() const; + + virtual AABB get_aabb() const; + virtual DVector get_faces(uint32_t p_usage_flags) const; + + + + ReflectionProbe(); + ~ReflectionProbe(); +}; + + +VARIANT_ENUM_CAST( ReflectionProbe::UpdateMode ); + +#endif // REFLECTIONPROBE_H diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index ef619244d0..abc4bf3fe2 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2296,6 +2296,7 @@ SceneTree::SceneTree() { collision_debug_contacts=GLOBAL_DEF("debug/collision_max_contacts_displayed",10000); + tree_version=1; fixed_process_time=1; idle_process_time=1; @@ -2319,6 +2320,12 @@ SceneTree::SceneTree() { root->set_as_audio_listener_2d(true); current_scene=NULL; + int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size",2048); + int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv",8); + + VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(),ref_atlas_size,ref_atlas_subdiv); + + stretch_mode=STRETCH_MODE_DISABLED; stretch_aspect=STRETCH_ASPECT_IGNORE; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index e2f5b56796..d2b9def5c7 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -166,6 +166,7 @@ #include "scene/resources/sample.h" #include "scene/audio/sample_player.h" #include "scene/resources/texture.h" +#include "scene/resources/sky_box.h" #include "scene/resources/material.h" #include "scene/resources/mesh.h" #include "scene/resources/room.h" @@ -203,6 +204,7 @@ #include "scene/3d/mesh_instance.h" #include "scene/3d/quad.h" #include "scene/3d/light.h" +#include "scene/3d/reflection_probe.h" #include "scene/3d/particles.h" #include "scene/3d/portal.h" #include "scene/resources/environment.h" @@ -421,6 +423,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); @@ -578,6 +581,8 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_virtual_type(); + ObjectTypeDB::register_virtual_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 47f4370cc2..d35200d98c 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -44,16 +44,15 @@ void Environment::set_background(BGMode p_bg) { _change_notify(); } -void Environment::set_skybox(const Ref& p_skybox){ +void Environment::set_skybox(const Ref &p_skybox){ bg_skybox=p_skybox; RID sb_rid; if (bg_skybox.is_valid()) sb_rid=bg_skybox->get_rid(); - print_line("skybox valid: "+itos(sb_rid.is_valid())); - VS::get_singleton()->environment_set_skybox(environment,sb_rid,Globals::get_singleton()->get("rendering/skybox/radiance_cube_resolution")); + VS::get_singleton()->environment_set_skybox(environment,sb_rid); } void Environment::set_skybox_scale(float p_scale) { @@ -97,7 +96,7 @@ Environment::BGMode Environment::get_background() const{ return bg_mode; } -Ref Environment::get_skybox() const{ +Ref Environment::get_skybox() const{ return bg_skybox; } @@ -326,7 +325,7 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Clear Color,Custom Color,Skybox,Canvas,Keep"),_SCS("set_background"),_SCS("get_background") ); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"background/skybox",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_skybox"),_SCS("get_skybox") ); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"background/skybox",PROPERTY_HINT_RESOURCE_TYPE,"SkyBox"),_SCS("set_skybox"),_SCS("get_skybox") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/skybox_scale",PROPERTY_HINT_RANGE,"0,32,0.01"),_SCS("set_skybox_scale"),_SCS("get_skybox_scale") ); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_bg_color"),_SCS("get_bg_color") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_bg_energy"),_SCS("get_bg_energy") ); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 394b67dadf..ca55b51b20 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -32,6 +32,7 @@ #include "resource.h" #include "servers/visual_server.h" #include "scene/resources/texture.h" +#include "scene/resources/sky_box.h" class Environment : public Resource { @@ -69,7 +70,7 @@ private: RID environment; BGMode bg_mode; - Ref bg_skybox; + Ref bg_skybox; float bg_skybox_scale; Color bg_color; float bg_energy; @@ -102,7 +103,7 @@ public: void set_background(BGMode p_bg); - void set_skybox(const Ref& p_skybox); + void set_skybox(const Ref& p_skybox); void set_skybox_scale(float p_scale); void set_bg_color(const Color& p_color); void set_bg_energy(float p_energy); @@ -112,7 +113,7 @@ public: void set_ambient_light_skybox_contribution(float p_energy); BGMode get_background() const; - Ref get_skybox() const; + Ref get_skybox() const; float get_skybox_scale() const; Color get_bg_color() const; float get_bg_energy() const; diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp new file mode 100644 index 0000000000..e8017cb084 --- /dev/null +++ b/scene/resources/sky_box.cpp @@ -0,0 +1,158 @@ +#include "sky_box.h" +#include "io/image_loader.h" + + +void SkyBox::set_radiance_size(RadianceSize p_size) { + ERR_FAIL_INDEX(p_size,RADIANCE_SIZE_MAX); + + radiance_size=p_size; + _radiance_changed(); +} + +SkyBox::RadianceSize SkyBox::get_radiance_size() const { + + return radiance_size; +} + +void SkyBox::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_radiance_size","size"),&SkyBox::set_radiance_size); + ObjectTypeDB::bind_method(_MD("get_radiance_size"),&SkyBox::get_radiance_size); + + ADD_PROPERTY(PropertyInfo(Variant::INT,"radiance_size",PROPERTY_HINT_ENUM,"256,512,1024,2048"),_SCS("set_radiance_size"),_SCS("get_radiance_size")); + + + BIND_CONSTANT( RADIANCE_SIZE_256 ); + BIND_CONSTANT( RADIANCE_SIZE_512 ); + BIND_CONSTANT( RADIANCE_SIZE_1024 ); + BIND_CONSTANT( RADIANCE_SIZE_2048 ); + BIND_CONSTANT( RADIANCE_SIZE_MAX ); +} + +SkyBox::SkyBox() +{ + radiance_size=RADIANCE_SIZE_512; +} + +///////////////////////////////////////// + + + +void ImageSkyBox::_radiance_changed() { + + if (cube_map_valid) { + static const int size[RADIANCE_SIZE_MAX]={ + 256,512,1024,2048 + }; + VS::get_singleton()->skybox_set_texture(sky_box,cube_map,size[get_radiance_size()]); + } +} + +void ImageSkyBox::set_image_path(ImagePath p_image,const String &p_path) { + + ERR_FAIL_INDEX(p_image,IMAGE_PATH_MAX); + image_path[p_image]=p_path; + + bool all_ok=true; + for(int i=0;itexture_allocate(cube_map,w,h,format,VS::TEXTURE_FLAG_FILTER|VS::TEXTURE_FLAG_CUBEMAP|VS::TEXTURE_FLAG_MIPMAPS); + for(int i=0;itexture_set_data(cube_map,images[i],VS::CubeMapSide(i)); + } + + cube_map_valid=true; + _radiance_changed(); + } + + +} + +String ImageSkyBox::get_image_path(ImagePath p_image) const { + + ERR_FAIL_INDEX_V(p_image,IMAGE_PATH_MAX,String()); + return image_path[p_image]; + +} + +RID ImageSkyBox::get_rid() const { + + return sky_box; +} + +void ImageSkyBox::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_image_path","image","path"),&ImageSkyBox::set_image_path); + ObjectTypeDB::bind_method(_MD("get_image_path","image"),&ImageSkyBox::get_image_path); + + List extensions; + ImageLoader::get_recognized_extensions(&extensions); + String hints; + for(List::Element *E=extensions.front();E;E=E->next()) { + if (hints!=String()) { + hints+=","; + } + hints+="*."+E->get(); + } + + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_X); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_x",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_X); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Y); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_y",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Y); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/negative_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_NEGATIVE_Z); + ADD_PROPERTYI(PropertyInfo(Variant::STRING,"image_path/positive_z",PROPERTY_HINT_FILE,hints),_SCS("set_image_path"),_SCS("get_image_path"),IMAGE_PATH_POSITIVE_Z); + + BIND_CONSTANT( IMAGE_PATH_NEGATIVE_X ); + BIND_CONSTANT( IMAGE_PATH_POSITIVE_X ); + BIND_CONSTANT( IMAGE_PATH_NEGATIVE_Y ); + BIND_CONSTANT( IMAGE_PATH_POSITIVE_Y ); + BIND_CONSTANT( IMAGE_PATH_NEGATIVE_Z ); + BIND_CONSTANT( IMAGE_PATH_POSITIVE_Z ); + BIND_CONSTANT( IMAGE_PATH_MAX ); + +} + +ImageSkyBox::ImageSkyBox() { + + cube_map=VS::get_singleton()->texture_create(); + sky_box=VS::get_singleton()->skybox_create(); + cube_map_valid=false; +} + +ImageSkyBox::~ImageSkyBox() { + + VS::get_singleton()->free(cube_map); + VS::get_singleton()->free(sky_box); +} + diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h new file mode 100644 index 0000000000..3a3dd1b2de --- /dev/null +++ b/scene/resources/sky_box.h @@ -0,0 +1,71 @@ +#ifndef SKYBOX_H +#define SKYBOX_H + +#include "scene/resources/texture.h" + +class SkyBox : public Resource { + OBJ_TYPE(SkyBox,Resource); + +public: + + enum RadianceSize { + RADIANCE_SIZE_256, + RADIANCE_SIZE_512, + RADIANCE_SIZE_1024, + RADIANCE_SIZE_2048, + RADIANCE_SIZE_MAX + }; +private: + + RadianceSize radiance_size; +protected: + static void _bind_methods(); + virtual void _radiance_changed()=0; +public: + + void set_radiance_size(RadianceSize p_size); + RadianceSize get_radiance_size() const; + SkyBox(); +}; + +VARIANT_ENUM_CAST(SkyBox::RadianceSize) + + +class ImageSkyBox : public SkyBox { + OBJ_TYPE(ImageSkyBox,SkyBox); + +public: + + enum ImagePath { + IMAGE_PATH_NEGATIVE_X, + IMAGE_PATH_POSITIVE_X, + IMAGE_PATH_NEGATIVE_Y, + IMAGE_PATH_POSITIVE_Y, + IMAGE_PATH_NEGATIVE_Z, + IMAGE_PATH_POSITIVE_Z, + IMAGE_PATH_MAX + }; +private: + RID cube_map; + RID sky_box; + bool cube_map_valid; + + String image_path[IMAGE_PATH_MAX]; +protected: + static void _bind_methods(); + virtual void _radiance_changed(); +public: + + void set_image_path(ImagePath p_image, const String &p_path); + String get_image_path(ImagePath p_image) const; + + virtual RID get_rid() const; + + ImageSkyBox(); + ~ImageSkyBox(); +}; + +VARIANT_ENUM_CAST(ImageSkyBox::ImagePath) + + +#endif // SKYBOX_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 06509c6fd0..0f70b036a6 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -54,7 +54,7 @@ public: virtual RID environment_create()=0; virtual void environment_set_background(RID p_env,VS::EnvironmentBG p_bg)=0; - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox)=0; virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; @@ -84,6 +84,7 @@ public: Vector materials; Vector light_instances; + Vector reflection_probe_instances; Vector morph_values; @@ -125,7 +126,19 @@ public: virtual void light_instance_set_shadow_transform(RID p_light_instance,const CameraMatrix& p_projection,const Transform& p_transform,float p_far,float p_split,int p_pass)=0; virtual void light_instance_mark_visible(RID p_light_instance)=0; - virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID p_environment,RID p_shadow_atlas)=0; + virtual RID reflection_atlas_create()=0; + virtual void reflection_atlas_set_size(RID p_ref_atlas,int p_size)=0; + virtual void reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv)=0; + + virtual RID reflection_probe_instance_create(RID p_probe)=0; + virtual void reflection_probe_instance_set_transform(RID p_instance,const Transform& p_transform)=0; + virtual void reflection_probe_release_atlas_index(RID p_instance)=0; + virtual bool reflection_probe_instance_needs_redraw(RID p_instance)=0; + virtual bool reflection_probe_instance_has_reflection(RID p_instance)=0; + virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas)=0; + virtual bool reflection_probe_instance_postprocess_step(RID p_instance)=0; + + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass)=0; virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count)=0; virtual void set_scene_pass(uint64_t p_pass)=0; @@ -165,6 +178,11 @@ public: virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; + /* SKYBOX API */ + + virtual RID skybox_create()=0; + virtual void skybox_set_texture(RID p_skybox,RID p_cube_map,int p_radiance_size)=0; + /* SHADER API */ @@ -324,16 +342,27 @@ public: virtual RID reflection_probe_create()=0; + virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode)=0; virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity)=0; - virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far)=0; - virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance)=0; + virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color& p_ambient)=0; + virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy)=0; + virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib)=0; + virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance)=0; virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents)=0; virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset)=0; - virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable)=0; - virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution)=0; - virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide)=0; + virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable)=0; virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0; + virtual AABB reflection_probe_get_aabb(RID p_probe) const=0; + virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const=0; + virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const=0; + virtual Vector3 reflection_probe_get_extents(RID p_probe) const=0; + virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const=0; + virtual float reflection_probe_get_origin_max_distance(RID p_probe) const=0; + virtual bool reflection_probe_renders_shadows(RID p_probe) const=0; + /* ROOM API */ diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index bbad460f4f..6ba63a7690 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -94,6 +94,7 @@ void VisualServerRaster::draw(){ VSG::rasterizer->begin_frame(); VSG::viewport->draw_viewports(); + VSG::scene->render_probes(); //_draw_cursors_and_margins(); VSG::rasterizer->end_frame(); //draw_extra_frame=VS:rasterizer->needs_to_draw_next_frame(); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 4d8a46122c..4e9110445b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -629,7 +629,10 @@ public: BIND1(texture_set_shrink_all_x2_on_set_data,bool) BIND1(texture_debug_usage,List*) + /* SKYBOX API */ + BIND0R(RID,skybox_create) + BIND3(skybox_set_texture,RID,RID,int) /* SHADER API */ @@ -772,17 +775,19 @@ public: BIND0R(RID,reflection_probe_create) + BIND2(reflection_probe_set_update_mode,RID, ReflectionProbeUpdateMode ) BIND2(reflection_probe_set_intensity,RID, float ) - BIND3(reflection_probe_set_clip,RID, float , float ) - BIND2(reflection_probe_set_min_blend_distance,RID, float ) + BIND2(reflection_probe_set_interior_ambient,RID, const Color& ) + BIND2(reflection_probe_set_interior_ambient_energy,RID, float ) + BIND2(reflection_probe_set_interior_ambient_probe_contribution,RID, float ) + BIND2(reflection_probe_set_max_distance,RID, float ) BIND2(reflection_probe_set_extents,RID, const Vector3& ) BIND2(reflection_probe_set_origin_offset,RID, const Vector3& ) - BIND2(reflection_probe_set_enable_parallax_correction,RID, bool ) - BIND2(reflection_probe_set_resolution,RID, int ) - BIND2(reflection_probe_set_hide_skybox,RID, bool ) + BIND2(reflection_probe_set_as_interior,RID, bool ) + BIND2(reflection_probe_set_enable_box_projection,RID, bool ) + BIND2(reflection_probe_set_enable_shadows,RID, bool ) BIND2(reflection_probe_set_cull_mask,RID, uint32_t ) - /* ROOM API */ BIND0R(RID,room_create) @@ -866,7 +871,7 @@ public: BIND0R(RID,environment_create) BIND2(environment_set_background,RID ,EnvironmentBG ) - BIND3(environment_set_skybox,RID,RID ,int ) + BIND2(environment_set_skybox,RID,RID ) BIND2(environment_set_skybox_scale,RID,float) BIND2(environment_set_bg_color,RID,const Color& ) BIND2(environment_set_bg_energy,RID,float ) @@ -890,6 +895,7 @@ public: BIND2(scenario_set_debug,RID,ScenarioDebugMode ) BIND2(scenario_set_environment,RID, RID ) + BIND3(scenario_set_reflection_atlas_size,RID, int,int ) BIND2(scenario_set_fallback_environment,RID, RID ) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index e214374f4d..74d77c5262 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -102,9 +102,26 @@ void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance } geom->lighting_dirty=true; + return E; //this element should make freeing faster + } else if (B->base_type==VS::INSTANCE_REFLECTION_PROBE && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceReflectionProbeData * reflection_probe = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + + InstanceReflectionProbeData::PairInfo pinfo; + pinfo.geometry=A; + pinfo.L = geom->reflection_probes.push_back(B); + + List::Element *E = reflection_probe->geometries.push_back(pinfo); + + geom->reflection_dirty=true; + return E; //this element should make freeing faster } + + #if 0 if (A->base_type==INSTANCE_PORTAL) { @@ -189,6 +206,18 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance geom->lighting_dirty=true; + } else if (B->base_type==VS::INSTANCE_REFLECTION_PROBE && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceReflectionProbeData * reflection_probe = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + List::Element *E = reinterpret_cast::Element*>(udata); + + geom->reflection_probes.erase(E->get().L); + reflection_probe->geometries.erase(E); + + geom->reflection_dirty=true; + } #if 0 if (A->base_type==INSTANCE_PORTAL) { @@ -252,6 +281,13 @@ RID VisualServerScene::scenario_create() { scenario->octree.set_pair_callback(_instance_pair,this); scenario->octree.set_unpair_callback(_instance_unpair,this); + scenario->reflection_probe_shadow_atlas=VSG::scene_render->shadow_atlas_create(); + VSG::scene_render->shadow_atlas_set_size(scenario->reflection_probe_shadow_atlas,1024); //make enough shadows for close distance, don't bother with rest + VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas,0,4); + VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas,1,4); + VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas,2,4); + VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas,3,8); + scenario->reflection_atlas=VSG::scene_render->reflection_atlas_create(); return scenario_rid; } @@ -281,6 +317,16 @@ void VisualServerScene::scenario_set_fallback_environment(RID p_scenario, RID p_ } +void VisualServerScene::scenario_set_reflection_atlas_size(RID p_scenario, int p_size,int p_subdiv) { + + Scenario *scenario = scenario_owner.get(p_scenario); + ERR_FAIL_COND(!scenario); + VSG::scene_render->reflection_atlas_set_size(scenario->reflection_atlas,p_size); + VSG::scene_render->reflection_atlas_set_subdivision(scenario->reflection_atlas,p_subdiv); + + +} + /* INSTANCING API */ @@ -343,6 +389,14 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ } VSG::scene_render->free(light->instance); } break; + case VS::INSTANCE_REFLECTION_PROBE: { + + InstanceReflectionProbeData *reflection_probe = static_cast(instance->base_data); + VSG::scene_render->free(reflection_probe->instance); + if (reflection_probe->update_list.in_list()) { + reflection_probe_render_list.remove(&reflection_probe->update_list); + } + } break; } if (instance->base_data) { @@ -508,6 +562,14 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ InstanceGeometryData *geom = memnew( InstanceGeometryData ); instance->base_data=geom; } break; + case VS::INSTANCE_REFLECTION_PROBE: { + + InstanceReflectionProbeData *reflection_probe = memnew( InstanceReflectionProbeData ); + reflection_probe->owner=instance; + instance->base_data=reflection_probe; + + reflection_probe->instance=VSG::scene_render->reflection_probe_instance_create(p_base); + } break; } @@ -607,6 +669,12 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ light->D=NULL; } } break; + case VS::INSTANCE_REFLECTION_PROBE: { + + InstanceReflectionProbeData *reflection_probe = static_cast(instance->base_data); + VSG::scene_render->reflection_probe_release_atlas_index(reflection_probe->instance); + } break; + } instance->scenario=NULL; @@ -876,6 +944,15 @@ void VisualServerScene::_update_instance(Instance *p_instance) { } + if (p_instance->base_type == VS::INSTANCE_REFLECTION_PROBE) { + + InstanceReflectionProbeData *reflection_probe = static_cast(p_instance->base_data); + + VSG::scene_render->reflection_probe_instance_set_transform( reflection_probe->instance, p_instance->transform ); + reflection_probe->reflection_dirty=true; + + } + if (p_instance->aabb.has_no_surface()) return; @@ -970,7 +1047,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { uint32_t pairable_mask=0; bool pairable=false; - if (p_instance->base_type == VS::INSTANCE_LIGHT) { + if (p_instance->base_type == VS::INSTANCE_LIGHT || p_instance->base_type==VS::INSTANCE_REFLECTION_PROBE) { pairable_mask=p_instance->visible?VS::INSTANCE_GEOMETRY_MASK:0; pairable=true; @@ -1072,6 +1149,12 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { new_aabb = VSG::storage->light_get_aabb(p_instance->base); } break; + case VisualServer::INSTANCE_REFLECTION_PROBE: { + + new_aabb = VSG::storage->reflection_probe_get_aabb(p_instance->base); + + } break; + #if 0 case VisualServer::INSTANCE_ROOM: { @@ -1129,7 +1212,7 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { -void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camera* p_camera,RID p_shadow_atlas,Scenario* p_scenario,Size2 p_viewport_rect) { +void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,const Transform p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_orthogonal,RID p_shadow_atlas,Scenario* p_scenario) { InstanceLightData * light = static_cast(p_instance->base_data); @@ -1138,14 +1221,14 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer case VS::LIGHT_DIRECTIONAL: { - float max_distance = p_camera->zfar; + float max_distance =p_cam_projection.get_z_far(); float shadow_max = VSG::storage->light_get_param(p_instance->base,VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE); if (shadow_max>0) { max_distance=MIN(shadow_max,max_distance); } - max_distance=MAX(max_distance,p_camera->znear+0.001); + max_distance=MAX(max_distance,p_cam_projection.get_z_near()+0.001); - float range = max_distance-p_camera->znear; + float range = max_distance-p_cam_projection.get_z_near(); int splits=0; switch(VSG::storage->light_directional_get_shadow_mode(p_instance->base)) { @@ -1156,9 +1239,9 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer float distances[5]; - distances[0]=p_camera->znear; + distances[0]=p_cam_projection.get_z_near(); for(int i=0;iznear+VSG::storage->light_get_param(p_instance->base,VS::LightParam(VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET+i))*range; + distances[i+1]=p_cam_projection.get_z_near()+VSG::storage->light_get_param(p_instance->base,VS::LightParam(VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET+i))*range; }; distances[splits]=max_distance; @@ -1172,38 +1255,24 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer // setup a camera matrix for that range! CameraMatrix camera_matrix; - switch(p_camera->type) { - - case Camera::ORTHOGONAL: { - - camera_matrix.set_orthogonal( - p_camera->size, - p_viewport_rect.width / p_viewport_rect.height, - distances[(i==0 || !overlap )?i:i-1], - distances[i+1], - p_camera->vaspect - - ); - } break; - case Camera::PERSPECTIVE: { + float aspect = p_cam_projection.get_aspect(); - camera_matrix.set_perspective( - p_camera->fov, - p_viewport_rect.width / (float)p_viewport_rect.height, - distances[(i==0 || !overlap )?i:i-1], - distances[i+1], - p_camera->vaspect + if (p_cam_orthogonal) { - ); + float w,h; + p_cam_projection.get_viewport_size(w,h); + camera_matrix.set_orthogonal(w,aspect,distances[(i==0 || !overlap )?i:i-1],distances[i+1],false); + } else { - } break; + float fov = p_cam_projection.get_fov(); + camera_matrix.set_perspective(fov,aspect,distances[(i==0 || !overlap )?i:i-1],distances[i+1],false); } //obtain the frustum endpoints Vector3 endpoints[8]; // frustum plane endpoints - bool res = camera_matrix.get_endpoints(p_camera->transform,endpoints); + bool res = camera_matrix.get_endpoints(p_cam_transform,endpoints); ERR_CONTINUE(!res); // obtain the light frustm ranges (given endpoints) @@ -1459,8 +1528,8 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer float angle = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_SPOT_ANGLE); CameraMatrix cm; - cm.set_perspective( 90, 1.0, 0.01, radius ); - print_line("perspective: "+cm); + cm.set_perspective( angle, 1.0, 0.01, radius ); + Vector planes = cm.get_projection_planes(p_instance->transform); int cull_count = p_scenario->octree.cull_convex(planes,instance_shadow_cull_result,MAX_INSTANCE_CULL,VS::INSTANCE_GEOMETRY_MASK); @@ -1477,7 +1546,6 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer } - print_line("MOMONGO"); VSG::scene_render->light_instance_set_shadow_transform(light->instance,cm,p_instance->transform,radius,0,0); VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,0,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); @@ -1487,26 +1555,13 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,Camer } - - - void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewport_size,RID p_shadow_atlas) { - Camera *camera = camera_owner.getornull(p_camera); ERR_FAIL_COND(!camera); - Scenario *scenario = scenario_owner.getornull(p_scenario); - - render_pass++; - uint32_t camera_layer_mask=camera->visible_layers; - - VSG::scene_render->set_scene_pass(render_pass); - - /* STEP 1 - SETUP CAMERA */ CameraMatrix camera_matrix; - Transform camera_inverse_xform = camera->transform.affine_inverse(); bool ortho=false; @@ -1538,16 +1593,36 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp } break; } + _render_scene(camera->transform,camera_matrix,ortho,camera->env,camera->visible_layers,p_scenario,p_shadow_atlas,RID(),-1); + +} + + +void VisualServerScene::_render_scene(const Transform p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_orthogonal,RID p_force_environment,uint32_t p_visible_layers, RID p_scenario,RID p_shadow_atlas,RID p_reflection_probe,int p_reflection_probe_pass) { + + + + Scenario *scenario = scenario_owner.getornull(p_scenario); + + render_pass++; + uint32_t camera_layer_mask=p_visible_layers; + + VSG::scene_render->set_scene_pass(render_pass); + // rasterizer->set_camera(camera->transform, camera_matrix,ortho); - Vector planes = camera_matrix.get_projection_planes(camera->transform); + Vector planes = p_cam_projection.get_projection_planes(p_cam_transform); - Plane near_plane(camera->transform.origin,-camera->transform.basis.get_axis(2).normalized()); + Plane near_plane(p_cam_transform.origin,-p_cam_transform.basis.get_axis(2).normalized()); + float z_far = p_cam_projection.get_z_far(); /* STEP 2 - CULL */ int cull_count = scenario->octree.cull_convex(planes,instance_cull_result,MAX_INSTANCE_CULL); light_cull_count=0; + + reflection_probe_cull_count=0; + // light_samplers_culled=0; /* print_line("OT: "+rtos( (OS::get_singleton()->get_ticks_usec()-t)/1000.0)); @@ -1649,7 +1724,6 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp bool keep=false; - if ((camera_layer_mask&ins->layer_mask)==0) { //failure @@ -1673,6 +1747,36 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp } + } else if (ins->base_type==VS::INSTANCE_REFLECTION_PROBE && ins->visible) { + + + if (ins->visible && reflection_probe_cull_count(ins->base_data); + + if (p_reflection_probe!=reflection_probe->instance) { + //avoid entering The Matrix + + if (!reflection_probe->geometries.empty()) { + //do not add this light if no geometry is affected by it.. + + if (reflection_probe->reflection_dirty || VSG::scene_render->reflection_probe_instance_needs_redraw(reflection_probe->instance)) { + if (!reflection_probe->update_list.in_list()) { + reflection_probe->render_step=0; + reflection_probe_render_list.add(&reflection_probe->update_list); + } + + reflection_probe->reflection_dirty=false; + } + + if (VSG::scene_render->reflection_probe_instance_has_reflection(reflection_probe->instance)) { + reflection_probe_instance_cull_result[reflection_probe_cull_count]=reflection_probe->instance; + reflection_probe_cull_count++; + } + + } + } + } } else if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK && ins->visible && ins->cast_shadows!=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { @@ -1746,6 +1850,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp InstanceGeometryData * geom = static_cast(ins->base_data); + if (geom->lighting_dirty) { int l=0; //only called when lights AABB enter/exit this geometry @@ -1761,7 +1866,23 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp geom->lighting_dirty=false; } + if (geom->reflection_dirty) { + int l=0; + //only called when reflection probe AABB enter/exit this geometry + ins->reflection_probe_instances.resize(geom->reflection_probes.size()); + + for (List::Element *E=geom->reflection_probes.front();E;E=E->next()) { + + InstanceReflectionProbeData * reflection_probe = static_cast(E->get()->base_data); + + ins->reflection_probe_instances[l++]=reflection_probe->instance; + } + + geom->reflection_dirty=false; + } + ins->depth = near_plane.distance_to(ins->transform.origin); + ins->depth_layer=CLAMP(int(ins->depth*8/z_far),0,7); } @@ -1803,7 +1924,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp //check shadow.. - if (light && VSG::storage->light_has_shadow(E->get()->base)) { + if (light && p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(E->get()->base)) { lights_with_shadow[directional_shadow_count++]=E->get(); } @@ -1817,7 +1938,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp for(int i=0;itransform; - float zn = camera_matrix.get_z_near(); + Transform cam_xf = p_cam_transform; + float zn = p_cam_projection.get_z_near(); Plane p (cam_xf.origin + cam_xf.basis.get_axis(2) * -zn, -cam_xf.basis.get_axis(2) ); //camera near plane float vp_w,vp_h; //near plane size in screen coordinates - camera_matrix.get_viewport_size(vp_w,vp_h); + p_cam_projection.get_viewport_size(vp_w,vp_h); switch(VSG::storage->light_get_type(ins->base)) { @@ -1861,7 +1982,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp ins->transform.origin+cam_xf.basis.get_axis(0)*radius }; - if (!ortho) { + if (!p_cam_orthogonal) { //if using perspetive, map them to near plane for(int j=0;j<2;j++) { if (p.distance_to(points[j]) < 0 ) { @@ -1895,7 +2016,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp base+cam_xf.basis.get_axis(0)*w }; - if (!ortho) { + if (!p_cam_orthogonal) { //if using perspetive, map them to near plane for(int j=0;j<2;j++) { if (p.distance_to(points[j]) < 0 ) { @@ -1933,7 +2054,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp if (redraw) { //must redraw! - _light_instance_update_shadow(ins,camera,p_shadow_atlas,scenario,p_viewport_size); + _light_instance_update_shadow(ins,p_cam_transform,p_cam_projection,p_cam_orthogonal,p_shadow_atlas,scenario); } } @@ -1942,8 +2063,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp /* ENVIRONMENT */ RID environment; - if (camera->env.is_valid()) //camera has more environment priority - environment=camera->env; + if (p_force_environment.is_valid()) //camera has more environment priority + environment=p_force_environment; else if (scenario->environment.is_valid()) environment=scenario->environment; else @@ -1964,45 +2085,129 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario,Size2 p_viewp #endif /* STEP 7 - PROCESS GEOMETRY AND DRAW SCENE*/ -#if 0 - // add lights + VSG::scene_render->render_scene(p_cam_transform, p_cam_projection,p_cam_orthogonal,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count+directional_light_count,reflection_probe_instance_cull_result,reflection_probe_cull_count,environment,p_shadow_atlas,scenario->reflection_atlas,p_reflection_probe,p_reflection_probe_pass); - { - List::Element *E=p_scenario->directional_lights.front(); +} - for(;E;E=E->next()) { - Instance *light = E->get().is_valid()?instance_owner.get(E->get()):NULL; +bool VisualServerScene::_render_probe_step(Instance* p_instance,int p_step) { - ERR_CONTINUE(!light); - if (!light->light_info->enabled) - continue; + InstanceReflectionProbeData *reflection_probe = static_cast(p_instance->base_data); + Scenario *scenario = p_instance->scenario; + ERR_FAIL_COND_V(!scenario,true); - rasterizer->add_light(light->light_info->instance); - light->light_info->last_add_pass=render_pass; + if (p_step==0) { + + if (!VSG::scene_render->reflection_probe_instance_begin_render(reflection_probe->instance,scenario->reflection_atlas)) { + return true; //sorry, all full :( } + } - for (int i=0;i=0 && p_step<6) { - Instance *ins = light_cull_result[i]; - rasterizer->add_light(ins->light_info->instance); - ins->light_info->last_add_pass=render_pass; + static const Vector3 view_normals[6]={ + Vector3(-1, 0, 0), + Vector3(+1, 0, 0), + Vector3( 0,-1, 0), + Vector3( 0,+1, 0), + Vector3( 0, 0,-1), + Vector3( 0, 0,+1) + }; + + Vector3 extents = VSG::storage->reflection_probe_get_extents(p_instance->base); + Vector3 origin_offset = VSG::storage->reflection_probe_get_origin_offset(p_instance->base); + float max_distance = VSG::storage->reflection_probe_get_origin_max_distance(p_instance->base); + + + Vector3 edge = view_normals[p_step]*extents; + float distance = ABS(view_normals[p_step].dot(edge)-view_normals[p_step].dot(origin_offset)); //distance from origin offset to actual view distance limit + + max_distance = MAX(max_distance,distance); + + + //render cubemap side + CameraMatrix cm; + cm.set_perspective(90,1,0.01,max_distance); + + + static const Vector3 view_up[6]={ + Vector3( 0,-1, 0), + Vector3( 0,-1, 0), + Vector3( 0, 0,-1), + Vector3( 0, 0,+1), + Vector3( 0,-1, 0), + Vector3( 0,-1, 0) + }; + + Transform local_view; + local_view.set_look_at(origin_offset,origin_offset+view_normals[p_step],view_up[p_step]); + + Transform xform = p_instance->transform * local_view; + + RID shadow_atlas; + + if (VSG::storage->reflection_probe_renders_shadows(p_instance->base)) { + + shadow_atlas=scenario->reflection_probe_shadow_atlas; } + + _render_scene(xform,cm,false,RID(),VSG::storage->reflection_probe_get_cull_mask(p_instance->base),p_instance->scenario->self,shadow_atlas,reflection_probe->instance,p_step); + + } else { + //do roughness postprocess step until it belives it's done + return VSG::scene_render->reflection_probe_instance_postprocess_step(reflection_probe->instance); } - // add geometry -#endif + return false; +} - VSG::scene_render->render_scene(camera->transform, camera_matrix,ortho,(RasterizerScene::InstanceBase**)instance_cull_result,cull_count,light_instance_cull_result,light_cull_count+directional_light_count,environment,p_shadow_atlas); +void VisualServerScene::render_probes() { -} + SelfList *probe = reflection_probe_render_list.first(); + bool busy=false; + while(probe) { -void VisualServerScene::_update_dirty_instance(Instance *p_instance) { + SelfList *next=probe->next(); + RID base = probe->self()->owner->base; + switch(VSG::storage->reflection_probe_get_update_mode(base)) { + + case VS::REFLECTION_PROBE_UPDATE_ONCE: { + if (busy) //already rendering something + break; + + bool done = _render_probe_step(probe->self()->owner,probe->self()->render_step); + if (done) { + reflection_probe_render_list.remove(probe); + } else { + probe->self()->render_step++; + } + + busy=true; //do not render another one of this kind + } break; + case VS::REFLECTION_PROBE_UPDATE_ALWAYS: { + + int step=0; + bool done=false; + while(!done) { + done = _render_probe_step(probe->self()->owner,step); + step++; + } + + reflection_probe_render_list.remove(probe); + } break; + + } + + probe=next; + } +} + +void VisualServerScene::_update_dirty_instance(Instance *p_instance) { if (p_instance->update_aabb) _update_instance_aabb(p_instance); @@ -2114,7 +2319,8 @@ bool VisualServerScene::free(RID p_rid) { while(scenario->instances.first()) { instance_set_scenario(scenario->instances.first()->self()->self,RID()); } - + VSG::scene_render->free(scenario->reflection_probe_shadow_atlas); + VSG::scene_render->free(scenario->reflection_atlas); scenario_owner.free(p_rid); memdelete(scenario); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index e4f06fee64..0eaad45c97 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -16,8 +16,9 @@ public: MAX_INSTANCE_CULL=65536, MAX_LIGHTS_CULLED=4096, + MAX_REFLECTION_PROBES_CULLED=4096, MAX_ROOM_CULL=32, - MAX_EXTERIOR_PORTALS=128, + MAX_EXTERIOR_PORTALS=128, }; uint64_t render_pass; @@ -156,6 +157,9 @@ public: List directional_lights; RID environment; RID fallback_environment; + RID reflection_probe_shadow_atlas; + RID reflection_atlas; + SelfList::List instances; @@ -172,6 +176,7 @@ public: virtual void scenario_set_debug(RID p_scenario,VS::ScenarioDebugMode p_debug_mode); virtual void scenario_set_environment(RID p_scenario, RID p_environment); virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment); + virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_size,int p_subdiv); /* INSTANCING API */ @@ -288,13 +293,43 @@ public: bool lighting_dirty; bool can_cast_shadows; + List reflection_probes; + bool reflection_dirty; + InstanceGeometryData() { lighting_dirty=false; + reflection_dirty=true; can_cast_shadows=true; } }; + struct InstanceReflectionProbeData : public InstanceBaseData { + + + Instance *owner; + + struct PairInfo { + List::Element *L; //light iterator in geometry + Instance *geometry; + }; + List geometries; + + + RID instance; + bool reflection_dirty; + SelfList update_list; + + int render_step; + + InstanceReflectionProbeData() : update_list(this) { + + reflection_dirty=true; + render_step=-1; + } + }; + + SelfList::List reflection_probe_render_list; struct InstanceLightData : public InstanceBaseData { @@ -325,6 +360,8 @@ public: Instance *light_cull_result[MAX_LIGHTS_CULLED]; RID light_instance_cull_result[MAX_LIGHTS_CULLED]; int light_cull_count; + RID reflection_probe_instance_cull_result[MAX_REFLECTION_PROBES_CULLED]; + int reflection_probe_cull_count; RID_Owner instance_owner; @@ -366,10 +403,15 @@ public: _FORCE_INLINE_ void _update_instance_aabb(Instance *p_instance); _FORCE_INLINE_ void _update_dirty_instance(Instance *p_instance); - _FORCE_INLINE_ void _light_instance_update_shadow(Instance *p_instance,Camera* p_camera,RID p_shadow_atlas,Scenario* p_scenario,Size2 p_viewport_rect); + _FORCE_INLINE_ void _light_instance_update_shadow(Instance *p_instance,const Transform p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_orthogonal,RID p_shadow_atlas,Scenario* p_scenario); - void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas); + void _render_scene(const Transform p_cam_transform, const CameraMatrix& p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass); + + void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas); void update_dirty_instances(); + + bool _render_probe_step(Instance* p_instance,int p_step); + void render_probes(); bool free(RID p_rid); VisualServerScene(); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 18742aa21d..fa2c461f36 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -520,26 +520,29 @@ void VisualServerViewport::viewport_set_shadow_atlas_quadrant_subdivision(RID p_ bool VisualServerViewport::free(RID p_rid) { - Viewport * viewport = viewport_owner.getornull(p_rid); - if (!viewport) - return false; + if (viewport_owner.owns(p_rid)) { + Viewport * viewport = viewport_owner.getornull(p_rid); - VSG::storage->free( viewport->render_target ); - VSG::scene_render->free( viewport->shadow_atlas ); - while(viewport->canvas_map.front()) { - viewport_remove_canvas(p_rid,viewport->canvas_map.front()->key()); - } + VSG::storage->free( viewport->render_target ); + VSG::scene_render->free( viewport->shadow_atlas ); + + while(viewport->canvas_map.front()) { + viewport_remove_canvas(p_rid,viewport->canvas_map.front()->key()); + } - viewport_set_scenario(p_rid,RID()); - active_viewports.erase(viewport); + viewport_set_scenario(p_rid,RID()); + active_viewports.erase(viewport); + + viewport_owner.free(p_rid); + memdelete(viewport); - viewport_owner.free(p_rid); - memdelete(viewport); + return true; + } - return true; + return false; } diff --git a/servers/visual_server.h b/servers/visual_server.h index 148d090a07..5e318a4fe8 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -127,8 +127,6 @@ public: virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0; - virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; - struct TextureInfo { RID texture; Size2 size; @@ -139,6 +137,10 @@ public: virtual void texture_debug_usage(List *r_info)=0; + /* SKYBOX API */ + + virtual RID skybox_create()=0; + virtual void skybox_set_texture(RID p_skybox,RID p_cube_map,int p_radiance_size)=0; /* SHADER API */ @@ -406,14 +408,23 @@ public: virtual RID reflection_probe_create()=0; + enum ReflectionProbeUpdateMode { + REFLECTION_PROBE_UPDATE_ONCE, + REFLECTION_PROBE_UPDATE_ALWAYS, + }; + + + virtual void reflection_probe_set_update_mode(RID p_probe, ReflectionProbeUpdateMode p_mode)=0; virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity)=0; - virtual void reflection_probe_set_clip(RID p_probe, float p_near, float p_far)=0; - virtual void reflection_probe_set_min_blend_distance(RID p_probe, float p_distance)=0; + virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color& p_color)=0; + virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy)=0; + virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib)=0; + virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance)=0; virtual void reflection_probe_set_extents(RID p_probe, const Vector3& p_extents)=0; virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3& p_offset)=0; - virtual void reflection_probe_set_enable_parallax_correction(RID p_probe, bool p_enable)=0; - virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution)=0; - virtual void reflection_probe_set_hide_skybox(RID p_probe, bool p_hide)=0; + virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable)=0; + virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable)=0; virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers)=0; @@ -514,7 +525,7 @@ public: }; virtual void environment_set_background(RID p_env,EnvironmentBG p_bg)=0; - virtual void environment_set_skybox(RID p_env,RID p_skybox,int p_radiance_size)=0; + virtual void environment_set_skybox(RID p_env,RID p_skybox)=0; virtual void environment_set_skybox_scale(RID p_env,float p_scale)=0; virtual void environment_set_bg_color(RID p_env,const Color& p_color)=0; virtual void environment_set_bg_energy(RID p_env,float p_energy)=0; @@ -563,6 +574,7 @@ public: virtual void scenario_set_debug(RID p_scenario,ScenarioDebugMode p_debug_mode)=0; virtual void scenario_set_environment(RID p_scenario, RID p_environment)=0; + virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_size,int p_subdiv)=0; virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment)=0; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index cdd56bbac5..a4a1aaedf0 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -245,6 +245,7 @@ void EditorSpatialGizmo::add_handles(const Vector &p_handles, bool p_bi Array a; a.resize(VS::ARRAY_MAX); a[VS::ARRAY_VERTEX]=p_handles; + print_line("handles?: "+itos(p_handles.size())); DVector colors; { colors.resize(p_handles.size()); @@ -2238,6 +2239,164 @@ VisibilityNotifierGizmo::VisibilityNotifierGizmo(VisibilityNotifier* p_notifier) //////// +/// + + +String ReflectionProbeGizmo::get_handle_name(int p_idx) const { + + switch(p_idx) { + case 0: return "Extents X"; + case 1: return "Extents Y"; + case 2: return "Extents Z"; + case 3: return "Origin X"; + case 4: return "Origin Y"; + case 5: return "Origin Z"; + } + + return ""; +} +Variant ReflectionProbeGizmo::get_handle_value(int p_idx) const{ + + return AABB(probe->get_extents(),probe->get_origin_offset()); +} +void ReflectionProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){ + + Transform gt = probe->get_global_transform(); + //gt.orthonormalize(); + Transform gi = gt.affine_inverse(); + + + if (p_idx<3) { + Vector3 extents = probe->get_extents(); + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(Vector3(),axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + if (d<0.001) + d=0.001; + + extents[p_idx]=d; + probe->set_extents(extents); + } else { + + p_idx-=3; + + Vector3 origin = probe->get_origin_offset(); + origin[p_idx]=0; + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(origin-axis*16384,origin+axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + d+=0.25; + + origin[p_idx]=d; + probe->set_origin_offset(origin); + + } +} + +void ReflectionProbeGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ + + AABB restore = p_restore; + + if (p_cancel) { + probe->set_extents(restore.pos); + probe->set_origin_offset(restore.size); + return; + } + + UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + ur->create_action(TTR("Change Probe Extents")); + ur->add_do_method(probe,"set_extents",probe->get_extents()); + ur->add_do_method(probe,"set_origin_offset",probe->get_origin_offset()); + ur->add_undo_method(probe,"set_extents",restore.pos); + ur->add_undo_method(probe,"set_origin_offset",restore.size); + ur->commit_action(); + +} + +void ReflectionProbeGizmo::redraw(){ + + clear(); + + Vector lines; + Vector internal_lines; + Vector3 extents = probe->get_extents(); + + AABB aabb; + aabb.pos=-extents; + aabb.size=extents*2; + + for(int i=0;i<12;i++) { + Vector3 a,b; + aabb.get_edge(i,a,b); + lines.push_back(a); + lines.push_back(b); + } + + for(int i=0;i<8;i++) { + Vector3 ep = aabb.get_endpoint(i); + internal_lines.push_back(probe->get_origin_offset()); + internal_lines.push_back(ep); + + + } + + Vector handles; + + + for(int i=0;i<3;i++) { + + Vector3 ax; + ax[i]=aabb.pos[i]+aabb.size[i]; + handles.push_back(ax); + } + + for(int i=0;i<3;i++) { + + + Vector3 orig_handle=probe->get_origin_offset(); + orig_handle[i]-=0.25; + lines.push_back(orig_handle); + handles.push_back(orig_handle); + + orig_handle[i]+=0.5; + lines.push_back(orig_handle); + } + + add_lines(lines,SpatialEditorGizmos::singleton->reflection_probe_material); + add_lines(internal_lines,SpatialEditorGizmos::singleton->reflection_probe_material_internal); + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_collision_segments(lines); + add_handles(handles); + +} +ReflectionProbeGizmo::ReflectionProbeGizmo(ReflectionProbe* p_probe){ + + probe=p_probe; + set_spatial_node(p_probe); +} + +//////// + + + void NavigationMeshSpatialGizmo::redraw() { @@ -2929,6 +3088,12 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { return misg; } + if (p_spatial->cast_to()) { + + Ref misg = memnew( ReflectionProbeGizmo(p_spatial->cast_to()) ); + return misg; + } + if (p_spatial->cast_to()) { Ref misg = memnew( VehicleWheelSpatialGizmo(p_spatial->cast_to()) ); @@ -3132,6 +3297,8 @@ SpatialEditorGizmos::SpatialEditorGizmos() { raycast_material = create_line_material(Color(1.0,0.8,0.6)); car_wheel_material = create_line_material(Color(0.6,0.8,1.0)); visibility_notifier_material = create_line_material(Color(1.0,0.5,1.0)); + reflection_probe_material = create_line_material(Color(0.5,1.0,0.7)); + reflection_probe_material_internal = create_line_material(Color(0.3,0.8,0.5,0.4)); joint_material = create_line_material(Color(0.6,0.8,1.0)); stream_player_icon = Ref( memnew( FixedSpatialMaterial )); diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 2c0033cdca..2cc1a7eab8 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -45,6 +45,7 @@ #include "scene/3d/portal.h" #include "scene/3d/ray_cast.h" #include "scene/3d/navigation_mesh.h" +#include "scene/3d/reflection_probe.h" #include "scene/3d/vehicle_body.h" #include "scene/3d/collision_polygon.h" @@ -307,6 +308,25 @@ public: }; +class ReflectionProbeGizmo : public EditorSpatialGizmo { + + OBJ_TYPE(ReflectionProbeGizmo ,EditorSpatialGizmo); + + + ReflectionProbe* probe; + +public: + + virtual String get_handle_name(int p_idx) const; + virtual Variant get_handle_value(int p_idx) const; + virtual void set_handle(int p_idx,Camera *p_camera, const Point2& p_point); + virtual void commit_handle(int p_idx,const Variant& p_restore,bool p_cancel=false); + + void redraw(); + ReflectionProbeGizmo(ReflectionProbe* p_notifier=NULL); + +}; + class CollisionShapeSpatialGizmo : public EditorSpatialGizmo { @@ -339,6 +359,7 @@ public: }; + class RayCastSpatialGizmo : public EditorSpatialGizmo { OBJ_TYPE(RayCastSpatialGizmo,EditorSpatialGizmo); @@ -473,6 +494,8 @@ public: Ref light_material_directional_icon; Ref camera_material; Ref skeleton_material; + Ref reflection_probe_material; + Ref reflection_probe_material_internal; Ref room_material; Ref portal_material; Ref raycast_material; -- cgit v1.2.3 From a2505542ffeea705208f72459152c5b86779e327 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 20 Nov 2016 22:49:53 -0300 Subject: Huge amount of improvement in the material system. Materials should be a lot more complete and usable now. --- drivers/gles3/rasterizer_canvas_gles3.cpp | 4 + drivers/gles3/rasterizer_scene_gles3.cpp | 7 +- drivers/gles3/rasterizer_storage_gles3.cpp | 20 ++- drivers/gles3/rasterizer_storage_gles3.h | 1 + drivers/gles3/shader_compiler_gles3.cpp | 51 +++++- drivers/gles3/shaders/scene.glsl | 195 +++++++++++++++------ scene/3d/light.cpp | 2 +- scene/resources/material.cpp | 268 +++++++++++++++++++++++++---- scene/resources/material.h | 49 ++++-- servers/visual/shader_language.cpp | 25 +++ servers/visual/shader_language.h | 4 + servers/visual/shader_types.cpp | 7 + 12 files changed, 528 insertions(+), 105 deletions(-) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 4573f94d22..10a8912561 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -934,9 +934,13 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list,int p_z,const if (!t) { switch(texture_hints[i]) { + case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO: case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { glBindTexture(GL_TEXTURE_2D,storage->resources.black_tex); } break; + case ShaderLanguage::ShaderNode::Uniform::HINT_ANISO: { + glBindTexture(GL_TEXTURE_2D,storage->resources.aniso_tex); + } break; case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { glBindTexture(GL_TEXTURE_2D,storage->resources.normal_tex); } break; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index e04908ea67..3ead218226 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1035,9 +1035,13 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m if (!t) { //check hints switch(texture_hints[i]) { + case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO: case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { glBindTexture(GL_TEXTURE_2D,storage->resources.black_tex); } break; + case ShaderLanguage::ShaderNode::Uniform::HINT_ANISO: { + glBindTexture(GL_TEXTURE_2D,storage->resources.aniso_tex); + } break; case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { glBindTexture(GL_TEXTURE_2D,storage->resources.normal_tex); } break; @@ -1046,7 +1050,6 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m } break; } - glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); continue; } @@ -1054,7 +1057,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m //if SRGB decode extension is present, simply switch the texture to whathever is needed bool must_srgb=false; - if (t->srgb && texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO) { + if (t->srgb && (texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO || texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO)) { must_srgb=true; } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 8188fe3adb..669ab96036 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2285,6 +2285,7 @@ void RasterizerStorageGLES3::_update_material(Material* material) { if (V) { //user provided _fill_std140_variant_ubo_value(E->get().type,V->get(),data,material->shader->mode==VS::SHADER_SPATIAL); + } else if (E->get().default_value.size()){ //default value _fill_std140_ubo_value(E->get().type,E->get().default_value,data); @@ -3304,7 +3305,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->type=p_type; light->param[VS::LIGHT_PARAM_ENERGY]=1.0; - light->param[VS::LIGHT_PARAM_SPECULAR]=1.0; + light->param[VS::LIGHT_PARAM_SPECULAR]=0.5; light->param[VS::LIGHT_PARAM_RANGE]=1.0; light->param[VS::LIGHT_PARAM_SPOT_ANGLE]=45; light->param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE]=0; @@ -4491,7 +4492,7 @@ void RasterizerStorageGLES3::initialize() { glGenTextures(1, &resources.black_tex); unsigned char blacktexdata[8*8*3]; - for(int i=0;i<8*8;i++) { + for(int i=0;i<8*8*3;i++) { blacktexdata[i]=0; } @@ -4515,6 +4516,21 @@ void RasterizerStorageGLES3::initialize() { glGenerateMipmap(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,0); + + glGenTextures(1, &resources.aniso_tex); + unsigned char anisotexdata[8*8*3]; + for(int i=0;i<8*8*3;i+=3) { + anisotexdata[i+0]=255; + anisotexdata[i+1]=128; + anisotexdata[i+2]=0; + } + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,resources.aniso_tex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE,anisotexdata); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D,0); + } glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&config.max_texture_image_units); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5f07efeb0a..b433bcd517 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -74,6 +74,7 @@ public: GLuint white_tex; GLuint black_tex; GLuint normal_tex; + GLuint aniso_tex; GLuint quadie; GLuint quadie_array; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index dce52ecd93..c54fc011e9 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -52,6 +52,7 @@ static int _get_datatype_size(SL::DataType p_type) { } + static String _prestr(SL::DataPrecision p_pres) { @@ -248,7 +249,11 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener r_gen_code.texture_hints.resize(max_texture_uniforms); Vector uniform_sizes; + Vector uniform_alignments; + Vector uniform_defines; uniform_sizes.resize(max_uniforms); + uniform_alignments.resize(max_uniforms); + uniform_defines.resize(max_uniforms); for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { @@ -272,19 +277,31 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener r_gen_code.defines.push_back(String("#define USE_MATERIAL\n").ascii()); } - r_gen_code.uniforms+=ucode; + uniform_defines[E->get().order]=ucode; uniform_sizes[E->get().order]=_get_datatype_size(E->get().type); + uniform_alignments[E->get().order]=MIN(16,_get_datatype_size(E->get().type)); } p_actions.uniforms->insert(E->key(),E->get()); } + for(int i=0;i0) + if (i>0) { + + int align = uniform_sizes[i-1] % uniform_alignments[i]; + if (align!=0) { + uniform_sizes[i-1]+=uniform_alignments[i]-align; + } + uniform_sizes[i]=uniform_sizes[i]+uniform_sizes[i-1]; + + } } //offset r_gen_code.uniform_offsets.resize(uniform_sizes.size()); @@ -294,8 +311,21 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener r_gen_code.uniform_offsets[i]=uniform_sizes[i-1]; else r_gen_code.uniform_offsets[i]=0; + + } +/* + for(Map::Element *E=pnode->uniforms.front();E;E=E->next()) { + + if (SL::is_sampler_type(E->get().type)) { + continue; + } + + print_line("u - "+String(E->key())+" offset: "+itos(r_gen_code.uniform_offsets[E->get().order])); + } + +*/ if (uniform_sizes.size()) { r_gen_code.uniform_total_size=uniform_sizes[ uniform_sizes.size() -1 ]; } else { @@ -549,13 +579,11 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, r_gen_code.uses_vertex_time=false; - used_name_defines.clear(); used_rmode_defines.clear(); _dump_node_code(parser.get_shader(),1,r_gen_code,*p_actions,actions[p_mode]); - return OK; } @@ -636,8 +664,14 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].renames["ALPHA"]="alpha"; actions[VS::SHADER_SPATIAL].renames["SPECULAR"]="specular"; actions[VS::SHADER_SPATIAL].renames["ROUGHNESS"]="roughness"; + actions[VS::SHADER_SPATIAL].renames["RIM"]="rim"; + actions[VS::SHADER_SPATIAL].renames["RIM_TINT"]="rim_tint"; + actions[VS::SHADER_SPATIAL].renames["CLEARCOAT"]="clearcoat"; + actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"]="clearcoat_gloss"; + actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"]="anisotropy"; + actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"]="anisotropy_flow"; + actions[VS::SHADER_SPATIAL].renames["AO"]="ao"; actions[VS::SHADER_SPATIAL].renames["EMISSION"]="emission"; - actions[VS::SHADER_SPATIAL].renames["SPECIAL"]="special"; actions[VS::SHADER_SPATIAL].renames["DISCARD"]="_discard"; // actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2; actions[VS::SHADER_SPATIAL].renames["POINT_COORD"]="gl_PointCoord"; @@ -645,6 +679,13 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"]="#define ENABLE_TANGENT_INTERP\n"; actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"]="@TANGENT"; + actions[VS::SHADER_SPATIAL].usage_defines["RIM"]="#define LIGHT_USE_RIM\n"; + actions[VS::SHADER_SPATIAL].usage_defines["RIM_TINT"]="@RIM"; + actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT"]="#define LIGHT_USE_CLEARCOAT\n"; + actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"]="@CLEARCOAT"; + actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"]="#define LIGHT_USE_ANISOTROPY\n"; + actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"]="@ANISOTROPY"; + actions[VS::SHADER_SPATIAL].usage_defines["AO"]="#define ENABLE_AO\n"; actions[VS::SHADER_SPATIAL].usage_defines["UV"]="#define ENABLE_UV_INTERP\n"; actions[VS::SHADER_SPATIAL].usage_defines["UV2"]="#define ENABLE_UV2_INTERP\n"; actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"]="#define ENABLE_NORMALMAP\n"; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index a923c130dc..aa8b3cacdc 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -108,7 +108,7 @@ out vec2 uv2_interp; #endif -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) out vec3 tangent_interp; out vec3 binormal_interp; #endif @@ -146,7 +146,7 @@ void main() { highp mat4 modelview = camera_inverse_matrix * world_transform; vec3 normal = normal_attrib * normal_mult; -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) vec3 tangent = tangent_attrib.xyz; tangent*=normal_mult; float binormalf = tangent_attrib.a; @@ -163,7 +163,7 @@ void main() { vertex = vertex_in * m; normal = (vec4(normal,0.0) * m).xyz; -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) tangent = (vec4(tangent,0.0) * m).xyz; #endif } @@ -176,7 +176,7 @@ void main() { normal = normalize((modelview * vec4(normal,0.0)).xyz); #endif -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) # if !defined(SKIP_TRANSFORM_USED) tangent=normalize((modelview * vec4(tangent,0.0)).xyz); @@ -207,7 +207,7 @@ VERTEX_SHADER_CODE vertex_interp = vertex.xyz; normal_interp = normal; -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) tangent_interp = tangent; binormal_interp = binormal; #endif @@ -276,7 +276,7 @@ in vec2 uv_interp; in vec2 uv2_interp; #endif -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) in vec3 tangent_interp; in vec3 binormal_interp; #endif @@ -455,40 +455,86 @@ float G1V(float dotNV, float k) return 1.0 / (dotNV * (1.0 - k) + k); } -float specularGGX(vec3 N, vec3 V, vec3 L, float roughness, float F0) + +float SchlickFresnel(float u) { - float alpha = roughness * roughness; + float m = 1.0-u; + float m2 = m*m; + return m2*m2*m; // pow(m,5) +} + +float GTR1(float NdotH, float a) +{ + if (a >= 1.0) return 1.0/M_PI; + float a2 = a*a; + float t = 1.0 + (a2-1.0)*NdotH*NdotH; + return (a2-1.0) / (M_PI*log(a2)*t); +} - vec3 H = normalize(V + L); +void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 diffuse_color, vec3 specular_color, float specular_blob_intensity, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse, inout vec3 specular) { - float dotNL = max(dot(N,L), 0.0 ); - float dotNV = max(dot(N,V), 0.0 ); - float dotNH = max(dot(N,H), 0.0 ); - float dotLH = max(dot(L,H), 0.0 ); + float dotNL = max(dot(N,L), 0.0 ); + float dotNV = max(dot(N,V), 0.0 ); - // D - float alphaSqr = alpha * alpha; - float pi = M_PI; - float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0; - float D = alphaSqr / (pi * denom * denom); +#if defined(LIGHT_USE_RIM) + float rim_light = pow(1.0-dotNV,(1.0-roughness)*16.0); + diffuse += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color; +#endif - // F - float dotLH5 = pow(1.0 - dotLH, 5.0); - float F = F0 + (1.0 - F0) * (dotLH5); + diffuse += dotNL * light_color * diffuse_color; - // V - float k = alpha / 2.0f; - float vis = G1V(dotNL, k) * G1V(dotNV, k); + if (roughness > 0.0) { - return dotNL * D * F * vis; -} + float alpha = roughness * roughness; + + vec3 H = normalize(V + L); + + float dotNH = max(dot(N,H), 0.0 ); + float dotLH = max(dot(L,H), 0.0 ); + + // D +#if defined(LIGHT_USE_ANISOTROPY) + + float aspect = sqrt(1.0-anisotropy*0.9); + float rx = roughness/aspect; + float ry = roughness*aspect; + float ax = rx*rx; + float ay = ry*ry; + float dotXH = dot( T, H ); + float dotYH = dot( B, H ); + float pi = M_PI; + float denom = dotXH*dotXH / (ax*ax) + dotYH*dotYH / (ay*ay) + dotNH*dotNH; + float D = 1.0 / ( pi * ax*ay * denom*denom ); + +#else + float alphaSqr = alpha * alpha; + float pi = M_PI; + float denom = dotNH * dotNH * (alphaSqr - 1.0) + 1.0; + float D = alphaSqr / (pi * denom * denom); +#endif + // F + float F0 = 1.0; + float dotLH5 = SchlickFresnel( dotLH ); + float F = F0 + (1.0 - F0) * (dotLH5); + + // V + float k = alpha / 2.0f; + float vis = G1V(dotNL, k) * G1V(dotNV, k); + + float speci = dotNL * D * F * vis; + + specular += speci * light_color * specular_color * specular_blob_intensity; + +#if defined(LIGHT_USE_CLEARCOAT) + float Dr = GTR1(dotNH, mix(.1,.001,clearcoat_gloss)); + float Fr = mix(.04, 1.0, dotLH5); + float Gr = G1V(dotNL, .25) * G1V(dotNV, .25); + + specular += .25*clearcoat*Gr*Fr*Dr; +#endif + } -void light_compute(vec3 normal, vec3 light_vec,vec3 eye_vec,vec3 light_color,vec3 diffuse_color, vec3 specular_color, float roughness, inout vec3 diffuse, inout vec3 specular) { - diffuse += max(0.0,dot(normal,light_vec)) * light_color * diffuse_color; - //specular += specular_ggx( roughness, max(0.0,dot(normal,eye_vec)) ) * specular_color * attenuation; - float s = roughness > 0.0 ? specularGGX(normal,eye_vec,light_vec,roughness,1.0) : 0.0; - specular += s * light_color * specular_color; } @@ -536,7 +582,7 @@ in highp float dp_clip; #endif -void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 albedo, vec3 specular, float roughness, inout vec3 diffuse_light, inout vec3 specular_light) { +void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 specular, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse_light, inout vec3 specular_light) { vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; float normalized_distance = length( light_rel_vec )*omni_lights[idx].light_pos_inv_radius.w; @@ -577,11 +623,11 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 albe light_attenuation*=mix(omni_lights[idx].shadow_color.rgb,vec3(1.0),sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect)); } - light_compute(normal,normalize(light_rel_vec),eye_vec,omni_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,roughness,diffuse_light,specular_light); + light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,omni_lights[idx].light_params.z,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); } -void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 albedo, vec3 specular, float roughness, inout vec3 diffuse_light, inout vec3 specular_light) { +void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent,vec3 albedo, vec3 specular, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) { vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex; float normalized_distance = length( light_rel_vec )*spot_lights[idx].light_pos_inv_radius.w; @@ -589,8 +635,8 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 al vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz; float spot_cutoff=spot_lights[idx].light_params.y; float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff); - float rim = (1.0 - scos) / (1.0 - spot_cutoff); - light_attenuation *= 1.0 - pow( rim, spot_lights[idx].light_params.x); + float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff); + light_attenuation *= 1.0 - pow( spot_rim, spot_lights[idx].light_params.x); if (spot_lights[idx].light_params.w>0.5) { //there is a shadowmap @@ -599,11 +645,11 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 al light_attenuation*=mix(spot_lights[idx].shadow_color.rgb,vec3(1.0),sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp)); } - light_compute(normal,normalize(light_rel_vec),eye_vec,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,roughness,diffuse_light,specular_light); + light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,spot_lights[idx].light_params.z,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); } -void reflection_process(int idx, vec3 vertex, vec3 normal,float roughness,vec3 ambient,vec3 skybox,vec2 brdf, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) { +void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 tangent,float roughness,float anisotropy,vec3 ambient,vec3 skybox,vec2 brdf, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) { vec3 ref_vec = normalize(reflect(vertex,normal)); vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex,1.0)).xyz; @@ -729,7 +775,19 @@ void main() { highp vec3 vertex = vertex_interp; vec3 albedo = vec3(0.8,0.8,0.8); vec3 specular = vec3(0.2,0.2,0.2); + vec3 emission = vec3(0.0,0.0,0.0); float roughness = 1.0; + float rim = 0.0; + float rim_tint = 0.0; + float clearcoat=0.0; + float clearcoat_gloss=0.0; + float anisotropy = 1.0; + vec2 anisotropy_flow = vec2(1.0,0.0); + +#if defined(ENABLE_AO) + float ao=1.0; +#endif + float alpha = 1.0; #ifdef METERIAL_DOUBLESIDED @@ -739,9 +797,12 @@ void main() { #endif -#if defined(ENABLE_TANGENT_INTERP) +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; +#else + vec3 binormal = vec3(0.0); + vec3 tangent = vec3(0.0); #endif vec3 normal = normalize(normal_interp)*side; @@ -777,9 +838,26 @@ FRAGMENT_SHADER_CODE } + + #if defined(ENABLE_NORMALMAP) - normal = normalize( mix(normal_interp,tangent_interp * normalmap.x + binormal_interp * normalmap.y + normal_interp * normalmap.z,normaldepth) ) * side; + normalmap.xy=normalmap.xy*2.0-1.0; + normalmap.z=sqrt(1.0-dot(normalmap.xy,normalmap.xy)); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc. + + normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side; + +#endif + +#if defined(LIGHT_USE_ANISOTROPY) + + if (anisotropy>0.01) { + //rotation matrix + mat3 rot = mat3( tangent, binormal, normal ); + //make local to space + tangent = normalize(rot * vec3(anisotropy_flow.x,anisotropy_flow.y,0.0)); + binormal = normalize(rot * vec3(-anisotropy_flow.y,anisotropy_flow.x,0.0)); + } #endif @@ -799,6 +877,10 @@ FRAGMENT_SHADER_CODE /////////////////////// LIGHTING ////////////////////////////// + //apply energy conservation + vec3 diffuse=mix(albedo,vec3(0.0),specular); + specular = max(vec3(0.04),specular); + vec3 specular_light = vec3(0.0,0.0,0.0); vec3 ambient_light; vec3 diffuse_light = vec3(0.0,0.0,0.0); @@ -839,8 +921,7 @@ FRAGMENT_SHADER_CODE norm.xy/=norm.z; norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25+y_ofs); - vec3 radiance = textureLod(radiance_map, norm.xy, lod).xyz * ( brdf.x + brdf.y); - specular_light=mix(albedo,radiance,specular); + specular_light = textureLod(radiance_map, norm.xy, lod).xyz * ( brdf.x + brdf.y); } //no longer a cubemap @@ -996,7 +1077,7 @@ FRAGMENT_SHADER_CODE #endif //LIGHT_DIRECTIONAL_SHADOW - light_compute(normal,-light_direction_attenuation.xyz,eye_vec,light_color_energy.rgb*light_attenuation,albedo,specular,roughness,diffuse_light,specular_light); + light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb*light_attenuation,diffuse,specular,light_params.z,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); #endif //#USE_LIGHT_DIRECTIONAL @@ -1008,23 +1089,22 @@ FRAGMENT_SHADER_CODE highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0); for(int i=0;i0.0) { specular_light=reflection_accum.rgb/reflection_accum.a; - specular_light*=specular; } if (ambient_accum.a>0.0) { ambient_light=ambient_accum.rgb/ambient_accum.a; } for(int i=0;i0.0) ? max_ambient/total_ambient : 0.0; +#endif //ENABLE_AO - diffuse_buffer=vec4(diffuse_light+ambient_light,ambient_scale); + diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale); specular_buffer=vec4(specular_light,0.0); normal_mr_buffer=vec4(normal.x,normal.y,max(specular.r,max(specular.g,specular.b)),roughness); @@ -1067,11 +1159,14 @@ LIGHT_SHADER_CODE #ifdef SHADELESS frag_color=vec4(albedo,alpha); #else - frag_color=vec4(ambient_light+diffuse_light+specular_light,alpha); + frag_color=vec4(emission+ambient_light+diffuse_light+specular_light,alpha); #endif //SHADELESS + #endif //USE_MULTIPLE_RENDER_TARGETS + + #endif //RENDER_SHADOW diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index dfb9521639..49bffd3c21 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -254,7 +254,7 @@ Light::Light(VisualServer::LightType p_type) { set_cull_mask(0xFFFFFFFF); set_param(PARAM_ENERGY,1); - set_param(PARAM_SPECULAR,1); + set_param(PARAM_SPECULAR,0.5); set_param(PARAM_RANGE,5); set_param(PARAM_ATTENUATION,1); set_param(PARAM_SPOT_ANGLE,45); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index cb55f4f030..99b7a130f7 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -64,25 +64,30 @@ void FixedSpatialMaterial::init_shaders() { shader_names->specular="specular"; shader_names->roughness="roughness"; shader_names->emission="emission"; + shader_names->emission_energy="emission_energy"; shader_names->normal_scale="normal_scale"; - shader_names->sheen="sheen"; - shader_names->sheen_color="sheen_color"; + shader_names->rim="rim"; + shader_names->rim_tint="rim_tint"; shader_names->clearcoat="clearcoat"; shader_names->clearcoat_gloss="clearcoat_gloss"; - shader_names->anisotropy="anisotropy"; + shader_names->anisotropy="anisotropy_ratio"; shader_names->height_scale="height_scale"; shader_names->subsurface_scattering="subsurface_scattering"; shader_names->refraction="refraction"; shader_names->refraction_roughness="refraction_roughness"; shader_names->point_size="point_size"; + shader_names->uv1_scale="uv1_scale"; + shader_names->uv1_offset="uv1_offset"; + shader_names->uv2_scale="uv2_scale"; + shader_names->uv2_offset="uv2_offset"; shader_names->texture_names[TEXTURE_ALBEDO]="texture_albedo"; shader_names->texture_names[TEXTURE_SPECULAR]="texture_specular"; shader_names->texture_names[TEXTURE_EMISSION]="texture_emission"; shader_names->texture_names[TEXTURE_NORMAL]="texture_normal"; - shader_names->texture_names[TEXTURE_SHEEN]="texture_sheen"; + shader_names->texture_names[TEXTURE_RIM]="texture_rim"; shader_names->texture_names[TEXTURE_CLEARCOAT]="texture_clearcoat"; - shader_names->texture_names[TEXTURE_ANISOTROPY]="texture_anisotropy"; + shader_names->texture_names[TEXTURE_FLOWMAP]="texture_flowmap"; shader_names->texture_names[TEXTURE_AMBIENT_OCCLUSION]="texture_ambient_occlusion"; shader_names->texture_names[TEXTURE_HEIGHT]="texture_height"; shader_names->texture_names[TEXTURE_SUBSURFACE_SCATTERING]="texture_subsurface_scattering"; @@ -172,6 +177,46 @@ void FixedSpatialMaterial::_update_shader() { code+="uniform float roughness : hint_range(0,1);\n"; code+="uniform float point_size : hint_range(0,128);\n"; code+="uniform sampler2D texture_specular : hint_white;\n"; + code+="uniform vec2 uv1_scale;\n"; + code+="uniform vec2 uv1_offset;\n"; + code+="uniform vec2 uv2_scale;\n"; + code+="uniform vec2 uv2_offset;\n"; + + if (features[FEATURE_EMISSION]) { + + code+="uniform sampler2D texture_emission : hint_black_albedo;\n"; + code+="uniform vec4 emission : hint_color;\n"; + code+="uniform float emission_energy;\n"; + } + + if (features[FEATURE_NORMAL_MAPPING]) { + code+="uniform sampler2D texture_normal : hint_normal;\n"; + code+="uniform float normal_scale : hint_range(-16,16);\n"; + } + if (features[FEATURE_RIM]) { + code+="uniform float rim : hint_range(0,1);\n"; + code+="uniform float rim_tint : hint_range(0,1);\n"; + code+="uniform sampler2D texture_rim : hint_white;\n"; + } + if (features[FEATURE_CLEARCOAT]) { + code+="uniform float clearcoat : hint_range(0,1);\n"; + code+="uniform float clearcoat_gloss : hint_range(0,1);\n"; + code+="uniform sampler2D texture_clearcoat : hint_white;\n"; + } + if (features[FEATURE_ANISOTROPY]) { + code+="uniform float anisotropy_ratio : hint_range(0,256);\n"; + code+="uniform sampler2D texture_flowmap : hint_aniso;\n"; + } + if (features[FEATURE_AMBIENT_OCCLUSION]) { + code+="uniform sampler2D texture_ambient_occlusion : hint_white;\n"; + } + + if (features[FEATURE_DETAIL]) { + code+="uniform sampler2D texture_detail_albedo : hint_albedo;\n"; + code+="uniform sampler2D texture_detail_normal : hint_normal;\n"; + code+="uniform sampler2D texture_detail_mask : hint_white;\n"; + } + code+="\n\n"; code+="void vertex() {\n"; @@ -184,6 +229,10 @@ void FixedSpatialMaterial::_update_shader() { code+="\tPOINT_SIZE=point_size;\n"; } + code+="\tUV=UV*uv1_scale+uv1_offset;\n"; + if (detail_blend_mode==DETAIL_UV_2) { + code+="\tUV2=UV2*uv2_scale+uv2_offset;\n"; + } code+="}\n"; code+="\n\n"; @@ -203,6 +252,66 @@ void FixedSpatialMaterial::_update_shader() { if (features[FEATURE_TRANSPARENT]) { code+="\tALPHA = albedo.a * albedo_tex.a;\n"; } + + if (features[FEATURE_EMISSION]) { + code+="\tEMISSION = (emission.rgb+texture(texture_emission,UV).rgb)*emission_energy;\n"; + } + + if (features[FEATURE_NORMAL_MAPPING]) { + code+="\tNORMALMAP = texture(texture_normal,UV).rgb;\n"; + code+="\tNORMALMAP_DEPTH = normal_scale;\n"; + } + + if (features[FEATURE_RIM]) { + code+="\tvec2 rim_tex = texture(texture_rim,UV).xw;\n"; + code+="\tRIM = rim*rim_tex.x;"; + code+="\tRIM_TINT = rim_tint*rim_tex.y;\n"; + } + + if (features[FEATURE_CLEARCOAT]) { + code+="\tvec2 clearcoat_tex = texture(texture_clearcoat,UV).xw;\n"; + code+="\tCLEARCOAT = clearcoat*clearcoat_tex.x;"; + code+="\tCLEARCOAT_GLOSS = clearcoat_gloss*clearcoat_tex.y;\n"; + } + + if (features[FEATURE_ANISOTROPY]) { + code+="\tvec4 anisotropy_tex = texture(texture_flowmap,UV);\n"; + code+="\tANISOTROPY = anisotropy_ratio*anisotropy_tex.a;\n"; + code+="\tANISOTROPY_FLOW = anisotropy_tex.rg*2.0-1.0;\n"; + } + + if (features[FEATURE_AMBIENT_OCCLUSION]) { + code+="\tAO = texture(texture_ambient_occlusion,UV).r;\n"; + } + + if (features[FEATURE_DETAIL]) { + String det_uv=detail_uv==DETAIL_UV_1?"UV":"UV2"; + code+="\tvec4 detail_tex = texture(texture_detail_albedo,"+det_uv+");\n"; + code+="\tvec4 detail_norm_tex = texture(texture_detail_normal,"+det_uv+");\n"; + code+="\tvec4 detail_mask_tex = texture(texture_detail_mask,UV);\n"; + + switch(detail_blend_mode) { + case BLEND_MODE_MIX: { + code+="\tvec3 detail = mix(ALBEDO.rgb,detail_tex.rgb,detail_tex.a);\n"; + } break; + case BLEND_MODE_ADD: { + code+="\tvec3 detail = mix(ALBEDO.rgb,ALBEDO.rgb+detail_tex.rgb,detail_tex.a);\n"; + } break; + case BLEND_MODE_SUB: { + code+="\tvec3 detail = mix(ALBEDO.rgb,ALBEDO.rgb-detail_tex.rgb,detail_tex.a);\n"; + } break; + case BLEND_MODE_MUL: { + code+="\tvec3 detail = mix(ALBEDO.rgb,ALBEDO.rgb*detail_tex.rgb,detail_tex.a);\n"; + } break; + + } + + code+="\tvec3 detail_norm = mix(NORMALMAP,detail_norm_tex.rgb,detail_tex.a);\n"; + + code+="\tNORMALMAP = mix(NORMALMAP,detail_norm,detail_mask_tex.r);\n"; + code+="\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n"; + } + code+="\tvec4 specular_tex = texture(texture_specular,UV);\n"; code+="\tSPECULAR = specular.rgb * specular_tex.rgb;\n"; code+="\tROUGHNESS = specular.a * roughness;\n"; @@ -308,6 +417,18 @@ Color FixedSpatialMaterial::get_emission() const{ return emission; } + +void FixedSpatialMaterial::set_emission_energy(float p_emission_energy){ + + emission_energy=p_emission_energy; + VS::get_singleton()->material_set_param(_get_material(),shader_names->emission_energy,p_emission_energy); + +} +float FixedSpatialMaterial::get_emission_energy() const{ + + return emission_energy; +} + void FixedSpatialMaterial::set_normal_scale(float p_normal_scale){ normal_scale=p_normal_scale; @@ -319,27 +440,27 @@ float FixedSpatialMaterial::get_normal_scale() const{ return normal_scale; } -void FixedSpatialMaterial::set_sheen(float p_sheen){ +void FixedSpatialMaterial::set_rim(float p_rim){ - sheen=p_sheen; - VS::get_singleton()->material_set_param(_get_material(),shader_names->sheen,p_sheen); + rim=p_rim; + VS::get_singleton()->material_set_param(_get_material(),shader_names->rim,p_rim); } -float FixedSpatialMaterial::get_sheen() const{ +float FixedSpatialMaterial::get_rim() const{ - return sheen; + return rim; } -void FixedSpatialMaterial::set_sheen_color(const Color& p_sheen_color){ +void FixedSpatialMaterial::set_rim_tint(float p_rim_tint){ - sheen_color=p_sheen_color; - VS::get_singleton()->material_set_param(_get_material(),shader_names->sheen_color,p_sheen_color); + rim_tint=p_rim_tint; + VS::get_singleton()->material_set_param(_get_material(),shader_names->rim_tint,p_rim_tint); } -Color FixedSpatialMaterial::get_sheen_color() const{ +float FixedSpatialMaterial::get_rim_tint() const{ - return sheen_color; + return rim_tint; } void FixedSpatialMaterial::set_clearcoat(float p_clearcoat){ @@ -565,7 +686,8 @@ void FixedSpatialMaterial::_validate_feature(const String& text, Feature feature void FixedSpatialMaterial::_validate_property(PropertyInfo& property) const { _validate_feature("normal",FEATURE_NORMAL_MAPPING,property); - _validate_feature("sheen",FEATURE_SHEEN,property); + _validate_feature("emission",FEATURE_EMISSION,property); + _validate_feature("rim",FEATURE_RIM,property); _validate_feature("clearcoat",FEATURE_CLEARCOAT,property); _validate_feature("anisotropy",FEATURE_ANISOTROPY,property); _validate_feature("ao",FEATURE_AMBIENT_OCCLUSION,property); @@ -598,6 +720,53 @@ float FixedSpatialMaterial::get_point_size() const { return point_size; } + +void FixedSpatialMaterial::set_uv1_scale(const Vector2& p_scale) { + + uv1_scale=p_scale; + VS::get_singleton()->material_set_param(_get_material(),shader_names->uv1_scale,p_scale); +} + +Vector2 FixedSpatialMaterial::get_uv1_scale() const{ + + return uv1_scale; +} + +void FixedSpatialMaterial::set_uv1_offset(const Vector2& p_offset){ + + uv1_offset=p_offset; + VS::get_singleton()->material_set_param(_get_material(),shader_names->uv1_offset,p_offset); + +} +Vector2 FixedSpatialMaterial::get_uv1_offset() const{ + + return uv1_offset; +} + + +void FixedSpatialMaterial::set_uv2_scale(const Vector2& p_scale) { + + uv2_scale=p_scale; + VS::get_singleton()->material_set_param(_get_material(),shader_names->uv2_scale,p_scale); +} + +Vector2 FixedSpatialMaterial::get_uv2_scale() const{ + + return uv2_scale; +} + +void FixedSpatialMaterial::set_uv2_offset(const Vector2& p_offset){ + + uv2_offset=p_offset; + VS::get_singleton()->material_set_param(_get_material(),shader_names->uv2_offset,p_offset); + +} + +Vector2 FixedSpatialMaterial::get_uv2_offset() const{ + + return uv2_offset; +} + void FixedSpatialMaterial::_bind_methods() { @@ -613,14 +782,17 @@ void FixedSpatialMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_emission","emission"),&FixedSpatialMaterial::set_emission); ObjectTypeDB::bind_method(_MD("get_emission"),&FixedSpatialMaterial::get_emission); + ObjectTypeDB::bind_method(_MD("set_emission_energy","emission_energy"),&FixedSpatialMaterial::set_emission_energy); + ObjectTypeDB::bind_method(_MD("get_emission_energy"),&FixedSpatialMaterial::get_emission_energy); + ObjectTypeDB::bind_method(_MD("set_normal_scale","normal_scale"),&FixedSpatialMaterial::set_normal_scale); ObjectTypeDB::bind_method(_MD("get_normal_scale"),&FixedSpatialMaterial::get_normal_scale); - ObjectTypeDB::bind_method(_MD("set_sheen","sheen"),&FixedSpatialMaterial::set_sheen); - ObjectTypeDB::bind_method(_MD("get_sheen"),&FixedSpatialMaterial::get_sheen); + ObjectTypeDB::bind_method(_MD("set_rim","rim"),&FixedSpatialMaterial::set_rim); + ObjectTypeDB::bind_method(_MD("get_rim"),&FixedSpatialMaterial::get_rim); - ObjectTypeDB::bind_method(_MD("set_sheen_color","sheen_color"),&FixedSpatialMaterial::set_sheen_color); - ObjectTypeDB::bind_method(_MD("get_sheen_color"),&FixedSpatialMaterial::get_sheen_color); + ObjectTypeDB::bind_method(_MD("set_rim_tint","rim_tint"),&FixedSpatialMaterial::set_rim_tint); + ObjectTypeDB::bind_method(_MD("get_rim_tint"),&FixedSpatialMaterial::get_rim_tint); ObjectTypeDB::bind_method(_MD("set_clearcoat","clearcoat"),&FixedSpatialMaterial::set_clearcoat); ObjectTypeDB::bind_method(_MD("get_clearcoat"),&FixedSpatialMaterial::get_clearcoat); @@ -676,6 +848,18 @@ void FixedSpatialMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_detail_blend_mode","detail_blend_mode"),&FixedSpatialMaterial::set_detail_blend_mode); ObjectTypeDB::bind_method(_MD("get_detail_blend_mode"),&FixedSpatialMaterial::get_detail_blend_mode); + ObjectTypeDB::bind_method(_MD("set_uv1_scale","scale"),&FixedSpatialMaterial::set_uv1_scale); + ObjectTypeDB::bind_method(_MD("get_uv1_scale"),&FixedSpatialMaterial::get_uv1_scale); + + ObjectTypeDB::bind_method(_MD("set_uv1_offset","offset"),&FixedSpatialMaterial::set_uv1_offset); + ObjectTypeDB::bind_method(_MD("get_uv1_offset"),&FixedSpatialMaterial::get_uv1_offset); + + ObjectTypeDB::bind_method(_MD("set_uv2_scale","scale"),&FixedSpatialMaterial::set_uv2_scale); + ObjectTypeDB::bind_method(_MD("get_uv2_scale"),&FixedSpatialMaterial::get_uv2_scale); + + ObjectTypeDB::bind_method(_MD("set_uv2_offset","offset"),&FixedSpatialMaterial::set_uv2_offset); + ObjectTypeDB::bind_method(_MD("get_uv2_offset"),&FixedSpatialMaterial::get_uv2_offset); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/transparent"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_TRANSPARENT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/unshaded"),_SCS("set_flag"),_SCS("get_flag"),FLAG_UNSHADED); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"flags/on_top"),_SCS("set_flag"),_SCS("get_flag"),FLAG_ONTOP); @@ -693,27 +877,32 @@ void FixedSpatialMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo/color"),_SCS("set_albedo"),_SCS("get_albedo")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular/color"),_SCS("set_specular"),_SCS("get_specular")); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_specular"),_SCS("get_specular")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_roughness"),_SCS("get_roughness")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"specular/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SPECULAR); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"emission/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_EMISSION); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"emission/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_emission"),_SCS("get_emission")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"emission/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_emission_energy"),_SCS("get_emission_energy")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"emission/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_EMISSION); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"normal/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_NORMAL_MAPPING); ADD_PROPERTY(PropertyInfo(Variant::REAL,"normal/scale",PROPERTY_HINT_RANGE,"-16,16,0.01"),_SCS("set_normal_scale"),_SCS("get_normal_scale")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"normal/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_NORMAL); - ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"sheen/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SHEEN); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"sheen/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_sheen"),_SCS("get_sheen")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"sheen/color"),_SCS("set_sheen_color"),_SCS("get_sheen_color")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"sheen/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SHEEN); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"rim/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_RIM); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim"),_SCS("get_rim")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"rim/tint",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_rim_tint"),_SCS("get_rim_tint")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"rim/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_RIM); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"clearcoat/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_CLEARCOAT); ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat"),_SCS("get_clearcoat")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/gloss"),_SCS("set_clearcoat_gloss"),_SCS("get_clearcoat_gloss")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"clearcoat/gloss",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_clearcoat_gloss"),_SCS("get_clearcoat_gloss")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"clearcoat/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_CLEARCOAT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"anisotropy/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_ANISOTROPY); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"anisotropy/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_anisotropy"),_SCS("get_anisotropy")); - ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"anisotropy/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ANISOTROPY); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"anisotropy/anisotropy",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_anisotropy"),_SCS("get_anisotropy")); + ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"anisotropy/flowmap",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_FLOWMAP); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"ao/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_AMBIENT_OCCLUSION); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"ao/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_AMBIENT_OCCLUSION); @@ -738,13 +927,19 @@ void FixedSpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/albedo",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_ALBEDO); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"detail/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_DETAIL_NORMAL); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1/scale"),_SCS("set_uv1_scale"),_SCS("get_uv1_scale")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv1/offset"),_SCS("set_uv1_offset"),_SCS("get_uv1_offset")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2/scale"),_SCS("set_uv2_scale"),_SCS("get_uv2_scale")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"uv2/offset"),_SCS("set_uv2_offset"),_SCS("get_uv2_offset")); + + BIND_CONSTANT( TEXTURE_ALBEDO ); BIND_CONSTANT( TEXTURE_SPECULAR ); BIND_CONSTANT( TEXTURE_EMISSION ); BIND_CONSTANT( TEXTURE_NORMAL ); - BIND_CONSTANT( TEXTURE_SHEEN ); + BIND_CONSTANT( TEXTURE_RIM ); BIND_CONSTANT( TEXTURE_CLEARCOAT ); - BIND_CONSTANT( TEXTURE_ANISOTROPY ); + BIND_CONSTANT( TEXTURE_FLOWMAP ); BIND_CONSTANT( TEXTURE_AMBIENT_OCCLUSION ); BIND_CONSTANT( TEXTURE_HEIGHT ); BIND_CONSTANT( TEXTURE_SUBSURFACE_SCATTERING ); @@ -762,7 +957,7 @@ void FixedSpatialMaterial::_bind_methods() { BIND_CONSTANT( FEATURE_TRANSPARENT ); BIND_CONSTANT( FEATURE_EMISSION ); BIND_CONSTANT( FEATURE_NORMAL_MAPPING ); - BIND_CONSTANT( FEATURE_SHEEN ); + BIND_CONSTANT( FEATURE_RIM ); BIND_CONSTANT( FEATURE_CLEARCOAT ); BIND_CONSTANT( FEATURE_ANISOTROPY ); BIND_CONSTANT( FEATURE_AMBIENT_OCCLUSION ); @@ -808,10 +1003,11 @@ FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { set_specular(Color(0.1,0.1,0.1)); set_roughness(0.0); set_emission(Color(0,0,0)); + set_emission_energy(1.0); set_normal_scale(1); - set_sheen(0); - set_sheen_color(Color(1,1,1,1)); - set_clearcoat(0); + set_rim(1.0); + set_rim_tint(0.5); + set_clearcoat(1); set_clearcoat_gloss(0.5); set_anisotropy(0); set_height_scale(1); @@ -820,6 +1016,10 @@ FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { set_refraction_roughness(0); set_line_width(1); set_point_size(1); + set_uv1_offset(Vector2(0,0)); + set_uv1_scale(Vector2(1,1)); + set_uv2_offset(Vector2(0,0)); + set_uv2_scale(Vector2(1,1)); detail_uv=DETAIL_UV_1; blend_mode=BLEND_MODE_MIX; diff --git a/scene/resources/material.h b/scene/resources/material.h index 35f01d4756..15c5910a9c 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -69,9 +69,9 @@ public: TEXTURE_SPECULAR, TEXTURE_EMISSION, TEXTURE_NORMAL, - TEXTURE_SHEEN, + TEXTURE_RIM, TEXTURE_CLEARCOAT, - TEXTURE_ANISOTROPY, + TEXTURE_FLOWMAP, TEXTURE_AMBIENT_OCCLUSION, TEXTURE_HEIGHT, TEXTURE_SUBSURFACE_SCATTERING, @@ -95,7 +95,7 @@ public: FEATURE_TRANSPARENT, FEATURE_EMISSION, FEATURE_NORMAL_MAPPING, - FEATURE_SHEEN, + FEATURE_RIM, FEATURE_CLEARCOAT, FEATURE_ANISOTROPY, FEATURE_AMBIENT_OCCLUSION, @@ -205,9 +205,10 @@ private: StringName specular; StringName roughness; StringName emission; + StringName emission_energy; StringName normal_scale; - StringName sheen; - StringName sheen_color; + StringName rim; + StringName rim_tint; StringName clearcoat; StringName clearcoat_gloss; StringName anisotropy; @@ -216,6 +217,10 @@ private: StringName refraction; StringName refraction_roughness; StringName point_size; + StringName uv1_scale; + StringName uv1_offset; + StringName uv2_scale; + StringName uv2_offset; StringName texture_names[TEXTURE_MAX]; }; @@ -234,9 +239,10 @@ private: Color specular; float roughness; Color emission; + float emission_energy; float normal_scale; - float sheen; - Color sheen_color; + float rim; + float rim_tint; float clearcoat; float clearcoat_gloss; float anisotropy; @@ -247,6 +253,12 @@ private: float line_width; float point_size; + Vector2 uv1_scale; + Vector2 uv1_offset; + + Vector2 uv2_scale; + Vector2 uv2_offset; + DetailUV detail_uv; BlendMode blend_mode; @@ -282,14 +294,17 @@ public: void set_emission(const Color& p_emission); Color get_emission() const; + void set_emission_energy(float p_emission_energy); + float get_emission_energy() const; + void set_normal_scale(float p_normal_scale); float get_normal_scale() const; - void set_sheen(float p_sheen); - float get_sheen() const; + void set_rim(float p_rim); + float get_rim() const; - void set_sheen_color(const Color& p_sheen_color); - Color get_sheen_color() const; + void set_rim_tint(float p_rim_tint); + float get_rim_tint() const; void set_clearcoat(float p_clearcoat); float get_clearcoat() const; @@ -345,6 +360,18 @@ public: void set_feature(Feature p_feature,bool p_enabled); bool get_feature(Feature p_feature) const; + void set_uv1_scale(const Vector2& p_scale); + Vector2 get_uv1_scale() const; + + void set_uv1_offset(const Vector2& p_offset); + Vector2 get_uv1_offset() const; + + void set_uv2_scale(const Vector2& p_scale); + Vector2 get_uv2_scale() const; + + void set_uv2_offset(const Vector2& p_offset); + Vector2 get_uv2_offset() const; + static void init_shaders(); static void finish_shaders(); static void flush_changes(); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 357546e595..f6220250d9 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -183,7 +183,9 @@ const char * ShaderLanguage::token_names[TK_MAX]={ "HINT_WHITE_TEXTURE", "HINT_BLACK_TEXTURE", "HINT_NORMAL_TEXTURE", + "HINT_ANISO_TEXTURE", "HINT_ALBEDO_TEXTURE", + "HINT_BLACK_ALBEDO_TEXTURE", "HINT_COLOR", "HINT_RANGE", "CURSOR", @@ -263,7 +265,9 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[]={ {TK_HINT_WHITE_TEXTURE,"hint_white"}, {TK_HINT_BLACK_TEXTURE,"hint_black"}, {TK_HINT_NORMAL_TEXTURE,"hint_normal"}, + {TK_HINT_ANISO_TEXTURE,"hint_aniso"}, {TK_HINT_ALBEDO_TEXTURE,"hint_albedo"}, + {TK_HINT_BLACK_ALBEDO_TEXTURE,"hint_black_albedo"}, {TK_HINT_COLOR,"hint_color"}, {TK_HINT_RANGE,"hint_range"}, @@ -3303,8 +3307,12 @@ Error ShaderLanguage::_parse_shader(const Map< StringName, Map Date: Mon, 21 Nov 2016 19:03:39 -0300 Subject: Skeletons are working now. --- drivers/gles3/rasterizer_gles3.cpp | 1 + drivers/gles3/rasterizer_scene_gles3.cpp | 20 +++ drivers/gles3/rasterizer_scene_gles3.h | 1 + drivers/gles3/rasterizer_storage_gles3.cpp | 228 ++++++++++++++++++++++++++--- drivers/gles3/rasterizer_storage_gles3.h | 21 +++ drivers/gles3/shaders/scene.glsl | 43 ++++-- servers/visual_server.cpp | 22 ++- servers/visual_server.h | 2 +- 8 files changed, 304 insertions(+), 34 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index dabb7918a9..63090e53a7 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -124,6 +124,7 @@ void RasterizerGLES3::begin_frame(){ storage->frame.time[3]=Math::fmod(time_total,60); storage->frame.count++; + storage->update_dirty_skeletons(); storage->update_dirty_shaders(); storage->update_dirty_materials(); scene->iteration(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 3ead218226..e0a3dbd36e 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1329,6 +1329,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e int current_blend_mode=-1; int prev_shading=-1; + RID prev_skeleton; state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); //by default unshaded (easier to set) @@ -1338,6 +1339,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e RenderList::Element *e = p_elements[i]; RasterizerStorageGLES3::Material* material= e->material; + RID skeleton = e->instance->skeleton; bool rebind=first; @@ -1466,6 +1468,18 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } + if (prev_skeleton!=skeleton) { + if (prev_skeleton.is_valid() != skeleton.is_valid()) { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,skeleton.is_valid()); + rebind=true; + } + if (skeleton.is_valid()) { + RasterizerStorageGLES3::Skeleton *sk = storage->skeleton_owner.getornull(skeleton); + if (sk->size) { + glBindBufferBase(GL_UNIFORM_BUFFER,7,sk->ubo); + } + } + } if (material!=prev_material || rebind) { @@ -1495,6 +1509,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e prev_base_type=e->instance->base_type; prev_geometry=e->geometry; prev_shading=shading; + prev_skeleton=skeleton; first=false; } @@ -1504,6 +1519,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glFrontFace(GL_CW); glBindVertexArray(0); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); @@ -3469,6 +3485,10 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_REFLECTION_DATA_STRUCTS "+itos(state.max_ubo_reflections)+"\n"); + state.max_skeleton_bones=max_ubo_size/(12*sizeof(float)); + state.scene_shader.add_custom_define("#define MAX_SKELETON_BONES "+itos(state.max_skeleton_bones)+"\n"); + + } GLOBAL_DEF("rendering/gles3/shadow_filter_mode",1); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 81c13bdc08..31253e56b6 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -98,6 +98,7 @@ public: int max_ubo_lights; int max_forward_lights_per_object; int max_ubo_reflections; + int max_skeleton_bones; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 669ab96036..c2598e458f 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2416,12 +2416,15 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P if (! (p_format&(1<size==p_bones && skeleton->use_2d==p_2d_skeleton) + return; + + if (skeleton->ubo) { + glDeleteBuffers(1,&skeleton->ubo); + skeleton->ubo=0; + } + + skeleton->size=p_bones; + if (p_2d_skeleton) { + skeleton->bones.resize(p_bones*8); + for(int i=0;ibones.size();i+=8) { + skeleton->bones[i+0]=1; + skeleton->bones[i+1]=0; + skeleton->bones[i+2]=0; + skeleton->bones[i+3]=0; + skeleton->bones[i+4]=0; + skeleton->bones[i+5]=1; + skeleton->bones[i+6]=0; + skeleton->bones[i+7]=0; + } + + } else { + skeleton->bones.resize(p_bones*12); + for(int i=0;ibones.size();i+=12) { + skeleton->bones[i+0]=1; + skeleton->bones[i+1]=0; + skeleton->bones[i+2]=0; + skeleton->bones[i+3]=0; + skeleton->bones[i+4]=0; + skeleton->bones[i+5]=1; + skeleton->bones[i+6]=0; + skeleton->bones[i+7]=0; + skeleton->bones[i+8]=0; + skeleton->bones[i+9]=0; + skeleton->bones[i+10]=1; + skeleton->bones[i+11]=0; + } + + } + + + + if (p_bones) { + glGenBuffers(1, &skeleton->ubo); + glBindBuffer(GL_UNIFORM_BUFFER, skeleton->ubo); + glBufferData(GL_UNIFORM_BUFFER, skeleton->bones.size()*sizeof(float), NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + } + + if (!skeleton->update_list.in_list()) { + skeleton_update_list.add(&skeleton->update_list); + } + + skeleton->instance_change_notify(); + } int RasterizerStorageGLES3::skeleton_get_bone_count(RID p_skeleton) const{ - return 0; + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + ERR_FAIL_COND_V(!skeleton,0); + + return skeleton->size; } + void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton,int p_bone, const Transform& p_transform){ + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + + ERR_FAIL_COND(!skeleton); + ERR_FAIL_INDEX(p_bone,skeleton->size); + ERR_FAIL_COND(skeleton->use_2d); + + float * bones = skeleton->bones.ptr(); + bones[p_bone*12+ 0]=p_transform.basis.elements[0][0]; + bones[p_bone*12+ 1]=p_transform.basis.elements[0][1]; + bones[p_bone*12+ 2]=p_transform.basis.elements[0][2]; + bones[p_bone*12+ 3]=p_transform.origin.x; + bones[p_bone*12+ 4]=p_transform.basis.elements[1][0]; + bones[p_bone*12+ 5]=p_transform.basis.elements[1][1]; + bones[p_bone*12+ 6]=p_transform.basis.elements[1][2]; + bones[p_bone*12+ 7]=p_transform.origin.y; + bones[p_bone*12+ 8]=p_transform.basis.elements[2][0]; + bones[p_bone*12+ 9]=p_transform.basis.elements[2][1]; + bones[p_bone*12+10]=p_transform.basis.elements[2][2]; + bones[p_bone*12+11]=p_transform.origin.z; + + if (!skeleton->update_list.in_list()) { + skeleton_update_list.add(&skeleton->update_list); + } } + + Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton,int p_bone) const{ - return Transform(); + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + + ERR_FAIL_COND_V(!skeleton,Transform()); + ERR_FAIL_INDEX_V(p_bone,skeleton->size,Transform()); + ERR_FAIL_COND_V(skeleton->use_2d,Transform()); + + float * bones = skeleton->bones.ptr(); + Transform mtx; + mtx.basis.elements[0][0]=bones[p_bone*12+ 0]; + mtx.basis.elements[0][1]=bones[p_bone*12+ 1]; + mtx.basis.elements[0][2]=bones[p_bone*12+ 2]; + mtx.origin.x=bones[p_bone*12+ 3]; + mtx.basis.elements[1][0]=bones[p_bone*12+ 4]; + mtx.basis.elements[1][1]=bones[p_bone*12+ 5]; + mtx.basis.elements[1][2]=bones[p_bone*12+ 6]; + mtx.origin.y=bones[p_bone*12+ 7]; + mtx.basis.elements[2][0]=bones[p_bone*12+ 8]; + mtx.basis.elements[2][1]=bones[p_bone*12+ 9]; + mtx.basis.elements[2][2]=bones[p_bone*12+10]; + mtx.origin.z=bones[p_bone*12+11]; + + return mtx; } void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone, const Matrix32& p_transform){ + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + + ERR_FAIL_COND(!skeleton); + ERR_FAIL_INDEX(p_bone,skeleton->size); + ERR_FAIL_COND(!skeleton->use_2d); + + float * bones = skeleton->bones.ptr(); + bones[p_bone*12+ 0]=p_transform.elements[0][0]; + bones[p_bone*12+ 1]=p_transform.elements[1][0]; + bones[p_bone*12+ 2]=0; + bones[p_bone*12+ 3]=p_transform.elements[2][0]; + bones[p_bone*12+ 4]=p_transform.elements[0][1]; + bones[p_bone*12+ 5]=p_transform.elements[1][1]; + bones[p_bone*12+ 6]=0; + bones[p_bone*12+ 7]=p_transform.elements[2][1]; + + if (!skeleton->update_list.in_list()) { + skeleton_update_list.add(&skeleton->update_list); + } } Matrix32 RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone) const{ - return Matrix32(); + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + + + ERR_FAIL_COND_V(!skeleton,Matrix32()); + ERR_FAIL_INDEX_V(p_bone,skeleton->size,Matrix32()); + ERR_FAIL_COND_V(!skeleton->use_2d,Matrix32()); + + Matrix32 mtx; + + float * bones = skeleton->bones.ptr(); + mtx.elements[0][0]=bones[p_bone*12+ 0]; + mtx.elements[1][0]=bones[p_bone*12+ 1]; + mtx.elements[2][0]=bones[p_bone*12+ 3]; + mtx.elements[0][1]=bones[p_bone*12+ 4]; + mtx.elements[1][1]=bones[p_bone*12+ 5]; + mtx.elements[2][1]=bones[p_bone*12+ 7]; + + return mtx; +} + +void RasterizerStorageGLES3::update_dirty_skeletons() { + + while(skeleton_update_list.first()) { + + Skeleton *skeleton = skeleton_update_list.first()->self(); + if (skeleton->size) { + glBindBuffer(GL_UNIFORM_BUFFER, skeleton->ubo); + glBufferSubData(GL_UNIFORM_BUFFER,0,skeleton->bones.size()*sizeof(float),skeleton->bones.ptr()); + glBindBuffer(GL_UNIFORM_BUFFER, 0); + } + skeleton->instance_change_notify(); + + skeleton_update_list.remove(skeleton_update_list.first()); + } + } /* Light API */ @@ -3795,7 +3966,12 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: ERR_FAIL_COND(!inst); } break; default: { - ERR_FAIL(); + if (skeleton_owner.owns(p_base)) { + inst=skeleton_owner.getornull(p_base); + } + if (!inst) { + ERR_FAIL(); + } } } @@ -3821,7 +3997,12 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce ERR_FAIL_COND(!inst); } break; default: { - ERR_FAIL(); + if (skeleton_owner.owns(p_base)) { + inst=skeleton_owner.getornull(p_base); + } + if (!inst) { + ERR_FAIL(); + } } } @@ -4378,6 +4559,17 @@ bool RasterizerStorageGLES3::free(RID p_rid){ material_owner.free(p_rid); memdelete(material); + } else if (skeleton_owner.owns(p_rid)) { + + // delete the texture + Skeleton *skeleton = skeleton_owner.get(p_rid); + if (skeleton->update_list.in_list()) { + skeleton_update_list.remove(&skeleton->update_list); + } + skeleton_allocate(p_rid,0,false); + skeleton_owner.free(p_rid); + memdelete(skeleton); + } else if (mesh_owner.owns(p_rid)) { // delete the texture diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b433bcd517..b5eacacb4e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -465,6 +465,7 @@ public: struct Attrib { bool enabled; + bool integer; GLuint index; GLint size; GLenum type; @@ -632,6 +633,26 @@ public: /* SKELETON API */ + struct Skeleton : Instantiable { + int size; + bool use_2d; + Vector bones; //4x3 or 4x2 depending on what is needed + GLuint ubo; + SelfList update_list; + + Skeleton() : update_list(this) { + size=0; + use_2d=false; + ubo=0; + } + }; + + mutable RID_Owner skeleton_owner; + + SelfList::List skeleton_update_list; + + void update_dirty_skeletons(); + virtual RID skeleton_create(); virtual void skeleton_allocate(RID p_skeleton,int p_bones,bool p_2d_skeleton=false); virtual int skeleton_get_bone_count(RID p_skeleton) const; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index aa8b3cacdc..f3dade9e50 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -22,17 +22,27 @@ ARRAY_INDEX=8, layout(location=0) in highp vec4 vertex_attrib; layout(location=1) in vec3 normal_attrib; +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) layout(location=2) in vec4 tangent_attrib; +#endif + +#if defined(ENABLE_COLOR_INTERP) layout(location=3) in vec4 color_attrib; +#endif + +#if defined(ENABLE_UV_INTERP) layout(location=4) in vec2 uv_attrib; +#endif + +#if defined(ENABLE_UV2_INTERP) layout(location=5) in vec2 uv2_attrib; +#endif uniform float normal_mult; #ifdef USE_SKELETON -layout(location=6) mediump ivec4 bone_indices; // attrib:6 -layout(location=7) mediump vec4 bone_weights; // attrib:7 -uniform highp sampler2D skeleton_matrices; +layout(location=6) in ivec4 bone_indices; // attrib:6 +layout(location=7) in vec4 bone_weights; // attrib:7 #endif #ifdef USE_ATTRIBUTE_INSTANCING @@ -140,6 +150,15 @@ out highp float dp_clip; #endif +#ifdef USE_SKELETON + +layout(std140) uniform SkeletonData { //ubo:7 + + mat3x4 skeleton[MAX_SKELETON_BONES]; +}; + +#endif + void main() { highp vec4 vertex = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0); @@ -152,23 +171,25 @@ void main() { float binormalf = tangent_attrib.a; #endif + #ifdef USE_SKELETON { //skeleton transform - highp mat4 m=mat4(texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.x*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.x; - m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.y*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.y; - m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.z*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.z; - m+=mat4(texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+0.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+1.0)*skeltex_pixel_size,0.0)),texture2D(skeleton_matrices,vec2((bone_indices.w*3.0+2.0)*skeltex_pixel_size,0.0)),vec4(0.0,0.0,0.0,1.0))*bone_weights.w; + highp mat3x4 m=skeleton[bone_indices.x]*bone_weights.x; + m+=skeleton[bone_indices.y]*bone_weights.y; + m+=skeleton[bone_indices.z]*bone_weights.z; + m+=skeleton[bone_indices.w]*bone_weights.w; - vertex = vertex_in * m; - normal = (vec4(normal,0.0) * m).xyz; + vertex.xyz = vertex * m; + + normal = vec4(normal,0.0) * m; #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) - tangent = (vec4(tangent,0.0) * m).xyz; + tangent.xyz = vec4(tangent.xyz,0.0) * mn; #endif } +#endif // USE_SKELETON1 -#endif #if !defined(SKIP_TRANSFORM_USED) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 953448db52..267a87930a 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1007,12 +1007,26 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } break; case VS::ARRAY_BONES: { - if (p_compress_format&ARRAY_FLAG_USE_16_BIT_BONES) { - elem_size=sizeof(uint32_t); - } else { + DVector bones = p_arrays[VS::ARRAY_BONES]; + int max_bone=0; + + { + int bc = bones.size(); + DVector::Read r=bones.read(); + for(int j=0;j 255) { + p_compress_format|=ARRAY_FLAG_USE_16_BIT_BONES; elem_size=sizeof(uint16_t)*4; + } else { + p_compress_format&=~ARRAY_FLAG_USE_16_BIT_BONES; + elem_size=sizeof(uint32_t); } + } break; case VS::ARRAY_INDEX: { @@ -1043,7 +1057,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } uint32_t mask = (1< Date: Tue, 22 Nov 2016 01:26:56 -0300 Subject: Instancing is working! (hooray) --- drivers/gles3/rasterizer_gles3.cpp | 1 + drivers/gles3/rasterizer_scene_gles3.cpp | 92 ++++ drivers/gles3/rasterizer_storage_gles3.cpp | 540 ++++++++++++++++++++--- drivers/gles3/rasterizer_storage_gles3.h | 42 +- drivers/gles3/shaders/scene.glsl | 26 +- scene/main/viewport.cpp | 16 - scene/resources/multimesh.cpp | 43 +- scene/resources/multimesh.h | 5 - servers/visual/rasterizer.h | 6 +- servers/visual/visual_server_raster.h | 5 +- servers/visual/visual_server_scene.cpp | 84 +++- servers/visual_server.cpp | 2 +- servers/visual_server.h | 6 +- tools/editor/plugins/multimesh_editor_plugin.cpp | 8 +- 14 files changed, 722 insertions(+), 154 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 63090e53a7..84fa349313 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -124,6 +124,7 @@ void RasterizerGLES3::begin_frame(){ storage->frame.time[3]=Math::fmod(time_total,60); storage->frame.count++; + storage->update_dirty_multimeshes(); storage->update_dirty_skeletons(); storage->update_dirty_shaders(); storage->update_dirty_materials(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index e0a3dbd36e..54dc3b914b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1098,6 +1098,55 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { glBindVertexArray(s->array_id); // everything is so easy nowadays } break; + + case VS::INSTANCE_MULTIMESH: { + + RasterizerStorageGLES3::MultiMesh *multi_mesh = static_cast(e->owner); + RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); + glBindVertexArray(s->instancing_array_id); // use the instancing array ID + glBindBuffer(GL_ARRAY_BUFFER,multi_mesh->buffer); //modify the buffer + + int stride = (multi_mesh->xform_floats+multi_mesh->color_floats)*4; + glEnableVertexAttribArray(8); + glVertexAttribPointer(8,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+0); + glVertexAttribDivisorARB(8,1); + glEnableVertexAttribArray(9); + glVertexAttribPointer(9,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+4*4); + glVertexAttribDivisorARB(9,1); + + int color_ofs; + + if (multi_mesh->transform_format==VS::MULTIMESH_TRANSFORM_3D) { + glEnableVertexAttribArray(10); + glVertexAttribPointer(10,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+8*4); + glVertexAttribDivisorARB(10,1); + color_ofs=12*4; + } else { + glDisableVertexAttribArray(10); + glVertexAttrib4f(10,0,0,1,0); + color_ofs=8*4; + } + + switch(multi_mesh->color_format) { + + case VS::MULTIMESH_COLOR_NONE: { + glDisableVertexAttribArray(11); + glVertexAttrib4f(11,1,1,1,1); + } break; + case VS::MULTIMESH_COLOR_8BIT: { + glEnableVertexAttribArray(11); + glVertexAttribPointer(11,4,GL_UNSIGNED_BYTE,GL_TRUE,stride,((uint8_t*)NULL)+color_ofs); + glVertexAttribDivisorARB(11,1); + + } break; + case VS::MULTIMESH_COLOR_FLOAT: { + glEnableVertexAttribArray(11); + glVertexAttribPointer(11,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+color_ofs); + glVertexAttribDivisorARB(11,1); + } break; + } + + } break; } } @@ -1133,6 +1182,25 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } } break; + case VS::INSTANCE_MULTIMESH: { + + RasterizerStorageGLES3::MultiMesh *multi_mesh = static_cast(e->owner); + RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); + + int amount = MAX(multi_mesh->size,multi_mesh->visible_instances); + + if (s->index_array_len>0) { + + glDrawElementsInstancedARB(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0,amount); + + } else { + + glDrawArraysInstancedARB(gl_primitive[s->primitive],0,s->array_len,amount); + + } + + } break; + } } @@ -1481,6 +1549,11 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } } + if ((prev_base_type==VS::INSTANCE_MULTIMESH) != (e->instance->base_type==VS::INSTANCE_MULTIMESH)) { + state.scene_shader.set_conditional(SceneShaderGLES3::USE_INSTANCING,e->instance->base_type==VS::INSTANCE_MULTIMESH); + rebind=true; + } + if (material!=prev_material || rebind) { rebind = _setup_material(material,p_alpha_pass); @@ -1519,6 +1592,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e glFrontFace(GL_CW); glBindVertexArray(0); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_INSTANCING,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_RADIANCE_MAP,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,false); @@ -2414,6 +2488,24 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_ } break; case VS::INSTANCE_MULTIMESH: { + RasterizerStorageGLES3::MultiMesh *multi_mesh = storage->multimesh_owner.getptr(inst->base); + ERR_CONTINUE(!multi_mesh); + + if (multi_mesh->size==0 || multi_mesh->visible_instances==0) + continue; + + RasterizerStorageGLES3::Mesh *mesh = storage->mesh_owner.getptr(multi_mesh->mesh); + if (!mesh) + continue; //mesh not assigned + + int ssize = mesh->surfaces.size(); + + for (int i=0;isurfaces[i]; + _add_geometry(s,inst,multi_mesh,-1,p_shadow); + } + } break; case VS::INSTANCE_IMMEDIATE: { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index c2598e458f..e5a0cded8e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2716,31 +2716,45 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P //generate arrays for faster state switching - glGenVertexArrays(1,&surface->array_id); - glBindVertexArray(surface->array_id); - glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); + for(int i=0;i<2;i++) { - for(int i=0;iarray_id); + glBindVertexArray(surface->array_id); + glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); + } else { + //for instancing draw (can be changed and no one cares) + glGenVertexArrays(1,&surface->instancing_array_id); + glBindVertexArray(surface->instancing_array_id); + glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - if (!attribs[i].enabled) - continue; + } + + + for(int i=0;iindex_id) { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); + } - if (surface->index_id) { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER,0); //unbind + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); } - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER,0); //unbind - } { @@ -3068,14 +3082,14 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ if (mesh->custom_aabb!=AABB()) return mesh->custom_aabb; -/* + Skeleton *sk=NULL; if (p_skeleton.is_valid()) sk=skeleton_owner.get(p_skeleton); -*/ + AABB aabb; - /* - if (sk && sk->bones.size()!=0) { + + if (sk && sk->size!=0) { for (int i=0;isurfaces.size();i++) { @@ -3088,21 +3102,67 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr(); - int sbs = sk->bones.size(); + int sbs = sk->size; ERR_CONTINUE(bs>sbs); - Skeleton::Bone *skb = sk->bones.ptr(); + float *skb = sk->bones.ptr(); + + bool first=true; - for(int j=0;juse_2d) { + for(int j=0;jsurfaces.size();i++) { if (i==0) @@ -3125,9 +3185,9 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh,RID p_skeleton) const{ else aabb.merge_with(mesh->surfaces[i]->aabb); } -/* + } -*/ + return aabb; } @@ -3146,75 +3206,431 @@ void RasterizerStorageGLES3::mesh_clear(RID p_mesh){ RID RasterizerStorageGLES3::multimesh_create(){ - return RID(); + MultiMesh *multimesh = memnew( MultiMesh ); + return multimesh_owner.make_rid(multimesh); } -void RasterizerStorageGLES3::multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb){ +void RasterizerStorageGLES3::multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); + + if (multimesh->size==p_instances && multimesh->transform_format==p_transform_format && multimesh->color_format==p_color_format) + return; + + if (multimesh->buffer) { + glDeleteBuffers(1,&multimesh->buffer); + multimesh->data.resize(0); + } + + multimesh->size=p_instances; + multimesh->transform_format=p_transform_format; + multimesh->color_format=p_color_format; + + if (multimesh->size) { + + if (multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D) { + multimesh->xform_floats=8; + } else { + multimesh->xform_floats=12; + + } + + if (multimesh->color_format==VS::MULTIMESH_COLOR_NONE) { + multimesh->color_floats=0; + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_8BIT) { + multimesh->color_floats=1; + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { + multimesh->color_floats=4; + } + + int format_floats = multimesh->color_floats+multimesh->xform_floats; + multimesh->data.resize(format_floats*p_instances); + for(int i=0;itransform_format==VS::MULTIMESH_TRANSFORM_2D) { + multimesh->data[i+0]=1.0; + multimesh->data[i+1]=0.0; + multimesh->data[i+2]=0.0; + multimesh->data[i+3]=0.0; + multimesh->data[i+4]=0.0; + multimesh->data[i+5]=1.0; + multimesh->data[i+6]=0.0; + multimesh->data[i+7]=0.0; + color_from=8; + } else { + multimesh->data[i+0]=1.0; + multimesh->data[i+1]=0.0; + multimesh->data[i+2]=0.0; + multimesh->data[i+3]=0.0; + multimesh->data[i+4]=0.0; + multimesh->data[i+5]=1.0; + multimesh->data[i+6]=0.0; + multimesh->data[i+7]=0.0; + multimesh->data[i+8]=0.0; + multimesh->data[i+9]=0.0; + multimesh->data[i+10]=1.0; + multimesh->data[i+11]=0.0; + color_from=12; + } + + if (multimesh->color_format==VS::MULTIMESH_COLOR_NONE) { + //none + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_8BIT) { + + union { + uint32_t colu; + float colf; + } cu; + + cu.colu=0xFFFFFFFF; + multimesh->data[i+color_from+0]=cu.colf; + + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { + multimesh->data[i+color_from+0]=1.0; + multimesh->data[i+color_from+1]=1.0; + multimesh->data[i+color_from+2]=1.0; + multimesh->data[i+color_from+3]=1.0; + } + } + + glGenBuffers(1,&multimesh->buffer); + glBindBuffer(GL_ARRAY_BUFFER,multimesh->buffer); + glBufferData(GL_ARRAY_BUFFER,multimesh->data.size()*sizeof(float),NULL,GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); + + } + + multimesh->dirty_data=true; + multimesh->dirty_aabb=true; + + if (!multimesh->update_list.in_list()) { + multimesh_update_list.add(&multimesh->update_list); + } } + int RasterizerStorageGLES3::multimesh_get_instance_count(RID p_multimesh) const{ - return 0; + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,0); + + return multimesh->size; } void RasterizerStorageGLES3::multimesh_set_mesh(RID p_multimesh,RID p_mesh){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); -} -void RasterizerStorageGLES3::multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb){ + multimesh->mesh=p_mesh; + multimesh->dirty_aabb=true; + if (!multimesh->update_list.in_list()) { + multimesh_update_list.add(&multimesh->update_list); + } } -void RasterizerStorageGLES3::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform){ +void RasterizerStorageGLES3::multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); + ERR_FAIL_INDEX(p_index,multimesh->size); + ERR_FAIL_COND(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index]; + + dataptr[ 0]=p_transform.basis.elements[0][0]; + dataptr[ 1]=p_transform.basis.elements[0][1]; + dataptr[ 2]=p_transform.basis.elements[0][2]; + dataptr[ 3]=p_transform.origin.x; + dataptr[ 4]=p_transform.basis.elements[1][0]; + dataptr[ 5]=p_transform.basis.elements[1][1]; + dataptr[ 6]=p_transform.basis.elements[1][2]; + dataptr[ 7]=p_transform.origin.y; + dataptr[ 8]=p_transform.basis.elements[2][0]; + dataptr[ 9]=p_transform.basis.elements[2][1]; + dataptr[10]=p_transform.basis.elements[2][2]; + dataptr[11]=p_transform.origin.z; + + multimesh->dirty_data=true; + multimesh->dirty_aabb=true; + + if (!multimesh->update_list.in_list()) { + multimesh_update_list.add(&multimesh->update_list); + } } + void RasterizerStorageGLES3::multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); + ERR_FAIL_INDEX(p_index,multimesh->size); + ERR_FAIL_COND(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index]; + + dataptr[ 0]=p_transform.elements[0][0]; + dataptr[ 1]=p_transform.elements[1][0]; + dataptr[ 2]=0; + dataptr[ 3]=p_transform.elements[2][0]; + dataptr[ 4]=p_transform.elements[0][1]; + dataptr[ 5]=p_transform.elements[1][1]; + dataptr[ 6]=0; + dataptr[ 7]=p_transform.elements[2][1]; + + multimesh->dirty_data=true; + multimesh->dirty_aabb=true; + if (!multimesh->update_list.in_list()) { + multimesh_update_list.add(&multimesh->update_list); + } } void RasterizerStorageGLES3::multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); + ERR_FAIL_INDEX(p_index,multimesh->size); + ERR_FAIL_COND(multimesh->color_format==VS::MULTIMESH_COLOR_NONE); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index+multimesh->color_floats]; + + if (multimesh->color_format==VS::MULTIMESH_COLOR_8BIT) { + union { + uint32_t colu; + float colf; + } cu; + + cu.colu=p_color.to_32(); + dataptr[ 0]=cu.colf; + + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { + dataptr[ 0]=p_color.r; + dataptr[ 1]=p_color.g; + dataptr[ 2]=p_color.b; + dataptr[ 3]=p_color.a; + } + + + multimesh->dirty_data=true; + multimesh->dirty_aabb=true; + if (!multimesh->update_list.in_list()) { + multimesh_update_list.add(&multimesh->update_list); + } } RID RasterizerStorageGLES3::multimesh_get_mesh(RID p_multimesh) const{ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,RID()); - return RID(); + return multimesh->mesh; } -AABB RasterizerStorageGLES3::multimesh_get_custom_aabb(RID p_multimesh) const{ - return AABB(); -} Transform RasterizerStorageGLES3::multimesh_instance_get_transform(RID p_multimesh,int p_index) const{ - return Transform(); + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,Transform()); + ERR_FAIL_INDEX_V(p_index,multimesh->size,Transform()); + ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D,Transform()); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index]; + + Transform xform; + + xform.basis.elements[0][0]=dataptr[ 0]; + xform.basis.elements[0][1]=dataptr[ 1]; + xform.basis.elements[0][2]=dataptr[ 2]; + xform.origin.x=dataptr[ 3]; + xform.basis.elements[1][0]=dataptr[ 4]; + xform.basis.elements[1][1]=dataptr[ 5]; + xform.basis.elements[1][2]=dataptr[ 6]; + xform.origin.y=dataptr[ 7]; + xform.basis.elements[2][0]=dataptr[ 8]; + xform.basis.elements[2][1]=dataptr[ 9]; + xform.basis.elements[2][2]=dataptr[10]; + xform.origin.z=dataptr[11]; + + return xform; } Matrix32 RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const{ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,Matrix32()); + ERR_FAIL_INDEX_V(p_index,multimesh->size,Matrix32()); + ERR_FAIL_COND_V(multimesh->transform_format==VS::MULTIMESH_TRANSFORM_3D,Matrix32()); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index]; + + Matrix32 xform; + + xform.elements[0][0]=dataptr[ 0]; + xform.elements[1][0]=dataptr[ 1]; + xform.elements[2][0]=dataptr[ 3]; + xform.elements[0][1]=dataptr[ 4]; + xform.elements[1][1]=dataptr[ 5]; + xform.elements[2][1]=dataptr[ 7]; - return Matrix32(); + return xform; } + Color RasterizerStorageGLES3::multimesh_instance_get_color(RID p_multimesh,int p_index) const{ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,Color()); + ERR_FAIL_INDEX_V(p_index,multimesh->size,Color()); + ERR_FAIL_COND_V(multimesh->color_format==VS::MULTIMESH_COLOR_NONE,Color()); + + int stride = multimesh->color_floats+multimesh->xform_floats; + float *dataptr=&multimesh->data[stride*p_index+multimesh->color_floats]; + + if (multimesh->color_format==VS::MULTIMESH_COLOR_8BIT) { + union { + uint32_t colu; + float colf; + } cu; + + return Color::hex(cu.colu); + + } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { + Color c; + c.r=dataptr[ 0]; + c.g=dataptr[ 1]; + c.b=dataptr[ 2]; + c.a=dataptr[ 3]; + + return c; + } + return Color(); + } void RasterizerStorageGLES3::multimesh_set_visible_instances(RID p_multimesh,int p_visible){ + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND(!multimesh); + multimesh->visible_instances=p_visible; } int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) const{ - return 0; + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,-1); + + return multimesh->visible_instances; } -AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_mesh) const{ +AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const{ - return AABB(); + MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); + ERR_FAIL_COND_V(!multimesh,AABB()); + + const_cast(this)->update_dirty_multimeshes(); //update pending AABBs + + return multimesh->aabb; +} + +void RasterizerStorageGLES3::update_dirty_multimeshes() { + + while(multimesh_update_list.first()) { + + MultiMesh *multimesh = multimesh_update_list.first()->self(); + + if (multimesh->size && multimesh->dirty_data) { + + + glBindBuffer(GL_ARRAY_BUFFER,multimesh->buffer); + glBufferSubData(GL_ARRAY_BUFFER,0,multimesh->data.size()*sizeof(float),multimesh->data.ptr()); + glBindBuffer(GL_ARRAY_BUFFER,0); + + + } + + + + if (multimesh->size && multimesh->dirty_aabb) { + + AABB mesh_aabb; + + if (multimesh->mesh.is_valid()) { + mesh_aabb=mesh_get_aabb(multimesh->mesh,RID()); + } else { + mesh_aabb.size+=Vector3(0.001,0.001,0.001); + } + + int stride=multimesh->color_floats+multimesh->xform_floats; + int count = multimesh->data.size(); + float *data=multimesh->data.ptr(); + + AABB aabb; + + if (multimesh->transform_format==VS::MULTIMESH_TRANSFORM_2D) { + + for(int i=0;iaabb=aabb; + } + multimesh->dirty_aabb=false; + multimesh->dirty_data=false; + + multimesh->instance_change_notify(); + + multimesh_update_list.remove(multimesh_update_list.first()); + } } /* IMMEDIATE API */ @@ -3957,6 +4373,10 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: inst = mesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_MULTIMESH: { + inst = multimesh_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_REFLECTION_PROBE: { inst = reflection_probe_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -3988,6 +4408,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_MULTIMESH: { + inst = multimesh_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_REFLECTION_PROBE: { inst = reflection_probe_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -4482,6 +4906,9 @@ VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { return VS::INSTANCE_MESH; } + if (multimesh_owner.owns(p_rid)) { + return VS::INSTANCE_MULTIMESH; + } if (light_owner.owns(p_rid)) { return VS::INSTANCE_LIGHT; } @@ -4580,6 +5007,17 @@ bool RasterizerStorageGLES3::free(RID p_rid){ mesh_owner.free(p_rid); memdelete(mesh); + } else if (multimesh_owner.owns(p_rid)) { + + // delete the texture + MultiMesh *multimesh = multimesh_owner.get(p_rid); + + multimesh_allocate(p_rid,0,VS::MULTIMESH_TRANSFORM_2D,VS::MULTIMESH_COLOR_NONE); //frees multimesh + update_dirty_multimeshes(); + + multimesh_owner.free(p_rid); + memdelete(multimesh); + } else if (light_owner.owns(p_rid)) { // delete the texture diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b5eacacb4e..c6712bd8ea 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -482,6 +482,7 @@ public: uint32_t format; GLuint array_id; + GLuint instancing_array_id; GLuint vertex_id; GLuint index_id; @@ -591,20 +592,53 @@ public: /* MULTIMESH API */ + struct MultiMesh : public GeometryOwner { + RID mesh; + int size; + VS::MultimeshTransformFormat transform_format; + VS::MultimeshColorFormat color_format; + Vector data; + AABB aabb; + SelfList update_list; + GLuint buffer; + int visible_instances; + + int xform_floats; + int color_floats; + + bool dirty_aabb; + bool dirty_data; + + MultiMesh() : update_list(this) { + dirty_aabb=true; + dirty_data=true; + xform_floats=0; + color_floats=0; + visible_instances=-1; + size=0; + buffer=0; + transform_format=VS::MULTIMESH_TRANSFORM_2D; + color_format=VS::MULTIMESH_COLOR_NONE; + } + }; + + mutable RID_Owner multimesh_owner; + + SelfList::List multimesh_update_list; + + void update_dirty_multimeshes(); virtual RID multimesh_create(); - virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb=true); + virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format); virtual int multimesh_get_instance_count(RID p_multimesh) const; virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh); - virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb); virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform); virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform); virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color); virtual RID multimesh_get_mesh(RID p_multimesh) const; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh) const; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const; virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const; @@ -613,7 +647,7 @@ public: virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible); virtual int multimesh_get_visible_instances(RID p_multimesh) const; - virtual AABB multimesh_get_aabb(RID p_mesh) const; + virtual AABB multimesh_get_aabb(RID p_multimesh) const; /* IMMEDIATE API */ diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index f3dade9e50..c198534728 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -45,7 +45,7 @@ layout(location=6) in ivec4 bone_indices; // attrib:6 layout(location=7) in vec4 bone_weights; // attrib:7 #endif -#ifdef USE_ATTRIBUTE_INSTANCING +#ifdef USE_INSTANCING layout(location=8) in highp vec4 instance_xform0; layout(location=9) in highp vec4 instance_xform1; @@ -171,6 +171,10 @@ void main() { float binormalf = tangent_attrib.a; #endif +#if defined(ENABLE_COLOR_INTERP) + color_interp = color_attrib; +#endif + #ifdef USE_SKELETON @@ -191,6 +195,23 @@ void main() { #endif // USE_SKELETON1 +#ifdef USE_INSTANCING + + { + highp mat3x4 m=mat3x4(instance_xform0,instance_xform1,instance_xform2); + + vertex.xyz = vertex * m; + normal = vec4(normal,0.0) * m; +#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) + tangent.xyz = vec4(tangent.xyz,0.0) * mn; +#endif + +#if defined(ENABLE_COLOR_INTERP) + color_interp*=instance_color; +#endif + } +#endif //USE_INSTANCING + #if !defined(SKIP_TRANSFORM_USED) vertex = modelview * vertex; @@ -207,9 +228,6 @@ void main() { -#if defined(ENABLE_COLOR_INTERP) - color_interp = color_attrib; -#endif #if defined(ENABLE_UV_INTERP) uv_interp = uv_attrib; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 0ca72eaa2a..bd5eb0a4e6 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -462,22 +462,6 @@ void Viewport::_notification(int p_what) { VS::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh,point_count); - if (point_count>0) { - AABB aabb; - - Transform t; - for(int i=0;imultimesh_instance_set_transform(contact_3d_debug_multimesh,i,t); - } - aabb.grow(aabb.get_longest_axis_size()*0.01); - VisualServer::get_singleton()->multimesh_set_custom_aabb(contact_3d_debug_multimesh,aabb); - } } diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 0a005d8c54..8515cd28a3 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -174,45 +174,13 @@ Color MultiMesh::get_instance_color(int p_instance) const { } -void MultiMesh::set_aabb(const AABB& p_aabb) { - aabb=p_aabb; - VisualServer::get_singleton()->multimesh_set_custom_aabb(multimesh,p_aabb); - - -} AABB MultiMesh::get_aabb() const { - return aabb; + return VisualServer::get_singleton()->multimesh_get_aabb(multimesh); } -void MultiMesh::generate_aabb() { - - - - ERR_EXPLAIN("Cannot generate AABB if mesh is null."); - ERR_FAIL_COND(mesh.is_null()); - - AABB base_aabb=mesh->get_aabb(); - - aabb=AABB(); - - int instance_count = get_instance_count(); - for(int i=0;imultimesh_create(); color_format=COLOR_NONE; - transform_format=TRANSFORM_NONE; + transform_format=TRANSFORM_2D; } MultiMesh::~MultiMesh() { diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index be4ee38fcd..5e28900c32 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -39,7 +39,6 @@ class MultiMesh : public Resource { public: enum TransformFormat { - TRANSFORM_NONE = VS::MULTIMESH_TRANSFORM_NONE, TRANSFORM_2D = VS::MULTIMESH_TRANSFORM_2D, TRANSFORM_3D = VS::MULTIMESH_TRANSFORM_3D }; @@ -50,7 +49,6 @@ public: COLOR_FLOAT = VS::MULTIMESH_COLOR_FLOAT, }; private: - AABB aabb; Ref mesh; RID multimesh; TransformFormat transform_format; @@ -87,11 +85,8 @@ public: void set_instance_color(int p_instance, const Color& p_color); Color get_instance_color(int p_instance) const; - void set_aabb(const AABB& p_aabb); virtual AABB get_aabb() const; - void generate_aabb(); - virtual RID get_rid() const; MultiMesh(); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 0f70b036a6..08d1995725 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -261,17 +261,15 @@ public: virtual RID multimesh_create()=0; - virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format,bool p_gen_aabb=true)=0; + virtual void multimesh_allocate(RID p_multimesh,int p_instances,VS::MultimeshTransformFormat p_transform_format,VS::MultimeshColorFormat p_color_format)=0; virtual int multimesh_get_instance_count(RID p_multimesh) const=0; virtual void multimesh_set_mesh(RID p_multimesh,RID p_mesh)=0; - virtual void multimesh_set_custom_aabb(RID p_multimesh,const AABB& p_aabb)=0; virtual void multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform& p_transform)=0; virtual void multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Matrix32& p_transform)=0; virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color)=0; virtual RID multimesh_get_mesh(RID p_multimesh) const=0; - virtual AABB multimesh_get_custom_aabb(RID p_multimesh) const=0; virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const=0; virtual Matrix32 multimesh_instance_get_transform_2d(RID p_multimesh,int p_index) const=0; @@ -280,7 +278,7 @@ public: virtual void multimesh_set_visible_instances(RID p_multimesh,int p_visible)=0; virtual int multimesh_get_visible_instances(RID p_multimesh) const=0; - virtual AABB multimesh_get_aabb(RID p_mesh) const=0; + virtual AABB multimesh_get_aabb(RID p_multimesh) const=0; /* IMMEDIATE API */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 4e9110445b..675e2d4aef 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -707,17 +707,16 @@ public: BIND0R(RID,multimesh_create) - BIND5(multimesh_allocate,RID,int,MultimeshTransformFormat,MultimeshColorFormat,bool) + BIND4(multimesh_allocate,RID,int,MultimeshTransformFormat,MultimeshColorFormat) BIND1RC(int,multimesh_get_instance_count,RID) BIND2(multimesh_set_mesh,RID,RID) - BIND2(multimesh_set_custom_aabb,RID,const AABB&) BIND3(multimesh_instance_set_transform,RID,int,const Transform&) BIND3(multimesh_instance_set_transform_2d,RID,int,const Matrix32& ) BIND3(multimesh_instance_set_color,RID,int,const Color&) BIND1RC(RID,multimesh_get_mesh,RID) - BIND1RC(AABB,multimesh_get_custom_aabb,RID) + BIND1RC(AABB,multimesh_get_aabb,RID) BIND2RC(Transform,multimesh_instance_get_transform,RID,int ) BIND2RC(Matrix32,multimesh_instance_get_transform_2d,RID,int) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 74d77c5262..f25e5bc943 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -562,6 +562,11 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ InstanceGeometryData *geom = memnew( InstanceGeometryData ); instance->base_data=geom; } break; + case VS::INSTANCE_MULTIMESH: { + + InstanceGeometryData *geom = memnew( InstanceGeometryData ); + instance->base_data=geom; + } break; case VS::INSTANCE_REFLECTION_PROBE: { InstanceReflectionProbeData *reflection_probe = memnew( InstanceReflectionProbeData ); @@ -764,8 +769,19 @@ void VisualServerScene::instance_attach_skeleton(RID p_instance,RID p_skeleton){ Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); + if (instance->skeleton==p_skeleton) + return; + + if (instance->skeleton.is_valid()) { + VSG::storage->instance_remove_dependency(p_skeleton,instance); + } + instance->skeleton=p_skeleton; + if (instance->skeleton.is_valid()) { + VSG::storage->instance_add_dependency(p_skeleton,instance); + } + _instance_queue_update(instance,true); } @@ -1125,12 +1141,13 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { new_aabb = VSG::storage->mesh_get_aabb(p_instance->base,p_instance->skeleton); } break; -#if 0 + case VisualServer::INSTANCE_MULTIMESH: { - new_aabb = rasterizer->multimesh_get_aabb(p_instance->base); + new_aabb = VSG::storage->multimesh_get_aabb(p_instance->base); } break; +#if 0 case VisualServer::INSTANCE_IMMEDIATE: { new_aabb = rasterizer->immediate_get_aabb(p_instance->base); @@ -2238,39 +2255,64 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { can_cast_shadows=VSG::storage->material_casts_shadows(p_instance->material_override); } else { - RID mesh; - if (p_instance->base_type==VS::INSTANCE_MESH) { - mesh=p_instance->base; - } else if (p_instance->base_type==VS::INSTANCE_MULTIMESH) { - } + if (p_instance->base_type==VS::INSTANCE_MESH) { + RID mesh=p_instance->base; - if (mesh.is_valid()) { + if (mesh.is_valid()) { + bool cast_shadows=false; - bool cast_shadows=false; + for(int i=0;imaterials.size();i++) { - for(int i=0;imaterials.size();i++) { + RID mat = p_instance->materials[i].is_valid()?p_instance->materials[i]:VSG::storage->mesh_surface_get_material(mesh,i); - RID mat = p_instance->materials[i].is_valid()?p_instance->materials[i]:VSG::storage->mesh_surface_get_material(mesh,i); + if (!mat.is_valid()) { + cast_shadows=true; + break; + } - if (!mat.is_valid()) { - cast_shadows=true; - break; + if (VSG::storage->material_casts_shadows(mat)) { + cast_shadows=true; + break; + } } - if (VSG::storage->material_casts_shadows(mat)) { - cast_shadows=true; - break; + if (!cast_shadows) { + can_cast_shadows=false; } } - if (!cast_shadows) { - can_cast_shadows=false; + } else if (p_instance->base_type==VS::INSTANCE_MULTIMESH) { + RID mesh = VSG::storage->multimesh_get_mesh(p_instance->base); + if (mesh.is_valid()) { + bool cast_shadows=false; + + int sc = VSG::storage->mesh_get_surface_count(mesh); + for(int i=0;imesh_surface_get_material(mesh,i); + + if (!mat.is_valid()) { + cast_shadows=true; + break; + } + + if (VSG::storage->material_casts_shadows(mat)) { + cast_shadows=true; + break; + } + } + + if (!cast_shadows) { + can_cast_shadows=false; + } } } + + } if (can_cast_shadows!=geom->can_cast_shadows) { @@ -2335,9 +2377,9 @@ bool VisualServerScene::free(RID p_rid) { instance_set_scenario(p_rid,RID()); instance_set_base(p_rid,RID()); instance_geometry_set_material_override(p_rid,RID()); + instance_attach_skeleton(p_rid,RID()); - if (instance->skeleton.is_valid()) - instance_attach_skeleton(p_rid,RID()); + update_dirty_instances(); //in case something changed this instance_owner.free(p_rid); memdelete(instance); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 267a87930a..30d6b76b8e 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1282,7 +1282,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p for(int j=0;jget_val(); + multimesh->set_transform_format(MultiMesh::TRANSFORM_3D); + multimesh->set_color_format(MultiMesh::COLOR_NONE); multimesh->set_instance_count(instance_count); float _tilt_random = populate_tilt_random->get_val(); @@ -247,10 +249,10 @@ void MultiMeshEditor::_populate() { multimesh->set_instance_transform(i,xform); - multimesh->set_instance_color(i,Color(1,1,1,1)); + } - multimesh->generate_aabb(); + node->set_multimesh(multimesh); @@ -386,6 +388,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale_random->set_min(0); populate_scale_random->set_max(1); populate_scale_random->set_val(0); + populate_scale_random->set_step(0.01); vbc->add_margin_child(TTR("Random Scale:"),populate_scale_random); @@ -393,6 +396,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale->set_min(0.001); populate_scale->set_max(4096); populate_scale->set_val(1); + populate_scale->set_step(0.01); vbc->add_margin_child(TTR("Scale:"),populate_scale); -- cgit v1.2.3 From 9d635f06298f84a59160e8e8cce0187cde6cf74e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 22 Nov 2016 20:51:56 -0300 Subject: Migrated from GLES to GLAD, fixes many issues. --- drivers/gl_context/GL/glew.h | 476 +- drivers/gl_context/GL/glxew.h | 61 +- drivers/gl_context/GL/wglew.h | 36 +- drivers/gl_context/KHR/khrplatform.h | 285 + drivers/gl_context/SCsub | 10 +- drivers/gl_context/glad.c | 1818 ++ drivers/gl_context/glad/glad.h | 3681 ++++ drivers/gl_context/glew.c | 26793 ++++++++++++++++----------- drivers/gles3/rasterizer_canvas_gles3.cpp | 134 +- drivers/gles3/rasterizer_canvas_gles3.h | 3 + drivers/gles3/rasterizer_gles3.cpp | 77 +- drivers/gles3/rasterizer_scene_gles3.cpp | 21 +- drivers/gles3/rasterizer_storage_gles3.cpp | 93 +- drivers/gles3/shader_gles3.cpp | 6 +- platform/x11/context_gl_x11.cpp | 23 +- platform/x11/os_x11.cpp | 2 +- platform/x11/platform_config.h | 3 +- 17 files changed, 22555 insertions(+), 10967 deletions(-) create mode 100644 drivers/gl_context/KHR/khrplatform.h create mode 100644 drivers/gl_context/glad.c create mode 100644 drivers/gl_context/glad/glad.h diff --git a/drivers/gl_context/GL/glew.h b/drivers/gl_context/GL/glew.h index 702265c38b..fae0c216a9 100644 --- a/drivers/gl_context/GL/glew.h +++ b/drivers/gl_context/GL/glew.h @@ -263,6 +263,9 @@ typedef _W64 int ptrdiff_t; #define GLEWAPIENTRY #endif +#define GLEW_VAR_EXPORT GLEWAPI +#define GLEW_FUN_EXPORT GLEWAPI + #ifdef __cplusplus extern "C" { #endif @@ -2819,6 +2822,15 @@ typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint i #endif /* GL_AMD_shader_atomic_counter_ops */ +/* ---------------- GL_AMD_shader_explicit_vertex_parameter ---------------- */ + +#ifndef GL_AMD_shader_explicit_vertex_parameter +#define GL_AMD_shader_explicit_vertex_parameter 1 + +#define GLEW_AMD_shader_explicit_vertex_parameter GLEW_GET_VAR(__GLEW_AMD_shader_explicit_vertex_parameter) + +#endif /* GL_AMD_shader_explicit_vertex_parameter */ + /* ---------------------- GL_AMD_shader_stencil_export --------------------- */ #ifndef GL_AMD_shader_stencil_export @@ -4023,8 +4035,8 @@ typedef void (GLAPIENTRY * PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffe 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 * PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, 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); @@ -4663,6 +4675,22 @@ typedef void (GLAPIENTRY * PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint l #endif /* GL_ARB_get_texture_sub_image */ +/* ---------------------------- GL_ARB_gl_spirv ---------------------------- */ + +#ifndef GL_ARB_gl_spirv +#define GL_ARB_gl_spirv 1 + +#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551 +#define GL_SPIR_V_BINARY_ARB 0x9552 + +typedef void (GLAPIENTRY * PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar* pEntryPoint, GLuint numSpecializationConstants, const GLuint* pConstantIndex, const GLuint* pConstantValue); + +#define glSpecializeShaderARB GLEW_GET_FUN(__glewSpecializeShaderARB) + +#define GLEW_ARB_gl_spirv GLEW_GET_VAR(__GLEW_ARB_gl_spirv) + +#endif /* GL_ARB_gl_spirv */ + /* --------------------------- GL_ARB_gpu_shader5 -------------------------- */ #ifndef GL_ARB_gpu_shader5 @@ -6600,7 +6628,7 @@ typedef void (GLAPIENTRY * PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, G #define GL_TIMEOUT_EXPIRED 0x911B #define GL_CONDITION_SATISFIED 0x911C #define GL_WAIT_FAILED 0x911D -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull typedef GLenum (GLAPIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync GLsync,GLbitfield flags,GLuint64 timeout); typedef void (GLAPIENTRY * PFNGLDELETESYNCPROC) (GLsync GLsync); @@ -7363,7 +7391,7 @@ typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); #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 +#define GL_INVALID_INDEX 0xFFFFFFFFu typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); @@ -8620,6 +8648,18 @@ typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GL #endif /* GL_ATI_vertex_streams */ +/* ---------------- GL_EGL_NV_robustness_video_memory_purge ---------------- */ + +#ifndef GL_EGL_NV_robustness_video_memory_purge +#define GL_EGL_NV_robustness_video_memory_purge 1 + +#define GL_EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C +#define GL_PURGED_CONTEXT_RESET_NV 0x92BB + +#define GLEW_EGL_NV_robustness_video_memory_purge GLEW_GET_VAR(__GLEW_EGL_NV_robustness_video_memory_purge) + +#endif /* GL_EGL_NV_robustness_video_memory_purge */ + /* --------------------------- GL_EXT_422_pixels --------------------------- */ #ifndef GL_EXT_422_pixels @@ -11597,6 +11637,26 @@ typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight); #endif /* GL_EXT_vertex_weighting */ +/* ------------------------ GL_EXT_window_rectangles ----------------------- */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 + +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 + +typedef void (GLAPIENTRY * PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint box[]); + +#define glWindowRectanglesEXT GLEW_GET_FUN(__glewWindowRectanglesEXT) + +#define GLEW_EXT_window_rectangles GLEW_GET_VAR(__GLEW_EXT_window_rectangles) + +#endif /* GL_EXT_window_rectangles */ + /* ------------------------- GL_EXT_x11_sync_object ------------------------ */ #ifndef GL_EXT_x11_sync_object @@ -11821,6 +11881,17 @@ typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum ty #endif /* GL_INGR_interlace_read */ +/* ------------------ GL_INTEL_conservative_rasterization ------------------ */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 + +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE + +#define GLEW_INTEL_conservative_rasterization GLEW_GET_VAR(__GLEW_INTEL_conservative_rasterization) + +#endif /* GL_INTEL_conservative_rasterization */ + /* ------------------- GL_INTEL_fragment_shader_ordering ------------------- */ #ifndef GL_INTEL_fragment_shader_ordering @@ -12202,6 +12273,15 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #endif /* GL_KHR_texture_compression_astc_ldr */ +/* --------------- GL_KHR_texture_compression_astc_sliced_3d --------------- */ + +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 + +#define GLEW_KHR_texture_compression_astc_sliced_3d GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_sliced_3d) + +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + /* -------------------------- GL_KTX_buffer_region ------------------------- */ #ifndef GL_KTX_buffer_region @@ -12268,6 +12348,15 @@ typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); #endif /* GL_MESA_resize_buffers */ +/* -------------------- GL_MESA_shader_integer_functions ------------------- */ + +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 + +#define GLEW_MESA_shader_integer_functions GLEW_GET_VAR(__GLEW_MESA_shader_integer_functions) + +#endif /* GL_MESA_shader_integer_functions */ + /* --------------------------- GL_MESA_window_pos -------------------------- */ #ifndef GL_MESA_window_pos @@ -12340,6 +12429,15 @@ typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p); #endif /* GL_MESA_ycbcr_texture */ +/* ----------- GL_NVX_blend_equation_advanced_multi_draw_buffers ----------- */ + +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 + +#define GLEW_NVX_blend_equation_advanced_multi_draw_buffers GLEW_GET_VAR(__GLEW_NVX_blend_equation_advanced_multi_draw_buffers) + +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + /* ----------------------- GL_NVX_conditional_render ----------------------- */ #ifndef GL_NVX_conditional_render @@ -12370,6 +12468,26 @@ typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVXPROC) (void); #endif /* GL_NVX_gpu_memory_info */ +/* ---------------------- GL_NVX_linked_gpu_multicast ---------------------- */ + +#ifndef GL_NVX_linked_gpu_multicast +#define GL_NVX_linked_gpu_multicast 1 + +#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800 +#define GL_MAX_LGPU_GPUS_NVX 0x92BA + +typedef void (GLAPIENTRY * PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GLAPIENTRY * PFNGLLGPUINTERLOCKNVXPROC) (void); +typedef void (GLAPIENTRY * PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); + +#define glLGPUCopyImageSubDataNVX GLEW_GET_FUN(__glewLGPUCopyImageSubDataNVX) +#define glLGPUInterlockNVX GLEW_GET_FUN(__glewLGPUInterlockNVX) +#define glLGPUNamedBufferSubDataNVX GLEW_GET_FUN(__glewLGPUNamedBufferSubDataNVX) + +#define GLEW_NVX_linked_gpu_multicast GLEW_GET_VAR(__GLEW_NVX_linked_gpu_multicast) + +#endif /* GL_NVX_linked_gpu_multicast */ + /* ------------------- GL_NV_bindless_multi_draw_indirect ------------------ */ #ifndef GL_NV_bindless_multi_draw_indirect @@ -12521,6 +12639,88 @@ typedef void (GLAPIENTRY * PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint valu #endif /* GL_NV_blend_square */ +/* ----------------------- GL_NV_clip_space_w_scaling ---------------------- */ + +#ifndef GL_NV_clip_space_w_scaling +#define GL_NV_clip_space_w_scaling 1 + +#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C +#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D +#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E + +typedef void (GLAPIENTRY * PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff); + +#define glViewportPositionWScaleNV GLEW_GET_FUN(__glewViewportPositionWScaleNV) + +#define GLEW_NV_clip_space_w_scaling GLEW_GET_VAR(__GLEW_NV_clip_space_w_scaling) + +#endif /* GL_NV_clip_space_w_scaling */ + +/* --------------------------- GL_NV_command_list -------------------------- */ + +#ifndef GL_NV_command_list +#define GL_NV_command_list 1 + +#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 +#define GL_NOP_COMMAND_NV 0x0001 +#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 +#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 +#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 +#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 +#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 +#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 +#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 +#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 +#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000a +#define GL_BLEND_COLOR_COMMAND_NV 0x000b +#define GL_STENCIL_REF_COMMAND_NV 0x000c +#define GL_LINE_WIDTH_COMMAND_NV 0x000d +#define GL_POLYGON_OFFSET_COMMAND_NV 0x000e +#define GL_ALPHA_REF_COMMAND_NV 0x000f +#define GL_VIEWPORT_COMMAND_NV 0x0010 +#define GL_SCISSOR_COMMAND_NV 0x0011 +#define GL_FRONT_FACE_COMMAND_NV 0x0012 + +typedef void (GLAPIENTRY * PFNGLCALLCOMMANDLISTNVPROC) (GLuint list); +typedef void (GLAPIENTRY * PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments); +typedef void (GLAPIENTRY * PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list); +typedef void (GLAPIENTRY * PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint* lists); +typedef void (GLAPIENTRY * PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint* states); +typedef void (GLAPIENTRY * PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint* lists); +typedef void (GLAPIENTRY * PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint* states); +typedef void (GLAPIENTRY * PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64* indirects, const GLsizei* sizes, GLuint count); +typedef void (GLAPIENTRY * PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr* indirects, const GLsizei* sizes, GLuint count); +typedef void (GLAPIENTRY * PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64* indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count); +typedef void (GLAPIENTRY * PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr* indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count); +typedef GLuint (GLAPIENTRY * PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size); +typedef GLushort (GLAPIENTRY * PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype); +typedef GLboolean (GLAPIENTRY * PFNGLISCOMMANDLISTNVPROC) (GLuint list); +typedef GLboolean (GLAPIENTRY * PFNGLISSTATENVPROC) (GLuint state); +typedef void (GLAPIENTRY * PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void** indirects, const GLsizei* sizes, const GLuint* states, const GLuint* fbos, GLuint count); +typedef void (GLAPIENTRY * PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); + +#define glCallCommandListNV GLEW_GET_FUN(__glewCallCommandListNV) +#define glCommandListSegmentsNV GLEW_GET_FUN(__glewCommandListSegmentsNV) +#define glCompileCommandListNV GLEW_GET_FUN(__glewCompileCommandListNV) +#define glCreateCommandListsNV GLEW_GET_FUN(__glewCreateCommandListsNV) +#define glCreateStatesNV GLEW_GET_FUN(__glewCreateStatesNV) +#define glDeleteCommandListsNV GLEW_GET_FUN(__glewDeleteCommandListsNV) +#define glDeleteStatesNV GLEW_GET_FUN(__glewDeleteStatesNV) +#define glDrawCommandsAddressNV GLEW_GET_FUN(__glewDrawCommandsAddressNV) +#define glDrawCommandsNV GLEW_GET_FUN(__glewDrawCommandsNV) +#define glDrawCommandsStatesAddressNV GLEW_GET_FUN(__glewDrawCommandsStatesAddressNV) +#define glDrawCommandsStatesNV GLEW_GET_FUN(__glewDrawCommandsStatesNV) +#define glGetCommandHeaderNV GLEW_GET_FUN(__glewGetCommandHeaderNV) +#define glGetStageIndexNV GLEW_GET_FUN(__glewGetStageIndexNV) +#define glIsCommandListNV GLEW_GET_FUN(__glewIsCommandListNV) +#define glIsStateNV GLEW_GET_FUN(__glewIsStateNV) +#define glListDrawCommandsStatesClientNV GLEW_GET_FUN(__glewListDrawCommandsStatesClientNV) +#define glStateCaptureNV GLEW_GET_FUN(__glewStateCaptureNV) + +#define GLEW_NV_command_list GLEW_GET_VAR(__GLEW_NV_command_list) + +#endif /* GL_NV_command_list */ + /* ------------------------- GL_NV_compute_program5 ------------------------ */ #ifndef GL_NV_compute_program5 @@ -12588,6 +12788,23 @@ typedef void (GLAPIENTRY * PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pnam #endif /* GL_NV_conservative_raster_dilate */ +/* -------------- GL_NV_conservative_raster_pre_snap_triangles ------------- */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 + +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F + +typedef void (GLAPIENTRY * PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); + +#define glConservativeRasterParameteriNV GLEW_GET_FUN(__glewConservativeRasterParameteriNV) + +#define GLEW_NV_conservative_raster_pre_snap_triangles GLEW_GET_VAR(__GLEW_NV_conservative_raster_pre_snap_triangles) + +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + /* ----------------------- GL_NV_copy_depth_to_color ----------------------- */ #ifndef GL_NV_copy_depth_to_color @@ -12686,6 +12903,29 @@ typedef void (GLAPIENTRY * PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampl #endif /* GL_NV_draw_texture */ +/* ------------------------ GL_NV_draw_vulkan_image ------------------------ */ + +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 + +typedef void (APIENTRY *GLVULKANPROCNV)(void); + +typedef void (GLAPIENTRY * PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (GLAPIENTRY * PFNGLGETVKPROCADDRNVPROC) (const GLchar* name); +typedef void (GLAPIENTRY * PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +typedef void (GLAPIENTRY * PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GLAPIENTRY * PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); + +#define glDrawVkImageNV GLEW_GET_FUN(__glewDrawVkImageNV) +#define glGetVkProcAddrNV GLEW_GET_FUN(__glewGetVkProcAddrNV) +#define glSignalVkFenceNV GLEW_GET_FUN(__glewSignalVkFenceNV) +#define glSignalVkSemaphoreNV GLEW_GET_FUN(__glewSignalVkSemaphoreNV) +#define glWaitVkSemaphoreNV GLEW_GET_FUN(__glewWaitVkSemaphoreNV) + +#define GLEW_NV_draw_vulkan_image GLEW_GET_VAR(__GLEW_NV_draw_vulkan_image) + +#endif /* GL_NV_draw_vulkan_image */ + /* ---------------------------- GL_NV_evaluators --------------------------- */ #ifndef GL_NV_evaluators @@ -13011,6 +13251,47 @@ typedef void (GLAPIENTRY * PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint #endif /* GL_NV_geometry_shader_passthrough */ +/* -------------------------- GL_NV_gpu_multicast -------------------------- */ + +#ifndef GL_NV_gpu_multicast +#define GL_NV_gpu_multicast 1 + +#define GL_PER_GPU_STORAGE_BIT_NV 0x0800 +#define GL_MULTICAST_GPUS_NV 0x92BA +#define GL_PER_GPU_STORAGE_NV 0x9548 +#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549 +#define GL_RENDER_GPU_MASK_NV 0x9558 + +typedef void (GLAPIENTRY * PFNGLMULTICASTBARRIERNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (GLAPIENTRY * PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (GLAPIENTRY * PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (GLAPIENTRY * PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (GLAPIENTRY * PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64* params); +typedef void (GLAPIENTRY * PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64* params); +typedef void (GLAPIENTRY * PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask); +typedef void (GLAPIENTRY * PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask); + +#define glMulticastBarrierNV GLEW_GET_FUN(__glewMulticastBarrierNV) +#define glMulticastBlitFramebufferNV GLEW_GET_FUN(__glewMulticastBlitFramebufferNV) +#define glMulticastBufferSubDataNV GLEW_GET_FUN(__glewMulticastBufferSubDataNV) +#define glMulticastCopyBufferSubDataNV GLEW_GET_FUN(__glewMulticastCopyBufferSubDataNV) +#define glMulticastCopyImageSubDataNV GLEW_GET_FUN(__glewMulticastCopyImageSubDataNV) +#define glMulticastFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewMulticastFramebufferSampleLocationsfvNV) +#define glMulticastGetQueryObjecti64vNV GLEW_GET_FUN(__glewMulticastGetQueryObjecti64vNV) +#define glMulticastGetQueryObjectivNV GLEW_GET_FUN(__glewMulticastGetQueryObjectivNV) +#define glMulticastGetQueryObjectui64vNV GLEW_GET_FUN(__glewMulticastGetQueryObjectui64vNV) +#define glMulticastGetQueryObjectuivNV GLEW_GET_FUN(__glewMulticastGetQueryObjectuivNV) +#define glMulticastWaitSyncNV GLEW_GET_FUN(__glewMulticastWaitSyncNV) +#define glRenderGpuMaskNV GLEW_GET_FUN(__glewRenderGpuMaskNV) + +#define GLEW_NV_gpu_multicast GLEW_GET_VAR(__GLEW_NV_gpu_multicast) + +#endif /* GL_NV_gpu_multicast */ + /* --------------------------- GL_NV_gpu_program4 -------------------------- */ #ifndef GL_NV_gpu_program4 @@ -13925,6 +14206,18 @@ typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage #endif /* GL_NV_register_combiners2 */ +/* ------------------ GL_NV_robustness_video_memory_purge ------------------ */ + +#ifndef GL_NV_robustness_video_memory_purge +#define GL_NV_robustness_video_memory_purge 1 + +#define GL_EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C +#define GL_PURGED_CONTEXT_RESET_NV 0x92BB + +#define GLEW_NV_robustness_video_memory_purge GLEW_GET_VAR(__GLEW_NV_robustness_video_memory_purge) + +#endif /* GL_NV_robustness_video_memory_purge */ + /* ------------------------- GL_NV_sample_locations ------------------------ */ #ifndef GL_NV_sample_locations @@ -13976,6 +14269,15 @@ typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint #endif /* GL_NV_shader_atomic_float */ +/* ---------------------- GL_NV_shader_atomic_float64 ---------------------- */ + +#ifndef GL_NV_shader_atomic_float64 +#define GL_NV_shader_atomic_float64 1 + +#define GLEW_NV_shader_atomic_float64 GLEW_GET_VAR(__GLEW_NV_shader_atomic_float64) + +#endif /* GL_NV_shader_atomic_float64 */ + /* -------------------- GL_NV_shader_atomic_fp16_vector -------------------- */ #ifndef GL_NV_shader_atomic_fp16_vector @@ -14066,6 +14368,15 @@ typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei cou #endif /* GL_NV_shader_thread_shuffle */ +/* ---------------------- GL_NV_stereo_view_rendering ---------------------- */ + +#ifndef GL_NV_stereo_view_rendering +#define GL_NV_stereo_view_rendering 1 + +#define GLEW_NV_stereo_view_rendering GLEW_GET_VAR(__GLEW_NV_stereo_view_rendering) + +#endif /* GL_NV_stereo_view_rendering */ + /* ---------------------- GL_NV_tessellation_program5 ---------------------- */ #ifndef GL_NV_tessellation_program5 @@ -14976,6 +15287,32 @@ typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint vid #endif /* GL_NV_viewport_array2 */ +/* ------------------------- GL_NV_viewport_swizzle ------------------------ */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 + +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B + +typedef void (GLAPIENTRY * PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); + +#define glViewportSwizzleNV GLEW_GET_FUN(__glewViewportSwizzleNV) + +#define GLEW_NV_viewport_swizzle GLEW_GET_VAR(__GLEW_NV_viewport_swizzle) + +#endif /* GL_NV_viewport_swizzle */ + /* ------------------------ GL_OES_byte_coordinates ------------------------ */ #ifndef GL_OES_byte_coordinates @@ -15733,10 +16070,6 @@ typedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); #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) @@ -16406,22 +16739,7 @@ typedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsiz /* ------------------------------------------------------------------------- */ -#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; @@ -17047,6 +17365,8 @@ GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri; GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage; GLEW_FUN_EXPORT PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage; +GLEW_FUN_EXPORT PFNGLSPECIALIZESHADERARBPROC __glewSpecializeShaderARB; + GLEW_FUN_EXPORT PFNGLGETUNIFORMDVPROC __glewGetUniformdv; GLEW_FUN_EXPORT PFNGLUNIFORM1DPROC __glewUniform1d; GLEW_FUN_EXPORT PFNGLUNIFORM1DVPROC __glewUniform1dv; @@ -18323,6 +18643,8 @@ GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT; +GLEW_FUN_EXPORT PFNGLWINDOWRECTANGLESEXTPROC __glewWindowRectanglesEXT; + GLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT; GLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY; @@ -18425,6 +18747,10 @@ GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA; GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX; GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX; +GLEW_FUN_EXPORT PFNGLLGPUCOPYIMAGESUBDATANVXPROC __glewLGPUCopyImageSubDataNVX; +GLEW_FUN_EXPORT PFNGLLGPUINTERLOCKNVXPROC __glewLGPUInterlockNVX; +GLEW_FUN_EXPORT PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC __glewLGPUNamedBufferSubDataNVX; + GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV; @@ -18448,6 +18774,26 @@ GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV; GLEW_FUN_EXPORT PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV; GLEW_FUN_EXPORT PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV; +GLEW_FUN_EXPORT PFNGLVIEWPORTPOSITIONWSCALENVPROC __glewViewportPositionWScaleNV; + +GLEW_FUN_EXPORT PFNGLCALLCOMMANDLISTNVPROC __glewCallCommandListNV; +GLEW_FUN_EXPORT PFNGLCOMMANDLISTSEGMENTSNVPROC __glewCommandListSegmentsNV; +GLEW_FUN_EXPORT PFNGLCOMPILECOMMANDLISTNVPROC __glewCompileCommandListNV; +GLEW_FUN_EXPORT PFNGLCREATECOMMANDLISTSNVPROC __glewCreateCommandListsNV; +GLEW_FUN_EXPORT PFNGLCREATESTATESNVPROC __glewCreateStatesNV; +GLEW_FUN_EXPORT PFNGLDELETECOMMANDLISTSNVPROC __glewDeleteCommandListsNV; +GLEW_FUN_EXPORT PFNGLDELETESTATESNVPROC __glewDeleteStatesNV; +GLEW_FUN_EXPORT PFNGLDRAWCOMMANDSADDRESSNVPROC __glewDrawCommandsAddressNV; +GLEW_FUN_EXPORT PFNGLDRAWCOMMANDSNVPROC __glewDrawCommandsNV; +GLEW_FUN_EXPORT PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC __glewDrawCommandsStatesAddressNV; +GLEW_FUN_EXPORT PFNGLDRAWCOMMANDSSTATESNVPROC __glewDrawCommandsStatesNV; +GLEW_FUN_EXPORT PFNGLGETCOMMANDHEADERNVPROC __glewGetCommandHeaderNV; +GLEW_FUN_EXPORT PFNGLGETSTAGEINDEXNVPROC __glewGetStageIndexNV; +GLEW_FUN_EXPORT PFNGLISCOMMANDLISTNVPROC __glewIsCommandListNV; +GLEW_FUN_EXPORT PFNGLISSTATENVPROC __glewIsStateNV; +GLEW_FUN_EXPORT PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC __glewListDrawCommandsStatesClientNV; +GLEW_FUN_EXPORT PFNGLSTATECAPTURENVPROC __glewStateCaptureNV; + GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV; GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV; @@ -18455,6 +18801,8 @@ GLEW_FUN_EXPORT PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV; GLEW_FUN_EXPORT PFNGLCONSERVATIVERASTERPARAMETERFNVPROC __glewConservativeRasterParameterfNV; +GLEW_FUN_EXPORT PFNGLCONSERVATIVERASTERPARAMETERINVPROC __glewConservativeRasterParameteriNV; + GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV; GLEW_FUN_EXPORT PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV; @@ -18463,6 +18811,12 @@ GLEW_FUN_EXPORT PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV; GLEW_FUN_EXPORT PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV; +GLEW_FUN_EXPORT PFNGLDRAWVKIMAGENVPROC __glewDrawVkImageNV; +GLEW_FUN_EXPORT PFNGLGETVKPROCADDRNVPROC __glewGetVkProcAddrNV; +GLEW_FUN_EXPORT PFNGLSIGNALVKFENCENVPROC __glewSignalVkFenceNV; +GLEW_FUN_EXPORT PFNGLSIGNALVKSEMAPHORENVPROC __glewSignalVkSemaphoreNV; +GLEW_FUN_EXPORT PFNGLWAITVKSEMAPHORENVPROC __glewWaitVkSemaphoreNV; + GLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV; GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV; GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV; @@ -18498,6 +18852,19 @@ GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbu GLEW_FUN_EXPORT PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV; +GLEW_FUN_EXPORT PFNGLMULTICASTBARRIERNVPROC __glewMulticastBarrierNV; +GLEW_FUN_EXPORT PFNGLMULTICASTBLITFRAMEBUFFERNVPROC __glewMulticastBlitFramebufferNV; +GLEW_FUN_EXPORT PFNGLMULTICASTBUFFERSUBDATANVPROC __glewMulticastBufferSubDataNV; +GLEW_FUN_EXPORT PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC __glewMulticastCopyBufferSubDataNV; +GLEW_FUN_EXPORT PFNGLMULTICASTCOPYIMAGESUBDATANVPROC __glewMulticastCopyImageSubDataNV; +GLEW_FUN_EXPORT PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewMulticastFramebufferSampleLocationsfvNV; +GLEW_FUN_EXPORT PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC __glewMulticastGetQueryObjecti64vNV; +GLEW_FUN_EXPORT PFNGLMULTICASTGETQUERYOBJECTIVNVPROC __glewMulticastGetQueryObjectivNV; +GLEW_FUN_EXPORT PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC __glewMulticastGetQueryObjectui64vNV; +GLEW_FUN_EXPORT PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC __glewMulticastGetQueryObjectuivNV; +GLEW_FUN_EXPORT PFNGLMULTICASTWAITSYNCNVPROC __glewMulticastWaitSyncNV; +GLEW_FUN_EXPORT PFNGLRENDERGPUMASKNVPROC __glewRenderGpuMaskNV; + GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV; @@ -18876,6 +19243,8 @@ GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStrea GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV; GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV; +GLEW_FUN_EXPORT PFNGLVIEWPORTSWIZZLENVPROC __glewViewportSwizzleNV; + GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES; GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES; GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES; @@ -19071,12 +19440,6 @@ 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 */ - 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; @@ -19115,6 +19478,7 @@ 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_explicit_vertex_parameter; 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; @@ -19204,6 +19568,7 @@ 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_gl_spirv; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader5; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_fp64; GLEW_VAR_EXPORT GLboolean __GLEW_ARB_gpu_shader_int64; @@ -19344,6 +19709,7 @@ 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_EGL_NV_robustness_video_memory_purge; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr; @@ -19451,6 +19817,7 @@ 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_window_rectangles; 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; @@ -19466,6 +19833,7 @@ 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_conservative_rasterization; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_fragment_shader_ordering; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_framebuffer_CMAA; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_map_texture; @@ -19481,24 +19849,31 @@ 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_KHR_texture_compression_astc_sliced_3d; 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_shader_integer_functions; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_blend_equation_advanced_multi_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_conditional_render; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_linked_gpu_multicast; 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_clip_space_w_scaling; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_command_list; 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_conservative_raster_dilate; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_pre_snap_triangles; 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; @@ -19506,6 +19881,7 @@ 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_draw_vulkan_image; GLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators; GLEW_VAR_EXPORT GLboolean __GLEW_NV_explicit_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fence; @@ -19523,6 +19899,7 @@ 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_multicast; 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; @@ -19545,16 +19922,19 @@ 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_robustness_video_memory_purge; 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_float64; 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_stereo_view_rendering; GLEW_VAR_EXPORT GLboolean __GLEW_NV_tessellation_program5; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection; @@ -19583,6 +19963,7 @@ 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_NV_viewport_array2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_viewport_swizzle; 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; @@ -19663,11 +20044,6 @@ 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 */ @@ -19688,40 +20064,24 @@ GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; /* GLEW version info */ /* -VERSION 1.13.0 -VERSION_MAJOR 1 -VERSION_MINOR 13 +VERSION 2.0.0 +VERSION_MAJOR 2 +VERSION_MINOR 0 VERSION_MICRO 0 */ /* 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) +#ifndef GLEW_GET_VAR #define GLEW_GET_VAR(x) (*(const GLboolean*)&x) -#define GLEW_GET_FUN(x) x +#endif -#endif /* GLEW_MX */ +#ifndef GLEW_GET_FUN +#define GLEW_GET_FUN(x) x +#endif GLEWAPI GLboolean glewExperimental; GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name); diff --git a/drivers/gl_context/GL/glxew.h b/drivers/gl_context/GL/glxew.h index d803d260b3..1e2596d662 100644 --- a/drivers/gl_context/GL/glxew.h +++ b/drivers/gl_context/GL/glxew.h @@ -670,6 +670,17 @@ typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context #endif /* GLX_EXT_import_context */ +/* ---------------------------- GLX_EXT_libglvnd --------------------------- */ + +#ifndef GLX_EXT_libglvnd +#define GLX_EXT_libglvnd 1 + +#define GLX_VENDOR_NAMES_EXT 0x20F6 + +#define GLXEW_EXT_libglvnd GLXEW_GET_VAR(__GLXEW_EXT_libglvnd) + +#endif /* GLX_EXT_libglvnd */ + /* -------------------------- GLX_EXT_scene_marker ------------------------- */ #ifndef GLX_EXT_scene_marker @@ -1015,6 +1026,17 @@ typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int #endif /* GLX_NV_present_video */ +/* ------------------ GLX_NV_robustness_video_memory_purge ----------------- */ + +#ifndef GLX_NV_robustness_video_memory_purge +#define GLX_NV_robustness_video_memory_purge 1 + +#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 + +#define GLXEW_NV_robustness_video_memory_purge GLXEW_GET_VAR(__GLXEW_NV_robustness_video_memory_purge) + +#endif /* GLX_NV_robustness_video_memory_purge */ + /* --------------------------- GLX_NV_swap_group --------------------------- */ #ifndef GLX_NV_swap_group @@ -1500,13 +1522,8 @@ typedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, /* ------------------------------------------------------------------------- */ -#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; @@ -1658,12 +1675,6 @@ GLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN; GLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN; GLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN; - -#if defined(GLEW_MX) -struct GLXEWContextStruct -{ -#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; @@ -1690,6 +1701,7 @@ 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_libglvnd; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_stereo_tree; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control; @@ -1711,6 +1723,7 @@ 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_robustness_video_memory_purge; 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; @@ -1734,34 +1747,18 @@ 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 */ - GLEWAPI GLenum GLEWAPIENTRY glxewInit (); GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name); +#ifndef GLXEW_GET_VAR #define GLXEW_GET_VAR(x) (*(const GLboolean*)&x) -#define GLXEW_GET_FUN(x) x +#endif -#endif /* GLEW_MX */ +#ifndef GLXEW_GET_FUN +#define GLXEW_GET_FUN(x) x +#endif GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); diff --git a/drivers/gl_context/GL/wglew.h b/drivers/gl_context/GL/wglew.h index 23e4d3fbab..71ee0f3013 100644 --- a/drivers/gl_context/GL/wglew.h +++ b/drivers/gl_context/GL/wglew.h @@ -1197,18 +1197,8 @@ typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT6 /* ------------------------------------------------------------------------- */ -#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; @@ -1413,34 +1403,18 @@ 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 */ - GLEWAPI GLenum GLEWAPIENTRY wglewInit (); GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name); +#ifndef WGLEW_GET_VAR #define WGLEW_GET_VAR(x) (*(const GLboolean*)&x) -#define WGLEW_GET_FUN(x) x +#endif -#endif /* GLEW_MX */ +#ifndef WGLEW_GET_FUN +#define WGLEW_GET_FUN(x) x +#endif GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); diff --git a/drivers/gl_context/KHR/khrplatform.h b/drivers/gl_context/KHR/khrplatform.h new file mode 100644 index 0000000000..07b61b9bd6 --- /dev/null +++ b/drivers/gl_context/KHR/khrplatform.h @@ -0,0 +1,285 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 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. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# include +# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__ +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index dac27c0125..a660aa401a 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -3,9 +3,13 @@ Import('env') env.add_source_files(env.drivers_sources,"*.cpp") if (env.get('glew') == 'yes'): - env.add_source_files(env.drivers_sources,"glew.c") - env.Append(CPPFLAGS = ['-DGLEW_ENABLED']) - env.Append(CPPFLAGS = ['-DGLEW_STATIC']) +# env.add_source_files(env.drivers_sources,"glew.c") + env.add_source_files(env.drivers_sources,"glad.c") + env.Append(CPPFLAGS = ['-DGLAD_ENABLED']) + env.Append(CPPFLAGS = ['-DGLES_OVER_GL']) + +# env.Append(CPPFLAGS = ['-DGLEW_ENABLED']) +# env.Append(CPPFLAGS = ['-DGLEW_STATIC']) env.Append(CPPPATH = ['.']) Export('env') diff --git a/drivers/gl_context/glad.c b/drivers/gl_context/glad.c new file mode 100644 index 0000000000..6a708041ed --- /dev/null +++ b/drivers/gl_context/glad.c @@ -0,0 +1,1818 @@ +/* + + OpenGL loader generated by glad 0.1.12a0 on Tue Nov 22 23:00:43 2016. + + Language/Generator: C/C++ + Specification: gl + APIs: gl=3.3 + Profile: compatibility + Extensions: + GL_ARB_debug_output + Loader: True + Local files: False + Omit khrplatform: False + + Commandline: + --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output" + Online: + http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output +*/ + +#include +#include +#include +#include + +static void* get_proc(const char *namez); + +#ifdef _WIN32 +#include +static HMODULE libGL; + +typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); +PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; + +static +int open_gl(void) { + libGL = LoadLibraryW(L"opengl32.dll"); + if(libGL != NULL) { + gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress( + libGL, "wglGetProcAddress"); + return gladGetProcAddressPtr != NULL; + } + + return 0; +} + +static +void close_gl(void) { + if(libGL != NULL) { + FreeLibrary(libGL); + libGL = NULL; + } +} +#else +#include +static void* libGL; + +#ifndef __APPLE__ +typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); +PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; +#endif + +static +int open_gl(void) { +#ifdef __APPLE__ + static const char *NAMES[] = { + "../Frameworks/OpenGL.framework/OpenGL", + "/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" + }; +#else + static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; +#endif + + unsigned int index = 0; + for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { + libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); + + if(libGL != NULL) { +#ifdef __APPLE__ + return 1; +#else + gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, + "glXGetProcAddressARB"); + return gladGetProcAddressPtr != NULL; +#endif + } + } + + return 0; +} + +static +void close_gl() { + if(libGL != NULL) { + dlclose(libGL); + libGL = NULL; + } +} +#endif + +static +void* get_proc(const char *namez) { + void* result = NULL; + if(libGL == NULL) return NULL; + +#ifndef __APPLE__ + if(gladGetProcAddressPtr != NULL) { + result = gladGetProcAddressPtr(namez); + } +#endif + if(result == NULL) { +#ifdef _WIN32 + result = (void*)GetProcAddress(libGL, namez); +#else + result = dlsym(libGL, namez); +#endif + } + + return result; +} + +int gladLoadGL(void) { + int status = 0; + + if(open_gl()) { + status = gladLoadGLLoader(&get_proc); + close_gl(); + } + + return status; +} + +struct gladGLversionStruct GLVersion; + +#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) +#define _GLAD_IS_SOME_NEW_VERSION 1 +#endif + +static int max_loaded_major; +static int max_loaded_minor; + +static const char *exts = NULL; +static int num_exts_i = 0; +static const char **exts_i = NULL; + +static int get_exts(void) { +#ifdef _GLAD_IS_SOME_NEW_VERSION + if(max_loaded_major < 3) { +#endif + exts = (const char *)glGetString(GL_EXTENSIONS); +#ifdef _GLAD_IS_SOME_NEW_VERSION + } else { + int index; + + num_exts_i = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); + if (num_exts_i > 0) { + exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i); + } + + if (exts_i == NULL) { + return 0; + } + + for(index = 0; index < num_exts_i; index++) { + exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index); + } + } +#endif + return 1; +} + +static void free_exts(void) { + if (exts_i != NULL) { + free((char **)exts_i); + exts_i = NULL; + } +} + +static int has_ext(const char *ext) { +#ifdef _GLAD_IS_SOME_NEW_VERSION + if(max_loaded_major < 3) { +#endif + const char *extensions; + const char *loc; + const char *terminator; + extensions = exts; + if(extensions == NULL || ext == NULL) { + return 0; + } + + while(1) { + loc = strstr(extensions, ext); + if(loc == NULL) { + return 0; + } + + terminator = loc + strlen(ext); + if((loc == extensions || *(loc - 1) == ' ') && + (*terminator == ' ' || *terminator == '\0')) { + return 1; + } + extensions = terminator; + } +#ifdef _GLAD_IS_SOME_NEW_VERSION + } else { + int index; + + for(index = 0; index < num_exts_i; index++) { + const char *e = exts_i[index]; + + if(strcmp(e, ext) == 0) { + return 1; + } + } + } +#endif + + return 0; +} +int GLAD_GL_VERSION_1_0; +int GLAD_GL_VERSION_1_1; +int GLAD_GL_VERSION_1_2; +int GLAD_GL_VERSION_1_3; +int GLAD_GL_VERSION_1_4; +int GLAD_GL_VERSION_1_5; +int GLAD_GL_VERSION_2_0; +int GLAD_GL_VERSION_2_1; +int GLAD_GL_VERSION_3_0; +int GLAD_GL_VERSION_3_1; +int GLAD_GL_VERSION_3_2; +int GLAD_GL_VERSION_3_3; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; +PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; +PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; +PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; +PFNGLVERTEX2FVPROC glad_glVertex2fv; +PFNGLINDEXIPROC glad_glIndexi; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +PFNGLRECTDVPROC glad_glRectdv; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; +PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; +PFNGLINDEXDPROC glad_glIndexd; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +PFNGLINDEXFPROC glad_glIndexf; +PFNGLBINDSAMPLERPROC glad_glBindSampler; +PFNGLLINEWIDTHPROC glad_glLineWidth; +PFNGLCOLORP3UIVPROC glad_glColorP3uiv; +PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +PFNGLGETMAPFVPROC glad_glGetMapfv; +PFNGLINDEXSPROC glad_glIndexs; +PFNGLCOMPILESHADERPROC glad_glCompileShader; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; +PFNGLINDEXFVPROC glad_glIndexfv; +PFNGLFOGIVPROC glad_glFogiv; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; +PFNGLLIGHTMODELIVPROC glad_glLightModeliv; +PFNGLCOLOR4UIPROC glad_glColor4ui; +PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; +PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; +PFNGLFOGFVPROC glad_glFogfv; +PFNGLVERTEXP4UIPROC glad_glVertexP4ui; +PFNGLENABLEIPROC glad_glEnablei; +PFNGLVERTEX4IVPROC glad_glVertex4iv; +PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; +PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; +PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; +PFNGLCREATESHADERPROC glad_glCreateShader; +PFNGLISBUFFERPROC glad_glIsBuffer; +PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +PFNGLVERTEX4FVPROC glad_glVertex4fv; +PFNGLBINDTEXTUREPROC glad_glBindTexture; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; +PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +PFNGLVERTEXP2UIPROC glad_glVertexP2ui; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +PFNGLPOINTSIZEPROC glad_glPointSize; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +PFNGLCOLOR4BVPROC glad_glColor4bv; +PFNGLRASTERPOS2FPROC glad_glRasterPos2f; +PFNGLRASTERPOS2DPROC glad_glRasterPos2d; +PFNGLLOADIDENTITYPROC glad_glLoadIdentity; +PFNGLRASTERPOS2IPROC glad_glRasterPos2i; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +PFNGLCOLOR3BPROC glad_glColor3b; +PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +PFNGLEDGEFLAGPROC glad_glEdgeFlag; +PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; +PFNGLVERTEX3DPROC glad_glVertex3d; +PFNGLVERTEX3FPROC glad_glVertex3f; +PFNGLVERTEX3IPROC glad_glVertex3i; +PFNGLCOLOR3IPROC glad_glColor3i; +PFNGLUNIFORM3FPROC glad_glUniform3f; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +PFNGLCOLOR3SPROC glad_glColor3s; +PFNGLVERTEX3SPROC glad_glVertex3s; +PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; +PFNGLCOLORMASKIPROC glad_glColorMaski; +PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; +PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; +PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +PFNGLVERTEX2IVPROC glad_glVertex2iv; +PFNGLCOLOR3SVPROC glad_glColor3sv; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +PFNGLNORMALPOINTERPROC glad_glNormalPointer; +PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; +PFNGLVERTEX4SVPROC glad_glVertex4sv; +PFNGLPASSTHROUGHPROC glad_glPassThrough; +PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; +PFNGLFOGIPROC glad_glFogi; +PFNGLBEGINPROC glad_glBegin; +PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; +PFNGLCOLOR3UBVPROC glad_glColor3ubv; +PFNGLVERTEXPOINTERPROC glad_glVertexPointer; +PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +PFNGLDRAWARRAYSPROC glad_glDrawArrays; +PFNGLUNIFORM1UIPROC glad_glUniform1ui; +PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; +PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; +PFNGLLIGHTFVPROC glad_glLightfv; +PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +PFNGLCLEARPROC glad_glClear; +PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; +PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; +PFNGLISENABLEDPROC glad_glIsEnabled; +PFNGLSTENCILOPPROC glad_glStencilOp; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +PFNGLTRANSLATEFPROC glad_glTranslatef; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +PFNGLTRANSLATEDPROC glad_glTranslated; +PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; +PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; +PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +PFNGLFOGCOORDFVPROC glad_glFogCoordfv; +PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +PFNGLINDEXSVPROC glad_glIndexsv; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +PFNGLVERTEX3IVPROC glad_glVertex3iv; +PFNGLBITMAPPROC glad_glBitmap; +PFNGLMATERIALIPROC glad_glMateriali; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +PFNGLGETQUERYIVPROC glad_glGetQueryiv; +PFNGLTEXCOORD4FPROC glad_glTexCoord4f; +PFNGLTEXCOORD4DPROC glad_glTexCoord4d; +PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; +PFNGLTEXCOORD4IPROC glad_glTexCoord4i; +PFNGLMATERIALFPROC glad_glMaterialf; +PFNGLTEXCOORD4SPROC glad_glTexCoord4s; +PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +PFNGLISSHADERPROC glad_glIsShader; +PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; +PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +PFNGLVERTEX3DVPROC glad_glVertex3dv; +PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +PFNGLENABLEPROC glad_glEnable; +PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +PFNGLCOLOR4FVPROC glad_glColor4fv; +PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; +PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; +PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; +PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; +PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; +PFNGLTEXGENFPROC glad_glTexGenf; +PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; +PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; +PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; +PFNGLGETPOINTERVPROC glad_glGetPointerv; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +PFNGLNORMAL3FVPROC glad_glNormal3fv; +PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; +PFNGLDEPTHRANGEPROC glad_glDepthRange; +PFNGLFRUSTUMPROC glad_glFrustum; +PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +PFNGLPUSHMATRIXPROC glad_glPushMatrix; +PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; +PFNGLORTHOPROC glad_glOrtho; +PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; +PFNGLCLEARINDEXPROC glad_glClearIndex; +PFNGLMAP1DPROC glad_glMap1d; +PFNGLMAP1FPROC glad_glMap1f; +PFNGLFLUSHPROC glad_glFlush; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +PFNGLINDEXIVPROC glad_glIndexiv; +PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +PFNGLPIXELZOOMPROC glad_glPixelZoom; +PFNGLFENCESYNCPROC glad_glFenceSync; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +PFNGLCOLORP3UIPROC glad_glColorP3ui; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +PFNGLLIGHTIPROC glad_glLighti; +PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; +PFNGLLIGHTFPROC glad_glLightf; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +PFNGLGENSAMPLERSPROC glad_glGenSamplers; +PFNGLCLAMPCOLORPROC glad_glClampColor; +PFNGLUNIFORM4IVPROC glad_glUniform4iv; +PFNGLCLEARSTENCILPROC glad_glClearStencil; +PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; +PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; +PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; +PFNGLGENTEXTURESPROC glad_glGenTextures; +PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; +PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +PFNGLINDEXPOINTERPROC glad_glIndexPointer; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +PFNGLISSYNCPROC glad_glIsSync; +PFNGLVERTEX2FPROC glad_glVertex2f; +PFNGLVERTEX2DPROC glad_glVertex2d; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +PFNGLUNIFORM2IPROC glad_glUniform2i; +PFNGLMAPGRID2DPROC glad_glMapGrid2d; +PFNGLMAPGRID2FPROC glad_glMapGrid2f; +PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; +PFNGLVERTEX2IPROC glad_glVertex2i; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +PFNGLVERTEX2SPROC glad_glVertex2s; +PFNGLNORMAL3BVPROC glad_glNormal3bv; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; +PFNGLVERTEX3SVPROC glad_glVertex3sv; +PFNGLGENQUERIESPROC glad_glGenQueries; +PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; +PFNGLTEXENVFPROC glad_glTexEnvf; +PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +PFNGLFOGCOORDDPROC glad_glFogCoordd; +PFNGLFOGCOORDFPROC glad_glFogCoordf; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +PFNGLTEXENVIPROC glad_glTexEnvi; +PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; +PFNGLISENABLEDIPROC glad_glIsEnabledi; +PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; +PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; +PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; +PFNGLUNIFORM2IVPROC glad_glUniform2iv; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +PFNGLMATRIXMODEPROC glad_glMatrixMode; +PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; +PFNGLGETMAPIVPROC glad_glGetMapiv; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +PFNGLGETSHADERIVPROC glad_glGetShaderiv; +PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; +PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; +PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; +PFNGLCALLLISTPROC glad_glCallList; +PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; +PFNGLGETDOUBLEVPROC glad_glGetDoublev; +PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +PFNGLLIGHTMODELFPROC glad_glLightModelf; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +PFNGLVERTEX2SVPROC glad_glVertex2sv; +PFNGLLIGHTMODELIPROC glad_glLightModeli; +PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; +PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; +PFNGLUNIFORM3FVPROC glad_glUniform3fv; +PFNGLPIXELSTOREIPROC glad_glPixelStorei; +PFNGLCALLLISTSPROC glad_glCallLists; +PFNGLMAPBUFFERPROC glad_glMapBuffer; +PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; +PFNGLTEXCOORD3IPROC glad_glTexCoord3i; +PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; +PFNGLRASTERPOS3IPROC glad_glRasterPos3i; +PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; +PFNGLRASTERPOS3DPROC glad_glRasterPos3d; +PFNGLRASTERPOS3FPROC glad_glRasterPos3f; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +PFNGLTEXCOORD3FPROC glad_glTexCoord3f; +PFNGLDELETESYNCPROC glad_glDeleteSync; +PFNGLTEXCOORD3DPROC glad_glTexCoord3d; +PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +PFNGLTEXCOORD3SPROC glad_glTexCoord3s; +PFNGLUNIFORM3IVPROC glad_glUniform3iv; +PFNGLRASTERPOS3SPROC glad_glRasterPos3s; +PFNGLPOLYGONMODEPROC glad_glPolygonMode; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; +PFNGLISLISTPROC glad_glIsList; +PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; +PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; +PFNGLCOLOR4SPROC glad_glColor4s; +PFNGLUSEPROGRAMPROC glad_glUseProgram; +PFNGLLINESTIPPLEPROC glad_glLineStipple; +PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +PFNGLCOLOR4BPROC glad_glColor4b; +PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; +PFNGLCOLOR4FPROC glad_glColor4f; +PFNGLCOLOR4DPROC glad_glColor4d; +PFNGLCOLOR4IPROC glad_glColor4i; +PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; +PFNGLVERTEX2DVPROC glad_glVertex2dv; +PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; +PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +PFNGLFINISHPROC glad_glFinish; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +PFNGLDELETESHADERPROC glad_glDeleteShader; +PFNGLDRAWELEMENTSPROC glad_glDrawElements; +PFNGLRASTERPOS2SPROC glad_glRasterPos2s; +PFNGLGETMAPDVPROC glad_glGetMapdv; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +PFNGLMATERIALFVPROC glad_glMaterialfv; +PFNGLVIEWPORTPROC glad_glViewport; +PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +PFNGLINDEXDVPROC glad_glIndexdv; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; +PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +PFNGLCLEARDEPTHPROC glad_glClearDepth; +PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +PFNGLTEXBUFFERPROC glad_glTexBuffer; +PFNGLPOPNAMEPROC glad_glPopName; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +PFNGLPIXELSTOREFPROC glad_glPixelStoref; +PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; +PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; +PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; +PFNGLRECTIPROC glad_glRecti; +PFNGLCOLOR4UBPROC glad_glColor4ub; +PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; +PFNGLRECTFPROC glad_glRectf; +PFNGLRECTDPROC glad_glRectd; +PFNGLNORMAL3SVPROC glad_glNormal3sv; +PFNGLNEWLISTPROC glad_glNewList; +PFNGLCOLOR4USPROC glad_glColor4us; +PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; +PFNGLLINKPROGRAMPROC glad_glLinkProgram; +PFNGLHINTPROC glad_glHint; +PFNGLRECTSPROC glad_glRects; +PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; +PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; +PFNGLGETSTRINGPROC glad_glGetString; +PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; +PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; +PFNGLDETACHSHADERPROC glad_glDetachShader; +PFNGLSCALEFPROC glad_glScalef; +PFNGLENDQUERYPROC glad_glEndQuery; +PFNGLSCALEDPROC glad_glScaled; +PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; +PFNGLCOPYPIXELSPROC glad_glCopyPixels; +PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +PFNGLPOPATTRIBPROC glad_glPopAttrib; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +PFNGLINITNAMESPROC glad_glInitNames; +PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +PFNGLCOLOR3DVPROC glad_glColor3dv; +PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +PFNGLWAITSYNCPROC glad_glWaitSync; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +PFNGLCOLORMATERIALPROC glad_glColorMaterial; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; +PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; +PFNGLUNIFORM1FPROC glad_glUniform1f; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +PFNGLRENDERMODEPROC glad_glRenderMode; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; +PFNGLUNIFORM1IPROC glad_glUniform1i; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +PFNGLUNIFORM3IPROC glad_glUniform3i; +PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +PFNGLDISABLEPROC glad_glDisable; +PFNGLLOGICOPPROC glad_glLogicOp; +PFNGLEVALPOINT2PROC glad_glEvalPoint2; +PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; +PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; +PFNGLUNIFORM4UIPROC glad_glUniform4ui; +PFNGLCOLOR3FPROC glad_glColor3f; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; +PFNGLRECTFVPROC glad_glRectfv; +PFNGLCULLFACEPROC glad_glCullFace; +PFNGLGETLIGHTFVPROC glad_glGetLightfv; +PFNGLCOLOR3DPROC glad_glColor3d; +PFNGLTEXGENDPROC glad_glTexGend; +PFNGLTEXGENIPROC glad_glTexGeni; +PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; +PFNGLGETSTRINGIPROC glad_glGetStringi; +PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; +PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; +PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; +PFNGLATTACHSHADERPROC glad_glAttachShader; +PFNGLFOGCOORDDVPROC glad_glFogCoorddv; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; +PFNGLQUERYCOUNTERPROC glad_glQueryCounter; +PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; +PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +PFNGLTEXGENIVPROC glad_glTexGeniv; +PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; +PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; +PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; +PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; +PFNGLNORMALP3UIPROC glad_glNormalP3ui; +PFNGLTEXENVFVPROC glad_glTexEnvfv; +PFNGLREADBUFFERPROC glad_glReadBuffer; +PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; +PFNGLLIGHTMODELFVPROC glad_glLightModelfv; +PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; +PFNGLDELETELISTSPROC glad_glDeleteLists; +PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; +PFNGLVERTEX4DVPROC glad_glVertex4dv; +PFNGLTEXCOORD2DPROC glad_glTexCoord2d; +PFNGLPOPMATRIXPROC glad_glPopMatrix; +PFNGLTEXCOORD2FPROC glad_glTexCoord2f; +PFNGLCOLOR4IVPROC glad_glColor4iv; +PFNGLINDEXUBVPROC glad_glIndexubv; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +PFNGLTEXCOORD2IPROC glad_glTexCoord2i; +PFNGLRASTERPOS4DPROC glad_glRasterPos4d; +PFNGLRASTERPOS4FPROC glad_glRasterPos4f; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +PFNGLTEXCOORD2SPROC glad_glTexCoord2s; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +PFNGLVERTEX3FVPROC glad_glVertex3fv; +PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; +PFNGLMATERIALIVPROC glad_glMaterialiv; +PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; +PFNGLISPROGRAMPROC glad_glIsProgram; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +PFNGLVERTEX4SPROC glad_glVertex4s; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +PFNGLNORMAL3DVPROC glad_glNormal3dv; +PFNGLUNIFORM4IPROC glad_glUniform4i; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +PFNGLROTATEDPROC glad_glRotated; +PFNGLROTATEFPROC glad_glRotatef; +PFNGLVERTEX4IPROC glad_glVertex4i; +PFNGLREADPIXELSPROC glad_glReadPixels; +PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +PFNGLLOADNAMEPROC glad_glLoadName; +PFNGLUNIFORM4FPROC glad_glUniform4f; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +PFNGLSHADEMODELPROC glad_glShadeModel; +PFNGLMAPGRID1DPROC glad_glMapGrid1d; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +PFNGLMAPGRID1FPROC glad_glMapGrid1f; +PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; +PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; +PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; +PFNGLALPHAFUNCPROC glad_glAlphaFunc; +PFNGLUNIFORM1IVPROC glad_glUniform1iv; +PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +PFNGLSTENCILFUNCPROC glad_glStencilFunc; +PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; +PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +PFNGLCOLOR4UIVPROC glad_glColor4uiv; +PFNGLRECTIVPROC glad_glRectiv; +PFNGLCOLORP4UIPROC glad_glColorP4ui; +PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; +PFNGLEVALMESH2PROC glad_glEvalMesh2; +PFNGLEVALMESH1PROC glad_glEvalMesh1; +PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; +PFNGLCOLOR4UBVPROC glad_glColor4ubv; +PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; +PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; +PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +PFNGLTEXENVIVPROC glad_glTexEnviv; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +PFNGLGENBUFFERSPROC glad_glGenBuffers; +PFNGLSELECTBUFFERPROC glad_glSelectBuffer; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +PFNGLPUSHATTRIBPROC glad_glPushAttrib; +PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +PFNGLBLENDFUNCPROC glad_glBlendFunc; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +PFNGLLIGHTIVPROC glad_glLightiv; +PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +PFNGLTEXGENFVPROC glad_glTexGenfv; +PFNGLENDPROC glad_glEnd; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +PFNGLSCISSORPROC glad_glScissor; +PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; +PFNGLCLIPPLANEPROC glad_glClipPlane; +PFNGLPUSHNAMEPROC glad_glPushName; +PFNGLTEXGENDVPROC glad_glTexGendv; +PFNGLINDEXUBPROC glad_glIndexub; +PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; +PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; +PFNGLRASTERPOS4IPROC glad_glRasterPos4i; +PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; +PFNGLCLEARCOLORPROC glad_glClearColor; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +PFNGLNORMAL3SPROC glad_glNormal3s; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +PFNGLCOLORP4UIVPROC glad_glColorP4uiv; +PFNGLBLENDCOLORPROC glad_glBlendColor; +PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; +PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; +PFNGLUNIFORM3UIPROC glad_glUniform3ui; +PFNGLCOLOR4DVPROC glad_glColor4dv; +PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +PFNGLUNIFORM2FVPROC glad_glUniform2fv; +PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; +PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; +PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; +PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; +PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +PFNGLNORMAL3IVPROC glad_glNormal3iv; +PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; +PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; +PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; +PFNGLCOLOR3USPROC glad_glColor3us; +PFNGLCOLOR3UIVPROC glad_glColor3uiv; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +PFNGLGETLIGHTIVPROC glad_glGetLightiv; +PFNGLDEPTHFUNCPROC glad_glDepthFunc; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +PFNGLLISTBASEPROC glad_glListBase; +PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; +PFNGLCOLOR3UBPROC glad_glColor3ub; +PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; +PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +PFNGLCOLOR3UIPROC glad_glColor3ui; +PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; +PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; +PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; +PFNGLCOLORMASKPROC glad_glColorMask; +PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; +PFNGLRASTERPOS4SPROC glad_glRasterPos4s; +PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; +PFNGLCOLOR4SVPROC glad_glColor4sv; +PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; +PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +PFNGLFOGFPROC glad_glFogf; +PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +PFNGLISSAMPLERPROC glad_glIsSampler; +PFNGLVERTEXP3UIPROC glad_glVertexP3ui; +PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; +PFNGLCOLOR3IVPROC glad_glColor3iv; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +PFNGLTEXCOORD1IPROC glad_glTexCoord1i; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +PFNGLTEXCOORD1DPROC glad_glTexCoord1d; +PFNGLTEXCOORD1FPROC glad_glTexCoord1f; +PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +PFNGLTEXCOORD1SPROC glad_glTexCoord1s; +PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +PFNGLGENLISTSPROC glad_glGenLists; +PFNGLCOLOR3BVPROC glad_glColor3bv; +PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +PFNGLGETTEXGENDVPROC glad_glGetTexGendv; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +PFNGLENDLISTPROC glad_glEndList; +PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; +PFNGLUNIFORM2UIPROC glad_glUniform2ui; +PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +PFNGLCOLOR3USVPROC glad_glColor3usv; +PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; +PFNGLDISABLEIPROC glad_glDisablei; +PFNGLINDEXMASKPROC glad_glIndexMask; +PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; +PFNGLSHADERSOURCEPROC glad_glShaderSource; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +PFNGLCLEARACCUMPROC glad_glClearAccum; +PFNGLGETSYNCIVPROC glad_glGetSynciv; +PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; +PFNGLUNIFORM2FPROC glad_glUniform2f; +PFNGLBEGINQUERYPROC glad_glBeginQuery; +PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +PFNGLBINDBUFFERPROC glad_glBindBuffer; +PFNGLMAP2DPROC glad_glMap2d; +PFNGLMAP2FPROC glad_glMap2f; +PFNGLVERTEX4DPROC glad_glVertex4d; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; +PFNGLBUFFERDATAPROC glad_glBufferData; +PFNGLEVALPOINT1PROC glad_glEvalPoint1; +PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; +PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; +PFNGLGETERRORPROC glad_glGetError; +PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; +PFNGLGETFLOATVPROC glad_glGetFloatv; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; +PFNGLPIXELMAPFVPROC glad_glPixelMapfv; +PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; +PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; +PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; +PFNGLGETINTEGERVPROC glad_glGetIntegerv; +PFNGLACCUMPROC glad_glAccum; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; +PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; +PFNGLISQUERYPROC glad_glIsQuery; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +PFNGLSTENCILMASKPROC glad_glStencilMask; +PFNGLDRAWPIXELSPROC glad_glDrawPixels; +PFNGLMULTMATRIXDPROC glad_glMultMatrixd; +PFNGLMULTMATRIXFPROC glad_glMultMatrixf; +PFNGLISTEXTUREPROC glad_glIsTexture; +PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; +PFNGLUNIFORM1FVPROC glad_glUniform1fv; +PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; +PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +PFNGLVERTEX4FPROC glad_glVertex4f; +PFNGLRECTSVPROC glad_glRectsv; +PFNGLCOLOR4USVPROC glad_glColor4usv; +PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; +PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; +PFNGLNORMAL3IPROC glad_glNormal3i; +PFNGLNORMAL3FPROC glad_glNormal3f; +PFNGLNORMAL3DPROC glad_glNormal3d; +PFNGLNORMAL3BPROC glad_glNormal3b; +PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; +PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; +PFNGLARRAYELEMENTPROC glad_glArrayElement; +PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; +PFNGLDEPTHMASKPROC glad_glDepthMask; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +PFNGLCOLOR3FVPROC glad_glColor3fv; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +PFNGLUNIFORM4FVPROC glad_glUniform4fv; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +PFNGLCOLORPOINTERPROC glad_glColorPointer; +PFNGLFRONTFACEPROC glad_glFrontFace; +PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +int GLAD_GL_ARB_debug_output; +PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB; +PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB; +PFNGLDEBUGMESSAGECALLBACKARBPROC glad_glDebugMessageCallbackARB; +PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB; +static void load_GL_VERSION_1_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_0) return; + glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); + glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); + glad_glHint = (PFNGLHINTPROC)load("glHint"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); + glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); + glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); + glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); + glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); + glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); + glad_glClear = (PFNGLCLEARPROC)load("glClear"); + glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); + glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); + glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); + glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); + glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); + glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); + glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); + glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); + glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); + glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); + glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); + glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); + glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); + glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); + glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); + glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); + glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); + glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); + glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); + glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); + glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); + glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); + glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); + glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); + glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); + glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); + glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); + glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); + glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); + glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); + glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); + glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); + glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); + glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); + glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); + glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); + glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); + glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); + glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); + glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); + glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); + glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); + glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); + glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); + glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); + glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); + glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); + glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); + glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); + glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); + glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); + glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); + glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); + glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); + glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); + glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); + glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); + glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); + glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); + glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); + glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); + glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); + glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); + glad_glEnd = (PFNGLENDPROC)load("glEnd"); + glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); + glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); + glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); + glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); + glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); + glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); + glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); + glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); + glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); + glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); + glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); + glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); + glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); + glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); + glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); + glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); + glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); + glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); + glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); + glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); + glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); + glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); + glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); + glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); + glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); + glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); + glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); + glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); + glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); + glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); + glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); + glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); + glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); + glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); + glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); + glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); + glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); + glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); + glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); + glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); + glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); + glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); + glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); + glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); + glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); + glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); + glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); + glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); + glad_glRects = (PFNGLRECTSPROC)load("glRects"); + glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); + glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); + glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); + glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); + glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); + glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); + glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); + glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); + glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); + glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); + glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); + glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); + glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); + glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); + glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); + glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); + glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); + glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); + glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); + glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); + glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); + glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); + glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); + glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); + glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); + glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); + glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); + glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); + glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); + glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); + glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); + glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); + glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); + glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); + glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); + glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); + glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); + glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); + glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); + glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); + glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); + glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); + glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); + glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); + glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); + glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); + glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); + glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); + glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); + glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); + glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); + glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); + glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); + glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); + glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); + glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); + glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); + glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); + glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); + glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); + glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); + glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); + glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); + glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); + glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); + glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); + glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); + glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); + glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); + glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); + glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); + glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); + glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); + glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); + glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); + glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); + glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); + glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); + glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); + glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); + glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); + glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); + glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); + glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); + glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); + glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); + glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); + glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); + glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); + glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); + glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); + glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); + glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); + glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); + glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); + glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); + glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); + glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); + glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); + glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); + glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); + glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); + glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); + glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); + glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); + glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); + glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); + glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); + glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); + glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); + glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); + glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); + glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); + glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); + glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); + glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); + glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); + glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); + glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); + glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); + glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); + glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); + glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); + glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); + glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); + glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); + glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); + glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); + glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); + glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); + glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); + glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); + glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); + glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); + glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); + glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); + glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); + glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); + glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); + glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); + glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); + glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); + glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); + glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); + glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); + glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); + glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); + glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); + glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); + glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); + glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); + glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); + glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); + glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); + glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); + glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); + glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); + glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); + glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); + glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); + glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); + glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); + glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); + glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); + glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); +} +static void load_GL_VERSION_1_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_1) return; + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); + glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); + glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); + glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); + glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); + glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); + glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); + glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); + glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); + glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); + glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); + glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); + glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); + glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); + glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); + glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); + glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); + glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); + glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); + glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); + glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); +} +static void load_GL_VERSION_1_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_2) return; + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); +} +static void load_GL_VERSION_1_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_3) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); + glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); + glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); + glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); + glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); + glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); + glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); + glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); + glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); + glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); + glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); + glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); + glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); + glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); + glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); + glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); + glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); + glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); + glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); + glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); + glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); + glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); + glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); + glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); + glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); + glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); + glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); + glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); + glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); + glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); + glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); + glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); + glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); + glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); + glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); + glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); + glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); + glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); + glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); + glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); + glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); +} +static void load_GL_VERSION_1_4(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_4) return; + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); + glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); + glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); + glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); + glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); + glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); + glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); + glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); + glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); + glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); + glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); + glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); + glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); + glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); + glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); + glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); + glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); + glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); + glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); + glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); + glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); + glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); + glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); + glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); + glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); + glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); + glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); + glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); + glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); + glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); + glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); + glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); + glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); + glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); + glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); + glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); + glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); + glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); + glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); + glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); + glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); + glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); + glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); + glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); + glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); +} +static void load_GL_VERSION_1_5(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_5) return; + glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); + glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); + glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); + glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); + glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); + glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); + glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); + glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); + glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); +} +static void load_GL_VERSION_2_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_0) return; + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); + glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); + glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); + glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); + glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); + glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); + glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); + glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); + glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); + glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); + glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); + glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); + glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); + glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); + glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); + glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); + glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); + glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); + glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); + glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); + glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); + glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); + glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); + glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); + glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); + glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); + glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); + glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); + glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); + glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); + glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); + glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); +} +static void load_GL_VERSION_2_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_1) return; + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); +} +static void load_GL_VERSION_3_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_0) return; + glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); + glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); + glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); + glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); + glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); + glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); + glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); + glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); + glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); + glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); + glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); + glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); + glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); + glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); + glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); + glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); + glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); + glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); + glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); + glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); + glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); + glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); + glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); + glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); + glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); + glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); + glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); + glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); + glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); + glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); + glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); + glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); + glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); + glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); + glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); + glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); + glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); + glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); + glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); + glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); + glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); + glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); + glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); + glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); + glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); + glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); + glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); + glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); + glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); + glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); + glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); + glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); + glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); + glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); + glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); + glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); + glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); + glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); + glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); + glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); + glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); + glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); + glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); + glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); + glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); + glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); +} +static void load_GL_VERSION_3_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_1) return; + glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); + glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); + glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); + glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); + glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); + glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); + glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); + glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); + glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); + glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); + glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); + glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); +} +static void load_GL_VERSION_3_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_2) return; + glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex"); + glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex"); + glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex"); + glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex"); + glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex"); + glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); + glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); + glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); + glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); + glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); + glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); + glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); + glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); + glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); + glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture"); + glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample"); + glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample"); + glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv"); + glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski"); +} +static void load_GL_VERSION_3_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_3) return; + glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed"); + glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex"); + glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); + glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); + glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); + glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); + glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); + glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); + glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); + glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); + glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load("glSamplerParameterIiv"); + glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load("glSamplerParameterIuiv"); + glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); + glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load("glGetSamplerParameterIiv"); + glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); + glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load("glGetSamplerParameterIuiv"); + glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter"); + glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v"); + glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v"); + glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); + glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load("glVertexAttribP1ui"); + glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load("glVertexAttribP1uiv"); + glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load("glVertexAttribP2ui"); + glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load("glVertexAttribP2uiv"); + glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load("glVertexAttribP3ui"); + glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load("glVertexAttribP3uiv"); + glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load("glVertexAttribP4ui"); + glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load("glVertexAttribP4uiv"); + glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load("glVertexP2ui"); + glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load("glVertexP2uiv"); + glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load("glVertexP3ui"); + glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load("glVertexP3uiv"); + glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load("glVertexP4ui"); + glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load("glVertexP4uiv"); + glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load("glTexCoordP1ui"); + glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load("glTexCoordP1uiv"); + glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load("glTexCoordP2ui"); + glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load("glTexCoordP2uiv"); + glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load("glTexCoordP3ui"); + glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load("glTexCoordP3uiv"); + glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load("glTexCoordP4ui"); + glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("glTexCoordP4uiv"); + glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)load("glMultiTexCoordP1ui"); + glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)load("glMultiTexCoordP1uiv"); + glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)load("glMultiTexCoordP2ui"); + glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)load("glMultiTexCoordP2uiv"); + glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)load("glMultiTexCoordP3ui"); + glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)load("glMultiTexCoordP3uiv"); + glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)load("glMultiTexCoordP4ui"); + glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)load("glMultiTexCoordP4uiv"); + glad_glNormalP3ui = (PFNGLNORMALP3UIPROC)load("glNormalP3ui"); + glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC)load("glNormalP3uiv"); + glad_glColorP3ui = (PFNGLCOLORP3UIPROC)load("glColorP3ui"); + glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC)load("glColorP3uiv"); + glad_glColorP4ui = (PFNGLCOLORP4UIPROC)load("glColorP4ui"); + glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC)load("glColorP4uiv"); + glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); + glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); +} +static void load_GL_ARB_debug_output(GLADloadproc load) { + if(!GLAD_GL_ARB_debug_output) return; + glad_glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC)load("glDebugMessageControlARB"); + glad_glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC)load("glDebugMessageInsertARB"); + glad_glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)load("glDebugMessageCallbackARB"); + glad_glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)load("glGetDebugMessageLogARB"); +} +static int find_extensionsGL(void) { + if (!get_exts()) return 0; + GLAD_GL_ARB_debug_output = has_ext("GL_ARB_debug_output"); + free_exts(); + return 1; +} + +static void find_coreGL(void) { + + /* Thank you @elmindreda + * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 + * https://github.com/glfw/glfw/blob/master/src/context.c#L36 + */ + int i, major, minor; + + const char* version; + const char* prefixes[] = { + "OpenGL ES-CM ", + "OpenGL ES-CL ", + "OpenGL ES ", + NULL + }; + + version = (const char*) glGetString(GL_VERSION); + if (!version) return; + + for (i = 0; prefixes[i]; i++) { + const size_t length = strlen(prefixes[i]); + if (strncmp(version, prefixes[i], length) == 0) { + version += length; + break; + } + } + +/* PR #18 */ +#ifdef _MSC_VER + sscanf_s(version, "%d.%d", &major, &minor); +#else + sscanf(version, "%d.%d", &major, &minor); +#endif + + GLVersion.major = major; GLVersion.minor = minor; + max_loaded_major = major; max_loaded_minor = minor; + GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; + GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; + GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; + GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; + GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; + GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; + GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; + if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 3)) { + max_loaded_major = 3; + max_loaded_minor = 3; + } +} + +int gladLoadGLLoader(GLADloadproc load) { + GLVersion.major = 0; GLVersion.minor = 0; + glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + if(glGetString == NULL) return 0; + if(glGetString(GL_VERSION) == NULL) return 0; + find_coreGL(); + load_GL_VERSION_1_0(load); + load_GL_VERSION_1_1(load); + load_GL_VERSION_1_2(load); + load_GL_VERSION_1_3(load); + load_GL_VERSION_1_4(load); + load_GL_VERSION_1_5(load); + load_GL_VERSION_2_0(load); + load_GL_VERSION_2_1(load); + load_GL_VERSION_3_0(load); + load_GL_VERSION_3_1(load); + load_GL_VERSION_3_2(load); + load_GL_VERSION_3_3(load); + + if (!find_extensionsGL()) return 0; + load_GL_ARB_debug_output(load); + return GLVersion.major != 0 || GLVersion.minor != 0; +} + diff --git a/drivers/gl_context/glad/glad.h b/drivers/gl_context/glad/glad.h new file mode 100644 index 0000000000..7bb465f0ec --- /dev/null +++ b/drivers/gl_context/glad/glad.h @@ -0,0 +1,3681 @@ +/* + + OpenGL loader generated by glad 0.1.12a0 on Tue Nov 22 23:00:43 2016. + + Language/Generator: C/C++ + Specification: gl + APIs: gl=3.3 + Profile: compatibility + Extensions: + GL_ARB_debug_output + Loader: True + Local files: False + Omit khrplatform: False + + Commandline: + --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output" + Online: + http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output +*/ + + +#ifndef __glad_h_ +#define __glad_h_ + +#ifdef __gl_h_ +#error OpenGL header already included, remove this include, glad already provides it +#endif +#define __gl_h_ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct gladGLversionStruct { + int major; + int minor; +}; + +typedef void* (* GLADloadproc)(const char *name); + +#ifndef GLAPI +# if defined(GLAD_GLAPI_EXPORT) +# if defined(WIN32) || defined(__CYGWIN__) +# if defined(GLAD_GLAPI_EXPORT_BUILD) +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllexport)) extern +# else +# define GLAPI __declspec(dllexport) extern +# endif +# else +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllimport)) extern +# else +# define GLAPI __declspec(dllimport) extern +# endif +# endif +# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) +# define GLAPI __attribute__ ((visibility ("default"))) extern +# else +# define GLAPI extern +# endif +# else +# define GLAPI extern +# endif +#endif + +GLAPI struct gladGLversionStruct GLVersion; + +GLAPI int gladLoadGL(void); + +GLAPI int gladLoadGLLoader(GLADloadproc); + +#include +#include +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLclampx; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef int GLsizei; +typedef float GLfloat; +typedef float GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void *GLeglImageOES; +typedef char GLchar; +typedef char GLcharARB; +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +typedef unsigned short GLhalfARB; +typedef unsigned short GLhalf; +typedef GLint GLfixed; +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +typedef struct __GLsync *GLsync; +struct _cl_context; +struct _cl_event; +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +typedef unsigned short GLhalfNV; +typedef GLintptr GLvdpauSurfaceNV; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_NEVER 0x0200 +#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_ZERO 0 +#define GL_ONE 1 +#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_NONE 0 +#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_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#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_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#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_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_VIEWPORT 0x0BA2 +#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_COLOR_LOGIC_OP 0x0BF2 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#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_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#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_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#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_DOUBLE 0x140A +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#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_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#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_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#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_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_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_REPEAT 0x2901 +#define GL_R3_G3_B2 0x2A10 +#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_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_HINT_BIT 0x00008000 +#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 0xFFFFFFFF +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#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_EXP2 0x0801 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#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_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_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#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_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_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#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_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#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_INDEX_LOGIC_OP 0x0BF1 +#define GL_LOGIC_OP 0x0BF1 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#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_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_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_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_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#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_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#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_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#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_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#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_COLOR_INDEX 0x1900 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_BITMAP 0x1A00 +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_S 0x2000 +#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_CLAMP 0x2900 +#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_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_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_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_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_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_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#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_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_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#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_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_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_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#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_CLAMP_TO_BORDER 0x812D +#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_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#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_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#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_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#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_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#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_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_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 +#define GL_SRC1_ALPHA 0x8589 +#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_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC2_ALPHA 0x858A +#define GL_BLEND_EQUATION_RGB 0x8009 +#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_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_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#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 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#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_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#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_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#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_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 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#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_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_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_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_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_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF +#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 +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#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 +#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 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 GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#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_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_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#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_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#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 +#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_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_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#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 +#define GL_DEPTH_CLAMP 0x864F +#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 +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#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 +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#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 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#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 +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#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 GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_INT_2_10_10_10_REV 0x8D9F +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 +GLAPI int GLAD_GL_VERSION_1_0; +typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); +GLAPI PFNGLCULLFACEPROC glad_glCullFace; +#define glCullFace glad_glCullFace +typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); +GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; +#define glFrontFace glad_glFrontFace +typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); +GLAPI PFNGLHINTPROC glad_glHint; +#define glHint glad_glHint +typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); +GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; +#define glLineWidth glad_glLineWidth +typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); +GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; +#define glPointSize glad_glPointSize +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); +GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; +#define glPolygonMode glad_glPolygonMode +typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLSCISSORPROC glad_glScissor; +#define glScissor glad_glScissor +typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); +GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +#define glTexParameterf glad_glTexParameterf +typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +#define glTexParameterfv glad_glTexParameterfv +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +#define glTexParameteri glad_glTexParameteri +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +#define glTexParameteriv glad_glTexParameteriv +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +#define glTexImage1D glad_glTexImage1D +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +#define glTexImage2D glad_glTexImage2D +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); +GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +#define glDrawBuffer glad_glDrawBuffer +typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); +GLAPI PFNGLCLEARPROC glad_glClear; +#define glClear glad_glClear +typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; +#define glClearColor glad_glClearColor +typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); +GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; +#define glClearStencil glad_glClearStencil +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); +GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; +#define glClearDepth glad_glClearDepth +typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); +GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; +#define glStencilMask glad_glStencilMask +typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI PFNGLCOLORMASKPROC glad_glColorMask; +#define glColorMask glad_glColorMask +typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); +GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; +#define glDepthMask glad_glDepthMask +typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); +GLAPI PFNGLDISABLEPROC glad_glDisable; +#define glDisable glad_glDisable +typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); +GLAPI PFNGLENABLEPROC glad_glEnable; +#define glEnable glad_glEnable +typedef void (APIENTRYP PFNGLFINISHPROC)(); +GLAPI PFNGLFINISHPROC glad_glFinish; +#define glFinish glad_glFinish +typedef void (APIENTRYP PFNGLFLUSHPROC)(); +GLAPI PFNGLFLUSHPROC glad_glFlush; +#define glFlush glad_glFlush +typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; +#define glBlendFunc glad_glBlendFunc +typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); +GLAPI PFNGLLOGICOPPROC glad_glLogicOp; +#define glLogicOp glad_glLogicOp +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; +#define glStencilFunc glad_glStencilFunc +typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; +#define glStencilOp glad_glStencilOp +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); +GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; +#define glDepthFunc glad_glDepthFunc +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; +#define glPixelStoref glad_glPixelStoref +typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; +#define glPixelStorei glad_glPixelStorei +typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); +GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; +#define glReadBuffer glad_glReadBuffer +typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; +#define glReadPixels glad_glReadPixels +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); +GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +#define glGetBooleanv glad_glGetBooleanv +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); +GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; +#define glGetDoublev glad_glGetDoublev +typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(); +GLAPI PFNGLGETERRORPROC glad_glGetError; +#define glGetError glad_glGetError +typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); +GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; +#define glGetFloatv glad_glGetFloatv +typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); +GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; +#define glGetIntegerv glad_glGetIntegerv +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); +GLAPI PFNGLGETSTRINGPROC glad_glGetString; +#define glGetString glad_glGetString +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +#define glGetTexImage glad_glGetTexImage +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +#define glGetTexParameterfv glad_glGetTexParameterfv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +#define glGetTexParameteriv glad_glGetTexParameteriv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); +GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; +#define glIsEnabled glad_glIsEnabled +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far); +GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; +#define glDepthRange glad_glDepthRange +typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLVIEWPORTPROC glad_glViewport; +#define glViewport glad_glViewport +typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode); +GLAPI PFNGLNEWLISTPROC glad_glNewList; +#define glNewList glad_glNewList +typedef void (APIENTRYP PFNGLENDLISTPROC)(); +GLAPI PFNGLENDLISTPROC glad_glEndList; +#define glEndList glad_glEndList +typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list); +GLAPI PFNGLCALLLISTPROC glad_glCallList; +#define glCallList glad_glCallList +typedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists); +GLAPI PFNGLCALLLISTSPROC glad_glCallLists; +#define glCallLists glad_glCallLists +typedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); +GLAPI PFNGLDELETELISTSPROC glad_glDeleteLists; +#define glDeleteLists glad_glDeleteLists +typedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range); +GLAPI PFNGLGENLISTSPROC glad_glGenLists; +#define glGenLists glad_glGenLists +typedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base); +GLAPI PFNGLLISTBASEPROC glad_glListBase; +#define glListBase glad_glListBase +typedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode); +GLAPI PFNGLBEGINPROC glad_glBegin; +#define glBegin glad_glBegin +typedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI PFNGLBITMAPPROC glad_glBitmap; +#define glBitmap glad_glBitmap +typedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLCOLOR3BPROC glad_glColor3b; +#define glColor3b glad_glColor3b +typedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR3BVPROC glad_glColor3bv; +#define glColor3bv glad_glColor3bv +typedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLCOLOR3DPROC glad_glColor3d; +#define glColor3d glad_glColor3d +typedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR3DVPROC glad_glColor3dv; +#define glColor3dv glad_glColor3dv +typedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLCOLOR3FPROC glad_glColor3f; +#define glColor3f glad_glColor3f +typedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR3FVPROC glad_glColor3fv; +#define glColor3fv glad_glColor3fv +typedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLCOLOR3IPROC glad_glColor3i; +#define glColor3i glad_glColor3i +typedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR3IVPROC glad_glColor3iv; +#define glColor3iv glad_glColor3iv +typedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLCOLOR3SPROC glad_glColor3s; +#define glColor3s glad_glColor3s +typedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR3SVPROC glad_glColor3sv; +#define glColor3sv glad_glColor3sv +typedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLCOLOR3UBPROC glad_glColor3ub; +#define glColor3ub glad_glColor3ub +typedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv; +#define glColor3ubv glad_glColor3ubv +typedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLCOLOR3UIPROC glad_glColor3ui; +#define glColor3ui glad_glColor3ui +typedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv; +#define glColor3uiv glad_glColor3uiv +typedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLCOLOR3USPROC glad_glColor3us; +#define glColor3us glad_glColor3us +typedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR3USVPROC glad_glColor3usv; +#define glColor3usv glad_glColor3usv +typedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI PFNGLCOLOR4BPROC glad_glColor4b; +#define glColor4b glad_glColor4b +typedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR4BVPROC glad_glColor4bv; +#define glColor4bv glad_glColor4bv +typedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI PFNGLCOLOR4DPROC glad_glColor4d; +#define glColor4d glad_glColor4d +typedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR4DVPROC glad_glColor4dv; +#define glColor4dv glad_glColor4dv +typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCOLOR4FPROC glad_glColor4f; +#define glColor4f glad_glColor4f +typedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR4FVPROC glad_glColor4fv; +#define glColor4fv glad_glColor4fv +typedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); +GLAPI PFNGLCOLOR4IPROC glad_glColor4i; +#define glColor4i glad_glColor4i +typedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR4IVPROC glad_glColor4iv; +#define glColor4iv glad_glColor4iv +typedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI PFNGLCOLOR4SPROC glad_glColor4s; +#define glColor4s glad_glColor4s +typedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR4SVPROC glad_glColor4sv; +#define glColor4sv glad_glColor4sv +typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; +#define glColor4ub glad_glColor4ub +typedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv; +#define glColor4ubv glad_glColor4ubv +typedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI PFNGLCOLOR4UIPROC glad_glColor4ui; +#define glColor4ui glad_glColor4ui +typedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv; +#define glColor4uiv glad_glColor4uiv +typedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI PFNGLCOLOR4USPROC glad_glColor4us; +#define glColor4us glad_glColor4us +typedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR4USVPROC glad_glColor4usv; +#define glColor4usv glad_glColor4usv +typedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag); +GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag; +#define glEdgeFlag glad_glEdgeFlag +typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag); +GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; +#define glEdgeFlagv glad_glEdgeFlagv +typedef void (APIENTRYP PFNGLENDPROC)(); +GLAPI PFNGLENDPROC glad_glEnd; +#define glEnd glad_glEnd +typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c); +GLAPI PFNGLINDEXDPROC glad_glIndexd; +#define glIndexd glad_glIndexd +typedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c); +GLAPI PFNGLINDEXDVPROC glad_glIndexdv; +#define glIndexdv glad_glIndexdv +typedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c); +GLAPI PFNGLINDEXFPROC glad_glIndexf; +#define glIndexf glad_glIndexf +typedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c); +GLAPI PFNGLINDEXFVPROC glad_glIndexfv; +#define glIndexfv glad_glIndexfv +typedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c); +GLAPI PFNGLINDEXIPROC glad_glIndexi; +#define glIndexi glad_glIndexi +typedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c); +GLAPI PFNGLINDEXIVPROC glad_glIndexiv; +#define glIndexiv glad_glIndexiv +typedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c); +GLAPI PFNGLINDEXSPROC glad_glIndexs; +#define glIndexs glad_glIndexs +typedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c); +GLAPI PFNGLINDEXSVPROC glad_glIndexsv; +#define glIndexsv glad_glIndexsv +typedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI PFNGLNORMAL3BPROC glad_glNormal3b; +#define glNormal3b glad_glNormal3b +typedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v); +GLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv; +#define glNormal3bv glad_glNormal3bv +typedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI PFNGLNORMAL3DPROC glad_glNormal3d; +#define glNormal3d glad_glNormal3d +typedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v); +GLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv; +#define glNormal3dv glad_glNormal3dv +typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; +#define glNormal3f glad_glNormal3f +typedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v); +GLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv; +#define glNormal3fv glad_glNormal3fv +typedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); +GLAPI PFNGLNORMAL3IPROC glad_glNormal3i; +#define glNormal3i glad_glNormal3i +typedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v); +GLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv; +#define glNormal3iv glad_glNormal3iv +typedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); +GLAPI PFNGLNORMAL3SPROC glad_glNormal3s; +#define glNormal3s glad_glNormal3s +typedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v); +GLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv; +#define glNormal3sv glad_glNormal3sv +typedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d; +#define glRasterPos2d glad_glRasterPos2d +typedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; +#define glRasterPos2dv glad_glRasterPos2dv +typedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f; +#define glRasterPos2f glad_glRasterPos2f +typedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; +#define glRasterPos2fv glad_glRasterPos2fv +typedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i; +#define glRasterPos2i glad_glRasterPos2i +typedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; +#define glRasterPos2iv glad_glRasterPos2iv +typedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s; +#define glRasterPos2s glad_glRasterPos2s +typedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; +#define glRasterPos2sv glad_glRasterPos2sv +typedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d; +#define glRasterPos3d glad_glRasterPos3d +typedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; +#define glRasterPos3dv glad_glRasterPos3dv +typedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f; +#define glRasterPos3f glad_glRasterPos3f +typedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; +#define glRasterPos3fv glad_glRasterPos3fv +typedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i; +#define glRasterPos3i glad_glRasterPos3i +typedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; +#define glRasterPos3iv glad_glRasterPos3iv +typedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s; +#define glRasterPos3s glad_glRasterPos3s +typedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; +#define glRasterPos3sv glad_glRasterPos3sv +typedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d; +#define glRasterPos4d glad_glRasterPos4d +typedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; +#define glRasterPos4dv glad_glRasterPos4dv +typedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f; +#define glRasterPos4f glad_glRasterPos4f +typedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; +#define glRasterPos4fv glad_glRasterPos4fv +typedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i; +#define glRasterPos4i glad_glRasterPos4i +typedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; +#define glRasterPos4iv glad_glRasterPos4iv +typedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s; +#define glRasterPos4s glad_glRasterPos4s +typedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; +#define glRasterPos4sv glad_glRasterPos4sv +typedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI PFNGLRECTDPROC glad_glRectd; +#define glRectd glad_glRectd +typedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2); +GLAPI PFNGLRECTDVPROC glad_glRectdv; +#define glRectdv glad_glRectdv +typedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI PFNGLRECTFPROC glad_glRectf; +#define glRectf glad_glRectf +typedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2); +GLAPI PFNGLRECTFVPROC glad_glRectfv; +#define glRectfv glad_glRectfv +typedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI PFNGLRECTIPROC glad_glRecti; +#define glRecti glad_glRecti +typedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2); +GLAPI PFNGLRECTIVPROC glad_glRectiv; +#define glRectiv glad_glRectiv +typedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI PFNGLRECTSPROC glad_glRects; +#define glRects glad_glRects +typedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2); +GLAPI PFNGLRECTSVPROC glad_glRectsv; +#define glRectsv glad_glRectsv +typedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s); +GLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d; +#define glTexCoord1d glad_glTexCoord1d +typedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; +#define glTexCoord1dv glad_glTexCoord1dv +typedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s); +GLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f; +#define glTexCoord1f glad_glTexCoord1f +typedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; +#define glTexCoord1fv glad_glTexCoord1fv +typedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s); +GLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i; +#define glTexCoord1i glad_glTexCoord1i +typedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; +#define glTexCoord1iv glad_glTexCoord1iv +typedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s); +GLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s; +#define glTexCoord1s glad_glTexCoord1s +typedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; +#define glTexCoord1sv glad_glTexCoord1sv +typedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); +GLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d; +#define glTexCoord2d glad_glTexCoord2d +typedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; +#define glTexCoord2dv glad_glTexCoord2dv +typedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); +GLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f; +#define glTexCoord2f glad_glTexCoord2f +typedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; +#define glTexCoord2fv glad_glTexCoord2fv +typedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t); +GLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i; +#define glTexCoord2i glad_glTexCoord2i +typedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; +#define glTexCoord2iv glad_glTexCoord2iv +typedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); +GLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s; +#define glTexCoord2s glad_glTexCoord2s +typedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; +#define glTexCoord2sv glad_glTexCoord2sv +typedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d; +#define glTexCoord3d glad_glTexCoord3d +typedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; +#define glTexCoord3dv glad_glTexCoord3dv +typedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLTEXCOORD3FPROC glad_glTexCoord3f; +#define glTexCoord3f glad_glTexCoord3f +typedef void (APIENTRYP PFNGLTEXCOORD3FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; +#define glTexCoord3fv glad_glTexCoord3fv +typedef void (APIENTRYP PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); +GLAPI PFNGLTEXCOORD3IPROC glad_glTexCoord3i; +#define glTexCoord3i glad_glTexCoord3i +typedef void (APIENTRYP PFNGLTEXCOORD3IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; +#define glTexCoord3iv glad_glTexCoord3iv +typedef void (APIENTRYP PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); +GLAPI PFNGLTEXCOORD3SPROC glad_glTexCoord3s; +#define glTexCoord3s glad_glTexCoord3s +typedef void (APIENTRYP PFNGLTEXCOORD3SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; +#define glTexCoord3sv glad_glTexCoord3sv +typedef void (APIENTRYP PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLTEXCOORD4DPROC glad_glTexCoord4d; +#define glTexCoord4d glad_glTexCoord4d +typedef void (APIENTRYP PFNGLTEXCOORD4DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; +#define glTexCoord4dv glad_glTexCoord4dv +typedef void (APIENTRYP PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLTEXCOORD4FPROC glad_glTexCoord4f; +#define glTexCoord4f glad_glTexCoord4f +typedef void (APIENTRYP PFNGLTEXCOORD4FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; +#define glTexCoord4fv glad_glTexCoord4fv +typedef void (APIENTRYP PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLTEXCOORD4IPROC glad_glTexCoord4i; +#define glTexCoord4i glad_glTexCoord4i +typedef void (APIENTRYP PFNGLTEXCOORD4IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; +#define glTexCoord4iv glad_glTexCoord4iv +typedef void (APIENTRYP PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLTEXCOORD4SPROC glad_glTexCoord4s; +#define glTexCoord4s glad_glTexCoord4s +typedef void (APIENTRYP PFNGLTEXCOORD4SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; +#define glTexCoord4sv glad_glTexCoord4sv +typedef void (APIENTRYP PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLVERTEX2DPROC glad_glVertex2d; +#define glVertex2d glad_glVertex2d +typedef void (APIENTRYP PFNGLVERTEX2DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX2DVPROC glad_glVertex2dv; +#define glVertex2dv glad_glVertex2dv +typedef void (APIENTRYP PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLVERTEX2FPROC glad_glVertex2f; +#define glVertex2f glad_glVertex2f +typedef void (APIENTRYP PFNGLVERTEX2FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX2FVPROC glad_glVertex2fv; +#define glVertex2fv glad_glVertex2fv +typedef void (APIENTRYP PFNGLVERTEX2IPROC)(GLint x, GLint y); +GLAPI PFNGLVERTEX2IPROC glad_glVertex2i; +#define glVertex2i glad_glVertex2i +typedef void (APIENTRYP PFNGLVERTEX2IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX2IVPROC glad_glVertex2iv; +#define glVertex2iv glad_glVertex2iv +typedef void (APIENTRYP PFNGLVERTEX2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLVERTEX2SPROC glad_glVertex2s; +#define glVertex2s glad_glVertex2s +typedef void (APIENTRYP PFNGLVERTEX2SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX2SVPROC glad_glVertex2sv; +#define glVertex2sv glad_glVertex2sv +typedef void (APIENTRYP PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEX3DPROC glad_glVertex3d; +#define glVertex3d glad_glVertex3d +typedef void (APIENTRYP PFNGLVERTEX3DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX3DVPROC glad_glVertex3dv; +#define glVertex3dv glad_glVertex3dv +typedef void (APIENTRYP PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEX3FPROC glad_glVertex3f; +#define glVertex3f glad_glVertex3f +typedef void (APIENTRYP PFNGLVERTEX3FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX3FVPROC glad_glVertex3fv; +#define glVertex3fv glad_glVertex3fv +typedef void (APIENTRYP PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLVERTEX3IPROC glad_glVertex3i; +#define glVertex3i glad_glVertex3i +typedef void (APIENTRYP PFNGLVERTEX3IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX3IVPROC glad_glVertex3iv; +#define glVertex3iv glad_glVertex3iv +typedef void (APIENTRYP PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEX3SPROC glad_glVertex3s; +#define glVertex3s glad_glVertex3s +typedef void (APIENTRYP PFNGLVERTEX3SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX3SVPROC glad_glVertex3sv; +#define glVertex3sv glad_glVertex3sv +typedef void (APIENTRYP PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEX4DPROC glad_glVertex4d; +#define glVertex4d glad_glVertex4d +typedef void (APIENTRYP PFNGLVERTEX4DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX4DVPROC glad_glVertex4dv; +#define glVertex4dv glad_glVertex4dv +typedef void (APIENTRYP PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEX4FPROC glad_glVertex4f; +#define glVertex4f glad_glVertex4f +typedef void (APIENTRYP PFNGLVERTEX4FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX4FVPROC glad_glVertex4fv; +#define glVertex4fv glad_glVertex4fv +typedef void (APIENTRYP PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLVERTEX4IPROC glad_glVertex4i; +#define glVertex4i glad_glVertex4i +typedef void (APIENTRYP PFNGLVERTEX4IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX4IVPROC glad_glVertex4iv; +#define glVertex4iv glad_glVertex4iv +typedef void (APIENTRYP PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEX4SPROC glad_glVertex4s; +#define glVertex4s glad_glVertex4s +typedef void (APIENTRYP PFNGLVERTEX4SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX4SVPROC glad_glVertex4sv; +#define glVertex4sv glad_glVertex4sv +typedef void (APIENTRYP PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble *equation); +GLAPI PFNGLCLIPPLANEPROC glad_glClipPlane; +#define glClipPlane glad_glClipPlane +typedef void (APIENTRYP PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); +GLAPI PFNGLCOLORMATERIALPROC glad_glColorMaterial; +#define glColorMaterial glad_glColorMaterial +typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLFOGFPROC glad_glFogf; +#define glFogf glad_glFogf +typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLFOGFVPROC glad_glFogfv; +#define glFogfv glad_glFogfv +typedef void (APIENTRYP PFNGLFOGIPROC)(GLenum pname, GLint param); +GLAPI PFNGLFOGIPROC glad_glFogi; +#define glFogi glad_glFogi +typedef void (APIENTRYP PFNGLFOGIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLFOGIVPROC glad_glFogiv; +#define glFogiv glad_glFogiv +typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTFPROC glad_glLightf; +#define glLightf glad_glLightf +typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTFVPROC glad_glLightfv; +#define glLightfv glad_glLightfv +typedef void (APIENTRYP PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); +GLAPI PFNGLLIGHTIPROC glad_glLighti; +#define glLighti glad_glLighti +typedef void (APIENTRYP PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTIVPROC glad_glLightiv; +#define glLightiv glad_glLightiv +typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; +#define glLightModelf glad_glLightModelf +typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; +#define glLightModelfv glad_glLightModelfv +typedef void (APIENTRYP PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); +GLAPI PFNGLLIGHTMODELIPROC glad_glLightModeli; +#define glLightModeli glad_glLightModeli +typedef void (APIENTRYP PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTMODELIVPROC glad_glLightModeliv; +#define glLightModeliv glad_glLightModeliv +typedef void (APIENTRYP PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); +GLAPI PFNGLLINESTIPPLEPROC glad_glLineStipple; +#define glLineStipple glad_glLineStipple +typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); +GLAPI PFNGLMATERIALFPROC glad_glMaterialf; +#define glMaterialf glad_glMaterialf +typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); +GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; +#define glMaterialfv glad_glMaterialfv +typedef void (APIENTRYP PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); +GLAPI PFNGLMATERIALIPROC glad_glMateriali; +#define glMateriali glad_glMateriali +typedef void (APIENTRYP PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint *params); +GLAPI PFNGLMATERIALIVPROC glad_glMaterialiv; +#define glMaterialiv glad_glMaterialiv +typedef void (APIENTRYP PFNGLPOLYGONSTIPPLEPROC)(const GLubyte *mask); +GLAPI PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; +#define glPolygonStipple glad_glPolygonStipple +typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); +GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; +#define glShadeModel glad_glShadeModel +typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); +GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; +#define glTexEnvf glad_glTexEnvf +typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; +#define glTexEnvfv glad_glTexEnvfv +typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; +#define glTexEnvi glad_glTexEnvi +typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; +#define glTexEnviv glad_glTexEnviv +typedef void (APIENTRYP PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); +GLAPI PFNGLTEXGENDPROC glad_glTexGend; +#define glTexGend glad_glTexGend +typedef void (APIENTRYP PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble *params); +GLAPI PFNGLTEXGENDVPROC glad_glTexGendv; +#define glTexGendv glad_glTexGendv +typedef void (APIENTRYP PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); +GLAPI PFNGLTEXGENFPROC glad_glTexGenf; +#define glTexGenf glad_glTexGenf +typedef void (APIENTRYP PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXGENFVPROC glad_glTexGenfv; +#define glTexGenfv glad_glTexGenfv +typedef void (APIENTRYP PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); +GLAPI PFNGLTEXGENIPROC glad_glTexGeni; +#define glTexGeni glad_glTexGeni +typedef void (APIENTRYP PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint *params); +GLAPI PFNGLTEXGENIVPROC glad_glTexGeniv; +#define glTexGeniv glad_glTexGeniv +typedef void (APIENTRYP PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat *buffer); +GLAPI PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; +#define glFeedbackBuffer glad_glFeedbackBuffer +typedef void (APIENTRYP PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint *buffer); +GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer; +#define glSelectBuffer glad_glSelectBuffer +typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode); +GLAPI PFNGLRENDERMODEPROC glad_glRenderMode; +#define glRenderMode glad_glRenderMode +typedef void (APIENTRYP PFNGLINITNAMESPROC)(); +GLAPI PFNGLINITNAMESPROC glad_glInitNames; +#define glInitNames glad_glInitNames +typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name); +GLAPI PFNGLLOADNAMEPROC glad_glLoadName; +#define glLoadName glad_glLoadName +typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token); +GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough; +#define glPassThrough glad_glPassThrough +typedef void (APIENTRYP PFNGLPOPNAMEPROC)(); +GLAPI PFNGLPOPNAMEPROC glad_glPopName; +#define glPopName glad_glPopName +typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name); +GLAPI PFNGLPUSHNAMEPROC glad_glPushName; +#define glPushName glad_glPushName +typedef void (APIENTRYP PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARACCUMPROC glad_glClearAccum; +#define glClearAccum glad_glClearAccum +typedef void (APIENTRYP PFNGLCLEARINDEXPROC)(GLfloat c); +GLAPI PFNGLCLEARINDEXPROC glad_glClearIndex; +#define glClearIndex glad_glClearIndex +typedef void (APIENTRYP PFNGLINDEXMASKPROC)(GLuint mask); +GLAPI PFNGLINDEXMASKPROC glad_glIndexMask; +#define glIndexMask glad_glIndexMask +typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value); +GLAPI PFNGLACCUMPROC glad_glAccum; +#define glAccum glad_glAccum +typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(); +GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib; +#define glPopAttrib glad_glPopAttrib +typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHATTRIBPROC glad_glPushAttrib; +#define glPushAttrib glad_glPushAttrib +typedef void (APIENTRYP PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI PFNGLMAP1DPROC glad_glMap1d; +#define glMap1d glad_glMap1d +typedef void (APIENTRYP PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI PFNGLMAP1FPROC glad_glMap1f; +#define glMap1f glad_glMap1f +typedef void (APIENTRYP PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI PFNGLMAP2DPROC glad_glMap2d; +#define glMap2d glad_glMap2d +typedef void (APIENTRYP PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI PFNGLMAP2FPROC glad_glMap2f; +#define glMap2f glad_glMap2f +typedef void (APIENTRYP PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); +GLAPI PFNGLMAPGRID1DPROC glad_glMapGrid1d; +#define glMapGrid1d glad_glMapGrid1d +typedef void (APIENTRYP PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); +GLAPI PFNGLMAPGRID1FPROC glad_glMapGrid1f; +#define glMapGrid1f glad_glMapGrid1f +typedef void (APIENTRYP PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI PFNGLMAPGRID2DPROC glad_glMapGrid2d; +#define glMapGrid2d glad_glMapGrid2d +typedef void (APIENTRYP PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI PFNGLMAPGRID2FPROC glad_glMapGrid2f; +#define glMapGrid2f glad_glMapGrid2f +typedef void (APIENTRYP PFNGLEVALCOORD1DPROC)(GLdouble u); +GLAPI PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; +#define glEvalCoord1d glad_glEvalCoord1d +typedef void (APIENTRYP PFNGLEVALCOORD1DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; +#define glEvalCoord1dv glad_glEvalCoord1dv +typedef void (APIENTRYP PFNGLEVALCOORD1FPROC)(GLfloat u); +GLAPI PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; +#define glEvalCoord1f glad_glEvalCoord1f +typedef void (APIENTRYP PFNGLEVALCOORD1FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; +#define glEvalCoord1fv glad_glEvalCoord1fv +typedef void (APIENTRYP PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); +GLAPI PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; +#define glEvalCoord2d glad_glEvalCoord2d +typedef void (APIENTRYP PFNGLEVALCOORD2DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; +#define glEvalCoord2dv glad_glEvalCoord2dv +typedef void (APIENTRYP PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); +GLAPI PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; +#define glEvalCoord2f glad_glEvalCoord2f +typedef void (APIENTRYP PFNGLEVALCOORD2FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; +#define glEvalCoord2fv glad_glEvalCoord2fv +typedef void (APIENTRYP PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); +GLAPI PFNGLEVALMESH1PROC glad_glEvalMesh1; +#define glEvalMesh1 glad_glEvalMesh1 +typedef void (APIENTRYP PFNGLEVALPOINT1PROC)(GLint i); +GLAPI PFNGLEVALPOINT1PROC glad_glEvalPoint1; +#define glEvalPoint1 glad_glEvalPoint1 +typedef void (APIENTRYP PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI PFNGLEVALMESH2PROC glad_glEvalMesh2; +#define glEvalMesh2 glad_glEvalMesh2 +typedef void (APIENTRYP PFNGLEVALPOINT2PROC)(GLint i, GLint j); +GLAPI PFNGLEVALPOINT2PROC glad_glEvalPoint2; +#define glEvalPoint2 glad_glEvalPoint2 +typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); +GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; +#define glAlphaFunc glad_glAlphaFunc +typedef void (APIENTRYP PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); +GLAPI PFNGLPIXELZOOMPROC glad_glPixelZoom; +#define glPixelZoom glad_glPixelZoom +typedef void (APIENTRYP PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; +#define glPixelTransferf glad_glPixelTransferf +typedef void (APIENTRYP PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; +#define glPixelTransferi glad_glPixelTransferi +typedef void (APIENTRYP PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI PFNGLPIXELMAPFVPROC glad_glPixelMapfv; +#define glPixelMapfv glad_glPixelMapfv +typedef void (APIENTRYP PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; +#define glPixelMapuiv glad_glPixelMapuiv +typedef void (APIENTRYP PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; +#define glPixelMapusv glad_glPixelMapusv +typedef void (APIENTRYP PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI PFNGLCOPYPIXELSPROC glad_glCopyPixels; +#define glCopyPixels glad_glCopyPixels +typedef void (APIENTRYP PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLDRAWPIXELSPROC glad_glDrawPixels; +#define glDrawPixels glad_glDrawPixels +typedef void (APIENTRYP PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble *equation); +GLAPI PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; +#define glGetClipPlane glad_glGetClipPlane +typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); +GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; +#define glGetLightfv glad_glGetLightfv +typedef void (APIENTRYP PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint *params); +GLAPI PFNGLGETLIGHTIVPROC glad_glGetLightiv; +#define glGetLightiv glad_glGetLightiv +typedef void (APIENTRYP PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble *v); +GLAPI PFNGLGETMAPDVPROC glad_glGetMapdv; +#define glGetMapdv glad_glGetMapdv +typedef void (APIENTRYP PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat *v); +GLAPI PFNGLGETMAPFVPROC glad_glGetMapfv; +#define glGetMapfv glad_glGetMapfv +typedef void (APIENTRYP PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint *v); +GLAPI PFNGLGETMAPIVPROC glad_glGetMapiv; +#define glGetMapiv glad_glGetMapiv +typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); +GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; +#define glGetMaterialfv glad_glGetMaterialfv +typedef void (APIENTRYP PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint *params); +GLAPI PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; +#define glGetMaterialiv glad_glGetMaterialiv +typedef void (APIENTRYP PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat *values); +GLAPI PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; +#define glGetPixelMapfv glad_glGetPixelMapfv +typedef void (APIENTRYP PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint *values); +GLAPI PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; +#define glGetPixelMapuiv glad_glGetPixelMapuiv +typedef void (APIENTRYP PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort *values); +GLAPI PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; +#define glGetPixelMapusv glad_glGetPixelMapusv +typedef void (APIENTRYP PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte *mask); +GLAPI PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; +#define glGetPolygonStipple glad_glGetPolygonStipple +typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; +#define glGetTexEnvfv glad_glGetTexEnvfv +typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; +#define glGetTexEnviv glad_glGetTexEnviv +typedef void (APIENTRYP PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble *params); +GLAPI PFNGLGETTEXGENDVPROC glad_glGetTexGendv; +#define glGetTexGendv glad_glGetTexGendv +typedef void (APIENTRYP PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; +#define glGetTexGenfv glad_glGetTexGenfv +typedef void (APIENTRYP PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; +#define glGetTexGeniv glad_glGetTexGeniv +typedef GLboolean (APIENTRYP PFNGLISLISTPROC)(GLuint list); +GLAPI PFNGLISLISTPROC glad_glIsList; +#define glIsList glad_glIsList +typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLFRUSTUMPROC glad_glFrustum; +#define glFrustum glad_glFrustum +typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(); +GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; +#define glLoadIdentity glad_glLoadIdentity +typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; +#define glLoadMatrixf glad_glLoadMatrixf +typedef void (APIENTRYP PFNGLLOADMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; +#define glLoadMatrixd glad_glLoadMatrixd +typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); +GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; +#define glMatrixMode glad_glMatrixMode +typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; +#define glMultMatrixf glad_glMultMatrixf +typedef void (APIENTRYP PFNGLMULTMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd; +#define glMultMatrixd glad_glMultMatrixd +typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLORTHOPROC glad_glOrtho; +#define glOrtho glad_glOrtho +typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(); +GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix; +#define glPopMatrix glad_glPopMatrix +typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(); +GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix; +#define glPushMatrix glad_glPushMatrix +typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLROTATEDPROC glad_glRotated; +#define glRotated glad_glRotated +typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLROTATEFPROC glad_glRotatef; +#define glRotatef glad_glRotatef +typedef void (APIENTRYP PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLSCALEDPROC glad_glScaled; +#define glScaled glad_glScaled +typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLSCALEFPROC glad_glScalef; +#define glScalef glad_glScalef +typedef void (APIENTRYP PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLTRANSLATEDPROC glad_glTranslated; +#define glTranslated glad_glTranslated +typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; +#define glTranslatef glad_glTranslatef +#endif +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +GLAPI int GLAD_GL_VERSION_1_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; +#define glDrawArrays glad_glDrawArrays +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; +#define glDrawElements glad_glDrawElements +typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); +GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; +#define glGetPointerv glad_glGetPointerv +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +#define glPolygonOffset glad_glPolygonOffset +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +#define glCopyTexImage1D glad_glCopyTexImage1D +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +#define glCopyTexImage2D glad_glCopyTexImage2D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +#define glCopyTexSubImage1D glad_glCopyTexSubImage1D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +#define glCopyTexSubImage2D glad_glCopyTexSubImage2D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +#define glTexSubImage1D glad_glTexSubImage1D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +#define glTexSubImage2D glad_glTexSubImage2D +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; +#define glBindTexture glad_glBindTexture +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); +GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +#define glDeleteTextures glad_glDeleteTextures +typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); +GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; +#define glGenTextures glad_glGenTextures +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); +GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; +#define glIsTexture glad_glIsTexture +typedef void (APIENTRYP PFNGLARRAYELEMENTPROC)(GLint i); +GLAPI PFNGLARRAYELEMENTPROC glad_glArrayElement; +#define glArrayElement glad_glArrayElement +typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; +#define glColorPointer glad_glColorPointer +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; +#define glDisableClientState glad_glDisableClientState +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void *pointer); +GLAPI PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; +#define glEdgeFlagPointer glad_glEdgeFlagPointer +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; +#define glEnableClientState glad_glEnableClientState +typedef void (APIENTRYP PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLINDEXPOINTERPROC glad_glIndexPointer; +#define glIndexPointer glad_glIndexPointer +typedef void (APIENTRYP PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void *pointer); +GLAPI PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; +#define glInterleavedArrays glad_glInterleavedArrays +typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; +#define glNormalPointer glad_glNormalPointer +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; +#define glTexCoordPointer glad_glTexCoordPointer +typedef void (APIENTRYP PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXPOINTERPROC glad_glVertexPointer; +#define glVertexPointer glad_glVertexPointer +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; +#define glAreTexturesResident glad_glAreTexturesResident +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint *textures, const GLfloat *priorities); +GLAPI PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; +#define glPrioritizeTextures glad_glPrioritizeTextures +typedef void (APIENTRYP PFNGLINDEXUBPROC)(GLubyte c); +GLAPI PFNGLINDEXUBPROC glad_glIndexub; +#define glIndexub glad_glIndexub +typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c); +GLAPI PFNGLINDEXUBVPROC glad_glIndexubv; +#define glIndexubv glad_glIndexubv +typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(); +GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; +#define glPopClientAttrib glad_glPopClientAttrib +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; +#define glPushClientAttrib glad_glPushClientAttrib +#endif +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +GLAPI int GLAD_GL_VERSION_1_2; +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +#define glDrawRangeElements glad_glDrawRangeElements +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +#define glTexImage3D glad_glTexImage3D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +#define glTexSubImage3D glad_glTexSubImage3D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +#define glCopyTexSubImage3D glad_glCopyTexSubImage3D +#endif +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +GLAPI int GLAD_GL_VERSION_1_3; +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +#define glActiveTexture glad_glActiveTexture +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +#define glSampleCoverage glad_glSampleCoverage +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +#define glCompressedTexImage3D glad_glCompressedTexImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +#define glCompressedTexImage2D glad_glCompressedTexImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +#define glCompressedTexImage1D glad_glCompressedTexImage1D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); +GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +#define glGetCompressedTexImage glad_glGetCompressedTexImage +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; +#define glClientActiveTexture glad_glClientActiveTexture +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); +GLAPI PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; +#define glMultiTexCoord1d glad_glMultiTexCoord1d +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; +#define glMultiTexCoord1dv glad_glMultiTexCoord1dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); +GLAPI PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; +#define glMultiTexCoord1f glad_glMultiTexCoord1f +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; +#define glMultiTexCoord1fv glad_glMultiTexCoord1fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); +GLAPI PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; +#define glMultiTexCoord1i glad_glMultiTexCoord1i +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; +#define glMultiTexCoord1iv glad_glMultiTexCoord1iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); +GLAPI PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; +#define glMultiTexCoord1s glad_glMultiTexCoord1s +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; +#define glMultiTexCoord1sv glad_glMultiTexCoord1sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); +GLAPI PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; +#define glMultiTexCoord2d glad_glMultiTexCoord2d +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; +#define glMultiTexCoord2dv glad_glMultiTexCoord2dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); +GLAPI PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; +#define glMultiTexCoord2f glad_glMultiTexCoord2f +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; +#define glMultiTexCoord2fv glad_glMultiTexCoord2fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); +GLAPI PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; +#define glMultiTexCoord2i glad_glMultiTexCoord2i +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; +#define glMultiTexCoord2iv glad_glMultiTexCoord2iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); +GLAPI PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; +#define glMultiTexCoord2s glad_glMultiTexCoord2s +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; +#define glMultiTexCoord2sv glad_glMultiTexCoord2sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; +#define glMultiTexCoord3d glad_glMultiTexCoord3d +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; +#define glMultiTexCoord3dv glad_glMultiTexCoord3dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; +#define glMultiTexCoord3f glad_glMultiTexCoord3f +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; +#define glMultiTexCoord3fv glad_glMultiTexCoord3fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); +GLAPI PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; +#define glMultiTexCoord3i glad_glMultiTexCoord3i +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; +#define glMultiTexCoord3iv glad_glMultiTexCoord3iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; +#define glMultiTexCoord3s glad_glMultiTexCoord3s +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; +#define glMultiTexCoord3sv glad_glMultiTexCoord3sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; +#define glMultiTexCoord4d glad_glMultiTexCoord4d +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; +#define glMultiTexCoord4dv glad_glMultiTexCoord4dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; +#define glMultiTexCoord4f glad_glMultiTexCoord4f +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; +#define glMultiTexCoord4fv glad_glMultiTexCoord4fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; +#define glMultiTexCoord4i glad_glMultiTexCoord4i +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; +#define glMultiTexCoord4iv glad_glMultiTexCoord4iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; +#define glMultiTexCoord4s glad_glMultiTexCoord4s +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; +#define glMultiTexCoord4sv glad_glMultiTexCoord4sv +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; +#define glLoadTransposeMatrixf glad_glLoadTransposeMatrixf +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; +#define glLoadTransposeMatrixd glad_glLoadTransposeMatrixd +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; +#define glMultTransposeMatrixf glad_glMultTransposeMatrixf +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; +#define glMultTransposeMatrixd glad_glMultTransposeMatrixd +#endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +GLAPI int GLAD_GL_VERSION_1_4; +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +#define glBlendFuncSeparate glad_glBlendFuncSeparate +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +#define glMultiDrawArrays glad_glMultiDrawArrays +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +#define glMultiDrawElements glad_glMultiDrawElements +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +#define glPointParameterf glad_glPointParameterf +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +#define glPointParameterfv glad_glPointParameterfv +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +#define glPointParameteri glad_glPointParameteri +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +#define glPointParameteriv glad_glPointParameteriv +typedef void (APIENTRYP PFNGLFOGCOORDFPROC)(GLfloat coord); +GLAPI PFNGLFOGCOORDFPROC glad_glFogCoordf; +#define glFogCoordf glad_glFogCoordf +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC)(const GLfloat *coord); +GLAPI PFNGLFOGCOORDFVPROC glad_glFogCoordfv; +#define glFogCoordfv glad_glFogCoordfv +typedef void (APIENTRYP PFNGLFOGCOORDDPROC)(GLdouble coord); +GLAPI PFNGLFOGCOORDDPROC glad_glFogCoordd; +#define glFogCoordd glad_glFogCoordd +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC)(const GLdouble *coord); +GLAPI PFNGLFOGCOORDDVPROC glad_glFogCoorddv; +#define glFogCoorddv glad_glFogCoorddv +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; +#define glFogCoordPointer glad_glFogCoordPointer +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; +#define glSecondaryColor3b glad_glSecondaryColor3b +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; +#define glSecondaryColor3bv glad_glSecondaryColor3bv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; +#define glSecondaryColor3d glad_glSecondaryColor3d +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; +#define glSecondaryColor3dv glad_glSecondaryColor3dv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; +#define glSecondaryColor3f glad_glSecondaryColor3f +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; +#define glSecondaryColor3fv glad_glSecondaryColor3fv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; +#define glSecondaryColor3i glad_glSecondaryColor3i +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; +#define glSecondaryColor3iv glad_glSecondaryColor3iv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; +#define glSecondaryColor3s glad_glSecondaryColor3s +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; +#define glSecondaryColor3sv glad_glSecondaryColor3sv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; +#define glSecondaryColor3ub glad_glSecondaryColor3ub +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; +#define glSecondaryColor3ubv glad_glSecondaryColor3ubv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; +#define glSecondaryColor3ui glad_glSecondaryColor3ui +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; +#define glSecondaryColor3uiv glad_glSecondaryColor3uiv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; +#define glSecondaryColor3us glad_glSecondaryColor3us +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; +#define glSecondaryColor3usv glad_glSecondaryColor3usv +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; +#define glSecondaryColorPointer glad_glSecondaryColorPointer +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; +#define glWindowPos2d glad_glWindowPos2d +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; +#define glWindowPos2dv glad_glWindowPos2dv +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; +#define glWindowPos2f glad_glWindowPos2f +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; +#define glWindowPos2fv glad_glWindowPos2fv +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; +#define glWindowPos2i glad_glWindowPos2i +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; +#define glWindowPos2iv glad_glWindowPos2iv +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; +#define glWindowPos2s glad_glWindowPos2s +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; +#define glWindowPos2sv glad_glWindowPos2sv +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; +#define glWindowPos3d glad_glWindowPos3d +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; +#define glWindowPos3dv glad_glWindowPos3dv +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; +#define glWindowPos3f glad_glWindowPos3f +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; +#define glWindowPos3fv glad_glWindowPos3fv +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; +#define glWindowPos3i glad_glWindowPos3i +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; +#define glWindowPos3iv glad_glWindowPos3iv +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; +#define glWindowPos3s glad_glWindowPos3s +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; +#define glWindowPos3sv glad_glWindowPos3sv +typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; +#define glBlendColor glad_glBlendColor +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); +GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +#define glBlendEquation glad_glBlendEquation +#endif +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +GLAPI int GLAD_GL_VERSION_1_5; +typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; +#define glGenQueries glad_glGenQueries +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); +GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +#define glDeleteQueries glad_glDeleteQueries +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); +GLAPI PFNGLISQUERYPROC glad_glIsQuery; +#define glIsQuery glad_glIsQuery +typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); +GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; +#define glBeginQuery glad_glBeginQuery +typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); +GLAPI PFNGLENDQUERYPROC glad_glEndQuery; +#define glEndQuery glad_glEndQuery +typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; +#define glGetQueryiv glad_glGetQueryiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +#define glGetQueryObjectiv glad_glGetQueryObjectiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); +GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +#define glGetQueryObjectuiv glad_glGetQueryObjectuiv +typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; +#define glBindBuffer glad_glBindBuffer +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); +GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +#define glDeleteBuffers glad_glDeleteBuffers +typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); +GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; +#define glGenBuffers glad_glGenBuffers +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); +GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; +#define glIsBuffer glad_glIsBuffer +typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; +#define glBufferData glad_glBufferData +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +#define glBufferSubData glad_glBufferSubData +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +#define glGetBufferSubData glad_glGetBufferSubData +typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); +GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; +#define glMapBuffer glad_glMapBuffer +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); +GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +#define glUnmapBuffer glad_glUnmapBuffer +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +#define glGetBufferParameteriv glad_glGetBufferParameteriv +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); +GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +#define glGetBufferPointerv glad_glGetBufferPointerv +#endif +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +GLAPI int GLAD_GL_VERSION_2_0; +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +#define glBlendEquationSeparate glad_glBlendEquationSeparate +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); +GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +#define glDrawBuffers glad_glDrawBuffers +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +#define glStencilOpSeparate glad_glStencilOpSeparate +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +#define glStencilFuncSeparate glad_glStencilFuncSeparate +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +#define glStencilMaskSeparate glad_glStencilMaskSeparate +typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; +#define glAttachShader glad_glAttachShader +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); +GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +#define glBindAttribLocation glad_glBindAttribLocation +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); +GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; +#define glCompileShader glad_glCompileShader +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(); +GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +#define glCreateProgram glad_glCreateProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); +GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; +#define glCreateShader glad_glCreateShader +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); +GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +#define glDeleteProgram glad_glDeleteProgram +typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); +GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; +#define glDeleteShader glad_glDeleteShader +typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; +#define glDetachShader glad_glDetachShader +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +#define glDisableVertexAttribArray glad_glDisableVertexAttribArray +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +#define glEnableVertexAttribArray glad_glEnableVertexAttribArray +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +#define glGetActiveAttrib glad_glGetActiveAttrib +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +#define glGetActiveUniform glad_glGetActiveUniform +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +#define glGetAttachedShaders glad_glGetAttachedShaders +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +#define glGetAttribLocation glad_glGetAttribLocation +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +#define glGetProgramiv glad_glGetProgramiv +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +#define glGetProgramInfoLog glad_glGetProgramInfoLog +typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); +GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; +#define glGetShaderiv glad_glGetShaderiv +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +#define glGetShaderInfoLog glad_glGetShaderInfoLog +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +#define glGetShaderSource glad_glGetShaderSource +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +#define glGetUniformLocation glad_glGetUniformLocation +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); +GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +#define glGetUniformfv glad_glGetUniformfv +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); +GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +#define glGetUniformiv glad_glGetUniformiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); +GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +#define glGetVertexAttribdv glad_glGetVertexAttribdv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); +GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +#define glGetVertexAttribfv glad_glGetVertexAttribfv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +#define glGetVertexAttribiv glad_glGetVertexAttribiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); +GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); +GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; +#define glIsProgram glad_glIsProgram +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); +GLAPI PFNGLISSHADERPROC glad_glIsShader; +#define glIsShader glad_glIsShader +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); +GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; +#define glLinkProgram glad_glLinkProgram +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; +#define glShaderSource glad_glShaderSource +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); +GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; +#define glUseProgram glad_glUseProgram +typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; +#define glUniform1f glad_glUniform1f +typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; +#define glUniform2f glad_glUniform2f +typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; +#define glUniform3f glad_glUniform3f +typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; +#define glUniform4f glad_glUniform4f +typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; +#define glUniform1i glad_glUniform1i +typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; +#define glUniform2i glad_glUniform2i +typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; +#define glUniform3i glad_glUniform3i +typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; +#define glUniform4i glad_glUniform4i +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; +#define glUniform1fv glad_glUniform1fv +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; +#define glUniform2fv glad_glUniform2fv +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; +#define glUniform3fv glad_glUniform3fv +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; +#define glUniform4fv glad_glUniform4fv +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; +#define glUniform1iv glad_glUniform1iv +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; +#define glUniform2iv glad_glUniform2iv +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; +#define glUniform3iv glad_glUniform3iv +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; +#define glUniform4iv glad_glUniform4iv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +#define glUniformMatrix2fv glad_glUniformMatrix2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +#define glUniformMatrix3fv glad_glUniformMatrix3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +#define glUniformMatrix4fv glad_glUniformMatrix4fv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); +GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +#define glValidateProgram glad_glValidateProgram +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); +GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +#define glVertexAttrib1d glad_glVertexAttrib1d +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +#define glVertexAttrib1dv glad_glVertexAttrib1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +#define glVertexAttrib1f glad_glVertexAttrib1f +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +#define glVertexAttrib1fv glad_glVertexAttrib1fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); +GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +#define glVertexAttrib1s glad_glVertexAttrib1s +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +#define glVertexAttrib1sv glad_glVertexAttrib1sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); +GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +#define glVertexAttrib2d glad_glVertexAttrib2d +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +#define glVertexAttrib2dv glad_glVertexAttrib2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +#define glVertexAttrib2f glad_glVertexAttrib2f +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +#define glVertexAttrib2fv glad_glVertexAttrib2fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); +GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +#define glVertexAttrib2s glad_glVertexAttrib2s +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +#define glVertexAttrib2sv glad_glVertexAttrib2sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +#define glVertexAttrib3d glad_glVertexAttrib3d +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +#define glVertexAttrib3dv glad_glVertexAttrib3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +#define glVertexAttrib3f glad_glVertexAttrib3f +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +#define glVertexAttrib3fv glad_glVertexAttrib3fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +#define glVertexAttrib3s glad_glVertexAttrib3s +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +#define glVertexAttrib3sv glad_glVertexAttrib3sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +#define glVertexAttrib4Niv glad_glVertexAttrib4Niv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +#define glVertexAttrib4Nub glad_glVertexAttrib4Nub +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +#define glVertexAttrib4bv glad_glVertexAttrib4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +#define glVertexAttrib4d glad_glVertexAttrib4d +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +#define glVertexAttrib4dv glad_glVertexAttrib4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +#define glVertexAttrib4f glad_glVertexAttrib4f +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +#define glVertexAttrib4fv glad_glVertexAttrib4fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +#define glVertexAttrib4iv glad_glVertexAttrib4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +#define glVertexAttrib4s glad_glVertexAttrib4s +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +#define glVertexAttrib4sv glad_glVertexAttrib4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +#define glVertexAttrib4ubv glad_glVertexAttrib4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +#define glVertexAttrib4uiv glad_glVertexAttrib4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +#define glVertexAttrib4usv glad_glVertexAttrib4usv +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +#define glVertexAttribPointer glad_glVertexAttribPointer +#endif +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +GLAPI int GLAD_GL_VERSION_2_1; +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv +#endif +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +GLAPI int GLAD_GL_VERSION_3_0; +typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; +#define glColorMaski glad_glColorMaski +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); +GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +#define glGetBooleani_v glad_glGetBooleani_v +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); +GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +#define glGetIntegeri_v glad_glGetIntegeri_v +typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); +GLAPI PFNGLENABLEIPROC glad_glEnablei; +#define glEnablei glad_glEnablei +typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); +GLAPI PFNGLDISABLEIPROC glad_glDisablei; +#define glDisablei glad_glDisablei +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); +GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; +#define glIsEnabledi glad_glIsEnabledi +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); +GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +#define glBeginTransformFeedback glad_glBeginTransformFeedback +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(); +GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +#define glEndTransformFeedback glad_glEndTransformFeedback +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +#define glBindBufferRange glad_glBindBufferRange +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); +GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +#define glBindBufferBase glad_glBindBufferBase +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); +GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; +#define glClampColor glad_glClampColor +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); +GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +#define glBeginConditionalRender glad_glBeginConditionalRender +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(); +GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +#define glEndConditionalRender glad_glEndConditionalRender +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +#define glVertexAttribIPointer glad_glVertexAttribIPointer +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +#define glGetVertexAttribIiv glad_glGetVertexAttribIiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); +GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); +GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +#define glVertexAttribI1i glad_glVertexAttribI1i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); +GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +#define glVertexAttribI2i glad_glVertexAttribI2i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); +GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +#define glVertexAttribI3i glad_glVertexAttribI3i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +#define glVertexAttribI4i glad_glVertexAttribI4i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); +GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +#define glVertexAttribI1ui glad_glVertexAttribI1ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); +GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +#define glVertexAttribI2ui glad_glVertexAttribI2ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +#define glVertexAttribI3ui glad_glVertexAttribI3ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +#define glVertexAttribI4ui glad_glVertexAttribI4ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +#define glVertexAttribI1iv glad_glVertexAttribI1iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +#define glVertexAttribI2iv glad_glVertexAttribI2iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +#define glVertexAttribI3iv glad_glVertexAttribI3iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +#define glVertexAttribI4iv glad_glVertexAttribI4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +#define glVertexAttribI1uiv glad_glVertexAttribI1uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +#define glVertexAttribI2uiv glad_glVertexAttribI2uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +#define glVertexAttribI3uiv glad_glVertexAttribI3uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +#define glVertexAttribI4uiv glad_glVertexAttribI4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +#define glVertexAttribI4bv glad_glVertexAttribI4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +#define glVertexAttribI4sv glad_glVertexAttribI4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +#define glVertexAttribI4ubv glad_glVertexAttribI4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +#define glVertexAttribI4usv glad_glVertexAttribI4usv +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); +GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +#define glGetUniformuiv glad_glGetUniformuiv +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); +GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +#define glBindFragDataLocation glad_glBindFragDataLocation +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +#define glGetFragDataLocation glad_glGetFragDataLocation +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); +GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; +#define glUniform1ui glad_glUniform1ui +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); +GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; +#define glUniform2ui glad_glUniform2ui +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; +#define glUniform3ui glad_glUniform3ui +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; +#define glUniform4ui glad_glUniform4ui +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +#define glUniform1uiv glad_glUniform1uiv +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +#define glUniform2uiv glad_glUniform2uiv +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +#define glUniform3uiv glad_glUniform3uiv +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +#define glUniform4uiv glad_glUniform4uiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +#define glTexParameterIiv glad_glTexParameterIiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); +GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +#define glTexParameterIuiv glad_glTexParameterIuiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +#define glGetTexParameterIiv glad_glGetTexParameterIiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); +GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +#define glGetTexParameterIuiv glad_glGetTexParameterIuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +#define glClearBufferiv glad_glClearBufferiv +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +#define glClearBufferuiv glad_glClearBufferuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +#define glClearBufferfv glad_glClearBufferfv +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +#define glClearBufferfi glad_glClearBufferfi +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); +GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; +#define glGetStringi glad_glGetStringi +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); +GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +#define glIsRenderbuffer glad_glIsRenderbuffer +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); +GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +#define glBindRenderbuffer glad_glBindRenderbuffer +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); +GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +#define glDeleteRenderbuffers glad_glDeleteRenderbuffers +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); +GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +#define glGenRenderbuffers glad_glGenRenderbuffers +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +#define glRenderbufferStorage glad_glRenderbufferStorage +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); +GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +#define glIsFramebuffer glad_glIsFramebuffer +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +#define glBindFramebuffer glad_glBindFramebuffer +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); +GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +#define glDeleteFramebuffers glad_glDeleteFramebuffers +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); +GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +#define glGenFramebuffers glad_glGenFramebuffers +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); +GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +#define glCheckFramebufferStatus glad_glCheckFramebufferStatus +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +#define glFramebufferTexture1D glad_glFramebufferTexture1D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +#define glFramebufferTexture2D glad_glFramebufferTexture2D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +#define glFramebufferTexture3D glad_glFramebufferTexture3D +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); +GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +#define glGenerateMipmap glad_glGenerateMipmap +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +#define glBlitFramebuffer glad_glBlitFramebuffer +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +#define glFramebufferTextureLayer glad_glFramebufferTextureLayer +typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +#define glMapBufferRange glad_glMapBufferRange +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +#define glFlushMappedBufferRange glad_glFlushMappedBufferRange +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); +GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +#define glBindVertexArray glad_glBindVertexArray +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); +GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +#define glDeleteVertexArrays glad_glDeleteVertexArrays +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); +GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +#define glGenVertexArrays glad_glGenVertexArrays +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); +GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +#define glIsVertexArray glad_glIsVertexArray +#endif +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +GLAPI int GLAD_GL_VERSION_3_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +#define glDrawArraysInstanced glad_glDrawArraysInstanced +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +#define glDrawElementsInstanced glad_glDrawElementsInstanced +typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); +GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; +#define glTexBuffer glad_glTexBuffer +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); +GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +#define glCopyBufferSubData glad_glCopyBufferSubData +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +#define glGetUniformIndices glad_glGetUniformIndices +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +#define glGetActiveUniformsiv glad_glGetActiveUniformsiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +#define glGetActiveUniformName glad_glGetActiveUniformName +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); +GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +#define glGetUniformBlockIndex glad_glGetUniformBlockIndex +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +#define glUniformBlockBinding glad_glUniformBlockBinding +#endif +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +GLAPI int GLAD_GL_VERSION_3_2; +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +#define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +#define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +#define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +#define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); +GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +#define glProvokingVertex glad_glProvokingVertex +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); +GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; +#define glFenceSync glad_glFenceSync +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync sync); +GLAPI PFNGLISSYNCPROC glad_glIsSync; +#define glIsSync glad_glIsSync +typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); +GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; +#define glDeleteSync glad_glDeleteSync +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +#define glClientWaitSync glad_glClientWaitSync +typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; +#define glWaitSync glad_glWaitSync +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); +GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +#define glGetInteger64v glad_glGetInteger64v +typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; +#define glGetSynciv glad_glGetSynciv +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); +GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +#define glGetInteger64i_v glad_glGetInteger64i_v +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); +GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +#define glGetBufferParameteri64v glad_glGetBufferParameteri64v +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +#define glFramebufferTexture glad_glFramebufferTexture +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +#define glTexImage2DMultisample glad_glTexImage2DMultisample +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +#define glTexImage3DMultisample glad_glTexImage3DMultisample +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat *val); +GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +#define glGetMultisamplefv glad_glGetMultisamplefv +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); +GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +#define glSampleMaski glad_glSampleMaski +#endif +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +GLAPI int GLAD_GL_VERSION_3_3; +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; +#define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; +#define glGetFragDataIndex glad_glGetFragDataIndex +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); +GLAPI PFNGLGENSAMPLERSPROC glad_glGenSamplers; +#define glGenSamplers glad_glGenSamplers +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); +GLAPI PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; +#define glDeleteSamplers glad_glDeleteSamplers +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); +GLAPI PFNGLISSAMPLERPROC glad_glIsSampler; +#define glIsSampler glad_glIsSampler +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); +GLAPI PFNGLBINDSAMPLERPROC glad_glBindSampler; +#define glBindSampler glad_glBindSampler +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); +GLAPI PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; +#define glSamplerParameteri glad_glSamplerParameteri +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +GLAPI PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; +#define glSamplerParameteriv glad_glSamplerParameteriv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); +GLAPI PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; +#define glSamplerParameterf glad_glSamplerParameterf +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; +#define glSamplerParameterfv glad_glSamplerParameterfv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +GLAPI PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; +#define glSamplerParameterIiv glad_glSamplerParameterIiv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint *param); +GLAPI PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; +#define glSamplerParameterIuiv glad_glSamplerParameterIuiv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; +#define glGetSamplerParameteriv glad_glGetSamplerParameteriv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; +#define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); +GLAPI PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; +#define glGetSamplerParameterfv glad_glGetSamplerParameterfv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; +#define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); +GLAPI PFNGLQUERYCOUNTERPROC glad_glQueryCounter; +#define glQueryCounter glad_glQueryCounter +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 *params); +GLAPI PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; +#define glGetQueryObjecti64v glad_glGetQueryObjecti64v +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 *params); +GLAPI PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; +#define glGetQueryObjectui64v glad_glGetQueryObjectui64v +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); +GLAPI PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; +#define glVertexAttribDivisor glad_glVertexAttribDivisor +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; +#define glVertexAttribP1ui glad_glVertexAttribP1ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; +#define glVertexAttribP1uiv glad_glVertexAttribP1uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; +#define glVertexAttribP2ui glad_glVertexAttribP2ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; +#define glVertexAttribP2uiv glad_glVertexAttribP2uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; +#define glVertexAttribP3ui glad_glVertexAttribP3ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; +#define glVertexAttribP3uiv glad_glVertexAttribP3uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; +#define glVertexAttribP4ui glad_glVertexAttribP4ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; +#define glVertexAttribP4uiv glad_glVertexAttribP4uiv +typedef void (APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP2UIPROC glad_glVertexP2ui; +#define glVertexP2ui glad_glVertexP2ui +typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; +#define glVertexP2uiv glad_glVertexP2uiv +typedef void (APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP3UIPROC glad_glVertexP3ui; +#define glVertexP3ui glad_glVertexP3ui +typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; +#define glVertexP3uiv glad_glVertexP3uiv +typedef void (APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP4UIPROC glad_glVertexP4ui; +#define glVertexP4ui glad_glVertexP4ui +typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; +#define glVertexP4uiv glad_glVertexP4uiv +typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; +#define glTexCoordP1ui glad_glTexCoordP1ui +typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; +#define glTexCoordP1uiv glad_glTexCoordP1uiv +typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; +#define glTexCoordP2ui glad_glTexCoordP2ui +typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; +#define glTexCoordP2uiv glad_glTexCoordP2uiv +typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; +#define glTexCoordP3ui glad_glTexCoordP3ui +typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; +#define glTexCoordP3uiv glad_glTexCoordP3uiv +typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; +#define glTexCoordP4ui glad_glTexCoordP4ui +typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; +#define glTexCoordP4uiv glad_glTexCoordP4uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; +#define glMultiTexCoordP1ui glad_glMultiTexCoordP1ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; +#define glMultiTexCoordP1uiv glad_glMultiTexCoordP1uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; +#define glMultiTexCoordP2ui glad_glMultiTexCoordP2ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; +#define glMultiTexCoordP2uiv glad_glMultiTexCoordP2uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; +#define glMultiTexCoordP3ui glad_glMultiTexCoordP3ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; +#define glMultiTexCoordP3uiv glad_glMultiTexCoordP3uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; +#define glMultiTexCoordP4ui glad_glMultiTexCoordP4ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; +#define glMultiTexCoordP4uiv glad_glMultiTexCoordP4uiv +typedef void (APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLNORMALP3UIPROC glad_glNormalP3ui; +#define glNormalP3ui glad_glNormalP3ui +typedef void (APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; +#define glNormalP3uiv glad_glNormalP3uiv +typedef void (APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLCOLORP3UIPROC glad_glColorP3ui; +#define glColorP3ui glad_glColorP3ui +typedef void (APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLCOLORP3UIVPROC glad_glColorP3uiv; +#define glColorP3uiv glad_glColorP3uiv +typedef void (APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLCOLORP4UIPROC glad_glColorP4ui; +#define glColorP4ui glad_glColorP4ui +typedef void (APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLCOLORP4UIVPROC glad_glColorP4uiv; +#define glColorP4uiv glad_glColorP4uiv +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; +#define glSecondaryColorP3ui glad_glSecondaryColorP3ui +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; +#define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv +#endif +#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 +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +GLAPI int GLAD_GL_ARB_debug_output; +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB; +#define glDebugMessageControlARB glad_glDebugMessageControlARB +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB; +#define glDebugMessageInsertARB glad_glDebugMessageInsertARB +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC)(GLDEBUGPROCARB callback, const void *userParam); +GLAPI PFNGLDEBUGMESSAGECALLBACKARBPROC glad_glDebugMessageCallbackARB; +#define glDebugMessageCallbackARB glad_glDebugMessageCallbackARB +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC)(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB; +#define glGetDebugMessageLogARB glad_glGetDebugMessageLogARB +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/drivers/gl_context/glew.c b/drivers/gl_context/glew.c index 0ed5520dae..6c93c07e46 100644 --- a/drivers/gl_context/glew.c +++ b/drivers/gl_context/glew.c @@ -32,7 +32,12 @@ #include -#if defined(_WIN32) +#if defined(GLEW_OSMESA) +# define GLAPI extern +# include +#elif defined(GLEW_EGL) +# include +#elif defined(_WIN32) # include #elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include @@ -40,36 +45,8 @@ #include /* For size_t */ -/* - * 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) +#if defined(GLEW_EGL) +#elif defined(GLEW_REGAL) /* In GLEW_REGAL mode we call direcly into the linked libRegal.so glGetProcAddressREGAL for looking up @@ -121,7 +98,7 @@ void* NSGLGetProcAddress (const GLubyte *name) { static void* image = NULL; void* addr; - if (NULL == image) + if (NULL == image) { image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); } @@ -170,7 +147,11 @@ void* NSGLGetProcAddress (const GLubyte *name) * Define glewGetProcAddress. */ #if defined(GLEW_REGAL) -# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *) name) +# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name) +#elif defined(GLEW_OSMESA) +# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name) +#elif defined(GLEW_EGL) +# define glewGetProcAddress(name) eglGetProcAddress((const char *)name) #elif defined(_WIN32) # define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) @@ -190,34 +171,28 @@ void* NSGLGetProcAddress (const GLubyte *name) */ #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 */ +# define WGLEW_GET_VAR(x) (x) #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 */ +# define GLXEW_GET_VAR(x) (x) #endif /* GLXEW_GET_VAR */ +#ifdef EGLEW_GET_VAR +# undef EGLEW_GET_VAR +# define EGLEW_GET_VAR(x) (x) +#endif /* EGLEW_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; @@ -231,9 +206,20 @@ 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; + return i; +} + +static GLuint _glewStrCopy(char *d, const char *s, char c) +{ + GLuint i=0; + if (s == NULL) return 0; + while (s[i] != '\0' && s[i] != c) { d[i] = s[i]; i++; } + d[i] = '\0'; + return i; } +#if !defined(GLEW_OSMESA) +#if !defined(__APPLE__) || defined(GLEW_APPLE_GLX) static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) { GLuint i=0; @@ -242,6 +228,8 @@ static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++; return i == n ? GL_TRUE : GL_FALSE; } +#endif +#endif static GLboolean _glewStrSame1 (const GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) { @@ -302,6 +290,8 @@ static GLboolean _glewStrSame3 (const GLubyte** a, GLuint* na, const GLubyte* b, * other extension names. Could use strtok() but the constant * string returned by glGetString might be in read-only memory. */ +#if !defined(GLEW_OSMESA) +#if !defined(__APPLE__) || defined(GLEW_APPLE_GLX) static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, const GLubyte *end) { const GLubyte* p; @@ -315,8 +305,8 @@ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, c } return GL_FALSE; } - -#if !defined(_WIN32) || !defined(GLEW_MX) +#endif +#endif PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL; @@ -942,6 +932,8 @@ PFNGLPROGRAMPARAMETERIPROC __glewProgramParameteri = NULL; PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC __glewGetCompressedTextureSubImage = NULL; PFNGLGETTEXTURESUBIMAGEPROC __glewGetTextureSubImage = NULL; +PFNGLSPECIALIZESHADERARBPROC __glewSpecializeShaderARB = NULL; + PFNGLGETUNIFORMDVPROC __glewGetUniformdv = NULL; PFNGLUNIFORM1DPROC __glewUniform1d = NULL; PFNGLUNIFORM1DVPROC __glewUniform1dv = NULL; @@ -2218,6 +2210,8 @@ PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL; PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL; PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL; +PFNGLWINDOWRECTANGLESEXTPROC __glewWindowRectanglesEXT = NULL; + PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT = NULL; PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY = NULL; @@ -2320,6 +2314,10 @@ PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA = NULL; PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX = NULL; PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX = NULL; +PFNGLLGPUCOPYIMAGESUBDATANVXPROC __glewLGPUCopyImageSubDataNVX = NULL; +PFNGLLGPUINTERLOCKNVXPROC __glewLGPUInterlockNVX = NULL; +PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC __glewLGPUNamedBufferSubDataNVX = NULL; + PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV = NULL; PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV = NULL; @@ -2343,6 +2341,26 @@ PFNGLUNIFORMHANDLEUI64VNVPROC __glewUniformHandleui64vNV = NULL; PFNGLBLENDBARRIERNVPROC __glewBlendBarrierNV = NULL; PFNGLBLENDPARAMETERINVPROC __glewBlendParameteriNV = NULL; +PFNGLVIEWPORTPOSITIONWSCALENVPROC __glewViewportPositionWScaleNV = NULL; + +PFNGLCALLCOMMANDLISTNVPROC __glewCallCommandListNV = NULL; +PFNGLCOMMANDLISTSEGMENTSNVPROC __glewCommandListSegmentsNV = NULL; +PFNGLCOMPILECOMMANDLISTNVPROC __glewCompileCommandListNV = NULL; +PFNGLCREATECOMMANDLISTSNVPROC __glewCreateCommandListsNV = NULL; +PFNGLCREATESTATESNVPROC __glewCreateStatesNV = NULL; +PFNGLDELETECOMMANDLISTSNVPROC __glewDeleteCommandListsNV = NULL; +PFNGLDELETESTATESNVPROC __glewDeleteStatesNV = NULL; +PFNGLDRAWCOMMANDSADDRESSNVPROC __glewDrawCommandsAddressNV = NULL; +PFNGLDRAWCOMMANDSNVPROC __glewDrawCommandsNV = NULL; +PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC __glewDrawCommandsStatesAddressNV = NULL; +PFNGLDRAWCOMMANDSSTATESNVPROC __glewDrawCommandsStatesNV = NULL; +PFNGLGETCOMMANDHEADERNVPROC __glewGetCommandHeaderNV = NULL; +PFNGLGETSTAGEINDEXNVPROC __glewGetStageIndexNV = NULL; +PFNGLISCOMMANDLISTNVPROC __glewIsCommandListNV = NULL; +PFNGLISSTATENVPROC __glewIsStateNV = NULL; +PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC __glewListDrawCommandsStatesClientNV = NULL; +PFNGLSTATECAPTURENVPROC __glewStateCaptureNV = NULL; + PFNGLBEGINCONDITIONALRENDERNVPROC __glewBeginConditionalRenderNV = NULL; PFNGLENDCONDITIONALRENDERNVPROC __glewEndConditionalRenderNV = NULL; @@ -2350,6 +2368,8 @@ PFNGLSUBPIXELPRECISIONBIASNVPROC __glewSubpixelPrecisionBiasNV = NULL; PFNGLCONSERVATIVERASTERPARAMETERFNVPROC __glewConservativeRasterParameterfNV = NULL; +PFNGLCONSERVATIVERASTERPARAMETERINVPROC __glewConservativeRasterParameteriNV = NULL; + PFNGLCOPYIMAGESUBDATANVPROC __glewCopyImageSubDataNV = NULL; PFNGLCLEARDEPTHDNVPROC __glewClearDepthdNV = NULL; @@ -2358,6 +2378,12 @@ PFNGLDEPTHRANGEDNVPROC __glewDepthRangedNV = NULL; PFNGLDRAWTEXTURENVPROC __glewDrawTextureNV = NULL; +PFNGLDRAWVKIMAGENVPROC __glewDrawVkImageNV = NULL; +PFNGLGETVKPROCADDRNVPROC __glewGetVkProcAddrNV = NULL; +PFNGLSIGNALVKFENCENVPROC __glewSignalVkFenceNV = NULL; +PFNGLSIGNALVKSEMAPHORENVPROC __glewSignalVkSemaphoreNV = NULL; +PFNGLWAITVKSEMAPHORENVPROC __glewWaitVkSemaphoreNV = NULL; + PFNGLEVALMAPSNVPROC __glewEvalMapsNV = NULL; PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV = NULL; PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV = NULL; @@ -2393,6 +2419,19 @@ PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC __glewRenderbufferStorageMulti PFNGLPROGRAMVERTEXLIMITNVPROC __glewProgramVertexLimitNV = NULL; +PFNGLMULTICASTBARRIERNVPROC __glewMulticastBarrierNV = NULL; +PFNGLMULTICASTBLITFRAMEBUFFERNVPROC __glewMulticastBlitFramebufferNV = NULL; +PFNGLMULTICASTBUFFERSUBDATANVPROC __glewMulticastBufferSubDataNV = NULL; +PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC __glewMulticastCopyBufferSubDataNV = NULL; +PFNGLMULTICASTCOPYIMAGESUBDATANVPROC __glewMulticastCopyImageSubDataNV = NULL; +PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewMulticastFramebufferSampleLocationsfvNV = NULL; +PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC __glewMulticastGetQueryObjecti64vNV = NULL; +PFNGLMULTICASTGETQUERYOBJECTIVNVPROC __glewMulticastGetQueryObjectivNV = NULL; +PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC __glewMulticastGetQueryObjectui64vNV = NULL; +PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC __glewMulticastGetQueryObjectuivNV = NULL; +PFNGLMULTICASTWAITSYNCNVPROC __glewMulticastWaitSyncNV = NULL; +PFNGLRENDERGPUMASKNVPROC __glewRenderGpuMaskNV = NULL; + PFNGLPROGRAMENVPARAMETERI4INVPROC __glewProgramEnvParameterI4iNV = NULL; PFNGLPROGRAMENVPARAMETERI4IVNVPROC __glewProgramEnvParameterI4ivNV = NULL; PFNGLPROGRAMENVPARAMETERI4UINVPROC __glewProgramEnvParameterI4uiNV = NULL; @@ -2771,6 +2810,8 @@ PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV = PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV = NULL; PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV = NULL; +PFNGLVIEWPORTSWIZZLENVPROC __glewViewportSwizzleNV = NULL; + PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES = NULL; PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES = NULL; PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES = NULL; @@ -2967,10 +3008,6 @@ 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; @@ -3009,6 +3046,7 @@ 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_explicit_vertex_parameter = 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; @@ -3098,6 +3136,7 @@ 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_gl_spirv = GL_FALSE; GLboolean __GLEW_ARB_gpu_shader5 = GL_FALSE; GLboolean __GLEW_ARB_gpu_shader_fp64 = GL_FALSE; GLboolean __GLEW_ARB_gpu_shader_int64 = GL_FALSE; @@ -3238,6 +3277,7 @@ 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_EGL_NV_robustness_video_memory_purge = GL_FALSE; GLboolean __GLEW_EXT_422_pixels = GL_FALSE; GLboolean __GLEW_EXT_Cg_shader = GL_FALSE; GLboolean __GLEW_EXT_abgr = GL_FALSE; @@ -3345,6 +3385,7 @@ 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_window_rectangles = GL_FALSE; GLboolean __GLEW_EXT_x11_sync_object = GL_FALSE; GLboolean __GLEW_GREMEDY_frame_terminator = GL_FALSE; GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE; @@ -3360,6 +3401,7 @@ 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_conservative_rasterization = GL_FALSE; GLboolean __GLEW_INTEL_fragment_shader_ordering = GL_FALSE; GLboolean __GLEW_INTEL_framebuffer_CMAA = GL_FALSE; GLboolean __GLEW_INTEL_map_texture = GL_FALSE; @@ -3375,24 +3417,31 @@ 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_KHR_texture_compression_astc_sliced_3d = 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_shader_integer_functions = GL_FALSE; GLboolean __GLEW_MESA_window_pos = GL_FALSE; GLboolean __GLEW_MESA_ycbcr_texture = GL_FALSE; +GLboolean __GLEW_NVX_blend_equation_advanced_multi_draw_buffers = GL_FALSE; GLboolean __GLEW_NVX_conditional_render = GL_FALSE; GLboolean __GLEW_NVX_gpu_memory_info = GL_FALSE; +GLboolean __GLEW_NVX_linked_gpu_multicast = 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_clip_space_w_scaling = GL_FALSE; +GLboolean __GLEW_NV_command_list = 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_conservative_raster_dilate = GL_FALSE; +GLboolean __GLEW_NV_conservative_raster_pre_snap_triangles = 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; @@ -3400,6 +3449,7 @@ 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_draw_vulkan_image = GL_FALSE; GLboolean __GLEW_NV_evaluators = GL_FALSE; GLboolean __GLEW_NV_explicit_multisample = GL_FALSE; GLboolean __GLEW_NV_fence = GL_FALSE; @@ -3417,6 +3467,7 @@ 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_multicast = 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; @@ -3439,16 +3490,19 @@ 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_robustness_video_memory_purge = 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_float64 = 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_stereo_view_rendering = GL_FALSE; GLboolean __GLEW_NV_tessellation_program5 = GL_FALSE; GLboolean __GLEW_NV_texgen_emboss = GL_FALSE; GLboolean __GLEW_NV_texgen_reflection = GL_FALSE; @@ -3477,6 +3531,7 @@ GLboolean __GLEW_NV_vertex_program3 = GL_FALSE; GLboolean __GLEW_NV_vertex_program4 = GL_FALSE; GLboolean __GLEW_NV_video_capture = GL_FALSE; GLboolean __GLEW_NV_viewport_array2 = GL_FALSE; +GLboolean __GLEW_NV_viewport_swizzle = GL_FALSE; GLboolean __GLEW_OES_byte_coordinates = GL_FALSE; GLboolean __GLEW_OES_compressed_paletted_texture = GL_FALSE; GLboolean __GLEW_OES_read_format = GL_FALSE; @@ -3558,15042 +3613,20332 @@ GLboolean __GLEW_WIN_phong_shading = GL_FALSE; GLboolean __GLEW_WIN_specular_fog = GL_FALSE; GLboolean __GLEW_WIN_swap_hint = GL_FALSE; -#endif /* !GLEW_MX */ - +static const char * _glewExtensionLookup[] = { #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 */ - + "GL_VERSION_1_2", +#endif +#ifdef GL_VERSION_1_2_1 + "GL_VERSION_1_2_1", +#endif #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 */ - + "GL_VERSION_1_3", +#endif #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 */ - + "GL_VERSION_1_4", +#endif #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 */ - + "GL_VERSION_1_5", +#endif #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 */ - + "GL_VERSION_2_0", +#endif #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 */ - + "GL_VERSION_2_1", +#endif #ifdef GL_VERSION_3_0 - -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; - - return r; -} - -#endif /* GL_VERSION_3_0 */ - + "GL_VERSION_3_0", +#endif #ifdef GL_VERSION_3_1 - -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; - - return r; -} - -#endif /* GL_VERSION_3_1 */ - + "GL_VERSION_3_1", +#endif #ifdef GL_VERSION_3_2 - -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; - - return r; -} - -#endif /* GL_VERSION_3_2 */ - + "GL_VERSION_3_2", +#endif #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 */ - + "GL_VERSION_3_3", +#endif #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 */ - + "GL_VERSION_4_0", +#endif +#ifdef GL_VERSION_4_1 + "GL_VERSION_4_1", +#endif +#ifdef GL_VERSION_4_2 + "GL_VERSION_4_2", +#endif +#ifdef GL_VERSION_4_3 + "GL_VERSION_4_3", +#endif +#ifdef GL_VERSION_4_4 + "GL_VERSION_4_4", +#endif #ifdef GL_VERSION_4_5 - -static GLboolean _glewInit_GL_VERSION_4_5 (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatus")) == NULL) || r; - r = ((glGetnCompressedTexImage = (PFNGLGETNCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImage")) == NULL) || r; - r = ((glGetnTexImage = (PFNGLGETNTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImage")) == NULL) || r; - r = ((glGetnUniformdv = (PFNGLGETNUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdv")) == NULL) || r; - - return r; -} - -#endif /* GL_VERSION_4_5 */ - + "GL_VERSION_4_5", +#endif +#ifdef GL_3DFX_multisample + "GL_3DFX_multisample", +#endif #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 */ - + "GL_3DFX_tbuffer", +#endif +#ifdef GL_3DFX_texture_compression_FXT1 + "GL_3DFX_texture_compression_FXT1", +#endif +#ifdef GL_AMD_blend_minmax_factor + "GL_AMD_blend_minmax_factor", +#endif +#ifdef GL_AMD_conservative_depth + "GL_AMD_conservative_depth", +#endif #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 */ - + "GL_AMD_debug_output", +#endif +#ifdef GL_AMD_depth_clamp_separate + "GL_AMD_depth_clamp_separate", +#endif #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_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 */ - + "GL_AMD_draw_buffers_blend", +#endif +#ifdef GL_AMD_gcn_shader + "GL_AMD_gcn_shader", +#endif +#ifdef GL_AMD_gpu_shader_int64 + "GL_AMD_gpu_shader_int64", +#endif +#ifdef GL_AMD_interleaved_elements + "GL_AMD_interleaved_elements", +#endif #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 */ - + "GL_AMD_multi_draw_indirect", +#endif #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 */ - + "GL_AMD_name_gen_delete", +#endif #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 */ - + "GL_AMD_occlusion_query_event", +#endif #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 */ - + "GL_AMD_performance_monitor", +#endif +#ifdef GL_AMD_pinned_memory + "GL_AMD_pinned_memory", +#endif +#ifdef GL_AMD_query_buffer_object + "GL_AMD_query_buffer_object", +#endif #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 */ - + "GL_AMD_sample_positions", +#endif +#ifdef GL_AMD_seamless_cubemap_per_texture + "GL_AMD_seamless_cubemap_per_texture", +#endif +#ifdef GL_AMD_shader_atomic_counter_ops + "GL_AMD_shader_atomic_counter_ops", +#endif +#ifdef GL_AMD_shader_explicit_vertex_parameter + "GL_AMD_shader_explicit_vertex_parameter", +#endif +#ifdef GL_AMD_shader_stencil_export + "GL_AMD_shader_stencil_export", +#endif +#ifdef GL_AMD_shader_stencil_value_export + "GL_AMD_shader_stencil_value_export", +#endif +#ifdef GL_AMD_shader_trinary_minmax + "GL_AMD_shader_trinary_minmax", +#endif #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 */ - + "GL_AMD_sparse_texture", +#endif #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 */ - + "GL_AMD_stencil_operation_extended", +#endif +#ifdef GL_AMD_texture_texture4 + "GL_AMD_texture_texture4", +#endif +#ifdef GL_AMD_transform_feedback3_lines_triangles + "GL_AMD_transform_feedback3_lines_triangles", +#endif +#ifdef GL_AMD_transform_feedback4 + "GL_AMD_transform_feedback4", +#endif +#ifdef GL_AMD_vertex_shader_layer + "GL_AMD_vertex_shader_layer", +#endif #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 */ - + "GL_AMD_vertex_shader_tessellator", +#endif +#ifdef GL_AMD_vertex_shader_viewport_index + "GL_AMD_vertex_shader_viewport_index", +#endif +#ifdef GL_ANGLE_depth_texture + "GL_ANGLE_depth_texture", +#endif #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 */ - + "GL_ANGLE_framebuffer_blit", +#endif #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 */ - + "GL_ANGLE_framebuffer_multisample", +#endif #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 */ - + "GL_ANGLE_instanced_arrays", +#endif +#ifdef GL_ANGLE_pack_reverse_row_order + "GL_ANGLE_pack_reverse_row_order", +#endif +#ifdef GL_ANGLE_program_binary + "GL_ANGLE_program_binary", +#endif +#ifdef GL_ANGLE_texture_compression_dxt1 + "GL_ANGLE_texture_compression_dxt1", +#endif +#ifdef GL_ANGLE_texture_compression_dxt3 + "GL_ANGLE_texture_compression_dxt3", +#endif +#ifdef GL_ANGLE_texture_compression_dxt5 + "GL_ANGLE_texture_compression_dxt5", +#endif +#ifdef GL_ANGLE_texture_usage + "GL_ANGLE_texture_usage", +#endif #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 */ - + "GL_ANGLE_timer_query", +#endif #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 */ - + "GL_ANGLE_translated_shader_source", +#endif +#ifdef GL_APPLE_aux_depth_stencil + "GL_APPLE_aux_depth_stencil", +#endif +#ifdef GL_APPLE_client_storage + "GL_APPLE_client_storage", +#endif #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 */ - + "GL_APPLE_element_array", +#endif #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 */ - + "GL_APPLE_fence", +#endif +#ifdef GL_APPLE_float_pixels + "GL_APPLE_float_pixels", +#endif #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 */ - + "GL_APPLE_flush_buffer_range", +#endif #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 */ - + "GL_APPLE_object_purgeable", +#endif +#ifdef GL_APPLE_pixel_buffer + "GL_APPLE_pixel_buffer", +#endif +#ifdef GL_APPLE_rgb_422 + "GL_APPLE_rgb_422", +#endif +#ifdef GL_APPLE_row_bytes + "GL_APPLE_row_bytes", +#endif +#ifdef GL_APPLE_specular_vector + "GL_APPLE_specular_vector", +#endif #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 */ - + "GL_APPLE_texture_range", +#endif +#ifdef GL_APPLE_transform_hint + "GL_APPLE_transform_hint", +#endif #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 */ - + "GL_APPLE_vertex_array_object", +#endif #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 */ - + "GL_APPLE_vertex_array_range", +#endif #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 */ - + "GL_APPLE_vertex_program_evaluators", +#endif +#ifdef GL_APPLE_ycbcr_422 + "GL_APPLE_ycbcr_422", +#endif #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 */ - + "GL_ARB_ES2_compatibility", +#endif #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 */ - + "GL_ARB_ES3_1_compatibility", +#endif #ifdef GL_ARB_ES3_2_compatibility - -static GLboolean _glewInit_GL_ARB_ES3_2_compatibility (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glPrimitiveBoundingBoxARB = (PFNGLPRIMITIVEBOUNDINGBOXARBPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveBoundingBoxARB")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_ES3_2_compatibility */ - + "GL_ARB_ES3_2_compatibility", +#endif +#ifdef GL_ARB_ES3_compatibility + "GL_ARB_ES3_compatibility", +#endif +#ifdef GL_ARB_arrays_of_arrays + "GL_ARB_arrays_of_arrays", +#endif #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 */ - + "GL_ARB_base_instance", +#endif #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 */ - + "GL_ARB_bindless_texture", +#endif #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 */ - + "GL_ARB_blend_func_extended", +#endif #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 */ - + "GL_ARB_buffer_storage", +#endif #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 */ - + "GL_ARB_cl_event", +#endif #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 */ - + "GL_ARB_clear_buffer_object", +#endif #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 */ - + "GL_ARB_clear_texture", +#endif #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 */ - + "GL_ARB_clip_control", +#endif #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 */ - + "GL_ARB_color_buffer_float", +#endif +#ifdef GL_ARB_compatibility + "GL_ARB_compatibility", +#endif +#ifdef GL_ARB_compressed_texture_pixel_storage + "GL_ARB_compressed_texture_pixel_storage", +#endif #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 */ - + "GL_ARB_compute_shader", +#endif #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 */ - + "GL_ARB_compute_variable_group_size", +#endif +#ifdef GL_ARB_conditional_render_inverted + "GL_ARB_conditional_render_inverted", +#endif +#ifdef GL_ARB_conservative_depth + "GL_ARB_conservative_depth", +#endif #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 */ - + "GL_ARB_copy_buffer", +#endif #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 */ - + "GL_ARB_copy_image", +#endif +#ifdef GL_ARB_cull_distance + "GL_ARB_cull_distance", +#endif #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 */ - + "GL_ARB_debug_output", +#endif +#ifdef GL_ARB_depth_buffer_float + "GL_ARB_depth_buffer_float", +#endif +#ifdef GL_ARB_depth_clamp + "GL_ARB_depth_clamp", +#endif +#ifdef GL_ARB_depth_texture + "GL_ARB_depth_texture", +#endif +#ifdef GL_ARB_derivative_control + "GL_ARB_derivative_control", +#endif #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 */ - + "GL_ARB_direct_state_access", +#endif #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 */ - + "GL_ARB_draw_buffers", +#endif #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 */ - + "GL_ARB_draw_buffers_blend", +#endif #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 */ - + "GL_ARB_draw_elements_base_vertex", +#endif #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 */ - + "GL_ARB_draw_indirect", +#endif +#ifdef GL_ARB_draw_instanced + "GL_ARB_draw_instanced", +#endif +#ifdef GL_ARB_enhanced_layouts + "GL_ARB_enhanced_layouts", +#endif +#ifdef GL_ARB_explicit_attrib_location + "GL_ARB_explicit_attrib_location", +#endif +#ifdef GL_ARB_explicit_uniform_location + "GL_ARB_explicit_uniform_location", +#endif +#ifdef GL_ARB_fragment_coord_conventions + "GL_ARB_fragment_coord_conventions", +#endif +#ifdef GL_ARB_fragment_layer_viewport + "GL_ARB_fragment_layer_viewport", +#endif +#ifdef GL_ARB_fragment_program + "GL_ARB_fragment_program", +#endif +#ifdef GL_ARB_fragment_program_shadow + "GL_ARB_fragment_program_shadow", +#endif +#ifdef GL_ARB_fragment_shader + "GL_ARB_fragment_shader", +#endif +#ifdef GL_ARB_fragment_shader_interlock + "GL_ARB_fragment_shader_interlock", +#endif #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 */ - + "GL_ARB_framebuffer_no_attachments", +#endif #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 */ - + "GL_ARB_framebuffer_object", +#endif +#ifdef GL_ARB_framebuffer_sRGB + "GL_ARB_framebuffer_sRGB", +#endif #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 */ - + "GL_ARB_geometry_shader4", +#endif #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 */ - + "GL_ARB_get_program_binary", +#endif #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 */ - + "GL_ARB_get_texture_sub_image", +#endif +#ifdef GL_ARB_gl_spirv + "GL_ARB_gl_spirv", +#endif +#ifdef GL_ARB_gpu_shader5 + "GL_ARB_gpu_shader5", +#endif #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 */ - + "GL_ARB_gpu_shader_fp64", +#endif #ifdef GL_ARB_gpu_shader_int64 - -static GLboolean _glewInit_GL_ARB_gpu_shader_int64 (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glGetUniformi64vARB = (PFNGLGETUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vARB")) == NULL) || r; - r = ((glGetUniformui64vARB = (PFNGLGETUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vARB")) == NULL) || r; - r = ((glGetnUniformi64vARB = (PFNGLGETNUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformi64vARB")) == NULL) || r; - r = ((glGetnUniformui64vARB = (PFNGLGETNUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformui64vARB")) == NULL) || r; - r = ((glProgramUniform1i64ARB = (PFNGLPROGRAMUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64ARB")) == NULL) || r; - r = ((glProgramUniform1i64vARB = (PFNGLPROGRAMUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vARB")) == NULL) || r; - r = ((glProgramUniform1ui64ARB = (PFNGLPROGRAMUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64ARB")) == NULL) || r; - r = ((glProgramUniform1ui64vARB = (PFNGLPROGRAMUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vARB")) == NULL) || r; - r = ((glProgramUniform2i64ARB = (PFNGLPROGRAMUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64ARB")) == NULL) || r; - r = ((glProgramUniform2i64vARB = (PFNGLPROGRAMUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vARB")) == NULL) || r; - r = ((glProgramUniform2ui64ARB = (PFNGLPROGRAMUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64ARB")) == NULL) || r; - r = ((glProgramUniform2ui64vARB = (PFNGLPROGRAMUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vARB")) == NULL) || r; - r = ((glProgramUniform3i64ARB = (PFNGLPROGRAMUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64ARB")) == NULL) || r; - r = ((glProgramUniform3i64vARB = (PFNGLPROGRAMUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vARB")) == NULL) || r; - r = ((glProgramUniform3ui64ARB = (PFNGLPROGRAMUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64ARB")) == NULL) || r; - r = ((glProgramUniform3ui64vARB = (PFNGLPROGRAMUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vARB")) == NULL) || r; - r = ((glProgramUniform4i64ARB = (PFNGLPROGRAMUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64ARB")) == NULL) || r; - r = ((glProgramUniform4i64vARB = (PFNGLPROGRAMUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vARB")) == NULL) || r; - r = ((glProgramUniform4ui64ARB = (PFNGLPROGRAMUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64ARB")) == NULL) || r; - r = ((glProgramUniform4ui64vARB = (PFNGLPROGRAMUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vARB")) == NULL) || r; - r = ((glUniform1i64ARB = (PFNGLUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64ARB")) == NULL) || r; - r = ((glUniform1i64vARB = (PFNGLUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vARB")) == NULL) || r; - r = ((glUniform1ui64ARB = (PFNGLUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64ARB")) == NULL) || r; - r = ((glUniform1ui64vARB = (PFNGLUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vARB")) == NULL) || r; - r = ((glUniform2i64ARB = (PFNGLUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64ARB")) == NULL) || r; - r = ((glUniform2i64vARB = (PFNGLUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vARB")) == NULL) || r; - r = ((glUniform2ui64ARB = (PFNGLUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64ARB")) == NULL) || r; - r = ((glUniform2ui64vARB = (PFNGLUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vARB")) == NULL) || r; - r = ((glUniform3i64ARB = (PFNGLUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64ARB")) == NULL) || r; - r = ((glUniform3i64vARB = (PFNGLUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vARB")) == NULL) || r; - r = ((glUniform3ui64ARB = (PFNGLUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64ARB")) == NULL) || r; - r = ((glUniform3ui64vARB = (PFNGLUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vARB")) == NULL) || r; - r = ((glUniform4i64ARB = (PFNGLUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64ARB")) == NULL) || r; - r = ((glUniform4i64vARB = (PFNGLUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vARB")) == NULL) || r; - r = ((glUniform4ui64ARB = (PFNGLUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64ARB")) == NULL) || r; - r = ((glUniform4ui64vARB = (PFNGLUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vARB")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_gpu_shader_int64 */ - + "GL_ARB_gpu_shader_int64", +#endif +#ifdef GL_ARB_half_float_pixel + "GL_ARB_half_float_pixel", +#endif +#ifdef GL_ARB_half_float_vertex + "GL_ARB_half_float_vertex", +#endif #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 */ - + "GL_ARB_imaging", +#endif #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 */ - + "GL_ARB_indirect_parameters", +#endif #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 */ - + "GL_ARB_instanced_arrays", +#endif #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 */ - + "GL_ARB_internalformat_query", +#endif #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 */ - + "GL_ARB_internalformat_query2", +#endif #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 */ - + "GL_ARB_invalidate_subdata", +#endif +#ifdef GL_ARB_map_buffer_alignment + "GL_ARB_map_buffer_alignment", +#endif #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 */ - + "GL_ARB_map_buffer_range", +#endif #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 */ - + "GL_ARB_matrix_palette", +#endif #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 */ - + "GL_ARB_multi_bind", +#endif #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 */ - + "GL_ARB_multi_draw_indirect", +#endif #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 */ - + "GL_ARB_multisample", +#endif #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 */ - + "GL_ARB_multitexture", +#endif #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 */ - + "GL_ARB_occlusion_query", +#endif +#ifdef GL_ARB_occlusion_query2 + "GL_ARB_occlusion_query2", +#endif #ifdef GL_ARB_parallel_shader_compile - -static GLboolean _glewInit_GL_ARB_parallel_shader_compile (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glMaxShaderCompilerThreadsARB = (PFNGLMAXSHADERCOMPILERTHREADSARBPROC)glewGetProcAddress((const GLubyte*)"glMaxShaderCompilerThreadsARB")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_parallel_shader_compile */ - + "GL_ARB_parallel_shader_compile", +#endif +#ifdef GL_ARB_pipeline_statistics_query + "GL_ARB_pipeline_statistics_query", +#endif +#ifdef GL_ARB_pixel_buffer_object + "GL_ARB_pixel_buffer_object", +#endif #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 */ - + "GL_ARB_point_parameters", +#endif +#ifdef GL_ARB_point_sprite + "GL_ARB_point_sprite", +#endif +#ifdef GL_ARB_post_depth_coverage + "GL_ARB_post_depth_coverage", +#endif #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 */ - + "GL_ARB_program_interface_query", +#endif #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 */ - + "GL_ARB_provoking_vertex", +#endif +#ifdef GL_ARB_query_buffer_object + "GL_ARB_query_buffer_object", +#endif +#ifdef GL_ARB_robust_buffer_access_behavior + "GL_ARB_robust_buffer_access_behavior", +#endif #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 */ - + "GL_ARB_robustness", +#endif +#ifdef GL_ARB_robustness_application_isolation + "GL_ARB_robustness_application_isolation", +#endif +#ifdef GL_ARB_robustness_share_group_isolation + "GL_ARB_robustness_share_group_isolation", +#endif #ifdef GL_ARB_sample_locations - -static GLboolean _glewInit_GL_ARB_sample_locations (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glFramebufferSampleLocationsfvARB = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferSampleLocationsfvARB")) == NULL) || r; - r = ((glNamedFramebufferSampleLocationsfvARB = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferSampleLocationsfvARB")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_sample_locations */ - + "GL_ARB_sample_locations", +#endif #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 */ - + "GL_ARB_sample_shading", +#endif #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 */ - + "GL_ARB_sampler_objects", +#endif +#ifdef GL_ARB_seamless_cube_map + "GL_ARB_seamless_cube_map", +#endif +#ifdef GL_ARB_seamless_cubemap_per_texture + "GL_ARB_seamless_cubemap_per_texture", +#endif #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 */ - + "GL_ARB_separate_shader_objects", +#endif +#ifdef GL_ARB_shader_atomic_counter_ops + "GL_ARB_shader_atomic_counter_ops", +#endif #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 */ - + "GL_ARB_shader_atomic_counters", +#endif +#ifdef GL_ARB_shader_ballot + "GL_ARB_shader_ballot", +#endif +#ifdef GL_ARB_shader_bit_encoding + "GL_ARB_shader_bit_encoding", +#endif +#ifdef GL_ARB_shader_clock + "GL_ARB_shader_clock", +#endif +#ifdef GL_ARB_shader_draw_parameters + "GL_ARB_shader_draw_parameters", +#endif +#ifdef GL_ARB_shader_group_vote + "GL_ARB_shader_group_vote", +#endif #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 */ - + "GL_ARB_shader_image_load_store", +#endif +#ifdef GL_ARB_shader_image_size + "GL_ARB_shader_image_size", +#endif #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 */ - + "GL_ARB_shader_objects", +#endif +#ifdef GL_ARB_shader_precision + "GL_ARB_shader_precision", +#endif +#ifdef GL_ARB_shader_stencil_export + "GL_ARB_shader_stencil_export", +#endif #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 */ - + "GL_ARB_shader_storage_buffer_object", +#endif #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 */ - + "GL_ARB_shader_subroutine", +#endif +#ifdef GL_ARB_shader_texture_image_samples + "GL_ARB_shader_texture_image_samples", +#endif +#ifdef GL_ARB_shader_texture_lod + "GL_ARB_shader_texture_lod", +#endif +#ifdef GL_ARB_shader_viewport_layer_array + "GL_ARB_shader_viewport_layer_array", +#endif +#ifdef GL_ARB_shading_language_100 + "GL_ARB_shading_language_100", +#endif +#ifdef GL_ARB_shading_language_420pack + "GL_ARB_shading_language_420pack", +#endif #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 */ - + "GL_ARB_shading_language_include", +#endif +#ifdef GL_ARB_shading_language_packing + "GL_ARB_shading_language_packing", +#endif +#ifdef GL_ARB_shadow + "GL_ARB_shadow", +#endif +#ifdef GL_ARB_shadow_ambient + "GL_ARB_shadow_ambient", +#endif #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 */ - + "GL_ARB_sparse_buffer", +#endif #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 */ - + "GL_ARB_sparse_texture", +#endif +#ifdef GL_ARB_sparse_texture2 + "GL_ARB_sparse_texture2", +#endif +#ifdef GL_ARB_sparse_texture_clamp + "GL_ARB_sparse_texture_clamp", +#endif +#ifdef GL_ARB_stencil_texturing + "GL_ARB_stencil_texturing", +#endif #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 */ - + "GL_ARB_sync", +#endif #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 */ - + "GL_ARB_tessellation_shader", +#endif #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 */ - + "GL_ARB_texture_barrier", +#endif +#ifdef GL_ARB_texture_border_clamp + "GL_ARB_texture_border_clamp", +#endif #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 */ - + "GL_ARB_texture_buffer_object", +#endif +#ifdef GL_ARB_texture_buffer_object_rgb32 + "GL_ARB_texture_buffer_object_rgb32", +#endif #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 */ - + "GL_ARB_texture_buffer_range", +#endif #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 */ - + "GL_ARB_texture_compression", +#endif +#ifdef GL_ARB_texture_compression_bptc + "GL_ARB_texture_compression_bptc", +#endif +#ifdef GL_ARB_texture_compression_rgtc + "GL_ARB_texture_compression_rgtc", +#endif +#ifdef GL_ARB_texture_cube_map + "GL_ARB_texture_cube_map", +#endif +#ifdef GL_ARB_texture_cube_map_array + "GL_ARB_texture_cube_map_array", +#endif +#ifdef GL_ARB_texture_env_add + "GL_ARB_texture_env_add", +#endif +#ifdef GL_ARB_texture_env_combine + "GL_ARB_texture_env_combine", +#endif +#ifdef GL_ARB_texture_env_crossbar + "GL_ARB_texture_env_crossbar", +#endif +#ifdef GL_ARB_texture_env_dot3 + "GL_ARB_texture_env_dot3", +#endif +#ifdef GL_ARB_texture_filter_minmax + "GL_ARB_texture_filter_minmax", +#endif +#ifdef GL_ARB_texture_float + "GL_ARB_texture_float", +#endif +#ifdef GL_ARB_texture_gather + "GL_ARB_texture_gather", +#endif +#ifdef GL_ARB_texture_mirror_clamp_to_edge + "GL_ARB_texture_mirror_clamp_to_edge", +#endif +#ifdef GL_ARB_texture_mirrored_repeat + "GL_ARB_texture_mirrored_repeat", +#endif #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_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; - r = ((glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1DEXT")) == NULL) || r; - r = ((glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DEXT")) == NULL) || r; - r = ((glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DEXT")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_texture_storage */ - + "GL_ARB_texture_multisample", +#endif +#ifdef GL_ARB_texture_non_power_of_two + "GL_ARB_texture_non_power_of_two", +#endif +#ifdef GL_ARB_texture_query_levels + "GL_ARB_texture_query_levels", +#endif +#ifdef GL_ARB_texture_query_lod + "GL_ARB_texture_query_lod", +#endif +#ifdef GL_ARB_texture_rectangle + "GL_ARB_texture_rectangle", +#endif +#ifdef GL_ARB_texture_rg + "GL_ARB_texture_rg", +#endif +#ifdef GL_ARB_texture_rgb10_a2ui + "GL_ARB_texture_rgb10_a2ui", +#endif +#ifdef GL_ARB_texture_stencil8 + "GL_ARB_texture_stencil8", +#endif +#ifdef GL_ARB_texture_storage + "GL_ARB_texture_storage", +#endif #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; - r = ((glTextureStorage2DMultisampleEXT = (PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisampleEXT")) == NULL) || r; - r = ((glTextureStorage3DMultisampleEXT = (PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisampleEXT")) == NULL) || r; - - return r; -} - -#endif /* GL_ARB_texture_storage_multisample */ - + "GL_ARB_texture_storage_multisample", +#endif +#ifdef GL_ARB_texture_swizzle + "GL_ARB_texture_swizzle", +#endif #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 */ - + "GL_ARB_texture_view", +#endif #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 */ - + "GL_ARB_timer_query", +#endif #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 */ - + "GL_ARB_transform_feedback2", +#endif #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 */ - + "GL_ARB_transform_feedback3", +#endif #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 */ - + "GL_ARB_transform_feedback_instanced", +#endif +#ifdef GL_ARB_transform_feedback_overflow_query + "GL_ARB_transform_feedback_overflow_query", +#endif #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 */ - + "GL_ARB_transpose_matrix", +#endif #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 */ - + "GL_ARB_uniform_buffer_object", +#endif +#ifdef GL_ARB_vertex_array_bgra + "GL_ARB_vertex_array_bgra", +#endif #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 */ - + "GL_ARB_vertex_array_object", +#endif #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 */ - + "GL_ARB_vertex_attrib_64bit", +#endif #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 */ - + "GL_ARB_vertex_attrib_binding", +#endif #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 */ - + "GL_ARB_vertex_blend", +#endif #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 */ - + "GL_ARB_vertex_buffer_object", +#endif #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 */ - + "GL_ARB_vertex_program", +#endif #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 */ - + "GL_ARB_vertex_shader", +#endif +#ifdef GL_ARB_vertex_type_10f_11f_11f_rev + "GL_ARB_vertex_type_10f_11f_11f_rev", +#endif #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; - - 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 = ((glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1ui")) == NULL) || r; - r = ((glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1uiv")) == NULL) || r; - r = ((glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2ui")) == NULL) || r; - r = ((glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2uiv")) == NULL) || r; - r = ((glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3ui")) == NULL) || r; - r = ((glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3uiv")) == NULL) || r; - r = ((glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4ui")) == NULL) || r; - r = ((glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4uiv")) == 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; - - return r; -} - -#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ - + "GL_ARB_vertex_type_2_10_10_10_rev", +#endif #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 */ - + "GL_ARB_viewport_array", +#endif #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 */ - + "GL_ARB_window_pos", +#endif +#ifdef GL_ATIX_point_sprites + "GL_ATIX_point_sprites", +#endif +#ifdef GL_ATIX_texture_env_combine3 + "GL_ATIX_texture_env_combine3", +#endif +#ifdef GL_ATIX_texture_env_route + "GL_ATIX_texture_env_route", +#endif +#ifdef GL_ATIX_vertex_shader_output_point_size + "GL_ATIX_vertex_shader_output_point_size", +#endif #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 */ - + "GL_ATI_draw_buffers", +#endif #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 */ - + "GL_ATI_element_array", +#endif #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 */ - + "GL_ATI_envmap_bumpmap", +#endif #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 */ - + "GL_ATI_fragment_shader", +#endif #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 */ - + "GL_ATI_map_object_buffer", +#endif +#ifdef GL_ATI_meminfo + "GL_ATI_meminfo", +#endif #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 */ - + "GL_ATI_pn_triangles", +#endif #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 */ - + "GL_ATI_separate_stencil", +#endif +#ifdef GL_ATI_shader_texture_lod + "GL_ATI_shader_texture_lod", +#endif +#ifdef GL_ATI_text_fragment_shader + "GL_ATI_text_fragment_shader", +#endif +#ifdef GL_ATI_texture_compression_3dc + "GL_ATI_texture_compression_3dc", +#endif +#ifdef GL_ATI_texture_env_combine3 + "GL_ATI_texture_env_combine3", +#endif +#ifdef GL_ATI_texture_float + "GL_ATI_texture_float", +#endif +#ifdef GL_ATI_texture_mirror_once + "GL_ATI_texture_mirror_once", +#endif #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 */ - + "GL_ATI_vertex_array_object", +#endif #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 */ - + "GL_ATI_vertex_attrib_array_object", +#endif #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 */ - + "GL_ATI_vertex_streams", +#endif +#ifdef GL_EGL_NV_robustness_video_memory_purge + "GL_EGL_NV_robustness_video_memory_purge", +#endif +#ifdef GL_EXT_422_pixels + "GL_EXT_422_pixels", +#endif +#ifdef GL_EXT_Cg_shader + "GL_EXT_Cg_shader", +#endif +#ifdef GL_EXT_abgr + "GL_EXT_abgr", +#endif +#ifdef GL_EXT_bgra + "GL_EXT_bgra", +#endif #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 */ - + "GL_EXT_bindable_uniform", +#endif #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 */ - + "GL_EXT_blend_color", +#endif #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 */ - + "GL_EXT_blend_equation_separate", +#endif #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 */ - + "GL_EXT_blend_func_separate", +#endif +#ifdef GL_EXT_blend_logic_op + "GL_EXT_blend_logic_op", +#endif #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 */ - + "GL_EXT_blend_minmax", +#endif +#ifdef GL_EXT_blend_subtract + "GL_EXT_blend_subtract", +#endif +#ifdef GL_EXT_clip_volume_hint + "GL_EXT_clip_volume_hint", +#endif +#ifdef GL_EXT_cmyka + "GL_EXT_cmyka", +#endif #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 */ - + "GL_EXT_color_subtable", +#endif #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 */ - + "GL_EXT_compiled_vertex_array", +#endif #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 */ - + "GL_EXT_convolution", +#endif #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 */ - + "GL_EXT_coordinate_frame", +#endif #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 */ - + "GL_EXT_copy_texture", +#endif #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 */ - + "GL_EXT_cull_vertex", +#endif #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 */ - + "GL_EXT_debug_label", +#endif #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 */ - + "GL_EXT_debug_marker", +#endif #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 */ - + "GL_EXT_depth_bounds_test", +#endif #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 */ - + "GL_EXT_direct_state_access", +#endif #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 */ - + "GL_EXT_draw_buffers2", +#endif #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 */ - + "GL_EXT_draw_instanced", +#endif #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 */ - + "GL_EXT_draw_range_elements", +#endif #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 */ - + "GL_EXT_fog_coord", +#endif #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 */ - + "GL_EXT_fragment_lighting", +#endif #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 */ - + "GL_EXT_framebuffer_blit", +#endif #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 */ - + "GL_EXT_framebuffer_multisample", +#endif +#ifdef GL_EXT_framebuffer_multisample_blit_scaled + "GL_EXT_framebuffer_multisample_blit_scaled", +#endif #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 */ - + "GL_EXT_framebuffer_object", +#endif +#ifdef GL_EXT_framebuffer_sRGB + "GL_EXT_framebuffer_sRGB", +#endif #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 */ - + "GL_EXT_geometry_shader4", +#endif #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 */ - + "GL_EXT_gpu_program_parameters", +#endif #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 */ - + "GL_EXT_gpu_shader4", +#endif #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 */ - + "GL_EXT_histogram", +#endif +#ifdef GL_EXT_index_array_formats + "GL_EXT_index_array_formats", +#endif #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 */ - + "GL_EXT_index_func", +#endif #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 */ - + "GL_EXT_index_material", +#endif +#ifdef GL_EXT_index_texture + "GL_EXT_index_texture", +#endif #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 */ - + "GL_EXT_light_texture", +#endif +#ifdef GL_EXT_misc_attribute + "GL_EXT_misc_attribute", +#endif #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 */ - + "GL_EXT_multi_draw_arrays", +#endif #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 */ - + "GL_EXT_multisample", +#endif +#ifdef GL_EXT_packed_depth_stencil + "GL_EXT_packed_depth_stencil", +#endif +#ifdef GL_EXT_packed_float + "GL_EXT_packed_float", +#endif +#ifdef GL_EXT_packed_pixels + "GL_EXT_packed_pixels", +#endif #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 */ - + "GL_EXT_paletted_texture", +#endif +#ifdef GL_EXT_pixel_buffer_object + "GL_EXT_pixel_buffer_object", +#endif #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 */ - + "GL_EXT_pixel_transform", +#endif +#ifdef GL_EXT_pixel_transform_color_table + "GL_EXT_pixel_transform_color_table", +#endif #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 */ - + "GL_EXT_point_parameters", +#endif #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 */ - + "GL_EXT_polygon_offset", +#endif #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 */ - + "GL_EXT_polygon_offset_clamp", +#endif +#ifdef GL_EXT_post_depth_coverage + "GL_EXT_post_depth_coverage", +#endif #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 */ - + "GL_EXT_provoking_vertex", +#endif #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 */ - + "GL_EXT_raster_multisample", +#endif +#ifdef GL_EXT_rescale_normal + "GL_EXT_rescale_normal", +#endif #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 */ - + "GL_EXT_scene_marker", +#endif #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 */ - + "GL_EXT_secondary_color", +#endif #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 */ - + "GL_EXT_separate_shader_objects", +#endif +#ifdef GL_EXT_separate_specular_color + "GL_EXT_separate_specular_color", +#endif +#ifdef GL_EXT_shader_image_load_formatted + "GL_EXT_shader_image_load_formatted", +#endif #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 */ - + "GL_EXT_shader_image_load_store", +#endif +#ifdef GL_EXT_shader_integer_mix + "GL_EXT_shader_integer_mix", +#endif +#ifdef GL_EXT_shadow_funcs + "GL_EXT_shadow_funcs", +#endif +#ifdef GL_EXT_shared_texture_palette + "GL_EXT_shared_texture_palette", +#endif +#ifdef GL_EXT_sparse_texture2 + "GL_EXT_sparse_texture2", +#endif +#ifdef GL_EXT_stencil_clear_tag + "GL_EXT_stencil_clear_tag", +#endif #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 */ - + "GL_EXT_stencil_two_side", +#endif +#ifdef GL_EXT_stencil_wrap + "GL_EXT_stencil_wrap", +#endif #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 */ - + "GL_EXT_subtexture", +#endif +#ifdef GL_EXT_texture + "GL_EXT_texture", +#endif #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 */ - + "GL_EXT_texture3D", +#endif #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 */ - + "GL_EXT_texture_array", +#endif #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 */ - + "GL_EXT_texture_buffer_object", +#endif +#ifdef GL_EXT_texture_compression_dxt1 + "GL_EXT_texture_compression_dxt1", +#endif +#ifdef GL_EXT_texture_compression_latc + "GL_EXT_texture_compression_latc", +#endif +#ifdef GL_EXT_texture_compression_rgtc + "GL_EXT_texture_compression_rgtc", +#endif +#ifdef GL_EXT_texture_compression_s3tc + "GL_EXT_texture_compression_s3tc", +#endif +#ifdef GL_EXT_texture_cube_map + "GL_EXT_texture_cube_map", +#endif +#ifdef GL_EXT_texture_edge_clamp + "GL_EXT_texture_edge_clamp", +#endif +#ifdef GL_EXT_texture_env + "GL_EXT_texture_env", +#endif +#ifdef GL_EXT_texture_env_add + "GL_EXT_texture_env_add", +#endif +#ifdef GL_EXT_texture_env_combine + "GL_EXT_texture_env_combine", +#endif +#ifdef GL_EXT_texture_env_dot3 + "GL_EXT_texture_env_dot3", +#endif +#ifdef GL_EXT_texture_filter_anisotropic + "GL_EXT_texture_filter_anisotropic", +#endif +#ifdef GL_EXT_texture_filter_minmax + "GL_EXT_texture_filter_minmax", +#endif #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 */ - + "GL_EXT_texture_integer", +#endif +#ifdef GL_EXT_texture_lod_bias + "GL_EXT_texture_lod_bias", +#endif +#ifdef GL_EXT_texture_mirror_clamp + "GL_EXT_texture_mirror_clamp", +#endif #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 */ - + "GL_EXT_texture_object", +#endif #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 */ - + "GL_EXT_texture_perturb_normal", +#endif +#ifdef GL_EXT_texture_rectangle + "GL_EXT_texture_rectangle", +#endif +#ifdef GL_EXT_texture_sRGB + "GL_EXT_texture_sRGB", +#endif +#ifdef GL_EXT_texture_sRGB_decode + "GL_EXT_texture_sRGB_decode", +#endif +#ifdef GL_EXT_texture_shared_exponent + "GL_EXT_texture_shared_exponent", +#endif +#ifdef GL_EXT_texture_snorm + "GL_EXT_texture_snorm", +#endif +#ifdef GL_EXT_texture_swizzle + "GL_EXT_texture_swizzle", +#endif #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 */ - + "GL_EXT_timer_query", +#endif #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 */ - + "GL_EXT_transform_feedback", +#endif #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 */ - + "GL_EXT_vertex_array", +#endif +#ifdef GL_EXT_vertex_array_bgra + "GL_EXT_vertex_array_bgra", +#endif #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 */ - + "GL_EXT_vertex_attrib_64bit", +#endif #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 */ - + "GL_EXT_vertex_shader", +#endif #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 */ - + "GL_EXT_vertex_weighting", +#endif +#ifdef GL_EXT_window_rectangles + "GL_EXT_window_rectangles", +#endif #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 */ - + "GL_EXT_x11_sync_object", +#endif #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 */ - + "GL_GREMEDY_frame_terminator", +#endif #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 */ - + "GL_GREMEDY_string_marker", +#endif +#ifdef GL_HP_convolution_border_modes + "GL_HP_convolution_border_modes", +#endif #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 */ - + "GL_HP_image_transform", +#endif +#ifdef GL_HP_occlusion_test + "GL_HP_occlusion_test", +#endif +#ifdef GL_HP_texture_lighting + "GL_HP_texture_lighting", +#endif +#ifdef GL_IBM_cull_vertex + "GL_IBM_cull_vertex", +#endif #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 */ - + "GL_IBM_multimode_draw_arrays", +#endif +#ifdef GL_IBM_rasterpos_clip + "GL_IBM_rasterpos_clip", +#endif +#ifdef GL_IBM_static_data + "GL_IBM_static_data", +#endif +#ifdef GL_IBM_texture_mirrored_repeat + "GL_IBM_texture_mirrored_repeat", +#endif #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 */ - + "GL_IBM_vertex_array_lists", +#endif +#ifdef GL_INGR_color_clamp + "GL_INGR_color_clamp", +#endif +#ifdef GL_INGR_interlace_read + "GL_INGR_interlace_read", +#endif +#ifdef GL_INTEL_conservative_rasterization + "GL_INTEL_conservative_rasterization", +#endif +#ifdef GL_INTEL_fragment_shader_ordering + "GL_INTEL_fragment_shader_ordering", +#endif +#ifdef GL_INTEL_framebuffer_CMAA + "GL_INTEL_framebuffer_CMAA", +#endif #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 */ - + "GL_INTEL_map_texture", +#endif #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 */ - + "GL_INTEL_parallel_arrays", +#endif #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 */ - + "GL_INTEL_performance_query", +#endif #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 */ - + "GL_INTEL_texture_scissor", +#endif #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 */ - + "GL_KHR_blend_equation_advanced", +#endif +#ifdef GL_KHR_blend_equation_advanced_coherent + "GL_KHR_blend_equation_advanced_coherent", +#endif +#ifdef GL_KHR_context_flush_control + "GL_KHR_context_flush_control", +#endif #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 */ - + "GL_KHR_debug", +#endif +#ifdef GL_KHR_no_error + "GL_KHR_no_error", +#endif +#ifdef GL_KHR_robust_buffer_access_behavior + "GL_KHR_robust_buffer_access_behavior", +#endif #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 */ - + "GL_KHR_robustness", +#endif +#ifdef GL_KHR_texture_compression_astc_hdr + "GL_KHR_texture_compression_astc_hdr", +#endif +#ifdef GL_KHR_texture_compression_astc_ldr + "GL_KHR_texture_compression_astc_ldr", +#endif +#ifdef GL_KHR_texture_compression_astc_sliced_3d + "GL_KHR_texture_compression_astc_sliced_3d", +#endif #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 */ - + "GL_KTX_buffer_region", +#endif +#ifdef GL_MESAX_texture_stack + "GL_MESAX_texture_stack", +#endif +#ifdef GL_MESA_pack_invert + "GL_MESA_pack_invert", +#endif #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 */ - + "GL_MESA_resize_buffers", +#endif +#ifdef GL_MESA_shader_integer_functions + "GL_MESA_shader_integer_functions", +#endif #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 */ - + "GL_MESA_window_pos", +#endif +#ifdef GL_MESA_ycbcr_texture + "GL_MESA_ycbcr_texture", +#endif +#ifdef GL_NVX_blend_equation_advanced_multi_draw_buffers + "GL_NVX_blend_equation_advanced_multi_draw_buffers", +#endif #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 */ - + "GL_NVX_conditional_render", +#endif +#ifdef GL_NVX_gpu_memory_info + "GL_NVX_gpu_memory_info", +#endif +#ifdef GL_NVX_linked_gpu_multicast + "GL_NVX_linked_gpu_multicast", +#endif #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 */ - + "GL_NV_bindless_multi_draw_indirect", +#endif #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 */ - + "GL_NV_bindless_multi_draw_indirect_count", +#endif #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 */ - + "GL_NV_bindless_texture", +#endif #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 */ - + "GL_NV_blend_equation_advanced", +#endif +#ifdef GL_NV_blend_equation_advanced_coherent + "GL_NV_blend_equation_advanced_coherent", +#endif +#ifdef GL_NV_blend_square + "GL_NV_blend_square", +#endif +#ifdef GL_NV_clip_space_w_scaling + "GL_NV_clip_space_w_scaling", +#endif +#ifdef GL_NV_command_list + "GL_NV_command_list", +#endif +#ifdef GL_NV_compute_program5 + "GL_NV_compute_program5", +#endif #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 */ - + "GL_NV_conditional_render", +#endif #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 */ - + "GL_NV_conservative_raster", +#endif #ifdef GL_NV_conservative_raster_dilate - -static GLboolean _glewInit_GL_NV_conservative_raster_dilate (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glConservativeRasterParameterfNV = (PFNGLCONSERVATIVERASTERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glConservativeRasterParameterfNV")) == NULL) || r; - - return r; -} - -#endif /* GL_NV_conservative_raster_dilate */ - + "GL_NV_conservative_raster_dilate", +#endif +#ifdef GL_NV_conservative_raster_pre_snap_triangles + "GL_NV_conservative_raster_pre_snap_triangles", +#endif +#ifdef GL_NV_copy_depth_to_color + "GL_NV_copy_depth_to_color", +#endif #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 */ - + "GL_NV_copy_image", +#endif +#ifdef GL_NV_deep_texture3D + "GL_NV_deep_texture3D", +#endif #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 */ - + "GL_NV_depth_buffer_float", +#endif +#ifdef GL_NV_depth_clamp + "GL_NV_depth_clamp", +#endif +#ifdef GL_NV_depth_range_unclamped + "GL_NV_depth_range_unclamped", +#endif #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 */ - + "GL_NV_draw_texture", +#endif +#ifdef GL_NV_draw_vulkan_image + "GL_NV_draw_vulkan_image", +#endif #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 */ - + "GL_NV_evaluators", +#endif #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 */ - + "GL_NV_explicit_multisample", +#endif #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 */ - + "GL_NV_fence", +#endif +#ifdef GL_NV_fill_rectangle + "GL_NV_fill_rectangle", +#endif +#ifdef GL_NV_float_buffer + "GL_NV_float_buffer", +#endif +#ifdef GL_NV_fog_distance + "GL_NV_fog_distance", +#endif #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 */ - + "GL_NV_fragment_coverage_to_color", +#endif #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 */ - + "GL_NV_fragment_program", +#endif +#ifdef GL_NV_fragment_program2 + "GL_NV_fragment_program2", +#endif +#ifdef GL_NV_fragment_program4 + "GL_NV_fragment_program4", +#endif +#ifdef GL_NV_fragment_program_option + "GL_NV_fragment_program_option", +#endif +#ifdef GL_NV_fragment_shader_interlock + "GL_NV_fragment_shader_interlock", +#endif +#ifdef GL_NV_framebuffer_mixed_samples + "GL_NV_framebuffer_mixed_samples", +#endif #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 */ - + "GL_NV_framebuffer_multisample_coverage", +#endif #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 */ - + "GL_NV_geometry_program4", +#endif +#ifdef GL_NV_geometry_shader4 + "GL_NV_geometry_shader4", +#endif +#ifdef GL_NV_geometry_shader_passthrough + "GL_NV_geometry_shader_passthrough", +#endif +#ifdef GL_NV_gpu_multicast + "GL_NV_gpu_multicast", +#endif #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 */ - + "GL_NV_gpu_program4", +#endif +#ifdef GL_NV_gpu_program5 + "GL_NV_gpu_program5", +#endif +#ifdef GL_NV_gpu_program5_mem_extended + "GL_NV_gpu_program5_mem_extended", +#endif +#ifdef GL_NV_gpu_program_fp64 + "GL_NV_gpu_program_fp64", +#endif #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 */ - + "GL_NV_gpu_shader5", +#endif #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 */ - + "GL_NV_half_float", +#endif #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 */ - + "GL_NV_internalformat_sample_query", +#endif +#ifdef GL_NV_light_max_exponent + "GL_NV_light_max_exponent", +#endif +#ifdef GL_NV_multisample_coverage + "GL_NV_multisample_coverage", +#endif +#ifdef GL_NV_multisample_filter_hint + "GL_NV_multisample_filter_hint", +#endif #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 */ - + "GL_NV_occlusion_query", +#endif +#ifdef GL_NV_packed_depth_stencil + "GL_NV_packed_depth_stencil", +#endif #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 */ - + "GL_NV_parameter_buffer_object", +#endif +#ifdef GL_NV_parameter_buffer_object2 + "GL_NV_parameter_buffer_object2", +#endif #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 */ - + "GL_NV_path_rendering", +#endif +#ifdef GL_NV_path_rendering_shared_edge + "GL_NV_path_rendering_shared_edge", +#endif #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 */ - + "GL_NV_pixel_data_range", +#endif #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 */ - + "GL_NV_point_sprite", +#endif #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 */ - + "GL_NV_present_video", +#endif #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 */ - + "GL_NV_primitive_restart", +#endif #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 */ - + "GL_NV_register_combiners", +#endif #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 */ - + "GL_NV_register_combiners2", +#endif +#ifdef GL_NV_robustness_video_memory_purge + "GL_NV_robustness_video_memory_purge", +#endif #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 */ - + "GL_NV_sample_locations", +#endif +#ifdef GL_NV_sample_mask_override_coverage + "GL_NV_sample_mask_override_coverage", +#endif +#ifdef GL_NV_shader_atomic_counters + "GL_NV_shader_atomic_counters", +#endif +#ifdef GL_NV_shader_atomic_float + "GL_NV_shader_atomic_float", +#endif +#ifdef GL_NV_shader_atomic_float64 + "GL_NV_shader_atomic_float64", +#endif +#ifdef GL_NV_shader_atomic_fp16_vector + "GL_NV_shader_atomic_fp16_vector", +#endif +#ifdef GL_NV_shader_atomic_int64 + "GL_NV_shader_atomic_int64", +#endif #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 */ - + "GL_NV_shader_buffer_load", +#endif +#ifdef GL_NV_shader_storage_buffer_object + "GL_NV_shader_storage_buffer_object", +#endif +#ifdef GL_NV_shader_thread_group + "GL_NV_shader_thread_group", +#endif +#ifdef GL_NV_shader_thread_shuffle + "GL_NV_shader_thread_shuffle", +#endif +#ifdef GL_NV_stereo_view_rendering + "GL_NV_stereo_view_rendering", +#endif +#ifdef GL_NV_tessellation_program5 + "GL_NV_tessellation_program5", +#endif +#ifdef GL_NV_texgen_emboss + "GL_NV_texgen_emboss", +#endif +#ifdef GL_NV_texgen_reflection + "GL_NV_texgen_reflection", +#endif #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 */ - + "GL_NV_texture_barrier", +#endif +#ifdef GL_NV_texture_compression_vtc + "GL_NV_texture_compression_vtc", +#endif +#ifdef GL_NV_texture_env_combine4 + "GL_NV_texture_env_combine4", +#endif +#ifdef GL_NV_texture_expand_normal + "GL_NV_texture_expand_normal", +#endif #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 */ - + "GL_NV_texture_multisample", +#endif +#ifdef GL_NV_texture_rectangle + "GL_NV_texture_rectangle", +#endif +#ifdef GL_NV_texture_shader + "GL_NV_texture_shader", +#endif +#ifdef GL_NV_texture_shader2 + "GL_NV_texture_shader2", +#endif +#ifdef GL_NV_texture_shader3 + "GL_NV_texture_shader3", +#endif #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 */ - + "GL_NV_transform_feedback", +#endif #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 */ - + "GL_NV_transform_feedback2", +#endif +#ifdef GL_NV_uniform_buffer_unified_memory + "GL_NV_uniform_buffer_unified_memory", +#endif #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 */ - + "GL_NV_vdpau_interop", +#endif #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 */ - + "GL_NV_vertex_array_range", +#endif +#ifdef GL_NV_vertex_array_range2 + "GL_NV_vertex_array_range2", +#endif #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 */ - + "GL_NV_vertex_attrib_integer_64bit", +#endif #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 */ - + "GL_NV_vertex_buffer_unified_memory", +#endif #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 */ - + "GL_NV_vertex_program", +#endif +#ifdef GL_NV_vertex_program1_1 + "GL_NV_vertex_program1_1", +#endif +#ifdef GL_NV_vertex_program2 + "GL_NV_vertex_program2", +#endif +#ifdef GL_NV_vertex_program2_option + "GL_NV_vertex_program2_option", +#endif +#ifdef GL_NV_vertex_program3 + "GL_NV_vertex_program3", +#endif +#ifdef GL_NV_vertex_program4 + "GL_NV_vertex_program4", +#endif #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 */ - + "GL_NV_video_capture", +#endif +#ifdef GL_NV_viewport_array2 + "GL_NV_viewport_array2", +#endif +#ifdef GL_NV_viewport_swizzle + "GL_NV_viewport_swizzle", +#endif +#ifdef GL_OES_byte_coordinates + "GL_OES_byte_coordinates", +#endif +#ifdef GL_OES_compressed_paletted_texture + "GL_OES_compressed_paletted_texture", +#endif +#ifdef GL_OES_read_format + "GL_OES_read_format", +#endif #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 */ - + "GL_OES_single_precision", +#endif +#ifdef GL_OML_interlace + "GL_OML_interlace", +#endif +#ifdef GL_OML_resample + "GL_OML_resample", +#endif +#ifdef GL_OML_subsample + "GL_OML_subsample", +#endif #ifdef GL_OVR_multiview - -static GLboolean _glewInit_GL_OVR_multiview (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glFramebufferTextureMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureMultiviewOVR")) == NULL) || r; - - return r; -} - -#endif /* GL_OVR_multiview */ - + "GL_OVR_multiview", +#endif +#ifdef GL_OVR_multiview2 + "GL_OVR_multiview2", +#endif +#ifdef GL_PGI_misc_hints + "GL_PGI_misc_hints", +#endif +#ifdef GL_PGI_vertex_hints + "GL_PGI_vertex_hints", +#endif #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 */ - + "GL_REGAL_ES1_0_compatibility", +#endif #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 */ - + "GL_REGAL_ES1_1_compatibility", +#endif +#ifdef GL_REGAL_enable + "GL_REGAL_enable", +#endif #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 */ - + "GL_REGAL_error_string", +#endif #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 */ - + "GL_REGAL_extension_query", +#endif #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 */ - + "GL_REGAL_log", +#endif #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 */ - + "GL_REGAL_proc_address", +#endif +#ifdef GL_REND_screen_coordinates + "GL_REND_screen_coordinates", +#endif +#ifdef GL_S3_s3tc + "GL_S3_s3tc", +#endif +#ifdef GL_SGIS_color_range + "GL_SGIS_color_range", +#endif #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 */ - + "GL_SGIS_detail_texture", +#endif #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 */ - + "GL_SGIS_fog_function", +#endif +#ifdef GL_SGIS_generate_mipmap + "GL_SGIS_generate_mipmap", +#endif #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 */ - + "GL_SGIS_multisample", +#endif +#ifdef GL_SGIS_pixel_texture + "GL_SGIS_pixel_texture", +#endif +#ifdef GL_SGIS_point_line_texgen + "GL_SGIS_point_line_texgen", +#endif #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 */ - + "GL_SGIS_sharpen_texture", +#endif #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 */ - + "GL_SGIS_texture4D", +#endif +#ifdef GL_SGIS_texture_border_clamp + "GL_SGIS_texture_border_clamp", +#endif +#ifdef GL_SGIS_texture_edge_clamp + "GL_SGIS_texture_edge_clamp", +#endif #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 */ - + "GL_SGIS_texture_filter4", +#endif +#ifdef GL_SGIS_texture_lod + "GL_SGIS_texture_lod", +#endif +#ifdef GL_SGIS_texture_select + "GL_SGIS_texture_select", +#endif #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 */ - + "GL_SGIX_async", +#endif +#ifdef GL_SGIX_async_histogram + "GL_SGIX_async_histogram", +#endif +#ifdef GL_SGIX_async_pixel + "GL_SGIX_async_pixel", +#endif +#ifdef GL_SGIX_blend_alpha_minmax + "GL_SGIX_blend_alpha_minmax", +#endif +#ifdef GL_SGIX_clipmap + "GL_SGIX_clipmap", +#endif +#ifdef GL_SGIX_convolution_accuracy + "GL_SGIX_convolution_accuracy", +#endif +#ifdef GL_SGIX_depth_texture + "GL_SGIX_depth_texture", +#endif #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 */ - + "GL_SGIX_flush_raster", +#endif +#ifdef GL_SGIX_fog_offset + "GL_SGIX_fog_offset", +#endif #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 */ - + "GL_SGIX_fog_texture", +#endif #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 */ - + "GL_SGIX_fragment_specular_lighting", +#endif #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 */ - + "GL_SGIX_framezoom", +#endif +#ifdef GL_SGIX_interlace + "GL_SGIX_interlace", +#endif +#ifdef GL_SGIX_ir_instrument1 + "GL_SGIX_ir_instrument1", +#endif +#ifdef GL_SGIX_list_priority + "GL_SGIX_list_priority", +#endif #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 */ - + "GL_SGIX_pixel_texture", +#endif +#ifdef GL_SGIX_pixel_texture_bits + "GL_SGIX_pixel_texture_bits", +#endif #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 */ - + "GL_SGIX_reference_plane", +#endif +#ifdef GL_SGIX_resample + "GL_SGIX_resample", +#endif +#ifdef GL_SGIX_shadow + "GL_SGIX_shadow", +#endif +#ifdef GL_SGIX_shadow_ambient + "GL_SGIX_shadow_ambient", +#endif #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 */ - + "GL_SGIX_sprite", +#endif #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 */ - + "GL_SGIX_tag_sample_buffer", +#endif +#ifdef GL_SGIX_texture_add_env + "GL_SGIX_texture_add_env", +#endif +#ifdef GL_SGIX_texture_coordinate_clamp + "GL_SGIX_texture_coordinate_clamp", +#endif +#ifdef GL_SGIX_texture_lod_bias + "GL_SGIX_texture_lod_bias", +#endif +#ifdef GL_SGIX_texture_multi_buffer + "GL_SGIX_texture_multi_buffer", +#endif +#ifdef GL_SGIX_texture_range + "GL_SGIX_texture_range", +#endif +#ifdef GL_SGIX_texture_scale_bias + "GL_SGIX_texture_scale_bias", +#endif +#ifdef GL_SGIX_vertex_preclip + "GL_SGIX_vertex_preclip", +#endif +#ifdef GL_SGIX_vertex_preclip_hint + "GL_SGIX_vertex_preclip_hint", +#endif +#ifdef GL_SGIX_ycrcb + "GL_SGIX_ycrcb", +#endif +#ifdef GL_SGI_color_matrix + "GL_SGI_color_matrix", +#endif #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 */ - + "GL_SGI_color_table", +#endif +#ifdef GL_SGI_texture_color_table + "GL_SGI_texture_color_table", +#endif #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 */ - + "GL_SUNX_constant_data", +#endif +#ifdef GL_SUN_convolution_border_modes + "GL_SUN_convolution_border_modes", +#endif #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 */ - + "GL_SUN_global_alpha", +#endif +#ifdef GL_SUN_mesh_array + "GL_SUN_mesh_array", +#endif #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 */ - + "GL_SUN_read_video_pixels", +#endif +#ifdef GL_SUN_slice_accum + "GL_SUN_slice_accum", +#endif #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 */ - + "GL_SUN_triangle_list", +#endif #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 */ - + "GL_SUN_vertex", +#endif +#ifdef GL_WIN_phong_shading + "GL_WIN_phong_shading", +#endif +#ifdef GL_WIN_specular_fog + "GL_WIN_specular_fog", +#endif #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) -{ - const GLubyte* start; - const GLubyte* end; - start = (const GLubyte*)glGetString(GL_EXTENSIONS); - if (start == 0) - return GL_FALSE; - end = start + _glewStrLen(start); - return _glewSearchExtension(name, start, end); -} - -/* ------------------------------------------------------------------------- */ - -#ifndef GLEW_MX -static + "GL_WIN_swap_hint", #endif -GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) -{ - const GLubyte* s; - GLuint dot; - GLint major, minor; - const GLubyte* extStart; - const GLubyte* extEnd; - /* 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; - + NULL +}; - 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 */ - extStart = glGetString(GL_EXTENSIONS); - if (extStart == 0) - extStart = (const GLubyte*)""; - extEnd = extStart + _glewStrLen(extStart); - - /* initialize extensions */ +/* Detected in the extension string or strings */ +static GLboolean _glewExtensionString[603]; +/* Detected via extension string or experimental mode */ +static GLboolean* _glewExtensionEnabled[] = { #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 */ + &__GLEW_VERSION_1_2, +#endif #ifdef GL_VERSION_1_2_1 -#endif /* GL_VERSION_1_2_1 */ + &__GLEW_VERSION_1_2_1, +#endif #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 */ + &__GLEW_VERSION_1_3, +#endif #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 */ + &__GLEW_VERSION_1_4, +#endif #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 */ + &__GLEW_VERSION_1_5, +#endif #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 */ + &__GLEW_VERSION_2_0, +#endif #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 */ + &__GLEW_VERSION_2_1, +#endif #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 */ + &__GLEW_VERSION_3_0, +#endif #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 */ + &__GLEW_VERSION_3_1, +#endif #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 */ + &__GLEW_VERSION_3_2, +#endif #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 */ + &__GLEW_VERSION_3_3, +#endif #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 */ + &__GLEW_VERSION_4_0, +#endif #ifdef GL_VERSION_4_1 -#endif /* GL_VERSION_4_1 */ + &__GLEW_VERSION_4_1, +#endif #ifdef GL_VERSION_4_2 -#endif /* GL_VERSION_4_2 */ + &__GLEW_VERSION_4_2, +#endif #ifdef GL_VERSION_4_3 -#endif /* GL_VERSION_4_3 */ + &__GLEW_VERSION_4_3, +#endif #ifdef GL_VERSION_4_4 -#endif /* GL_VERSION_4_4 */ + &__GLEW_VERSION_4_4, +#endif #ifdef GL_VERSION_4_5 - if (glewExperimental || GLEW_VERSION_4_5) GLEW_VERSION_4_5 = !_glewInit_GL_VERSION_4_5(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_VERSION_4_5 */ + &__GLEW_VERSION_4_5, +#endif #ifdef GL_3DFX_multisample - GLEW_3DFX_multisample = _glewSearchExtension("GL_3DFX_multisample", extStart, extEnd); -#endif /* GL_3DFX_multisample */ + &__GLEW_3DFX_multisample, +#endif #ifdef GL_3DFX_tbuffer - GLEW_3DFX_tbuffer = _glewSearchExtension("GL_3DFX_tbuffer", extStart, extEnd); - if (glewExperimental || GLEW_3DFX_tbuffer) GLEW_3DFX_tbuffer = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_3DFX_tbuffer */ + &__GLEW_3DFX_tbuffer, +#endif #ifdef GL_3DFX_texture_compression_FXT1 - GLEW_3DFX_texture_compression_FXT1 = _glewSearchExtension("GL_3DFX_texture_compression_FXT1", extStart, extEnd); -#endif /* GL_3DFX_texture_compression_FXT1 */ + &__GLEW_3DFX_texture_compression_FXT1, +#endif #ifdef GL_AMD_blend_minmax_factor - GLEW_AMD_blend_minmax_factor = _glewSearchExtension("GL_AMD_blend_minmax_factor", extStart, extEnd); -#endif /* GL_AMD_blend_minmax_factor */ + &__GLEW_AMD_blend_minmax_factor, +#endif #ifdef GL_AMD_conservative_depth - GLEW_AMD_conservative_depth = _glewSearchExtension("GL_AMD_conservative_depth", extStart, extEnd); -#endif /* GL_AMD_conservative_depth */ + &__GLEW_AMD_conservative_depth, +#endif #ifdef GL_AMD_debug_output - GLEW_AMD_debug_output = _glewSearchExtension("GL_AMD_debug_output", extStart, extEnd); - 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 */ + &__GLEW_AMD_debug_output, +#endif #ifdef GL_AMD_depth_clamp_separate - GLEW_AMD_depth_clamp_separate = _glewSearchExtension("GL_AMD_depth_clamp_separate", extStart, extEnd); -#endif /* GL_AMD_depth_clamp_separate */ + &__GLEW_AMD_depth_clamp_separate, +#endif #ifdef GL_AMD_draw_buffers_blend - GLEW_AMD_draw_buffers_blend = _glewSearchExtension("GL_AMD_draw_buffers_blend", extStart, extEnd); - 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 */ + &__GLEW_AMD_draw_buffers_blend, +#endif #ifdef GL_AMD_gcn_shader - GLEW_AMD_gcn_shader = _glewSearchExtension("GL_AMD_gcn_shader", extStart, extEnd); -#endif /* GL_AMD_gcn_shader */ + &__GLEW_AMD_gcn_shader, +#endif #ifdef GL_AMD_gpu_shader_int64 - GLEW_AMD_gpu_shader_int64 = _glewSearchExtension("GL_AMD_gpu_shader_int64", extStart, extEnd); -#endif /* GL_AMD_gpu_shader_int64 */ + &__GLEW_AMD_gpu_shader_int64, +#endif #ifdef GL_AMD_interleaved_elements - GLEW_AMD_interleaved_elements = _glewSearchExtension("GL_AMD_interleaved_elements", extStart, extEnd); - 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 */ + &__GLEW_AMD_interleaved_elements, +#endif #ifdef GL_AMD_multi_draw_indirect - GLEW_AMD_multi_draw_indirect = _glewSearchExtension("GL_AMD_multi_draw_indirect", extStart, extEnd); - 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 */ + &__GLEW_AMD_multi_draw_indirect, +#endif #ifdef GL_AMD_name_gen_delete - GLEW_AMD_name_gen_delete = _glewSearchExtension("GL_AMD_name_gen_delete", extStart, extEnd); - 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 */ + &__GLEW_AMD_name_gen_delete, +#endif #ifdef GL_AMD_occlusion_query_event - GLEW_AMD_occlusion_query_event = _glewSearchExtension("GL_AMD_occlusion_query_event", extStart, extEnd); - 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 */ + &__GLEW_AMD_occlusion_query_event, +#endif #ifdef GL_AMD_performance_monitor - GLEW_AMD_performance_monitor = _glewSearchExtension("GL_AMD_performance_monitor", extStart, extEnd); - 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 */ + &__GLEW_AMD_performance_monitor, +#endif #ifdef GL_AMD_pinned_memory - GLEW_AMD_pinned_memory = _glewSearchExtension("GL_AMD_pinned_memory", extStart, extEnd); -#endif /* GL_AMD_pinned_memory */ + &__GLEW_AMD_pinned_memory, +#endif #ifdef GL_AMD_query_buffer_object - GLEW_AMD_query_buffer_object = _glewSearchExtension("GL_AMD_query_buffer_object", extStart, extEnd); -#endif /* GL_AMD_query_buffer_object */ + &__GLEW_AMD_query_buffer_object, +#endif #ifdef GL_AMD_sample_positions - GLEW_AMD_sample_positions = _glewSearchExtension("GL_AMD_sample_positions", extStart, extEnd); - 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 */ + &__GLEW_AMD_sample_positions, +#endif #ifdef GL_AMD_seamless_cubemap_per_texture - GLEW_AMD_seamless_cubemap_per_texture = _glewSearchExtension("GL_AMD_seamless_cubemap_per_texture", extStart, extEnd); -#endif /* GL_AMD_seamless_cubemap_per_texture */ + &__GLEW_AMD_seamless_cubemap_per_texture, +#endif #ifdef GL_AMD_shader_atomic_counter_ops - GLEW_AMD_shader_atomic_counter_ops = _glewSearchExtension("GL_AMD_shader_atomic_counter_ops", extStart, extEnd); -#endif /* GL_AMD_shader_atomic_counter_ops */ + &__GLEW_AMD_shader_atomic_counter_ops, +#endif +#ifdef GL_AMD_shader_explicit_vertex_parameter + &__GLEW_AMD_shader_explicit_vertex_parameter, +#endif #ifdef GL_AMD_shader_stencil_export - GLEW_AMD_shader_stencil_export = _glewSearchExtension("GL_AMD_shader_stencil_export", extStart, extEnd); -#endif /* GL_AMD_shader_stencil_export */ + &__GLEW_AMD_shader_stencil_export, +#endif #ifdef GL_AMD_shader_stencil_value_export - GLEW_AMD_shader_stencil_value_export = _glewSearchExtension("GL_AMD_shader_stencil_value_export", extStart, extEnd); -#endif /* GL_AMD_shader_stencil_value_export */ + &__GLEW_AMD_shader_stencil_value_export, +#endif #ifdef GL_AMD_shader_trinary_minmax - GLEW_AMD_shader_trinary_minmax = _glewSearchExtension("GL_AMD_shader_trinary_minmax", extStart, extEnd); -#endif /* GL_AMD_shader_trinary_minmax */ + &__GLEW_AMD_shader_trinary_minmax, +#endif #ifdef GL_AMD_sparse_texture - GLEW_AMD_sparse_texture = _glewSearchExtension("GL_AMD_sparse_texture", extStart, extEnd); - 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 */ + &__GLEW_AMD_sparse_texture, +#endif #ifdef GL_AMD_stencil_operation_extended - GLEW_AMD_stencil_operation_extended = _glewSearchExtension("GL_AMD_stencil_operation_extended", extStart, extEnd); - 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 */ + &__GLEW_AMD_stencil_operation_extended, +#endif #ifdef GL_AMD_texture_texture4 - GLEW_AMD_texture_texture4 = _glewSearchExtension("GL_AMD_texture_texture4", extStart, extEnd); -#endif /* GL_AMD_texture_texture4 */ + &__GLEW_AMD_texture_texture4, +#endif #ifdef GL_AMD_transform_feedback3_lines_triangles - GLEW_AMD_transform_feedback3_lines_triangles = _glewSearchExtension("GL_AMD_transform_feedback3_lines_triangles", extStart, extEnd); -#endif /* GL_AMD_transform_feedback3_lines_triangles */ + &__GLEW_AMD_transform_feedback3_lines_triangles, +#endif #ifdef GL_AMD_transform_feedback4 - GLEW_AMD_transform_feedback4 = _glewSearchExtension("GL_AMD_transform_feedback4", extStart, extEnd); -#endif /* GL_AMD_transform_feedback4 */ + &__GLEW_AMD_transform_feedback4, +#endif #ifdef GL_AMD_vertex_shader_layer - GLEW_AMD_vertex_shader_layer = _glewSearchExtension("GL_AMD_vertex_shader_layer", extStart, extEnd); -#endif /* GL_AMD_vertex_shader_layer */ + &__GLEW_AMD_vertex_shader_layer, +#endif #ifdef GL_AMD_vertex_shader_tessellator - GLEW_AMD_vertex_shader_tessellator = _glewSearchExtension("GL_AMD_vertex_shader_tessellator", extStart, extEnd); - 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 */ + &__GLEW_AMD_vertex_shader_tessellator, +#endif #ifdef GL_AMD_vertex_shader_viewport_index - GLEW_AMD_vertex_shader_viewport_index = _glewSearchExtension("GL_AMD_vertex_shader_viewport_index", extStart, extEnd); -#endif /* GL_AMD_vertex_shader_viewport_index */ + &__GLEW_AMD_vertex_shader_viewport_index, +#endif #ifdef GL_ANGLE_depth_texture - GLEW_ANGLE_depth_texture = _glewSearchExtension("GL_ANGLE_depth_texture", extStart, extEnd); -#endif /* GL_ANGLE_depth_texture */ + &__GLEW_ANGLE_depth_texture, +#endif #ifdef GL_ANGLE_framebuffer_blit - GLEW_ANGLE_framebuffer_blit = _glewSearchExtension("GL_ANGLE_framebuffer_blit", extStart, extEnd); - 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 */ + &__GLEW_ANGLE_framebuffer_blit, +#endif #ifdef GL_ANGLE_framebuffer_multisample - GLEW_ANGLE_framebuffer_multisample = _glewSearchExtension("GL_ANGLE_framebuffer_multisample", extStart, extEnd); - 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 */ + &__GLEW_ANGLE_framebuffer_multisample, +#endif #ifdef GL_ANGLE_instanced_arrays - GLEW_ANGLE_instanced_arrays = _glewSearchExtension("GL_ANGLE_instanced_arrays", extStart, extEnd); - 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 */ + &__GLEW_ANGLE_instanced_arrays, +#endif #ifdef GL_ANGLE_pack_reverse_row_order - GLEW_ANGLE_pack_reverse_row_order = _glewSearchExtension("GL_ANGLE_pack_reverse_row_order", extStart, extEnd); -#endif /* GL_ANGLE_pack_reverse_row_order */ + &__GLEW_ANGLE_pack_reverse_row_order, +#endif #ifdef GL_ANGLE_program_binary - GLEW_ANGLE_program_binary = _glewSearchExtension("GL_ANGLE_program_binary", extStart, extEnd); -#endif /* GL_ANGLE_program_binary */ + &__GLEW_ANGLE_program_binary, +#endif #ifdef GL_ANGLE_texture_compression_dxt1 - GLEW_ANGLE_texture_compression_dxt1 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt1", extStart, extEnd); -#endif /* GL_ANGLE_texture_compression_dxt1 */ + &__GLEW_ANGLE_texture_compression_dxt1, +#endif #ifdef GL_ANGLE_texture_compression_dxt3 - GLEW_ANGLE_texture_compression_dxt3 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt3", extStart, extEnd); -#endif /* GL_ANGLE_texture_compression_dxt3 */ + &__GLEW_ANGLE_texture_compression_dxt3, +#endif #ifdef GL_ANGLE_texture_compression_dxt5 - GLEW_ANGLE_texture_compression_dxt5 = _glewSearchExtension("GL_ANGLE_texture_compression_dxt5", extStart, extEnd); -#endif /* GL_ANGLE_texture_compression_dxt5 */ + &__GLEW_ANGLE_texture_compression_dxt5, +#endif #ifdef GL_ANGLE_texture_usage - GLEW_ANGLE_texture_usage = _glewSearchExtension("GL_ANGLE_texture_usage", extStart, extEnd); -#endif /* GL_ANGLE_texture_usage */ + &__GLEW_ANGLE_texture_usage, +#endif #ifdef GL_ANGLE_timer_query - GLEW_ANGLE_timer_query = _glewSearchExtension("GL_ANGLE_timer_query", extStart, extEnd); - 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 */ + &__GLEW_ANGLE_timer_query, +#endif #ifdef GL_ANGLE_translated_shader_source - GLEW_ANGLE_translated_shader_source = _glewSearchExtension("GL_ANGLE_translated_shader_source", extStart, extEnd); - 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 */ + &__GLEW_ANGLE_translated_shader_source, +#endif #ifdef GL_APPLE_aux_depth_stencil - GLEW_APPLE_aux_depth_stencil = _glewSearchExtension("GL_APPLE_aux_depth_stencil", extStart, extEnd); -#endif /* GL_APPLE_aux_depth_stencil */ + &__GLEW_APPLE_aux_depth_stencil, +#endif #ifdef GL_APPLE_client_storage - GLEW_APPLE_client_storage = _glewSearchExtension("GL_APPLE_client_storage", extStart, extEnd); -#endif /* GL_APPLE_client_storage */ + &__GLEW_APPLE_client_storage, +#endif #ifdef GL_APPLE_element_array - GLEW_APPLE_element_array = _glewSearchExtension("GL_APPLE_element_array", extStart, extEnd); - 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 */ + &__GLEW_APPLE_element_array, +#endif #ifdef GL_APPLE_fence - GLEW_APPLE_fence = _glewSearchExtension("GL_APPLE_fence", extStart, extEnd); - if (glewExperimental || GLEW_APPLE_fence) GLEW_APPLE_fence = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_APPLE_fence */ + &__GLEW_APPLE_fence, +#endif #ifdef GL_APPLE_float_pixels - GLEW_APPLE_float_pixels = _glewSearchExtension("GL_APPLE_float_pixels", extStart, extEnd); -#endif /* GL_APPLE_float_pixels */ + &__GLEW_APPLE_float_pixels, +#endif #ifdef GL_APPLE_flush_buffer_range - GLEW_APPLE_flush_buffer_range = _glewSearchExtension("GL_APPLE_flush_buffer_range", extStart, extEnd); - 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 */ + &__GLEW_APPLE_flush_buffer_range, +#endif #ifdef GL_APPLE_object_purgeable - GLEW_APPLE_object_purgeable = _glewSearchExtension("GL_APPLE_object_purgeable", extStart, extEnd); - 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 */ + &__GLEW_APPLE_object_purgeable, +#endif #ifdef GL_APPLE_pixel_buffer - GLEW_APPLE_pixel_buffer = _glewSearchExtension("GL_APPLE_pixel_buffer", extStart, extEnd); -#endif /* GL_APPLE_pixel_buffer */ + &__GLEW_APPLE_pixel_buffer, +#endif #ifdef GL_APPLE_rgb_422 - GLEW_APPLE_rgb_422 = _glewSearchExtension("GL_APPLE_rgb_422", extStart, extEnd); -#endif /* GL_APPLE_rgb_422 */ + &__GLEW_APPLE_rgb_422, +#endif #ifdef GL_APPLE_row_bytes - GLEW_APPLE_row_bytes = _glewSearchExtension("GL_APPLE_row_bytes", extStart, extEnd); -#endif /* GL_APPLE_row_bytes */ + &__GLEW_APPLE_row_bytes, +#endif #ifdef GL_APPLE_specular_vector - GLEW_APPLE_specular_vector = _glewSearchExtension("GL_APPLE_specular_vector", extStart, extEnd); -#endif /* GL_APPLE_specular_vector */ + &__GLEW_APPLE_specular_vector, +#endif #ifdef GL_APPLE_texture_range - GLEW_APPLE_texture_range = _glewSearchExtension("GL_APPLE_texture_range", extStart, extEnd); - 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 */ + &__GLEW_APPLE_texture_range, +#endif #ifdef GL_APPLE_transform_hint - GLEW_APPLE_transform_hint = _glewSearchExtension("GL_APPLE_transform_hint", extStart, extEnd); -#endif /* GL_APPLE_transform_hint */ + &__GLEW_APPLE_transform_hint, +#endif #ifdef GL_APPLE_vertex_array_object - GLEW_APPLE_vertex_array_object = _glewSearchExtension("GL_APPLE_vertex_array_object", extStart, extEnd); - 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 */ + &__GLEW_APPLE_vertex_array_object, +#endif #ifdef GL_APPLE_vertex_array_range - GLEW_APPLE_vertex_array_range = _glewSearchExtension("GL_APPLE_vertex_array_range", extStart, extEnd); - 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 */ + &__GLEW_APPLE_vertex_array_range, +#endif #ifdef GL_APPLE_vertex_program_evaluators - GLEW_APPLE_vertex_program_evaluators = _glewSearchExtension("GL_APPLE_vertex_program_evaluators", extStart, extEnd); - 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 */ + &__GLEW_APPLE_vertex_program_evaluators, +#endif #ifdef GL_APPLE_ycbcr_422 - GLEW_APPLE_ycbcr_422 = _glewSearchExtension("GL_APPLE_ycbcr_422", extStart, extEnd); -#endif /* GL_APPLE_ycbcr_422 */ + &__GLEW_APPLE_ycbcr_422, +#endif #ifdef GL_ARB_ES2_compatibility - GLEW_ARB_ES2_compatibility = _glewSearchExtension("GL_ARB_ES2_compatibility", extStart, extEnd); - 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 */ + &__GLEW_ARB_ES2_compatibility, +#endif #ifdef GL_ARB_ES3_1_compatibility - GLEW_ARB_ES3_1_compatibility = _glewSearchExtension("GL_ARB_ES3_1_compatibility", extStart, extEnd); - 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 */ + &__GLEW_ARB_ES3_1_compatibility, +#endif #ifdef GL_ARB_ES3_2_compatibility - GLEW_ARB_ES3_2_compatibility = _glewSearchExtension("GL_ARB_ES3_2_compatibility", extStart, extEnd); - if (glewExperimental || GLEW_ARB_ES3_2_compatibility) GLEW_ARB_ES3_2_compatibility = !_glewInit_GL_ARB_ES3_2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_ES3_2_compatibility */ + &__GLEW_ARB_ES3_2_compatibility, +#endif #ifdef GL_ARB_ES3_compatibility - GLEW_ARB_ES3_compatibility = _glewSearchExtension("GL_ARB_ES3_compatibility", extStart, extEnd); -#endif /* GL_ARB_ES3_compatibility */ + &__GLEW_ARB_ES3_compatibility, +#endif #ifdef GL_ARB_arrays_of_arrays - GLEW_ARB_arrays_of_arrays = _glewSearchExtension("GL_ARB_arrays_of_arrays", extStart, extEnd); -#endif /* GL_ARB_arrays_of_arrays */ + &__GLEW_ARB_arrays_of_arrays, +#endif #ifdef GL_ARB_base_instance - GLEW_ARB_base_instance = _glewSearchExtension("GL_ARB_base_instance", extStart, extEnd); - 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 */ + &__GLEW_ARB_base_instance, +#endif #ifdef GL_ARB_bindless_texture - GLEW_ARB_bindless_texture = _glewSearchExtension("GL_ARB_bindless_texture", extStart, extEnd); - 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 */ + &__GLEW_ARB_bindless_texture, +#endif #ifdef GL_ARB_blend_func_extended - GLEW_ARB_blend_func_extended = _glewSearchExtension("GL_ARB_blend_func_extended", extStart, extEnd); - 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 */ + &__GLEW_ARB_blend_func_extended, +#endif #ifdef GL_ARB_buffer_storage - GLEW_ARB_buffer_storage = _glewSearchExtension("GL_ARB_buffer_storage", extStart, extEnd); - 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 */ + &__GLEW_ARB_buffer_storage, +#endif #ifdef GL_ARB_cl_event - GLEW_ARB_cl_event = _glewSearchExtension("GL_ARB_cl_event", extStart, extEnd); - 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 */ + &__GLEW_ARB_cl_event, +#endif #ifdef GL_ARB_clear_buffer_object - GLEW_ARB_clear_buffer_object = _glewSearchExtension("GL_ARB_clear_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_clear_buffer_object, +#endif #ifdef GL_ARB_clear_texture - GLEW_ARB_clear_texture = _glewSearchExtension("GL_ARB_clear_texture", extStart, extEnd); - 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 */ + &__GLEW_ARB_clear_texture, +#endif #ifdef GL_ARB_clip_control - GLEW_ARB_clip_control = _glewSearchExtension("GL_ARB_clip_control", extStart, extEnd); - 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 */ + &__GLEW_ARB_clip_control, +#endif #ifdef GL_ARB_color_buffer_float - GLEW_ARB_color_buffer_float = _glewSearchExtension("GL_ARB_color_buffer_float", extStart, extEnd); - 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 */ + &__GLEW_ARB_color_buffer_float, +#endif #ifdef GL_ARB_compatibility - GLEW_ARB_compatibility = _glewSearchExtension("GL_ARB_compatibility", extStart, extEnd); -#endif /* GL_ARB_compatibility */ + &__GLEW_ARB_compatibility, +#endif #ifdef GL_ARB_compressed_texture_pixel_storage - GLEW_ARB_compressed_texture_pixel_storage = _glewSearchExtension("GL_ARB_compressed_texture_pixel_storage", extStart, extEnd); -#endif /* GL_ARB_compressed_texture_pixel_storage */ + &__GLEW_ARB_compressed_texture_pixel_storage, +#endif #ifdef GL_ARB_compute_shader - GLEW_ARB_compute_shader = _glewSearchExtension("GL_ARB_compute_shader", extStart, extEnd); - 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 */ + &__GLEW_ARB_compute_shader, +#endif #ifdef GL_ARB_compute_variable_group_size - GLEW_ARB_compute_variable_group_size = _glewSearchExtension("GL_ARB_compute_variable_group_size", extStart, extEnd); - 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 */ + &__GLEW_ARB_compute_variable_group_size, +#endif #ifdef GL_ARB_conditional_render_inverted - GLEW_ARB_conditional_render_inverted = _glewSearchExtension("GL_ARB_conditional_render_inverted", extStart, extEnd); -#endif /* GL_ARB_conditional_render_inverted */ + &__GLEW_ARB_conditional_render_inverted, +#endif #ifdef GL_ARB_conservative_depth - GLEW_ARB_conservative_depth = _glewSearchExtension("GL_ARB_conservative_depth", extStart, extEnd); -#endif /* GL_ARB_conservative_depth */ + &__GLEW_ARB_conservative_depth, +#endif #ifdef GL_ARB_copy_buffer - GLEW_ARB_copy_buffer = _glewSearchExtension("GL_ARB_copy_buffer", extStart, extEnd); - 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 */ + &__GLEW_ARB_copy_buffer, +#endif #ifdef GL_ARB_copy_image - GLEW_ARB_copy_image = _glewSearchExtension("GL_ARB_copy_image", extStart, extEnd); - 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 */ + &__GLEW_ARB_copy_image, +#endif #ifdef GL_ARB_cull_distance - GLEW_ARB_cull_distance = _glewSearchExtension("GL_ARB_cull_distance", extStart, extEnd); -#endif /* GL_ARB_cull_distance */ + &__GLEW_ARB_cull_distance, +#endif #ifdef GL_ARB_debug_output - GLEW_ARB_debug_output = _glewSearchExtension("GL_ARB_debug_output", extStart, extEnd); - 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 */ + &__GLEW_ARB_debug_output, +#endif #ifdef GL_ARB_depth_buffer_float - GLEW_ARB_depth_buffer_float = _glewSearchExtension("GL_ARB_depth_buffer_float", extStart, extEnd); -#endif /* GL_ARB_depth_buffer_float */ + &__GLEW_ARB_depth_buffer_float, +#endif #ifdef GL_ARB_depth_clamp - GLEW_ARB_depth_clamp = _glewSearchExtension("GL_ARB_depth_clamp", extStart, extEnd); -#endif /* GL_ARB_depth_clamp */ + &__GLEW_ARB_depth_clamp, +#endif #ifdef GL_ARB_depth_texture - GLEW_ARB_depth_texture = _glewSearchExtension("GL_ARB_depth_texture", extStart, extEnd); -#endif /* GL_ARB_depth_texture */ + &__GLEW_ARB_depth_texture, +#endif #ifdef GL_ARB_derivative_control - GLEW_ARB_derivative_control = _glewSearchExtension("GL_ARB_derivative_control", extStart, extEnd); -#endif /* GL_ARB_derivative_control */ + &__GLEW_ARB_derivative_control, +#endif #ifdef GL_ARB_direct_state_access - GLEW_ARB_direct_state_access = _glewSearchExtension("GL_ARB_direct_state_access", extStart, extEnd); - 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 */ + &__GLEW_ARB_direct_state_access, +#endif #ifdef GL_ARB_draw_buffers - GLEW_ARB_draw_buffers = _glewSearchExtension("GL_ARB_draw_buffers", extStart, extEnd); - 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 */ + &__GLEW_ARB_draw_buffers, +#endif #ifdef GL_ARB_draw_buffers_blend - GLEW_ARB_draw_buffers_blend = _glewSearchExtension("GL_ARB_draw_buffers_blend", extStart, extEnd); - 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 */ + &__GLEW_ARB_draw_buffers_blend, +#endif #ifdef GL_ARB_draw_elements_base_vertex - GLEW_ARB_draw_elements_base_vertex = _glewSearchExtension("GL_ARB_draw_elements_base_vertex", extStart, extEnd); - 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 */ + &__GLEW_ARB_draw_elements_base_vertex, +#endif #ifdef GL_ARB_draw_indirect - GLEW_ARB_draw_indirect = _glewSearchExtension("GL_ARB_draw_indirect", extStart, extEnd); - 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 */ + &__GLEW_ARB_draw_indirect, +#endif #ifdef GL_ARB_draw_instanced - GLEW_ARB_draw_instanced = _glewSearchExtension("GL_ARB_draw_instanced", extStart, extEnd); -#endif /* GL_ARB_draw_instanced */ + &__GLEW_ARB_draw_instanced, +#endif #ifdef GL_ARB_enhanced_layouts - GLEW_ARB_enhanced_layouts = _glewSearchExtension("GL_ARB_enhanced_layouts", extStart, extEnd); -#endif /* GL_ARB_enhanced_layouts */ + &__GLEW_ARB_enhanced_layouts, +#endif #ifdef GL_ARB_explicit_attrib_location - GLEW_ARB_explicit_attrib_location = _glewSearchExtension("GL_ARB_explicit_attrib_location", extStart, extEnd); -#endif /* GL_ARB_explicit_attrib_location */ + &__GLEW_ARB_explicit_attrib_location, +#endif #ifdef GL_ARB_explicit_uniform_location - GLEW_ARB_explicit_uniform_location = _glewSearchExtension("GL_ARB_explicit_uniform_location", extStart, extEnd); -#endif /* GL_ARB_explicit_uniform_location */ + &__GLEW_ARB_explicit_uniform_location, +#endif #ifdef GL_ARB_fragment_coord_conventions - GLEW_ARB_fragment_coord_conventions = _glewSearchExtension("GL_ARB_fragment_coord_conventions", extStart, extEnd); -#endif /* GL_ARB_fragment_coord_conventions */ + &__GLEW_ARB_fragment_coord_conventions, +#endif #ifdef GL_ARB_fragment_layer_viewport - GLEW_ARB_fragment_layer_viewport = _glewSearchExtension("GL_ARB_fragment_layer_viewport", extStart, extEnd); -#endif /* GL_ARB_fragment_layer_viewport */ + &__GLEW_ARB_fragment_layer_viewport, +#endif #ifdef GL_ARB_fragment_program - GLEW_ARB_fragment_program = _glewSearchExtension("GL_ARB_fragment_program", extStart, extEnd); -#endif /* GL_ARB_fragment_program */ + &__GLEW_ARB_fragment_program, +#endif #ifdef GL_ARB_fragment_program_shadow - GLEW_ARB_fragment_program_shadow = _glewSearchExtension("GL_ARB_fragment_program_shadow", extStart, extEnd); -#endif /* GL_ARB_fragment_program_shadow */ + &__GLEW_ARB_fragment_program_shadow, +#endif #ifdef GL_ARB_fragment_shader - GLEW_ARB_fragment_shader = _glewSearchExtension("GL_ARB_fragment_shader", extStart, extEnd); -#endif /* GL_ARB_fragment_shader */ + &__GLEW_ARB_fragment_shader, +#endif #ifdef GL_ARB_fragment_shader_interlock - GLEW_ARB_fragment_shader_interlock = _glewSearchExtension("GL_ARB_fragment_shader_interlock", extStart, extEnd); -#endif /* GL_ARB_fragment_shader_interlock */ + &__GLEW_ARB_fragment_shader_interlock, +#endif #ifdef GL_ARB_framebuffer_no_attachments - GLEW_ARB_framebuffer_no_attachments = _glewSearchExtension("GL_ARB_framebuffer_no_attachments", extStart, extEnd); - 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 */ + &__GLEW_ARB_framebuffer_no_attachments, +#endif #ifdef GL_ARB_framebuffer_object - GLEW_ARB_framebuffer_object = _glewSearchExtension("GL_ARB_framebuffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_framebuffer_object, +#endif #ifdef GL_ARB_framebuffer_sRGB - GLEW_ARB_framebuffer_sRGB = _glewSearchExtension("GL_ARB_framebuffer_sRGB", extStart, extEnd); -#endif /* GL_ARB_framebuffer_sRGB */ + &__GLEW_ARB_framebuffer_sRGB, +#endif #ifdef GL_ARB_geometry_shader4 - GLEW_ARB_geometry_shader4 = _glewSearchExtension("GL_ARB_geometry_shader4", extStart, extEnd); - 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 */ + &__GLEW_ARB_geometry_shader4, +#endif #ifdef GL_ARB_get_program_binary - GLEW_ARB_get_program_binary = _glewSearchExtension("GL_ARB_get_program_binary", extStart, extEnd); - 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 */ + &__GLEW_ARB_get_program_binary, +#endif #ifdef GL_ARB_get_texture_sub_image - GLEW_ARB_get_texture_sub_image = _glewSearchExtension("GL_ARB_get_texture_sub_image", extStart, extEnd); - 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 */ + &__GLEW_ARB_get_texture_sub_image, +#endif +#ifdef GL_ARB_gl_spirv + &__GLEW_ARB_gl_spirv, +#endif #ifdef GL_ARB_gpu_shader5 - GLEW_ARB_gpu_shader5 = _glewSearchExtension("GL_ARB_gpu_shader5", extStart, extEnd); -#endif /* GL_ARB_gpu_shader5 */ + &__GLEW_ARB_gpu_shader5, +#endif #ifdef GL_ARB_gpu_shader_fp64 - GLEW_ARB_gpu_shader_fp64 = _glewSearchExtension("GL_ARB_gpu_shader_fp64", extStart, extEnd); - 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 */ + &__GLEW_ARB_gpu_shader_fp64, +#endif #ifdef GL_ARB_gpu_shader_int64 - GLEW_ARB_gpu_shader_int64 = _glewSearchExtension("GL_ARB_gpu_shader_int64", extStart, extEnd); - if (glewExperimental || GLEW_ARB_gpu_shader_int64) GLEW_ARB_gpu_shader_int64 = !_glewInit_GL_ARB_gpu_shader_int64(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_gpu_shader_int64 */ + &__GLEW_ARB_gpu_shader_int64, +#endif #ifdef GL_ARB_half_float_pixel - GLEW_ARB_half_float_pixel = _glewSearchExtension("GL_ARB_half_float_pixel", extStart, extEnd); -#endif /* GL_ARB_half_float_pixel */ + &__GLEW_ARB_half_float_pixel, +#endif #ifdef GL_ARB_half_float_vertex - GLEW_ARB_half_float_vertex = _glewSearchExtension("GL_ARB_half_float_vertex", extStart, extEnd); -#endif /* GL_ARB_half_float_vertex */ + &__GLEW_ARB_half_float_vertex, +#endif #ifdef GL_ARB_imaging - GLEW_ARB_imaging = _glewSearchExtension("GL_ARB_imaging", extStart, extEnd); - if (glewExperimental || GLEW_ARB_imaging) GLEW_ARB_imaging = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_imaging */ + &__GLEW_ARB_imaging, +#endif #ifdef GL_ARB_indirect_parameters - GLEW_ARB_indirect_parameters = _glewSearchExtension("GL_ARB_indirect_parameters", extStart, extEnd); - 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 */ + &__GLEW_ARB_indirect_parameters, +#endif #ifdef GL_ARB_instanced_arrays - GLEW_ARB_instanced_arrays = _glewSearchExtension("GL_ARB_instanced_arrays", extStart, extEnd); - 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 */ + &__GLEW_ARB_instanced_arrays, +#endif #ifdef GL_ARB_internalformat_query - GLEW_ARB_internalformat_query = _glewSearchExtension("GL_ARB_internalformat_query", extStart, extEnd); - 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 */ + &__GLEW_ARB_internalformat_query, +#endif #ifdef GL_ARB_internalformat_query2 - GLEW_ARB_internalformat_query2 = _glewSearchExtension("GL_ARB_internalformat_query2", extStart, extEnd); - 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 */ + &__GLEW_ARB_internalformat_query2, +#endif #ifdef GL_ARB_invalidate_subdata - GLEW_ARB_invalidate_subdata = _glewSearchExtension("GL_ARB_invalidate_subdata", extStart, extEnd); - 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 */ + &__GLEW_ARB_invalidate_subdata, +#endif #ifdef GL_ARB_map_buffer_alignment - GLEW_ARB_map_buffer_alignment = _glewSearchExtension("GL_ARB_map_buffer_alignment", extStart, extEnd); -#endif /* GL_ARB_map_buffer_alignment */ + &__GLEW_ARB_map_buffer_alignment, +#endif #ifdef GL_ARB_map_buffer_range - GLEW_ARB_map_buffer_range = _glewSearchExtension("GL_ARB_map_buffer_range", extStart, extEnd); - 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 */ + &__GLEW_ARB_map_buffer_range, +#endif #ifdef GL_ARB_matrix_palette - GLEW_ARB_matrix_palette = _glewSearchExtension("GL_ARB_matrix_palette", extStart, extEnd); - 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 */ + &__GLEW_ARB_matrix_palette, +#endif #ifdef GL_ARB_multi_bind - GLEW_ARB_multi_bind = _glewSearchExtension("GL_ARB_multi_bind", extStart, extEnd); - 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 */ + &__GLEW_ARB_multi_bind, +#endif #ifdef GL_ARB_multi_draw_indirect - GLEW_ARB_multi_draw_indirect = _glewSearchExtension("GL_ARB_multi_draw_indirect", extStart, extEnd); - 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 */ + &__GLEW_ARB_multi_draw_indirect, +#endif #ifdef GL_ARB_multisample - GLEW_ARB_multisample = _glewSearchExtension("GL_ARB_multisample", extStart, extEnd); - if (glewExperimental || GLEW_ARB_multisample) GLEW_ARB_multisample = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_multisample */ + &__GLEW_ARB_multisample, +#endif #ifdef GL_ARB_multitexture - GLEW_ARB_multitexture = _glewSearchExtension("GL_ARB_multitexture", extStart, extEnd); - if (glewExperimental || GLEW_ARB_multitexture) GLEW_ARB_multitexture = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_multitexture */ + &__GLEW_ARB_multitexture, +#endif #ifdef GL_ARB_occlusion_query - GLEW_ARB_occlusion_query = _glewSearchExtension("GL_ARB_occlusion_query", extStart, extEnd); - 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 */ + &__GLEW_ARB_occlusion_query, +#endif #ifdef GL_ARB_occlusion_query2 - GLEW_ARB_occlusion_query2 = _glewSearchExtension("GL_ARB_occlusion_query2", extStart, extEnd); -#endif /* GL_ARB_occlusion_query2 */ + &__GLEW_ARB_occlusion_query2, +#endif #ifdef GL_ARB_parallel_shader_compile - GLEW_ARB_parallel_shader_compile = _glewSearchExtension("GL_ARB_parallel_shader_compile", extStart, extEnd); - if (glewExperimental || GLEW_ARB_parallel_shader_compile) GLEW_ARB_parallel_shader_compile = !_glewInit_GL_ARB_parallel_shader_compile(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_parallel_shader_compile */ + &__GLEW_ARB_parallel_shader_compile, +#endif #ifdef GL_ARB_pipeline_statistics_query - GLEW_ARB_pipeline_statistics_query = _glewSearchExtension("GL_ARB_pipeline_statistics_query", extStart, extEnd); -#endif /* GL_ARB_pipeline_statistics_query */ + &__GLEW_ARB_pipeline_statistics_query, +#endif #ifdef GL_ARB_pixel_buffer_object - GLEW_ARB_pixel_buffer_object = _glewSearchExtension("GL_ARB_pixel_buffer_object", extStart, extEnd); -#endif /* GL_ARB_pixel_buffer_object */ + &__GLEW_ARB_pixel_buffer_object, +#endif #ifdef GL_ARB_point_parameters - GLEW_ARB_point_parameters = _glewSearchExtension("GL_ARB_point_parameters", extStart, extEnd); - 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 */ + &__GLEW_ARB_point_parameters, +#endif #ifdef GL_ARB_point_sprite - GLEW_ARB_point_sprite = _glewSearchExtension("GL_ARB_point_sprite", extStart, extEnd); -#endif /* GL_ARB_point_sprite */ + &__GLEW_ARB_point_sprite, +#endif #ifdef GL_ARB_post_depth_coverage - GLEW_ARB_post_depth_coverage = _glewSearchExtension("GL_ARB_post_depth_coverage", extStart, extEnd); -#endif /* GL_ARB_post_depth_coverage */ + &__GLEW_ARB_post_depth_coverage, +#endif #ifdef GL_ARB_program_interface_query - GLEW_ARB_program_interface_query = _glewSearchExtension("GL_ARB_program_interface_query", extStart, extEnd); - 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 */ + &__GLEW_ARB_program_interface_query, +#endif #ifdef GL_ARB_provoking_vertex - GLEW_ARB_provoking_vertex = _glewSearchExtension("GL_ARB_provoking_vertex", extStart, extEnd); - 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 */ + &__GLEW_ARB_provoking_vertex, +#endif #ifdef GL_ARB_query_buffer_object - GLEW_ARB_query_buffer_object = _glewSearchExtension("GL_ARB_query_buffer_object", extStart, extEnd); -#endif /* GL_ARB_query_buffer_object */ + &__GLEW_ARB_query_buffer_object, +#endif #ifdef GL_ARB_robust_buffer_access_behavior - GLEW_ARB_robust_buffer_access_behavior = _glewSearchExtension("GL_ARB_robust_buffer_access_behavior", extStart, extEnd); -#endif /* GL_ARB_robust_buffer_access_behavior */ + &__GLEW_ARB_robust_buffer_access_behavior, +#endif #ifdef GL_ARB_robustness - GLEW_ARB_robustness = _glewSearchExtension("GL_ARB_robustness", extStart, extEnd); - if (glewExperimental || GLEW_ARB_robustness) GLEW_ARB_robustness = !_glewInit_GL_ARB_robustness(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_robustness */ + &__GLEW_ARB_robustness, +#endif #ifdef GL_ARB_robustness_application_isolation - GLEW_ARB_robustness_application_isolation = _glewSearchExtension("GL_ARB_robustness_application_isolation", extStart, extEnd); -#endif /* GL_ARB_robustness_application_isolation */ + &__GLEW_ARB_robustness_application_isolation, +#endif #ifdef GL_ARB_robustness_share_group_isolation - GLEW_ARB_robustness_share_group_isolation = _glewSearchExtension("GL_ARB_robustness_share_group_isolation", extStart, extEnd); -#endif /* GL_ARB_robustness_share_group_isolation */ + &__GLEW_ARB_robustness_share_group_isolation, +#endif #ifdef GL_ARB_sample_locations - GLEW_ARB_sample_locations = _glewSearchExtension("GL_ARB_sample_locations", extStart, extEnd); - if (glewExperimental || GLEW_ARB_sample_locations) GLEW_ARB_sample_locations = !_glewInit_GL_ARB_sample_locations(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_sample_locations */ + &__GLEW_ARB_sample_locations, +#endif #ifdef GL_ARB_sample_shading - GLEW_ARB_sample_shading = _glewSearchExtension("GL_ARB_sample_shading", extStart, extEnd); - 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 */ + &__GLEW_ARB_sample_shading, +#endif #ifdef GL_ARB_sampler_objects - GLEW_ARB_sampler_objects = _glewSearchExtension("GL_ARB_sampler_objects", extStart, extEnd); - 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 */ + &__GLEW_ARB_sampler_objects, +#endif #ifdef GL_ARB_seamless_cube_map - GLEW_ARB_seamless_cube_map = _glewSearchExtension("GL_ARB_seamless_cube_map", extStart, extEnd); -#endif /* GL_ARB_seamless_cube_map */ + &__GLEW_ARB_seamless_cube_map, +#endif #ifdef GL_ARB_seamless_cubemap_per_texture - GLEW_ARB_seamless_cubemap_per_texture = _glewSearchExtension("GL_ARB_seamless_cubemap_per_texture", extStart, extEnd); -#endif /* GL_ARB_seamless_cubemap_per_texture */ + &__GLEW_ARB_seamless_cubemap_per_texture, +#endif #ifdef GL_ARB_separate_shader_objects - GLEW_ARB_separate_shader_objects = _glewSearchExtension("GL_ARB_separate_shader_objects", extStart, extEnd); - 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 */ + &__GLEW_ARB_separate_shader_objects, +#endif #ifdef GL_ARB_shader_atomic_counter_ops - GLEW_ARB_shader_atomic_counter_ops = _glewSearchExtension("GL_ARB_shader_atomic_counter_ops", extStart, extEnd); -#endif /* GL_ARB_shader_atomic_counter_ops */ + &__GLEW_ARB_shader_atomic_counter_ops, +#endif #ifdef GL_ARB_shader_atomic_counters - GLEW_ARB_shader_atomic_counters = _glewSearchExtension("GL_ARB_shader_atomic_counters", extStart, extEnd); - 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 */ + &__GLEW_ARB_shader_atomic_counters, +#endif #ifdef GL_ARB_shader_ballot - GLEW_ARB_shader_ballot = _glewSearchExtension("GL_ARB_shader_ballot", extStart, extEnd); -#endif /* GL_ARB_shader_ballot */ + &__GLEW_ARB_shader_ballot, +#endif #ifdef GL_ARB_shader_bit_encoding - GLEW_ARB_shader_bit_encoding = _glewSearchExtension("GL_ARB_shader_bit_encoding", extStart, extEnd); -#endif /* GL_ARB_shader_bit_encoding */ + &__GLEW_ARB_shader_bit_encoding, +#endif #ifdef GL_ARB_shader_clock - GLEW_ARB_shader_clock = _glewSearchExtension("GL_ARB_shader_clock", extStart, extEnd); -#endif /* GL_ARB_shader_clock */ + &__GLEW_ARB_shader_clock, +#endif #ifdef GL_ARB_shader_draw_parameters - GLEW_ARB_shader_draw_parameters = _glewSearchExtension("GL_ARB_shader_draw_parameters", extStart, extEnd); -#endif /* GL_ARB_shader_draw_parameters */ + &__GLEW_ARB_shader_draw_parameters, +#endif #ifdef GL_ARB_shader_group_vote - GLEW_ARB_shader_group_vote = _glewSearchExtension("GL_ARB_shader_group_vote", extStart, extEnd); -#endif /* GL_ARB_shader_group_vote */ + &__GLEW_ARB_shader_group_vote, +#endif #ifdef GL_ARB_shader_image_load_store - GLEW_ARB_shader_image_load_store = _glewSearchExtension("GL_ARB_shader_image_load_store", extStart, extEnd); - 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 */ + &__GLEW_ARB_shader_image_load_store, +#endif #ifdef GL_ARB_shader_image_size - GLEW_ARB_shader_image_size = _glewSearchExtension("GL_ARB_shader_image_size", extStart, extEnd); -#endif /* GL_ARB_shader_image_size */ + &__GLEW_ARB_shader_image_size, +#endif #ifdef GL_ARB_shader_objects - GLEW_ARB_shader_objects = _glewSearchExtension("GL_ARB_shader_objects", extStart, extEnd); - 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 */ + &__GLEW_ARB_shader_objects, +#endif #ifdef GL_ARB_shader_precision - GLEW_ARB_shader_precision = _glewSearchExtension("GL_ARB_shader_precision", extStart, extEnd); -#endif /* GL_ARB_shader_precision */ + &__GLEW_ARB_shader_precision, +#endif #ifdef GL_ARB_shader_stencil_export - GLEW_ARB_shader_stencil_export = _glewSearchExtension("GL_ARB_shader_stencil_export", extStart, extEnd); -#endif /* GL_ARB_shader_stencil_export */ + &__GLEW_ARB_shader_stencil_export, +#endif #ifdef GL_ARB_shader_storage_buffer_object - GLEW_ARB_shader_storage_buffer_object = _glewSearchExtension("GL_ARB_shader_storage_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_shader_storage_buffer_object, +#endif #ifdef GL_ARB_shader_subroutine - GLEW_ARB_shader_subroutine = _glewSearchExtension("GL_ARB_shader_subroutine", extStart, extEnd); - 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 */ + &__GLEW_ARB_shader_subroutine, +#endif #ifdef GL_ARB_shader_texture_image_samples - GLEW_ARB_shader_texture_image_samples = _glewSearchExtension("GL_ARB_shader_texture_image_samples", extStart, extEnd); -#endif /* GL_ARB_shader_texture_image_samples */ + &__GLEW_ARB_shader_texture_image_samples, +#endif #ifdef GL_ARB_shader_texture_lod - GLEW_ARB_shader_texture_lod = _glewSearchExtension("GL_ARB_shader_texture_lod", extStart, extEnd); -#endif /* GL_ARB_shader_texture_lod */ + &__GLEW_ARB_shader_texture_lod, +#endif #ifdef GL_ARB_shader_viewport_layer_array - GLEW_ARB_shader_viewport_layer_array = _glewSearchExtension("GL_ARB_shader_viewport_layer_array", extStart, extEnd); -#endif /* GL_ARB_shader_viewport_layer_array */ + &__GLEW_ARB_shader_viewport_layer_array, +#endif #ifdef GL_ARB_shading_language_100 - GLEW_ARB_shading_language_100 = _glewSearchExtension("GL_ARB_shading_language_100", extStart, extEnd); -#endif /* GL_ARB_shading_language_100 */ + &__GLEW_ARB_shading_language_100, +#endif #ifdef GL_ARB_shading_language_420pack - GLEW_ARB_shading_language_420pack = _glewSearchExtension("GL_ARB_shading_language_420pack", extStart, extEnd); -#endif /* GL_ARB_shading_language_420pack */ + &__GLEW_ARB_shading_language_420pack, +#endif #ifdef GL_ARB_shading_language_include - GLEW_ARB_shading_language_include = _glewSearchExtension("GL_ARB_shading_language_include", extStart, extEnd); - 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 */ + &__GLEW_ARB_shading_language_include, +#endif #ifdef GL_ARB_shading_language_packing - GLEW_ARB_shading_language_packing = _glewSearchExtension("GL_ARB_shading_language_packing", extStart, extEnd); -#endif /* GL_ARB_shading_language_packing */ + &__GLEW_ARB_shading_language_packing, +#endif #ifdef GL_ARB_shadow - GLEW_ARB_shadow = _glewSearchExtension("GL_ARB_shadow", extStart, extEnd); -#endif /* GL_ARB_shadow */ + &__GLEW_ARB_shadow, +#endif #ifdef GL_ARB_shadow_ambient - GLEW_ARB_shadow_ambient = _glewSearchExtension("GL_ARB_shadow_ambient", extStart, extEnd); -#endif /* GL_ARB_shadow_ambient */ + &__GLEW_ARB_shadow_ambient, +#endif #ifdef GL_ARB_sparse_buffer - GLEW_ARB_sparse_buffer = _glewSearchExtension("GL_ARB_sparse_buffer", extStart, extEnd); - 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 */ + &__GLEW_ARB_sparse_buffer, +#endif #ifdef GL_ARB_sparse_texture - GLEW_ARB_sparse_texture = _glewSearchExtension("GL_ARB_sparse_texture", extStart, extEnd); - 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 */ + &__GLEW_ARB_sparse_texture, +#endif #ifdef GL_ARB_sparse_texture2 - GLEW_ARB_sparse_texture2 = _glewSearchExtension("GL_ARB_sparse_texture2", extStart, extEnd); -#endif /* GL_ARB_sparse_texture2 */ + &__GLEW_ARB_sparse_texture2, +#endif #ifdef GL_ARB_sparse_texture_clamp - GLEW_ARB_sparse_texture_clamp = _glewSearchExtension("GL_ARB_sparse_texture_clamp", extStart, extEnd); -#endif /* GL_ARB_sparse_texture_clamp */ + &__GLEW_ARB_sparse_texture_clamp, +#endif #ifdef GL_ARB_stencil_texturing - GLEW_ARB_stencil_texturing = _glewSearchExtension("GL_ARB_stencil_texturing", extStart, extEnd); -#endif /* GL_ARB_stencil_texturing */ + &__GLEW_ARB_stencil_texturing, +#endif #ifdef GL_ARB_sync - GLEW_ARB_sync = _glewSearchExtension("GL_ARB_sync", extStart, extEnd); - if (glewExperimental || GLEW_ARB_sync) GLEW_ARB_sync = !_glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_ARB_sync */ + &__GLEW_ARB_sync, +#endif #ifdef GL_ARB_tessellation_shader - GLEW_ARB_tessellation_shader = _glewSearchExtension("GL_ARB_tessellation_shader", extStart, extEnd); - 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 */ + &__GLEW_ARB_tessellation_shader, +#endif #ifdef GL_ARB_texture_barrier - GLEW_ARB_texture_barrier = _glewSearchExtension("GL_ARB_texture_barrier", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_barrier, +#endif #ifdef GL_ARB_texture_border_clamp - GLEW_ARB_texture_border_clamp = _glewSearchExtension("GL_ARB_texture_border_clamp", extStart, extEnd); -#endif /* GL_ARB_texture_border_clamp */ + &__GLEW_ARB_texture_border_clamp, +#endif #ifdef GL_ARB_texture_buffer_object - GLEW_ARB_texture_buffer_object = _glewSearchExtension("GL_ARB_texture_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_buffer_object, +#endif #ifdef GL_ARB_texture_buffer_object_rgb32 - GLEW_ARB_texture_buffer_object_rgb32 = _glewSearchExtension("GL_ARB_texture_buffer_object_rgb32", extStart, extEnd); -#endif /* GL_ARB_texture_buffer_object_rgb32 */ + &__GLEW_ARB_texture_buffer_object_rgb32, +#endif #ifdef GL_ARB_texture_buffer_range - GLEW_ARB_texture_buffer_range = _glewSearchExtension("GL_ARB_texture_buffer_range", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_buffer_range, +#endif #ifdef GL_ARB_texture_compression - GLEW_ARB_texture_compression = _glewSearchExtension("GL_ARB_texture_compression", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_compression, +#endif #ifdef GL_ARB_texture_compression_bptc - GLEW_ARB_texture_compression_bptc = _glewSearchExtension("GL_ARB_texture_compression_bptc", extStart, extEnd); -#endif /* GL_ARB_texture_compression_bptc */ + &__GLEW_ARB_texture_compression_bptc, +#endif #ifdef GL_ARB_texture_compression_rgtc - GLEW_ARB_texture_compression_rgtc = _glewSearchExtension("GL_ARB_texture_compression_rgtc", extStart, extEnd); -#endif /* GL_ARB_texture_compression_rgtc */ + &__GLEW_ARB_texture_compression_rgtc, +#endif #ifdef GL_ARB_texture_cube_map - GLEW_ARB_texture_cube_map = _glewSearchExtension("GL_ARB_texture_cube_map", extStart, extEnd); -#endif /* GL_ARB_texture_cube_map */ + &__GLEW_ARB_texture_cube_map, +#endif #ifdef GL_ARB_texture_cube_map_array - GLEW_ARB_texture_cube_map_array = _glewSearchExtension("GL_ARB_texture_cube_map_array", extStart, extEnd); -#endif /* GL_ARB_texture_cube_map_array */ + &__GLEW_ARB_texture_cube_map_array, +#endif #ifdef GL_ARB_texture_env_add - GLEW_ARB_texture_env_add = _glewSearchExtension("GL_ARB_texture_env_add", extStart, extEnd); -#endif /* GL_ARB_texture_env_add */ + &__GLEW_ARB_texture_env_add, +#endif #ifdef GL_ARB_texture_env_combine - GLEW_ARB_texture_env_combine = _glewSearchExtension("GL_ARB_texture_env_combine", extStart, extEnd); -#endif /* GL_ARB_texture_env_combine */ + &__GLEW_ARB_texture_env_combine, +#endif #ifdef GL_ARB_texture_env_crossbar - GLEW_ARB_texture_env_crossbar = _glewSearchExtension("GL_ARB_texture_env_crossbar", extStart, extEnd); -#endif /* GL_ARB_texture_env_crossbar */ + &__GLEW_ARB_texture_env_crossbar, +#endif #ifdef GL_ARB_texture_env_dot3 - GLEW_ARB_texture_env_dot3 = _glewSearchExtension("GL_ARB_texture_env_dot3", extStart, extEnd); -#endif /* GL_ARB_texture_env_dot3 */ + &__GLEW_ARB_texture_env_dot3, +#endif #ifdef GL_ARB_texture_filter_minmax - GLEW_ARB_texture_filter_minmax = _glewSearchExtension("GL_ARB_texture_filter_minmax", extStart, extEnd); -#endif /* GL_ARB_texture_filter_minmax */ + &__GLEW_ARB_texture_filter_minmax, +#endif #ifdef GL_ARB_texture_float - GLEW_ARB_texture_float = _glewSearchExtension("GL_ARB_texture_float", extStart, extEnd); -#endif /* GL_ARB_texture_float */ + &__GLEW_ARB_texture_float, +#endif #ifdef GL_ARB_texture_gather - GLEW_ARB_texture_gather = _glewSearchExtension("GL_ARB_texture_gather", extStart, extEnd); -#endif /* GL_ARB_texture_gather */ + &__GLEW_ARB_texture_gather, +#endif #ifdef GL_ARB_texture_mirror_clamp_to_edge - GLEW_ARB_texture_mirror_clamp_to_edge = _glewSearchExtension("GL_ARB_texture_mirror_clamp_to_edge", extStart, extEnd); -#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + &__GLEW_ARB_texture_mirror_clamp_to_edge, +#endif #ifdef GL_ARB_texture_mirrored_repeat - GLEW_ARB_texture_mirrored_repeat = _glewSearchExtension("GL_ARB_texture_mirrored_repeat", extStart, extEnd); -#endif /* GL_ARB_texture_mirrored_repeat */ + &__GLEW_ARB_texture_mirrored_repeat, +#endif #ifdef GL_ARB_texture_multisample - GLEW_ARB_texture_multisample = _glewSearchExtension("GL_ARB_texture_multisample", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_multisample, +#endif #ifdef GL_ARB_texture_non_power_of_two - GLEW_ARB_texture_non_power_of_two = _glewSearchExtension("GL_ARB_texture_non_power_of_two", extStart, extEnd); -#endif /* GL_ARB_texture_non_power_of_two */ + &__GLEW_ARB_texture_non_power_of_two, +#endif #ifdef GL_ARB_texture_query_levels - GLEW_ARB_texture_query_levels = _glewSearchExtension("GL_ARB_texture_query_levels", extStart, extEnd); -#endif /* GL_ARB_texture_query_levels */ + &__GLEW_ARB_texture_query_levels, +#endif #ifdef GL_ARB_texture_query_lod - GLEW_ARB_texture_query_lod = _glewSearchExtension("GL_ARB_texture_query_lod", extStart, extEnd); -#endif /* GL_ARB_texture_query_lod */ + &__GLEW_ARB_texture_query_lod, +#endif #ifdef GL_ARB_texture_rectangle - GLEW_ARB_texture_rectangle = _glewSearchExtension("GL_ARB_texture_rectangle", extStart, extEnd); -#endif /* GL_ARB_texture_rectangle */ + &__GLEW_ARB_texture_rectangle, +#endif #ifdef GL_ARB_texture_rg - GLEW_ARB_texture_rg = _glewSearchExtension("GL_ARB_texture_rg", extStart, extEnd); -#endif /* GL_ARB_texture_rg */ + &__GLEW_ARB_texture_rg, +#endif #ifdef GL_ARB_texture_rgb10_a2ui - GLEW_ARB_texture_rgb10_a2ui = _glewSearchExtension("GL_ARB_texture_rgb10_a2ui", extStart, extEnd); -#endif /* GL_ARB_texture_rgb10_a2ui */ + &__GLEW_ARB_texture_rgb10_a2ui, +#endif #ifdef GL_ARB_texture_stencil8 - GLEW_ARB_texture_stencil8 = _glewSearchExtension("GL_ARB_texture_stencil8", extStart, extEnd); -#endif /* GL_ARB_texture_stencil8 */ + &__GLEW_ARB_texture_stencil8, +#endif #ifdef GL_ARB_texture_storage - GLEW_ARB_texture_storage = _glewSearchExtension("GL_ARB_texture_storage", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_storage, +#endif #ifdef GL_ARB_texture_storage_multisample - GLEW_ARB_texture_storage_multisample = _glewSearchExtension("GL_ARB_texture_storage_multisample", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_storage_multisample, +#endif #ifdef GL_ARB_texture_swizzle - GLEW_ARB_texture_swizzle = _glewSearchExtension("GL_ARB_texture_swizzle", extStart, extEnd); -#endif /* GL_ARB_texture_swizzle */ + &__GLEW_ARB_texture_swizzle, +#endif #ifdef GL_ARB_texture_view - GLEW_ARB_texture_view = _glewSearchExtension("GL_ARB_texture_view", extStart, extEnd); - 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 */ + &__GLEW_ARB_texture_view, +#endif #ifdef GL_ARB_timer_query - GLEW_ARB_timer_query = _glewSearchExtension("GL_ARB_timer_query", extStart, extEnd); - 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 */ + &__GLEW_ARB_timer_query, +#endif #ifdef GL_ARB_transform_feedback2 - GLEW_ARB_transform_feedback2 = _glewSearchExtension("GL_ARB_transform_feedback2", extStart, extEnd); - 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 */ + &__GLEW_ARB_transform_feedback2, +#endif #ifdef GL_ARB_transform_feedback3 - GLEW_ARB_transform_feedback3 = _glewSearchExtension("GL_ARB_transform_feedback3", extStart, extEnd); - 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 */ + &__GLEW_ARB_transform_feedback3, +#endif #ifdef GL_ARB_transform_feedback_instanced - GLEW_ARB_transform_feedback_instanced = _glewSearchExtension("GL_ARB_transform_feedback_instanced", extStart, extEnd); - 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 */ + &__GLEW_ARB_transform_feedback_instanced, +#endif #ifdef GL_ARB_transform_feedback_overflow_query - GLEW_ARB_transform_feedback_overflow_query = _glewSearchExtension("GL_ARB_transform_feedback_overflow_query", extStart, extEnd); -#endif /* GL_ARB_transform_feedback_overflow_query */ + &__GLEW_ARB_transform_feedback_overflow_query, +#endif #ifdef GL_ARB_transpose_matrix - GLEW_ARB_transpose_matrix = _glewSearchExtension("GL_ARB_transpose_matrix", extStart, extEnd); - 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 */ + &__GLEW_ARB_transpose_matrix, +#endif #ifdef GL_ARB_uniform_buffer_object - GLEW_ARB_uniform_buffer_object = _glewSearchExtension("GL_ARB_uniform_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_uniform_buffer_object, +#endif #ifdef GL_ARB_vertex_array_bgra - GLEW_ARB_vertex_array_bgra = _glewSearchExtension("GL_ARB_vertex_array_bgra", extStart, extEnd); -#endif /* GL_ARB_vertex_array_bgra */ + &__GLEW_ARB_vertex_array_bgra, +#endif #ifdef GL_ARB_vertex_array_object - GLEW_ARB_vertex_array_object = _glewSearchExtension("GL_ARB_vertex_array_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_array_object, +#endif #ifdef GL_ARB_vertex_attrib_64bit - GLEW_ARB_vertex_attrib_64bit = _glewSearchExtension("GL_ARB_vertex_attrib_64bit", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_attrib_64bit, +#endif #ifdef GL_ARB_vertex_attrib_binding - GLEW_ARB_vertex_attrib_binding = _glewSearchExtension("GL_ARB_vertex_attrib_binding", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_attrib_binding, +#endif #ifdef GL_ARB_vertex_blend - GLEW_ARB_vertex_blend = _glewSearchExtension("GL_ARB_vertex_blend", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_blend, +#endif #ifdef GL_ARB_vertex_buffer_object - GLEW_ARB_vertex_buffer_object = _glewSearchExtension("GL_ARB_vertex_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_buffer_object, +#endif #ifdef GL_ARB_vertex_program - GLEW_ARB_vertex_program = _glewSearchExtension("GL_ARB_vertex_program", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_program, +#endif #ifdef GL_ARB_vertex_shader - GLEW_ARB_vertex_shader = _glewSearchExtension("GL_ARB_vertex_shader", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_shader, +#endif #ifdef GL_ARB_vertex_type_10f_11f_11f_rev - GLEW_ARB_vertex_type_10f_11f_11f_rev = _glewSearchExtension("GL_ARB_vertex_type_10f_11f_11f_rev", extStart, extEnd); -#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + &__GLEW_ARB_vertex_type_10f_11f_11f_rev, +#endif #ifdef GL_ARB_vertex_type_2_10_10_10_rev - GLEW_ARB_vertex_type_2_10_10_10_rev = _glewSearchExtension("GL_ARB_vertex_type_2_10_10_10_rev", extStart, extEnd); - 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 */ + &__GLEW_ARB_vertex_type_2_10_10_10_rev, +#endif #ifdef GL_ARB_viewport_array - GLEW_ARB_viewport_array = _glewSearchExtension("GL_ARB_viewport_array", extStart, extEnd); - 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 */ + &__GLEW_ARB_viewport_array, +#endif #ifdef GL_ARB_window_pos - GLEW_ARB_window_pos = _glewSearchExtension("GL_ARB_window_pos", extStart, extEnd); - 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 */ + &__GLEW_ARB_window_pos, +#endif #ifdef GL_ATIX_point_sprites - GLEW_ATIX_point_sprites = _glewSearchExtension("GL_ATIX_point_sprites", extStart, extEnd); -#endif /* GL_ATIX_point_sprites */ + &__GLEW_ATIX_point_sprites, +#endif #ifdef GL_ATIX_texture_env_combine3 - GLEW_ATIX_texture_env_combine3 = _glewSearchExtension("GL_ATIX_texture_env_combine3", extStart, extEnd); -#endif /* GL_ATIX_texture_env_combine3 */ + &__GLEW_ATIX_texture_env_combine3, +#endif #ifdef GL_ATIX_texture_env_route - GLEW_ATIX_texture_env_route = _glewSearchExtension("GL_ATIX_texture_env_route", extStart, extEnd); -#endif /* GL_ATIX_texture_env_route */ + &__GLEW_ATIX_texture_env_route, +#endif #ifdef GL_ATIX_vertex_shader_output_point_size - GLEW_ATIX_vertex_shader_output_point_size = _glewSearchExtension("GL_ATIX_vertex_shader_output_point_size", extStart, extEnd); -#endif /* GL_ATIX_vertex_shader_output_point_size */ + &__GLEW_ATIX_vertex_shader_output_point_size, +#endif #ifdef GL_ATI_draw_buffers - GLEW_ATI_draw_buffers = _glewSearchExtension("GL_ATI_draw_buffers", extStart, extEnd); - 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 */ + &__GLEW_ATI_draw_buffers, +#endif #ifdef GL_ATI_element_array - GLEW_ATI_element_array = _glewSearchExtension("GL_ATI_element_array", extStart, extEnd); - 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 */ + &__GLEW_ATI_element_array, +#endif #ifdef GL_ATI_envmap_bumpmap - GLEW_ATI_envmap_bumpmap = _glewSearchExtension("GL_ATI_envmap_bumpmap", extStart, extEnd); - 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 */ + &__GLEW_ATI_envmap_bumpmap, +#endif #ifdef GL_ATI_fragment_shader - GLEW_ATI_fragment_shader = _glewSearchExtension("GL_ATI_fragment_shader", extStart, extEnd); - 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 */ + &__GLEW_ATI_fragment_shader, +#endif #ifdef GL_ATI_map_object_buffer - GLEW_ATI_map_object_buffer = _glewSearchExtension("GL_ATI_map_object_buffer", extStart, extEnd); - 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 */ + &__GLEW_ATI_map_object_buffer, +#endif #ifdef GL_ATI_meminfo - GLEW_ATI_meminfo = _glewSearchExtension("GL_ATI_meminfo", extStart, extEnd); -#endif /* GL_ATI_meminfo */ + &__GLEW_ATI_meminfo, +#endif #ifdef GL_ATI_pn_triangles - GLEW_ATI_pn_triangles = _glewSearchExtension("GL_ATI_pn_triangles", extStart, extEnd); - 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 */ + &__GLEW_ATI_pn_triangles, +#endif #ifdef GL_ATI_separate_stencil - GLEW_ATI_separate_stencil = _glewSearchExtension("GL_ATI_separate_stencil", extStart, extEnd); - 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 */ + &__GLEW_ATI_separate_stencil, +#endif #ifdef GL_ATI_shader_texture_lod - GLEW_ATI_shader_texture_lod = _glewSearchExtension("GL_ATI_shader_texture_lod", extStart, extEnd); -#endif /* GL_ATI_shader_texture_lod */ + &__GLEW_ATI_shader_texture_lod, +#endif #ifdef GL_ATI_text_fragment_shader - GLEW_ATI_text_fragment_shader = _glewSearchExtension("GL_ATI_text_fragment_shader", extStart, extEnd); -#endif /* GL_ATI_text_fragment_shader */ + &__GLEW_ATI_text_fragment_shader, +#endif #ifdef GL_ATI_texture_compression_3dc - GLEW_ATI_texture_compression_3dc = _glewSearchExtension("GL_ATI_texture_compression_3dc", extStart, extEnd); -#endif /* GL_ATI_texture_compression_3dc */ + &__GLEW_ATI_texture_compression_3dc, +#endif #ifdef GL_ATI_texture_env_combine3 - GLEW_ATI_texture_env_combine3 = _glewSearchExtension("GL_ATI_texture_env_combine3", extStart, extEnd); -#endif /* GL_ATI_texture_env_combine3 */ + &__GLEW_ATI_texture_env_combine3, +#endif #ifdef GL_ATI_texture_float - GLEW_ATI_texture_float = _glewSearchExtension("GL_ATI_texture_float", extStart, extEnd); -#endif /* GL_ATI_texture_float */ + &__GLEW_ATI_texture_float, +#endif #ifdef GL_ATI_texture_mirror_once - GLEW_ATI_texture_mirror_once = _glewSearchExtension("GL_ATI_texture_mirror_once", extStart, extEnd); -#endif /* GL_ATI_texture_mirror_once */ + &__GLEW_ATI_texture_mirror_once, +#endif #ifdef GL_ATI_vertex_array_object - GLEW_ATI_vertex_array_object = _glewSearchExtension("GL_ATI_vertex_array_object", extStart, extEnd); - 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 */ + &__GLEW_ATI_vertex_array_object, +#endif #ifdef GL_ATI_vertex_attrib_array_object - GLEW_ATI_vertex_attrib_array_object = _glewSearchExtension("GL_ATI_vertex_attrib_array_object", extStart, extEnd); - 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 */ + &__GLEW_ATI_vertex_attrib_array_object, +#endif #ifdef GL_ATI_vertex_streams - GLEW_ATI_vertex_streams = _glewSearchExtension("GL_ATI_vertex_streams", extStart, extEnd); - 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 */ + &__GLEW_ATI_vertex_streams, +#endif +#ifdef GL_EGL_NV_robustness_video_memory_purge + &__GLEW_EGL_NV_robustness_video_memory_purge, +#endif #ifdef GL_EXT_422_pixels - GLEW_EXT_422_pixels = _glewSearchExtension("GL_EXT_422_pixels", extStart, extEnd); -#endif /* GL_EXT_422_pixels */ + &__GLEW_EXT_422_pixels, +#endif #ifdef GL_EXT_Cg_shader - GLEW_EXT_Cg_shader = _glewSearchExtension("GL_EXT_Cg_shader", extStart, extEnd); -#endif /* GL_EXT_Cg_shader */ + &__GLEW_EXT_Cg_shader, +#endif #ifdef GL_EXT_abgr - GLEW_EXT_abgr = _glewSearchExtension("GL_EXT_abgr", extStart, extEnd); -#endif /* GL_EXT_abgr */ + &__GLEW_EXT_abgr, +#endif #ifdef GL_EXT_bgra - GLEW_EXT_bgra = _glewSearchExtension("GL_EXT_bgra", extStart, extEnd); -#endif /* GL_EXT_bgra */ + &__GLEW_EXT_bgra, +#endif #ifdef GL_EXT_bindable_uniform - GLEW_EXT_bindable_uniform = _glewSearchExtension("GL_EXT_bindable_uniform", extStart, extEnd); - 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 */ + &__GLEW_EXT_bindable_uniform, +#endif #ifdef GL_EXT_blend_color - GLEW_EXT_blend_color = _glewSearchExtension("GL_EXT_blend_color", extStart, extEnd); - 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 */ + &__GLEW_EXT_blend_color, +#endif #ifdef GL_EXT_blend_equation_separate - GLEW_EXT_blend_equation_separate = _glewSearchExtension("GL_EXT_blend_equation_separate", extStart, extEnd); - 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 */ + &__GLEW_EXT_blend_equation_separate, +#endif #ifdef GL_EXT_blend_func_separate - GLEW_EXT_blend_func_separate = _glewSearchExtension("GL_EXT_blend_func_separate", extStart, extEnd); - 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 */ + &__GLEW_EXT_blend_func_separate, +#endif #ifdef GL_EXT_blend_logic_op - GLEW_EXT_blend_logic_op = _glewSearchExtension("GL_EXT_blend_logic_op", extStart, extEnd); -#endif /* GL_EXT_blend_logic_op */ + &__GLEW_EXT_blend_logic_op, +#endif #ifdef GL_EXT_blend_minmax - GLEW_EXT_blend_minmax = _glewSearchExtension("GL_EXT_blend_minmax", extStart, extEnd); - 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 */ + &__GLEW_EXT_blend_minmax, +#endif #ifdef GL_EXT_blend_subtract - GLEW_EXT_blend_subtract = _glewSearchExtension("GL_EXT_blend_subtract", extStart, extEnd); -#endif /* GL_EXT_blend_subtract */ + &__GLEW_EXT_blend_subtract, +#endif #ifdef GL_EXT_clip_volume_hint - GLEW_EXT_clip_volume_hint = _glewSearchExtension("GL_EXT_clip_volume_hint", extStart, extEnd); -#endif /* GL_EXT_clip_volume_hint */ + &__GLEW_EXT_clip_volume_hint, +#endif #ifdef GL_EXT_cmyka - GLEW_EXT_cmyka = _glewSearchExtension("GL_EXT_cmyka", extStart, extEnd); -#endif /* GL_EXT_cmyka */ + &__GLEW_EXT_cmyka, +#endif #ifdef GL_EXT_color_subtable - GLEW_EXT_color_subtable = _glewSearchExtension("GL_EXT_color_subtable", extStart, extEnd); - 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 */ + &__GLEW_EXT_color_subtable, +#endif #ifdef GL_EXT_compiled_vertex_array - GLEW_EXT_compiled_vertex_array = _glewSearchExtension("GL_EXT_compiled_vertex_array", extStart, extEnd); - 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 */ + &__GLEW_EXT_compiled_vertex_array, +#endif #ifdef GL_EXT_convolution - GLEW_EXT_convolution = _glewSearchExtension("GL_EXT_convolution", extStart, extEnd); - if (glewExperimental || GLEW_EXT_convolution) GLEW_EXT_convolution = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_EXT_convolution */ + &__GLEW_EXT_convolution, +#endif #ifdef GL_EXT_coordinate_frame - GLEW_EXT_coordinate_frame = _glewSearchExtension("GL_EXT_coordinate_frame", extStart, extEnd); - 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 */ + &__GLEW_EXT_coordinate_frame, +#endif #ifdef GL_EXT_copy_texture - GLEW_EXT_copy_texture = _glewSearchExtension("GL_EXT_copy_texture", extStart, extEnd); - 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 */ + &__GLEW_EXT_copy_texture, +#endif #ifdef GL_EXT_cull_vertex - GLEW_EXT_cull_vertex = _glewSearchExtension("GL_EXT_cull_vertex", extStart, extEnd); - 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 */ + &__GLEW_EXT_cull_vertex, +#endif #ifdef GL_EXT_debug_label - GLEW_EXT_debug_label = _glewSearchExtension("GL_EXT_debug_label", extStart, extEnd); - 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 */ + &__GLEW_EXT_debug_label, +#endif #ifdef GL_EXT_debug_marker - GLEW_EXT_debug_marker = _glewSearchExtension("GL_EXT_debug_marker", extStart, extEnd); - 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 */ + &__GLEW_EXT_debug_marker, +#endif #ifdef GL_EXT_depth_bounds_test - GLEW_EXT_depth_bounds_test = _glewSearchExtension("GL_EXT_depth_bounds_test", extStart, extEnd); - 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 */ + &__GLEW_EXT_depth_bounds_test, +#endif #ifdef GL_EXT_direct_state_access - GLEW_EXT_direct_state_access = _glewSearchExtension("GL_EXT_direct_state_access", extStart, extEnd); - 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 */ + &__GLEW_EXT_direct_state_access, +#endif #ifdef GL_EXT_draw_buffers2 - GLEW_EXT_draw_buffers2 = _glewSearchExtension("GL_EXT_draw_buffers2", extStart, extEnd); - 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 */ + &__GLEW_EXT_draw_buffers2, +#endif #ifdef GL_EXT_draw_instanced - GLEW_EXT_draw_instanced = _glewSearchExtension("GL_EXT_draw_instanced", extStart, extEnd); - 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 */ + &__GLEW_EXT_draw_instanced, +#endif #ifdef GL_EXT_draw_range_elements - GLEW_EXT_draw_range_elements = _glewSearchExtension("GL_EXT_draw_range_elements", extStart, extEnd); - 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 */ + &__GLEW_EXT_draw_range_elements, +#endif #ifdef GL_EXT_fog_coord - GLEW_EXT_fog_coord = _glewSearchExtension("GL_EXT_fog_coord", extStart, extEnd); - 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 */ + &__GLEW_EXT_fog_coord, +#endif #ifdef GL_EXT_fragment_lighting - GLEW_EXT_fragment_lighting = _glewSearchExtension("GL_EXT_fragment_lighting", extStart, extEnd); - 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 */ + &__GLEW_EXT_fragment_lighting, +#endif #ifdef GL_EXT_framebuffer_blit - GLEW_EXT_framebuffer_blit = _glewSearchExtension("GL_EXT_framebuffer_blit", extStart, extEnd); - 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 */ + &__GLEW_EXT_framebuffer_blit, +#endif #ifdef GL_EXT_framebuffer_multisample - GLEW_EXT_framebuffer_multisample = _glewSearchExtension("GL_EXT_framebuffer_multisample", extStart, extEnd); - 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 */ + &__GLEW_EXT_framebuffer_multisample, +#endif #ifdef GL_EXT_framebuffer_multisample_blit_scaled - GLEW_EXT_framebuffer_multisample_blit_scaled = _glewSearchExtension("GL_EXT_framebuffer_multisample_blit_scaled", extStart, extEnd); -#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ + &__GLEW_EXT_framebuffer_multisample_blit_scaled, +#endif #ifdef GL_EXT_framebuffer_object - GLEW_EXT_framebuffer_object = _glewSearchExtension("GL_EXT_framebuffer_object", extStart, extEnd); - 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 */ + &__GLEW_EXT_framebuffer_object, +#endif #ifdef GL_EXT_framebuffer_sRGB - GLEW_EXT_framebuffer_sRGB = _glewSearchExtension("GL_EXT_framebuffer_sRGB", extStart, extEnd); -#endif /* GL_EXT_framebuffer_sRGB */ + &__GLEW_EXT_framebuffer_sRGB, +#endif #ifdef GL_EXT_geometry_shader4 - GLEW_EXT_geometry_shader4 = _glewSearchExtension("GL_EXT_geometry_shader4", extStart, extEnd); - 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 */ + &__GLEW_EXT_geometry_shader4, +#endif #ifdef GL_EXT_gpu_program_parameters - GLEW_EXT_gpu_program_parameters = _glewSearchExtension("GL_EXT_gpu_program_parameters", extStart, extEnd); - 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 */ + &__GLEW_EXT_gpu_program_parameters, +#endif #ifdef GL_EXT_gpu_shader4 - GLEW_EXT_gpu_shader4 = _glewSearchExtension("GL_EXT_gpu_shader4", extStart, extEnd); - 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 */ + &__GLEW_EXT_gpu_shader4, +#endif #ifdef GL_EXT_histogram - GLEW_EXT_histogram = _glewSearchExtension("GL_EXT_histogram", extStart, extEnd); - if (glewExperimental || GLEW_EXT_histogram) GLEW_EXT_histogram = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_EXT_histogram */ + &__GLEW_EXT_histogram, +#endif #ifdef GL_EXT_index_array_formats - GLEW_EXT_index_array_formats = _glewSearchExtension("GL_EXT_index_array_formats", extStart, extEnd); -#endif /* GL_EXT_index_array_formats */ + &__GLEW_EXT_index_array_formats, +#endif #ifdef GL_EXT_index_func - GLEW_EXT_index_func = _glewSearchExtension("GL_EXT_index_func", extStart, extEnd); - 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 */ + &__GLEW_EXT_index_func, +#endif #ifdef GL_EXT_index_material - GLEW_EXT_index_material = _glewSearchExtension("GL_EXT_index_material", extStart, extEnd); - 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 */ + &__GLEW_EXT_index_material, +#endif #ifdef GL_EXT_index_texture - GLEW_EXT_index_texture = _glewSearchExtension("GL_EXT_index_texture", extStart, extEnd); -#endif /* GL_EXT_index_texture */ + &__GLEW_EXT_index_texture, +#endif #ifdef GL_EXT_light_texture - GLEW_EXT_light_texture = _glewSearchExtension("GL_EXT_light_texture", extStart, extEnd); - 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 */ + &__GLEW_EXT_light_texture, +#endif #ifdef GL_EXT_misc_attribute - GLEW_EXT_misc_attribute = _glewSearchExtension("GL_EXT_misc_attribute", extStart, extEnd); -#endif /* GL_EXT_misc_attribute */ + &__GLEW_EXT_misc_attribute, +#endif #ifdef GL_EXT_multi_draw_arrays - GLEW_EXT_multi_draw_arrays = _glewSearchExtension("GL_EXT_multi_draw_arrays", extStart, extEnd); - 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 */ + &__GLEW_EXT_multi_draw_arrays, +#endif #ifdef GL_EXT_multisample - GLEW_EXT_multisample = _glewSearchExtension("GL_EXT_multisample", extStart, extEnd); - if (glewExperimental || GLEW_EXT_multisample) GLEW_EXT_multisample = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_EXT_multisample */ + &__GLEW_EXT_multisample, +#endif #ifdef GL_EXT_packed_depth_stencil - GLEW_EXT_packed_depth_stencil = _glewSearchExtension("GL_EXT_packed_depth_stencil", extStart, extEnd); -#endif /* GL_EXT_packed_depth_stencil */ + &__GLEW_EXT_packed_depth_stencil, +#endif #ifdef GL_EXT_packed_float - GLEW_EXT_packed_float = _glewSearchExtension("GL_EXT_packed_float", extStart, extEnd); -#endif /* GL_EXT_packed_float */ + &__GLEW_EXT_packed_float, +#endif #ifdef GL_EXT_packed_pixels - GLEW_EXT_packed_pixels = _glewSearchExtension("GL_EXT_packed_pixels", extStart, extEnd); -#endif /* GL_EXT_packed_pixels */ + &__GLEW_EXT_packed_pixels, +#endif #ifdef GL_EXT_paletted_texture - GLEW_EXT_paletted_texture = _glewSearchExtension("GL_EXT_paletted_texture", extStart, extEnd); - 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 */ + &__GLEW_EXT_paletted_texture, +#endif #ifdef GL_EXT_pixel_buffer_object - GLEW_EXT_pixel_buffer_object = _glewSearchExtension("GL_EXT_pixel_buffer_object", extStart, extEnd); -#endif /* GL_EXT_pixel_buffer_object */ + &__GLEW_EXT_pixel_buffer_object, +#endif #ifdef GL_EXT_pixel_transform - GLEW_EXT_pixel_transform = _glewSearchExtension("GL_EXT_pixel_transform", extStart, extEnd); - 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 */ + &__GLEW_EXT_pixel_transform, +#endif #ifdef GL_EXT_pixel_transform_color_table - GLEW_EXT_pixel_transform_color_table = _glewSearchExtension("GL_EXT_pixel_transform_color_table", extStart, extEnd); -#endif /* GL_EXT_pixel_transform_color_table */ + &__GLEW_EXT_pixel_transform_color_table, +#endif #ifdef GL_EXT_point_parameters - GLEW_EXT_point_parameters = _glewSearchExtension("GL_EXT_point_parameters", extStart, extEnd); - 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 */ + &__GLEW_EXT_point_parameters, +#endif #ifdef GL_EXT_polygon_offset - GLEW_EXT_polygon_offset = _glewSearchExtension("GL_EXT_polygon_offset", extStart, extEnd); - 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 */ + &__GLEW_EXT_polygon_offset, +#endif #ifdef GL_EXT_polygon_offset_clamp - GLEW_EXT_polygon_offset_clamp = _glewSearchExtension("GL_EXT_polygon_offset_clamp", extStart, extEnd); - 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 */ + &__GLEW_EXT_polygon_offset_clamp, +#endif #ifdef GL_EXT_post_depth_coverage - GLEW_EXT_post_depth_coverage = _glewSearchExtension("GL_EXT_post_depth_coverage", extStart, extEnd); -#endif /* GL_EXT_post_depth_coverage */ + &__GLEW_EXT_post_depth_coverage, +#endif #ifdef GL_EXT_provoking_vertex - GLEW_EXT_provoking_vertex = _glewSearchExtension("GL_EXT_provoking_vertex", extStart, extEnd); - 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 */ + &__GLEW_EXT_provoking_vertex, +#endif #ifdef GL_EXT_raster_multisample - GLEW_EXT_raster_multisample = _glewSearchExtension("GL_EXT_raster_multisample", extStart, extEnd); - 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 */ + &__GLEW_EXT_raster_multisample, +#endif #ifdef GL_EXT_rescale_normal - GLEW_EXT_rescale_normal = _glewSearchExtension("GL_EXT_rescale_normal", extStart, extEnd); -#endif /* GL_EXT_rescale_normal */ + &__GLEW_EXT_rescale_normal, +#endif #ifdef GL_EXT_scene_marker - GLEW_EXT_scene_marker = _glewSearchExtension("GL_EXT_scene_marker", extStart, extEnd); - 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 */ + &__GLEW_EXT_scene_marker, +#endif #ifdef GL_EXT_secondary_color - GLEW_EXT_secondary_color = _glewSearchExtension("GL_EXT_secondary_color", extStart, extEnd); - 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 */ + &__GLEW_EXT_secondary_color, +#endif #ifdef GL_EXT_separate_shader_objects - GLEW_EXT_separate_shader_objects = _glewSearchExtension("GL_EXT_separate_shader_objects", extStart, extEnd); - 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 */ + &__GLEW_EXT_separate_shader_objects, +#endif #ifdef GL_EXT_separate_specular_color - GLEW_EXT_separate_specular_color = _glewSearchExtension("GL_EXT_separate_specular_color", extStart, extEnd); -#endif /* GL_EXT_separate_specular_color */ + &__GLEW_EXT_separate_specular_color, +#endif #ifdef GL_EXT_shader_image_load_formatted - GLEW_EXT_shader_image_load_formatted = _glewSearchExtension("GL_EXT_shader_image_load_formatted", extStart, extEnd); -#endif /* GL_EXT_shader_image_load_formatted */ + &__GLEW_EXT_shader_image_load_formatted, +#endif #ifdef GL_EXT_shader_image_load_store - GLEW_EXT_shader_image_load_store = _glewSearchExtension("GL_EXT_shader_image_load_store", extStart, extEnd); - 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 */ + &__GLEW_EXT_shader_image_load_store, +#endif #ifdef GL_EXT_shader_integer_mix - GLEW_EXT_shader_integer_mix = _glewSearchExtension("GL_EXT_shader_integer_mix", extStart, extEnd); -#endif /* GL_EXT_shader_integer_mix */ + &__GLEW_EXT_shader_integer_mix, +#endif #ifdef GL_EXT_shadow_funcs - GLEW_EXT_shadow_funcs = _glewSearchExtension("GL_EXT_shadow_funcs", extStart, extEnd); -#endif /* GL_EXT_shadow_funcs */ + &__GLEW_EXT_shadow_funcs, +#endif #ifdef GL_EXT_shared_texture_palette - GLEW_EXT_shared_texture_palette = _glewSearchExtension("GL_EXT_shared_texture_palette", extStart, extEnd); -#endif /* GL_EXT_shared_texture_palette */ + &__GLEW_EXT_shared_texture_palette, +#endif #ifdef GL_EXT_sparse_texture2 - GLEW_EXT_sparse_texture2 = _glewSearchExtension("GL_EXT_sparse_texture2", extStart, extEnd); -#endif /* GL_EXT_sparse_texture2 */ + &__GLEW_EXT_sparse_texture2, +#endif #ifdef GL_EXT_stencil_clear_tag - GLEW_EXT_stencil_clear_tag = _glewSearchExtension("GL_EXT_stencil_clear_tag", extStart, extEnd); -#endif /* GL_EXT_stencil_clear_tag */ + &__GLEW_EXT_stencil_clear_tag, +#endif #ifdef GL_EXT_stencil_two_side - GLEW_EXT_stencil_two_side = _glewSearchExtension("GL_EXT_stencil_two_side", extStart, extEnd); - 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 */ + &__GLEW_EXT_stencil_two_side, +#endif #ifdef GL_EXT_stencil_wrap - GLEW_EXT_stencil_wrap = _glewSearchExtension("GL_EXT_stencil_wrap", extStart, extEnd); -#endif /* GL_EXT_stencil_wrap */ + &__GLEW_EXT_stencil_wrap, +#endif #ifdef GL_EXT_subtexture - GLEW_EXT_subtexture = _glewSearchExtension("GL_EXT_subtexture", extStart, extEnd); - if (glewExperimental || GLEW_EXT_subtexture) GLEW_EXT_subtexture = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_EXT_subtexture */ + &__GLEW_EXT_subtexture, +#endif #ifdef GL_EXT_texture - GLEW_EXT_texture = _glewSearchExtension("GL_EXT_texture", extStart, extEnd); -#endif /* GL_EXT_texture */ + &__GLEW_EXT_texture, +#endif #ifdef GL_EXT_texture3D - GLEW_EXT_texture3D = _glewSearchExtension("GL_EXT_texture3D", extStart, extEnd); - if (glewExperimental || GLEW_EXT_texture3D) GLEW_EXT_texture3D = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_EXT_texture3D */ + &__GLEW_EXT_texture3D, +#endif #ifdef GL_EXT_texture_array - GLEW_EXT_texture_array = _glewSearchExtension("GL_EXT_texture_array", extStart, extEnd); - 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 */ + &__GLEW_EXT_texture_array, +#endif #ifdef GL_EXT_texture_buffer_object - GLEW_EXT_texture_buffer_object = _glewSearchExtension("GL_EXT_texture_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_EXT_texture_buffer_object, +#endif #ifdef GL_EXT_texture_compression_dxt1 - GLEW_EXT_texture_compression_dxt1 = _glewSearchExtension("GL_EXT_texture_compression_dxt1", extStart, extEnd); -#endif /* GL_EXT_texture_compression_dxt1 */ + &__GLEW_EXT_texture_compression_dxt1, +#endif #ifdef GL_EXT_texture_compression_latc - GLEW_EXT_texture_compression_latc = _glewSearchExtension("GL_EXT_texture_compression_latc", extStart, extEnd); -#endif /* GL_EXT_texture_compression_latc */ + &__GLEW_EXT_texture_compression_latc, +#endif #ifdef GL_EXT_texture_compression_rgtc - GLEW_EXT_texture_compression_rgtc = _glewSearchExtension("GL_EXT_texture_compression_rgtc", extStart, extEnd); -#endif /* GL_EXT_texture_compression_rgtc */ + &__GLEW_EXT_texture_compression_rgtc, +#endif #ifdef GL_EXT_texture_compression_s3tc - GLEW_EXT_texture_compression_s3tc = _glewSearchExtension("GL_EXT_texture_compression_s3tc", extStart, extEnd); -#endif /* GL_EXT_texture_compression_s3tc */ + &__GLEW_EXT_texture_compression_s3tc, +#endif #ifdef GL_EXT_texture_cube_map - GLEW_EXT_texture_cube_map = _glewSearchExtension("GL_EXT_texture_cube_map", extStart, extEnd); -#endif /* GL_EXT_texture_cube_map */ + &__GLEW_EXT_texture_cube_map, +#endif #ifdef GL_EXT_texture_edge_clamp - GLEW_EXT_texture_edge_clamp = _glewSearchExtension("GL_EXT_texture_edge_clamp", extStart, extEnd); -#endif /* GL_EXT_texture_edge_clamp */ + &__GLEW_EXT_texture_edge_clamp, +#endif #ifdef GL_EXT_texture_env - GLEW_EXT_texture_env = _glewSearchExtension("GL_EXT_texture_env", extStart, extEnd); -#endif /* GL_EXT_texture_env */ + &__GLEW_EXT_texture_env, +#endif #ifdef GL_EXT_texture_env_add - GLEW_EXT_texture_env_add = _glewSearchExtension("GL_EXT_texture_env_add", extStart, extEnd); -#endif /* GL_EXT_texture_env_add */ + &__GLEW_EXT_texture_env_add, +#endif #ifdef GL_EXT_texture_env_combine - GLEW_EXT_texture_env_combine = _glewSearchExtension("GL_EXT_texture_env_combine", extStart, extEnd); -#endif /* GL_EXT_texture_env_combine */ + &__GLEW_EXT_texture_env_combine, +#endif #ifdef GL_EXT_texture_env_dot3 - GLEW_EXT_texture_env_dot3 = _glewSearchExtension("GL_EXT_texture_env_dot3", extStart, extEnd); -#endif /* GL_EXT_texture_env_dot3 */ + &__GLEW_EXT_texture_env_dot3, +#endif #ifdef GL_EXT_texture_filter_anisotropic - GLEW_EXT_texture_filter_anisotropic = _glewSearchExtension("GL_EXT_texture_filter_anisotropic", extStart, extEnd); -#endif /* GL_EXT_texture_filter_anisotropic */ + &__GLEW_EXT_texture_filter_anisotropic, +#endif #ifdef GL_EXT_texture_filter_minmax - GLEW_EXT_texture_filter_minmax = _glewSearchExtension("GL_EXT_texture_filter_minmax", extStart, extEnd); -#endif /* GL_EXT_texture_filter_minmax */ + &__GLEW_EXT_texture_filter_minmax, +#endif #ifdef GL_EXT_texture_integer - GLEW_EXT_texture_integer = _glewSearchExtension("GL_EXT_texture_integer", extStart, extEnd); - 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 */ + &__GLEW_EXT_texture_integer, +#endif #ifdef GL_EXT_texture_lod_bias - GLEW_EXT_texture_lod_bias = _glewSearchExtension("GL_EXT_texture_lod_bias", extStart, extEnd); -#endif /* GL_EXT_texture_lod_bias */ + &__GLEW_EXT_texture_lod_bias, +#endif #ifdef GL_EXT_texture_mirror_clamp - GLEW_EXT_texture_mirror_clamp = _glewSearchExtension("GL_EXT_texture_mirror_clamp", extStart, extEnd); -#endif /* GL_EXT_texture_mirror_clamp */ + &__GLEW_EXT_texture_mirror_clamp, +#endif #ifdef GL_EXT_texture_object - GLEW_EXT_texture_object = _glewSearchExtension("GL_EXT_texture_object", extStart, extEnd); - 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 */ + &__GLEW_EXT_texture_object, +#endif #ifdef GL_EXT_texture_perturb_normal - GLEW_EXT_texture_perturb_normal = _glewSearchExtension("GL_EXT_texture_perturb_normal", extStart, extEnd); - 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 */ + &__GLEW_EXT_texture_perturb_normal, +#endif #ifdef GL_EXT_texture_rectangle - GLEW_EXT_texture_rectangle = _glewSearchExtension("GL_EXT_texture_rectangle", extStart, extEnd); -#endif /* GL_EXT_texture_rectangle */ + &__GLEW_EXT_texture_rectangle, +#endif #ifdef GL_EXT_texture_sRGB - GLEW_EXT_texture_sRGB = _glewSearchExtension("GL_EXT_texture_sRGB", extStart, extEnd); -#endif /* GL_EXT_texture_sRGB */ + &__GLEW_EXT_texture_sRGB, +#endif #ifdef GL_EXT_texture_sRGB_decode - GLEW_EXT_texture_sRGB_decode = _glewSearchExtension("GL_EXT_texture_sRGB_decode", extStart, extEnd); -#endif /* GL_EXT_texture_sRGB_decode */ + &__GLEW_EXT_texture_sRGB_decode, +#endif #ifdef GL_EXT_texture_shared_exponent - GLEW_EXT_texture_shared_exponent = _glewSearchExtension("GL_EXT_texture_shared_exponent", extStart, extEnd); -#endif /* GL_EXT_texture_shared_exponent */ + &__GLEW_EXT_texture_shared_exponent, +#endif #ifdef GL_EXT_texture_snorm - GLEW_EXT_texture_snorm = _glewSearchExtension("GL_EXT_texture_snorm", extStart, extEnd); -#endif /* GL_EXT_texture_snorm */ + &__GLEW_EXT_texture_snorm, +#endif #ifdef GL_EXT_texture_swizzle - GLEW_EXT_texture_swizzle = _glewSearchExtension("GL_EXT_texture_swizzle", extStart, extEnd); -#endif /* GL_EXT_texture_swizzle */ + &__GLEW_EXT_texture_swizzle, +#endif #ifdef GL_EXT_timer_query - GLEW_EXT_timer_query = _glewSearchExtension("GL_EXT_timer_query", extStart, extEnd); - 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 */ + &__GLEW_EXT_timer_query, +#endif #ifdef GL_EXT_transform_feedback - GLEW_EXT_transform_feedback = _glewSearchExtension("GL_EXT_transform_feedback", extStart, extEnd); - 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 */ + &__GLEW_EXT_transform_feedback, +#endif #ifdef GL_EXT_vertex_array - GLEW_EXT_vertex_array = _glewSearchExtension("GL_EXT_vertex_array", extStart, extEnd); - 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 */ + &__GLEW_EXT_vertex_array, +#endif #ifdef GL_EXT_vertex_array_bgra - GLEW_EXT_vertex_array_bgra = _glewSearchExtension("GL_EXT_vertex_array_bgra", extStart, extEnd); -#endif /* GL_EXT_vertex_array_bgra */ + &__GLEW_EXT_vertex_array_bgra, +#endif #ifdef GL_EXT_vertex_attrib_64bit - GLEW_EXT_vertex_attrib_64bit = _glewSearchExtension("GL_EXT_vertex_attrib_64bit", extStart, extEnd); - 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 */ + &__GLEW_EXT_vertex_attrib_64bit, +#endif #ifdef GL_EXT_vertex_shader - GLEW_EXT_vertex_shader = _glewSearchExtension("GL_EXT_vertex_shader", extStart, extEnd); - 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 */ + &__GLEW_EXT_vertex_shader, +#endif #ifdef GL_EXT_vertex_weighting - GLEW_EXT_vertex_weighting = _glewSearchExtension("GL_EXT_vertex_weighting", extStart, extEnd); - 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 */ + &__GLEW_EXT_vertex_weighting, +#endif +#ifdef GL_EXT_window_rectangles + &__GLEW_EXT_window_rectangles, +#endif #ifdef GL_EXT_x11_sync_object - GLEW_EXT_x11_sync_object = _glewSearchExtension("GL_EXT_x11_sync_object", extStart, extEnd); - 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 */ + &__GLEW_EXT_x11_sync_object, +#endif #ifdef GL_GREMEDY_frame_terminator - GLEW_GREMEDY_frame_terminator = _glewSearchExtension("GL_GREMEDY_frame_terminator", extStart, extEnd); - 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 */ + &__GLEW_GREMEDY_frame_terminator, +#endif #ifdef GL_GREMEDY_string_marker - GLEW_GREMEDY_string_marker = _glewSearchExtension("GL_GREMEDY_string_marker", extStart, extEnd); - 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 */ + &__GLEW_GREMEDY_string_marker, +#endif #ifdef GL_HP_convolution_border_modes - GLEW_HP_convolution_border_modes = _glewSearchExtension("GL_HP_convolution_border_modes", extStart, extEnd); -#endif /* GL_HP_convolution_border_modes */ + &__GLEW_HP_convolution_border_modes, +#endif #ifdef GL_HP_image_transform - GLEW_HP_image_transform = _glewSearchExtension("GL_HP_image_transform", extStart, extEnd); - 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 */ + &__GLEW_HP_image_transform, +#endif #ifdef GL_HP_occlusion_test - GLEW_HP_occlusion_test = _glewSearchExtension("GL_HP_occlusion_test", extStart, extEnd); -#endif /* GL_HP_occlusion_test */ + &__GLEW_HP_occlusion_test, +#endif #ifdef GL_HP_texture_lighting - GLEW_HP_texture_lighting = _glewSearchExtension("GL_HP_texture_lighting", extStart, extEnd); -#endif /* GL_HP_texture_lighting */ + &__GLEW_HP_texture_lighting, +#endif #ifdef GL_IBM_cull_vertex - GLEW_IBM_cull_vertex = _glewSearchExtension("GL_IBM_cull_vertex", extStart, extEnd); -#endif /* GL_IBM_cull_vertex */ + &__GLEW_IBM_cull_vertex, +#endif #ifdef GL_IBM_multimode_draw_arrays - GLEW_IBM_multimode_draw_arrays = _glewSearchExtension("GL_IBM_multimode_draw_arrays", extStart, extEnd); - 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 */ + &__GLEW_IBM_multimode_draw_arrays, +#endif #ifdef GL_IBM_rasterpos_clip - GLEW_IBM_rasterpos_clip = _glewSearchExtension("GL_IBM_rasterpos_clip", extStart, extEnd); -#endif /* GL_IBM_rasterpos_clip */ + &__GLEW_IBM_rasterpos_clip, +#endif #ifdef GL_IBM_static_data - GLEW_IBM_static_data = _glewSearchExtension("GL_IBM_static_data", extStart, extEnd); -#endif /* GL_IBM_static_data */ + &__GLEW_IBM_static_data, +#endif #ifdef GL_IBM_texture_mirrored_repeat - GLEW_IBM_texture_mirrored_repeat = _glewSearchExtension("GL_IBM_texture_mirrored_repeat", extStart, extEnd); -#endif /* GL_IBM_texture_mirrored_repeat */ + &__GLEW_IBM_texture_mirrored_repeat, +#endif #ifdef GL_IBM_vertex_array_lists - GLEW_IBM_vertex_array_lists = _glewSearchExtension("GL_IBM_vertex_array_lists", extStart, extEnd); - 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 */ + &__GLEW_IBM_vertex_array_lists, +#endif #ifdef GL_INGR_color_clamp - GLEW_INGR_color_clamp = _glewSearchExtension("GL_INGR_color_clamp", extStart, extEnd); -#endif /* GL_INGR_color_clamp */ + &__GLEW_INGR_color_clamp, +#endif #ifdef GL_INGR_interlace_read - GLEW_INGR_interlace_read = _glewSearchExtension("GL_INGR_interlace_read", extStart, extEnd); -#endif /* GL_INGR_interlace_read */ + &__GLEW_INGR_interlace_read, +#endif +#ifdef GL_INTEL_conservative_rasterization + &__GLEW_INTEL_conservative_rasterization, +#endif #ifdef GL_INTEL_fragment_shader_ordering - GLEW_INTEL_fragment_shader_ordering = _glewSearchExtension("GL_INTEL_fragment_shader_ordering", extStart, extEnd); -#endif /* GL_INTEL_fragment_shader_ordering */ + &__GLEW_INTEL_fragment_shader_ordering, +#endif #ifdef GL_INTEL_framebuffer_CMAA - GLEW_INTEL_framebuffer_CMAA = _glewSearchExtension("GL_INTEL_framebuffer_CMAA", extStart, extEnd); -#endif /* GL_INTEL_framebuffer_CMAA */ + &__GLEW_INTEL_framebuffer_CMAA, +#endif #ifdef GL_INTEL_map_texture - GLEW_INTEL_map_texture = _glewSearchExtension("GL_INTEL_map_texture", extStart, extEnd); - 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 */ + &__GLEW_INTEL_map_texture, +#endif #ifdef GL_INTEL_parallel_arrays - GLEW_INTEL_parallel_arrays = _glewSearchExtension("GL_INTEL_parallel_arrays", extStart, extEnd); - 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 */ + &__GLEW_INTEL_parallel_arrays, +#endif #ifdef GL_INTEL_performance_query - GLEW_INTEL_performance_query = _glewSearchExtension("GL_INTEL_performance_query", extStart, extEnd); - 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 */ + &__GLEW_INTEL_performance_query, +#endif #ifdef GL_INTEL_texture_scissor - GLEW_INTEL_texture_scissor = _glewSearchExtension("GL_INTEL_texture_scissor", extStart, extEnd); - 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 */ + &__GLEW_INTEL_texture_scissor, +#endif #ifdef GL_KHR_blend_equation_advanced - GLEW_KHR_blend_equation_advanced = _glewSearchExtension("GL_KHR_blend_equation_advanced", extStart, extEnd); - 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 */ + &__GLEW_KHR_blend_equation_advanced, +#endif #ifdef GL_KHR_blend_equation_advanced_coherent - GLEW_KHR_blend_equation_advanced_coherent = _glewSearchExtension("GL_KHR_blend_equation_advanced_coherent", extStart, extEnd); -#endif /* GL_KHR_blend_equation_advanced_coherent */ + &__GLEW_KHR_blend_equation_advanced_coherent, +#endif #ifdef GL_KHR_context_flush_control - GLEW_KHR_context_flush_control = _glewSearchExtension("GL_KHR_context_flush_control", extStart, extEnd); -#endif /* GL_KHR_context_flush_control */ + &__GLEW_KHR_context_flush_control, +#endif #ifdef GL_KHR_debug - GLEW_KHR_debug = _glewSearchExtension("GL_KHR_debug", extStart, extEnd); - if (glewExperimental || GLEW_KHR_debug) GLEW_KHR_debug = !_glewInit_GL_KHR_debug(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_KHR_debug */ + &__GLEW_KHR_debug, +#endif #ifdef GL_KHR_no_error - GLEW_KHR_no_error = _glewSearchExtension("GL_KHR_no_error", extStart, extEnd); -#endif /* GL_KHR_no_error */ + &__GLEW_KHR_no_error, +#endif #ifdef GL_KHR_robust_buffer_access_behavior - GLEW_KHR_robust_buffer_access_behavior = _glewSearchExtension("GL_KHR_robust_buffer_access_behavior", extStart, extEnd); -#endif /* GL_KHR_robust_buffer_access_behavior */ + &__GLEW_KHR_robust_buffer_access_behavior, +#endif #ifdef GL_KHR_robustness - GLEW_KHR_robustness = _glewSearchExtension("GL_KHR_robustness", extStart, extEnd); - if (glewExperimental || GLEW_KHR_robustness) GLEW_KHR_robustness = !_glewInit_GL_KHR_robustness(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_KHR_robustness */ + &__GLEW_KHR_robustness, +#endif #ifdef GL_KHR_texture_compression_astc_hdr - GLEW_KHR_texture_compression_astc_hdr = _glewSearchExtension("GL_KHR_texture_compression_astc_hdr", extStart, extEnd); -#endif /* GL_KHR_texture_compression_astc_hdr */ + &__GLEW_KHR_texture_compression_astc_hdr, +#endif #ifdef GL_KHR_texture_compression_astc_ldr - GLEW_KHR_texture_compression_astc_ldr = _glewSearchExtension("GL_KHR_texture_compression_astc_ldr", extStart, extEnd); -#endif /* GL_KHR_texture_compression_astc_ldr */ + &__GLEW_KHR_texture_compression_astc_ldr, +#endif +#ifdef GL_KHR_texture_compression_astc_sliced_3d + &__GLEW_KHR_texture_compression_astc_sliced_3d, +#endif #ifdef GL_KTX_buffer_region - GLEW_KTX_buffer_region = _glewSearchExtension("GL_KTX_buffer_region", extStart, extEnd); - 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 */ + &__GLEW_KTX_buffer_region, +#endif #ifdef GL_MESAX_texture_stack - GLEW_MESAX_texture_stack = _glewSearchExtension("GL_MESAX_texture_stack", extStart, extEnd); -#endif /* GL_MESAX_texture_stack */ + &__GLEW_MESAX_texture_stack, +#endif #ifdef GL_MESA_pack_invert - GLEW_MESA_pack_invert = _glewSearchExtension("GL_MESA_pack_invert", extStart, extEnd); -#endif /* GL_MESA_pack_invert */ + &__GLEW_MESA_pack_invert, +#endif #ifdef GL_MESA_resize_buffers - GLEW_MESA_resize_buffers = _glewSearchExtension("GL_MESA_resize_buffers", extStart, extEnd); - 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 */ + &__GLEW_MESA_resize_buffers, +#endif +#ifdef GL_MESA_shader_integer_functions + &__GLEW_MESA_shader_integer_functions, +#endif #ifdef GL_MESA_window_pos - GLEW_MESA_window_pos = _glewSearchExtension("GL_MESA_window_pos", extStart, extEnd); - 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 */ + &__GLEW_MESA_window_pos, +#endif #ifdef GL_MESA_ycbcr_texture - GLEW_MESA_ycbcr_texture = _glewSearchExtension("GL_MESA_ycbcr_texture", extStart, extEnd); -#endif /* GL_MESA_ycbcr_texture */ + &__GLEW_MESA_ycbcr_texture, +#endif +#ifdef GL_NVX_blend_equation_advanced_multi_draw_buffers + &__GLEW_NVX_blend_equation_advanced_multi_draw_buffers, +#endif #ifdef GL_NVX_conditional_render - GLEW_NVX_conditional_render = _glewSearchExtension("GL_NVX_conditional_render", extStart, extEnd); - 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 */ + &__GLEW_NVX_conditional_render, +#endif #ifdef GL_NVX_gpu_memory_info - GLEW_NVX_gpu_memory_info = _glewSearchExtension("GL_NVX_gpu_memory_info", extStart, extEnd); -#endif /* GL_NVX_gpu_memory_info */ + &__GLEW_NVX_gpu_memory_info, +#endif +#ifdef GL_NVX_linked_gpu_multicast + &__GLEW_NVX_linked_gpu_multicast, +#endif #ifdef GL_NV_bindless_multi_draw_indirect - GLEW_NV_bindless_multi_draw_indirect = _glewSearchExtension("GL_NV_bindless_multi_draw_indirect", extStart, extEnd); - 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 */ + &__GLEW_NV_bindless_multi_draw_indirect, +#endif #ifdef GL_NV_bindless_multi_draw_indirect_count - GLEW_NV_bindless_multi_draw_indirect_count = _glewSearchExtension("GL_NV_bindless_multi_draw_indirect_count", extStart, extEnd); - 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 */ + &__GLEW_NV_bindless_multi_draw_indirect_count, +#endif #ifdef GL_NV_bindless_texture - GLEW_NV_bindless_texture = _glewSearchExtension("GL_NV_bindless_texture", extStart, extEnd); - 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 */ + &__GLEW_NV_bindless_texture, +#endif #ifdef GL_NV_blend_equation_advanced - GLEW_NV_blend_equation_advanced = _glewSearchExtension("GL_NV_blend_equation_advanced", extStart, extEnd); - 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 */ + &__GLEW_NV_blend_equation_advanced, +#endif #ifdef GL_NV_blend_equation_advanced_coherent - GLEW_NV_blend_equation_advanced_coherent = _glewSearchExtension("GL_NV_blend_equation_advanced_coherent", extStart, extEnd); -#endif /* GL_NV_blend_equation_advanced_coherent */ + &__GLEW_NV_blend_equation_advanced_coherent, +#endif #ifdef GL_NV_blend_square - GLEW_NV_blend_square = _glewSearchExtension("GL_NV_blend_square", extStart, extEnd); -#endif /* GL_NV_blend_square */ + &__GLEW_NV_blend_square, +#endif +#ifdef GL_NV_clip_space_w_scaling + &__GLEW_NV_clip_space_w_scaling, +#endif +#ifdef GL_NV_command_list + &__GLEW_NV_command_list, +#endif #ifdef GL_NV_compute_program5 - GLEW_NV_compute_program5 = _glewSearchExtension("GL_NV_compute_program5", extStart, extEnd); -#endif /* GL_NV_compute_program5 */ + &__GLEW_NV_compute_program5, +#endif #ifdef GL_NV_conditional_render - GLEW_NV_conditional_render = _glewSearchExtension("GL_NV_conditional_render", extStart, extEnd); - 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 */ + &__GLEW_NV_conditional_render, +#endif #ifdef GL_NV_conservative_raster - GLEW_NV_conservative_raster = _glewSearchExtension("GL_NV_conservative_raster", extStart, extEnd); - 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 */ + &__GLEW_NV_conservative_raster, +#endif #ifdef GL_NV_conservative_raster_dilate - GLEW_NV_conservative_raster_dilate = _glewSearchExtension("GL_NV_conservative_raster_dilate", extStart, extEnd); - if (glewExperimental || GLEW_NV_conservative_raster_dilate) GLEW_NV_conservative_raster_dilate = !_glewInit_GL_NV_conservative_raster_dilate(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_NV_conservative_raster_dilate */ + &__GLEW_NV_conservative_raster_dilate, +#endif +#ifdef GL_NV_conservative_raster_pre_snap_triangles + &__GLEW_NV_conservative_raster_pre_snap_triangles, +#endif #ifdef GL_NV_copy_depth_to_color - GLEW_NV_copy_depth_to_color = _glewSearchExtension("GL_NV_copy_depth_to_color", extStart, extEnd); -#endif /* GL_NV_copy_depth_to_color */ + &__GLEW_NV_copy_depth_to_color, +#endif #ifdef GL_NV_copy_image - GLEW_NV_copy_image = _glewSearchExtension("GL_NV_copy_image", extStart, extEnd); - 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 */ + &__GLEW_NV_copy_image, +#endif #ifdef GL_NV_deep_texture3D - GLEW_NV_deep_texture3D = _glewSearchExtension("GL_NV_deep_texture3D", extStart, extEnd); -#endif /* GL_NV_deep_texture3D */ + &__GLEW_NV_deep_texture3D, +#endif #ifdef GL_NV_depth_buffer_float - GLEW_NV_depth_buffer_float = _glewSearchExtension("GL_NV_depth_buffer_float", extStart, extEnd); - 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 */ + &__GLEW_NV_depth_buffer_float, +#endif #ifdef GL_NV_depth_clamp - GLEW_NV_depth_clamp = _glewSearchExtension("GL_NV_depth_clamp", extStart, extEnd); -#endif /* GL_NV_depth_clamp */ + &__GLEW_NV_depth_clamp, +#endif #ifdef GL_NV_depth_range_unclamped - GLEW_NV_depth_range_unclamped = _glewSearchExtension("GL_NV_depth_range_unclamped", extStart, extEnd); -#endif /* GL_NV_depth_range_unclamped */ + &__GLEW_NV_depth_range_unclamped, +#endif #ifdef GL_NV_draw_texture - GLEW_NV_draw_texture = _glewSearchExtension("GL_NV_draw_texture", extStart, extEnd); - 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 */ + &__GLEW_NV_draw_texture, +#endif +#ifdef GL_NV_draw_vulkan_image + &__GLEW_NV_draw_vulkan_image, +#endif #ifdef GL_NV_evaluators - GLEW_NV_evaluators = _glewSearchExtension("GL_NV_evaluators", extStart, extEnd); - if (glewExperimental || GLEW_NV_evaluators) GLEW_NV_evaluators = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_NV_evaluators */ + &__GLEW_NV_evaluators, +#endif #ifdef GL_NV_explicit_multisample - GLEW_NV_explicit_multisample = _glewSearchExtension("GL_NV_explicit_multisample", extStart, extEnd); - 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 */ + &__GLEW_NV_explicit_multisample, +#endif #ifdef GL_NV_fence - GLEW_NV_fence = _glewSearchExtension("GL_NV_fence", extStart, extEnd); - if (glewExperimental || GLEW_NV_fence) GLEW_NV_fence = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_NV_fence */ + &__GLEW_NV_fence, +#endif #ifdef GL_NV_fill_rectangle - GLEW_NV_fill_rectangle = _glewSearchExtension("GL_NV_fill_rectangle", extStart, extEnd); -#endif /* GL_NV_fill_rectangle */ + &__GLEW_NV_fill_rectangle, +#endif #ifdef GL_NV_float_buffer - GLEW_NV_float_buffer = _glewSearchExtension("GL_NV_float_buffer", extStart, extEnd); -#endif /* GL_NV_float_buffer */ + &__GLEW_NV_float_buffer, +#endif #ifdef GL_NV_fog_distance - GLEW_NV_fog_distance = _glewSearchExtension("GL_NV_fog_distance", extStart, extEnd); -#endif /* GL_NV_fog_distance */ + &__GLEW_NV_fog_distance, +#endif #ifdef GL_NV_fragment_coverage_to_color - GLEW_NV_fragment_coverage_to_color = _glewSearchExtension("GL_NV_fragment_coverage_to_color", extStart, extEnd); - 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 */ + &__GLEW_NV_fragment_coverage_to_color, +#endif #ifdef GL_NV_fragment_program - GLEW_NV_fragment_program = _glewSearchExtension("GL_NV_fragment_program", extStart, extEnd); - 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 */ + &__GLEW_NV_fragment_program, +#endif #ifdef GL_NV_fragment_program2 - GLEW_NV_fragment_program2 = _glewSearchExtension("GL_NV_fragment_program2", extStart, extEnd); -#endif /* GL_NV_fragment_program2 */ + &__GLEW_NV_fragment_program2, +#endif #ifdef GL_NV_fragment_program4 - GLEW_NV_fragment_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); -#endif /* GL_NV_fragment_program4 */ + &__GLEW_NV_fragment_program4, +#endif #ifdef GL_NV_fragment_program_option - GLEW_NV_fragment_program_option = _glewSearchExtension("GL_NV_fragment_program_option", extStart, extEnd); -#endif /* GL_NV_fragment_program_option */ + &__GLEW_NV_fragment_program_option, +#endif #ifdef GL_NV_fragment_shader_interlock - GLEW_NV_fragment_shader_interlock = _glewSearchExtension("GL_NV_fragment_shader_interlock", extStart, extEnd); -#endif /* GL_NV_fragment_shader_interlock */ + &__GLEW_NV_fragment_shader_interlock, +#endif #ifdef GL_NV_framebuffer_mixed_samples - GLEW_NV_framebuffer_mixed_samples = _glewSearchExtension("GL_NV_framebuffer_mixed_samples", extStart, extEnd); -#endif /* GL_NV_framebuffer_mixed_samples */ + &__GLEW_NV_framebuffer_mixed_samples, +#endif #ifdef GL_NV_framebuffer_multisample_coverage - GLEW_NV_framebuffer_multisample_coverage = _glewSearchExtension("GL_NV_framebuffer_multisample_coverage", extStart, extEnd); - 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 */ + &__GLEW_NV_framebuffer_multisample_coverage, +#endif #ifdef GL_NV_geometry_program4 - GLEW_NV_geometry_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); - 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 */ + &__GLEW_NV_geometry_program4, +#endif #ifdef GL_NV_geometry_shader4 - GLEW_NV_geometry_shader4 = _glewSearchExtension("GL_NV_geometry_shader4", extStart, extEnd); -#endif /* GL_NV_geometry_shader4 */ + &__GLEW_NV_geometry_shader4, +#endif #ifdef GL_NV_geometry_shader_passthrough - GLEW_NV_geometry_shader_passthrough = _glewSearchExtension("GL_NV_geometry_shader_passthrough", extStart, extEnd); -#endif /* GL_NV_geometry_shader_passthrough */ + &__GLEW_NV_geometry_shader_passthrough, +#endif +#ifdef GL_NV_gpu_multicast + &__GLEW_NV_gpu_multicast, +#endif #ifdef GL_NV_gpu_program4 - GLEW_NV_gpu_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); - 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 */ + &__GLEW_NV_gpu_program4, +#endif #ifdef GL_NV_gpu_program5 - GLEW_NV_gpu_program5 = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); -#endif /* GL_NV_gpu_program5 */ + &__GLEW_NV_gpu_program5, +#endif #ifdef GL_NV_gpu_program5_mem_extended - GLEW_NV_gpu_program5_mem_extended = _glewSearchExtension("GL_NV_gpu_program5_mem_extended", extStart, extEnd); -#endif /* GL_NV_gpu_program5_mem_extended */ + &__GLEW_NV_gpu_program5_mem_extended, +#endif #ifdef GL_NV_gpu_program_fp64 - GLEW_NV_gpu_program_fp64 = _glewSearchExtension("GL_NV_gpu_program_fp64", extStart, extEnd); -#endif /* GL_NV_gpu_program_fp64 */ + &__GLEW_NV_gpu_program_fp64, +#endif #ifdef GL_NV_gpu_shader5 - GLEW_NV_gpu_shader5 = _glewSearchExtension("GL_NV_gpu_shader5", extStart, extEnd); - 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 */ + &__GLEW_NV_gpu_shader5, +#endif #ifdef GL_NV_half_float - GLEW_NV_half_float = _glewSearchExtension("GL_NV_half_float", extStart, extEnd); - 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 */ + &__GLEW_NV_half_float, +#endif #ifdef GL_NV_internalformat_sample_query - GLEW_NV_internalformat_sample_query = _glewSearchExtension("GL_NV_internalformat_sample_query", extStart, extEnd); - 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 */ + &__GLEW_NV_internalformat_sample_query, +#endif #ifdef GL_NV_light_max_exponent - GLEW_NV_light_max_exponent = _glewSearchExtension("GL_NV_light_max_exponent", extStart, extEnd); -#endif /* GL_NV_light_max_exponent */ + &__GLEW_NV_light_max_exponent, +#endif #ifdef GL_NV_multisample_coverage - GLEW_NV_multisample_coverage = _glewSearchExtension("GL_NV_multisample_coverage", extStart, extEnd); -#endif /* GL_NV_multisample_coverage */ + &__GLEW_NV_multisample_coverage, +#endif #ifdef GL_NV_multisample_filter_hint - GLEW_NV_multisample_filter_hint = _glewSearchExtension("GL_NV_multisample_filter_hint", extStart, extEnd); -#endif /* GL_NV_multisample_filter_hint */ + &__GLEW_NV_multisample_filter_hint, +#endif #ifdef GL_NV_occlusion_query - GLEW_NV_occlusion_query = _glewSearchExtension("GL_NV_occlusion_query", extStart, extEnd); - 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 */ + &__GLEW_NV_occlusion_query, +#endif #ifdef GL_NV_packed_depth_stencil - GLEW_NV_packed_depth_stencil = _glewSearchExtension("GL_NV_packed_depth_stencil", extStart, extEnd); -#endif /* GL_NV_packed_depth_stencil */ + &__GLEW_NV_packed_depth_stencil, +#endif #ifdef GL_NV_parameter_buffer_object - GLEW_NV_parameter_buffer_object = _glewSearchExtension("GL_NV_parameter_buffer_object", extStart, extEnd); - 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 */ + &__GLEW_NV_parameter_buffer_object, +#endif #ifdef GL_NV_parameter_buffer_object2 - GLEW_NV_parameter_buffer_object2 = _glewSearchExtension("GL_NV_parameter_buffer_object2", extStart, extEnd); -#endif /* GL_NV_parameter_buffer_object2 */ + &__GLEW_NV_parameter_buffer_object2, +#endif #ifdef GL_NV_path_rendering - GLEW_NV_path_rendering = _glewSearchExtension("GL_NV_path_rendering", extStart, extEnd); - 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 */ + &__GLEW_NV_path_rendering, +#endif #ifdef GL_NV_path_rendering_shared_edge - GLEW_NV_path_rendering_shared_edge = _glewSearchExtension("GL_NV_path_rendering_shared_edge", extStart, extEnd); -#endif /* GL_NV_path_rendering_shared_edge */ + &__GLEW_NV_path_rendering_shared_edge, +#endif #ifdef GL_NV_pixel_data_range - GLEW_NV_pixel_data_range = _glewSearchExtension("GL_NV_pixel_data_range", extStart, extEnd); - 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 */ + &__GLEW_NV_pixel_data_range, +#endif #ifdef GL_NV_point_sprite - GLEW_NV_point_sprite = _glewSearchExtension("GL_NV_point_sprite", extStart, extEnd); - 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 */ + &__GLEW_NV_point_sprite, +#endif #ifdef GL_NV_present_video - GLEW_NV_present_video = _glewSearchExtension("GL_NV_present_video", extStart, extEnd); - 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 */ + &__GLEW_NV_present_video, +#endif #ifdef GL_NV_primitive_restart - GLEW_NV_primitive_restart = _glewSearchExtension("GL_NV_primitive_restart", extStart, extEnd); - 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 */ + &__GLEW_NV_primitive_restart, +#endif #ifdef GL_NV_register_combiners - GLEW_NV_register_combiners = _glewSearchExtension("GL_NV_register_combiners", extStart, extEnd); - 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 */ + &__GLEW_NV_register_combiners, +#endif #ifdef GL_NV_register_combiners2 - GLEW_NV_register_combiners2 = _glewSearchExtension("GL_NV_register_combiners2", extStart, extEnd); - 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 */ + &__GLEW_NV_register_combiners2, +#endif +#ifdef GL_NV_robustness_video_memory_purge + &__GLEW_NV_robustness_video_memory_purge, +#endif #ifdef GL_NV_sample_locations - GLEW_NV_sample_locations = _glewSearchExtension("GL_NV_sample_locations", extStart, extEnd); - 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 */ + &__GLEW_NV_sample_locations, +#endif #ifdef GL_NV_sample_mask_override_coverage - GLEW_NV_sample_mask_override_coverage = _glewSearchExtension("GL_NV_sample_mask_override_coverage", extStart, extEnd); -#endif /* GL_NV_sample_mask_override_coverage */ + &__GLEW_NV_sample_mask_override_coverage, +#endif #ifdef GL_NV_shader_atomic_counters - GLEW_NV_shader_atomic_counters = _glewSearchExtension("GL_NV_shader_atomic_counters", extStart, extEnd); -#endif /* GL_NV_shader_atomic_counters */ + &__GLEW_NV_shader_atomic_counters, +#endif #ifdef GL_NV_shader_atomic_float - GLEW_NV_shader_atomic_float = _glewSearchExtension("GL_NV_shader_atomic_float", extStart, extEnd); -#endif /* GL_NV_shader_atomic_float */ + &__GLEW_NV_shader_atomic_float, +#endif +#ifdef GL_NV_shader_atomic_float64 + &__GLEW_NV_shader_atomic_float64, +#endif #ifdef GL_NV_shader_atomic_fp16_vector - GLEW_NV_shader_atomic_fp16_vector = _glewSearchExtension("GL_NV_shader_atomic_fp16_vector", extStart, extEnd); -#endif /* GL_NV_shader_atomic_fp16_vector */ + &__GLEW_NV_shader_atomic_fp16_vector, +#endif #ifdef GL_NV_shader_atomic_int64 - GLEW_NV_shader_atomic_int64 = _glewSearchExtension("GL_NV_shader_atomic_int64", extStart, extEnd); -#endif /* GL_NV_shader_atomic_int64 */ + &__GLEW_NV_shader_atomic_int64, +#endif #ifdef GL_NV_shader_buffer_load - GLEW_NV_shader_buffer_load = _glewSearchExtension("GL_NV_shader_buffer_load", extStart, extEnd); - 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 */ + &__GLEW_NV_shader_buffer_load, +#endif #ifdef GL_NV_shader_storage_buffer_object - GLEW_NV_shader_storage_buffer_object = _glewSearchExtension("GL_NV_shader_storage_buffer_object", extStart, extEnd); -#endif /* GL_NV_shader_storage_buffer_object */ + &__GLEW_NV_shader_storage_buffer_object, +#endif #ifdef GL_NV_shader_thread_group - GLEW_NV_shader_thread_group = _glewSearchExtension("GL_NV_shader_thread_group", extStart, extEnd); -#endif /* GL_NV_shader_thread_group */ + &__GLEW_NV_shader_thread_group, +#endif #ifdef GL_NV_shader_thread_shuffle - GLEW_NV_shader_thread_shuffle = _glewSearchExtension("GL_NV_shader_thread_shuffle", extStart, extEnd); -#endif /* GL_NV_shader_thread_shuffle */ + &__GLEW_NV_shader_thread_shuffle, +#endif +#ifdef GL_NV_stereo_view_rendering + &__GLEW_NV_stereo_view_rendering, +#endif #ifdef GL_NV_tessellation_program5 - GLEW_NV_tessellation_program5 = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); -#endif /* GL_NV_tessellation_program5 */ + &__GLEW_NV_tessellation_program5, +#endif #ifdef GL_NV_texgen_emboss - GLEW_NV_texgen_emboss = _glewSearchExtension("GL_NV_texgen_emboss", extStart, extEnd); -#endif /* GL_NV_texgen_emboss */ + &__GLEW_NV_texgen_emboss, +#endif #ifdef GL_NV_texgen_reflection - GLEW_NV_texgen_reflection = _glewSearchExtension("GL_NV_texgen_reflection", extStart, extEnd); -#endif /* GL_NV_texgen_reflection */ + &__GLEW_NV_texgen_reflection, +#endif #ifdef GL_NV_texture_barrier - GLEW_NV_texture_barrier = _glewSearchExtension("GL_NV_texture_barrier", extStart, extEnd); - 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 */ + &__GLEW_NV_texture_barrier, +#endif #ifdef GL_NV_texture_compression_vtc - GLEW_NV_texture_compression_vtc = _glewSearchExtension("GL_NV_texture_compression_vtc", extStart, extEnd); -#endif /* GL_NV_texture_compression_vtc */ + &__GLEW_NV_texture_compression_vtc, +#endif #ifdef GL_NV_texture_env_combine4 - GLEW_NV_texture_env_combine4 = _glewSearchExtension("GL_NV_texture_env_combine4", extStart, extEnd); -#endif /* GL_NV_texture_env_combine4 */ + &__GLEW_NV_texture_env_combine4, +#endif #ifdef GL_NV_texture_expand_normal - GLEW_NV_texture_expand_normal = _glewSearchExtension("GL_NV_texture_expand_normal", extStart, extEnd); -#endif /* GL_NV_texture_expand_normal */ + &__GLEW_NV_texture_expand_normal, +#endif #ifdef GL_NV_texture_multisample - GLEW_NV_texture_multisample = _glewSearchExtension("GL_NV_texture_multisample", extStart, extEnd); - 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 */ + &__GLEW_NV_texture_multisample, +#endif #ifdef GL_NV_texture_rectangle - GLEW_NV_texture_rectangle = _glewSearchExtension("GL_NV_texture_rectangle", extStart, extEnd); -#endif /* GL_NV_texture_rectangle */ + &__GLEW_NV_texture_rectangle, +#endif #ifdef GL_NV_texture_shader - GLEW_NV_texture_shader = _glewSearchExtension("GL_NV_texture_shader", extStart, extEnd); -#endif /* GL_NV_texture_shader */ + &__GLEW_NV_texture_shader, +#endif #ifdef GL_NV_texture_shader2 - GLEW_NV_texture_shader2 = _glewSearchExtension("GL_NV_texture_shader2", extStart, extEnd); -#endif /* GL_NV_texture_shader2 */ + &__GLEW_NV_texture_shader2, +#endif #ifdef GL_NV_texture_shader3 - GLEW_NV_texture_shader3 = _glewSearchExtension("GL_NV_texture_shader3", extStart, extEnd); -#endif /* GL_NV_texture_shader3 */ + &__GLEW_NV_texture_shader3, +#endif #ifdef GL_NV_transform_feedback - GLEW_NV_transform_feedback = _glewSearchExtension("GL_NV_transform_feedback", extStart, extEnd); - 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 */ + &__GLEW_NV_transform_feedback, +#endif #ifdef GL_NV_transform_feedback2 - GLEW_NV_transform_feedback2 = _glewSearchExtension("GL_NV_transform_feedback2", extStart, extEnd); - 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 */ + &__GLEW_NV_transform_feedback2, +#endif #ifdef GL_NV_uniform_buffer_unified_memory - GLEW_NV_uniform_buffer_unified_memory = _glewSearchExtension("GL_NV_uniform_buffer_unified_memory", extStart, extEnd); -#endif /* GL_NV_uniform_buffer_unified_memory */ + &__GLEW_NV_uniform_buffer_unified_memory, +#endif #ifdef GL_NV_vdpau_interop - GLEW_NV_vdpau_interop = _glewSearchExtension("GL_NV_vdpau_interop", extStart, extEnd); - 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 */ + &__GLEW_NV_vdpau_interop, +#endif #ifdef GL_NV_vertex_array_range - GLEW_NV_vertex_array_range = _glewSearchExtension("GL_NV_vertex_array_range", extStart, extEnd); - 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 */ + &__GLEW_NV_vertex_array_range, +#endif #ifdef GL_NV_vertex_array_range2 - GLEW_NV_vertex_array_range2 = _glewSearchExtension("GL_NV_vertex_array_range2", extStart, extEnd); -#endif /* GL_NV_vertex_array_range2 */ + &__GLEW_NV_vertex_array_range2, +#endif #ifdef GL_NV_vertex_attrib_integer_64bit - GLEW_NV_vertex_attrib_integer_64bit = _glewSearchExtension("GL_NV_vertex_attrib_integer_64bit", extStart, extEnd); - 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 */ + &__GLEW_NV_vertex_attrib_integer_64bit, +#endif #ifdef GL_NV_vertex_buffer_unified_memory - GLEW_NV_vertex_buffer_unified_memory = _glewSearchExtension("GL_NV_vertex_buffer_unified_memory", extStart, extEnd); - 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 */ + &__GLEW_NV_vertex_buffer_unified_memory, +#endif #ifdef GL_NV_vertex_program - GLEW_NV_vertex_program = _glewSearchExtension("GL_NV_vertex_program", extStart, extEnd); - 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 */ + &__GLEW_NV_vertex_program, +#endif #ifdef GL_NV_vertex_program1_1 - GLEW_NV_vertex_program1_1 = _glewSearchExtension("GL_NV_vertex_program1_1", extStart, extEnd); -#endif /* GL_NV_vertex_program1_1 */ + &__GLEW_NV_vertex_program1_1, +#endif #ifdef GL_NV_vertex_program2 - GLEW_NV_vertex_program2 = _glewSearchExtension("GL_NV_vertex_program2", extStart, extEnd); -#endif /* GL_NV_vertex_program2 */ + &__GLEW_NV_vertex_program2, +#endif #ifdef GL_NV_vertex_program2_option - GLEW_NV_vertex_program2_option = _glewSearchExtension("GL_NV_vertex_program2_option", extStart, extEnd); -#endif /* GL_NV_vertex_program2_option */ + &__GLEW_NV_vertex_program2_option, +#endif #ifdef GL_NV_vertex_program3 - GLEW_NV_vertex_program3 = _glewSearchExtension("GL_NV_vertex_program3", extStart, extEnd); -#endif /* GL_NV_vertex_program3 */ + &__GLEW_NV_vertex_program3, +#endif #ifdef GL_NV_vertex_program4 - GLEW_NV_vertex_program4 = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); -#endif /* GL_NV_vertex_program4 */ + &__GLEW_NV_vertex_program4, +#endif #ifdef GL_NV_video_capture - GLEW_NV_video_capture = _glewSearchExtension("GL_NV_video_capture", extStart, extEnd); - 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 */ + &__GLEW_NV_video_capture, +#endif #ifdef GL_NV_viewport_array2 - GLEW_NV_viewport_array2 = _glewSearchExtension("GL_NV_viewport_array2", extStart, extEnd); -#endif /* GL_NV_viewport_array2 */ + &__GLEW_NV_viewport_array2, +#endif +#ifdef GL_NV_viewport_swizzle + &__GLEW_NV_viewport_swizzle, +#endif #ifdef GL_OES_byte_coordinates - GLEW_OES_byte_coordinates = _glewSearchExtension("GL_OES_byte_coordinates", extStart, extEnd); -#endif /* GL_OES_byte_coordinates */ + &__GLEW_OES_byte_coordinates, +#endif #ifdef GL_OES_compressed_paletted_texture - GLEW_OES_compressed_paletted_texture = _glewSearchExtension("GL_OES_compressed_paletted_texture", extStart, extEnd); -#endif /* GL_OES_compressed_paletted_texture */ + &__GLEW_OES_compressed_paletted_texture, +#endif #ifdef GL_OES_read_format - GLEW_OES_read_format = _glewSearchExtension("GL_OES_read_format", extStart, extEnd); -#endif /* GL_OES_read_format */ + &__GLEW_OES_read_format, +#endif #ifdef GL_OES_single_precision - GLEW_OES_single_precision = _glewSearchExtension("GL_OES_single_precision", extStart, extEnd); - 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 */ + &__GLEW_OES_single_precision, +#endif #ifdef GL_OML_interlace - GLEW_OML_interlace = _glewSearchExtension("GL_OML_interlace", extStart, extEnd); -#endif /* GL_OML_interlace */ + &__GLEW_OML_interlace, +#endif #ifdef GL_OML_resample - GLEW_OML_resample = _glewSearchExtension("GL_OML_resample", extStart, extEnd); -#endif /* GL_OML_resample */ + &__GLEW_OML_resample, +#endif #ifdef GL_OML_subsample - GLEW_OML_subsample = _glewSearchExtension("GL_OML_subsample", extStart, extEnd); -#endif /* GL_OML_subsample */ + &__GLEW_OML_subsample, +#endif #ifdef GL_OVR_multiview - GLEW_OVR_multiview = _glewSearchExtension("GL_OVR_multiview", extStart, extEnd); - if (glewExperimental || GLEW_OVR_multiview) GLEW_OVR_multiview = !_glewInit_GL_OVR_multiview(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_OVR_multiview */ + &__GLEW_OVR_multiview, +#endif #ifdef GL_OVR_multiview2 - GLEW_OVR_multiview2 = _glewSearchExtension("GL_OVR_multiview2", extStart, extEnd); -#endif /* GL_OVR_multiview2 */ + &__GLEW_OVR_multiview2, +#endif #ifdef GL_PGI_misc_hints - GLEW_PGI_misc_hints = _glewSearchExtension("GL_PGI_misc_hints", extStart, extEnd); -#endif /* GL_PGI_misc_hints */ + &__GLEW_PGI_misc_hints, +#endif #ifdef GL_PGI_vertex_hints - GLEW_PGI_vertex_hints = _glewSearchExtension("GL_PGI_vertex_hints", extStart, extEnd); -#endif /* GL_PGI_vertex_hints */ + &__GLEW_PGI_vertex_hints, +#endif #ifdef GL_REGAL_ES1_0_compatibility - GLEW_REGAL_ES1_0_compatibility = _glewSearchExtension("GL_REGAL_ES1_0_compatibility", extStart, extEnd); - 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 */ + &__GLEW_REGAL_ES1_0_compatibility, +#endif #ifdef GL_REGAL_ES1_1_compatibility - GLEW_REGAL_ES1_1_compatibility = _glewSearchExtension("GL_REGAL_ES1_1_compatibility", extStart, extEnd); - 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 */ + &__GLEW_REGAL_ES1_1_compatibility, +#endif #ifdef GL_REGAL_enable - GLEW_REGAL_enable = _glewSearchExtension("GL_REGAL_enable", extStart, extEnd); -#endif /* GL_REGAL_enable */ + &__GLEW_REGAL_enable, +#endif #ifdef GL_REGAL_error_string - GLEW_REGAL_error_string = _glewSearchExtension("GL_REGAL_error_string", extStart, extEnd); - 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 */ + &__GLEW_REGAL_error_string, +#endif #ifdef GL_REGAL_extension_query - GLEW_REGAL_extension_query = _glewSearchExtension("GL_REGAL_extension_query", extStart, extEnd); - 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 */ + &__GLEW_REGAL_extension_query, +#endif #ifdef GL_REGAL_log - GLEW_REGAL_log = _glewSearchExtension("GL_REGAL_log", extStart, extEnd); - if (glewExperimental || GLEW_REGAL_log) GLEW_REGAL_log = !_glewInit_GL_REGAL_log(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_REGAL_log */ + &__GLEW_REGAL_log, +#endif #ifdef GL_REGAL_proc_address - GLEW_REGAL_proc_address = _glewSearchExtension("GL_REGAL_proc_address", extStart, extEnd); - 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 */ + &__GLEW_REGAL_proc_address, +#endif #ifdef GL_REND_screen_coordinates - GLEW_REND_screen_coordinates = _glewSearchExtension("GL_REND_screen_coordinates", extStart, extEnd); -#endif /* GL_REND_screen_coordinates */ + &__GLEW_REND_screen_coordinates, +#endif #ifdef GL_S3_s3tc - GLEW_S3_s3tc = _glewSearchExtension("GL_S3_s3tc", extStart, extEnd); -#endif /* GL_S3_s3tc */ + &__GLEW_S3_s3tc, +#endif #ifdef GL_SGIS_color_range - GLEW_SGIS_color_range = _glewSearchExtension("GL_SGIS_color_range", extStart, extEnd); -#endif /* GL_SGIS_color_range */ + &__GLEW_SGIS_color_range, +#endif #ifdef GL_SGIS_detail_texture - GLEW_SGIS_detail_texture = _glewSearchExtension("GL_SGIS_detail_texture", extStart, extEnd); - 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 */ + &__GLEW_SGIS_detail_texture, +#endif #ifdef GL_SGIS_fog_function - GLEW_SGIS_fog_function = _glewSearchExtension("GL_SGIS_fog_function", extStart, extEnd); - 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 */ + &__GLEW_SGIS_fog_function, +#endif #ifdef GL_SGIS_generate_mipmap - GLEW_SGIS_generate_mipmap = _glewSearchExtension("GL_SGIS_generate_mipmap", extStart, extEnd); -#endif /* GL_SGIS_generate_mipmap */ + &__GLEW_SGIS_generate_mipmap, +#endif #ifdef GL_SGIS_multisample - GLEW_SGIS_multisample = _glewSearchExtension("GL_SGIS_multisample", extStart, extEnd); - if (glewExperimental || GLEW_SGIS_multisample) GLEW_SGIS_multisample = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SGIS_multisample */ + &__GLEW_SGIS_multisample, +#endif #ifdef GL_SGIS_pixel_texture - GLEW_SGIS_pixel_texture = _glewSearchExtension("GL_SGIS_pixel_texture", extStart, extEnd); -#endif /* GL_SGIS_pixel_texture */ + &__GLEW_SGIS_pixel_texture, +#endif #ifdef GL_SGIS_point_line_texgen - GLEW_SGIS_point_line_texgen = _glewSearchExtension("GL_SGIS_point_line_texgen", extStart, extEnd); -#endif /* GL_SGIS_point_line_texgen */ + &__GLEW_SGIS_point_line_texgen, +#endif #ifdef GL_SGIS_sharpen_texture - GLEW_SGIS_sharpen_texture = _glewSearchExtension("GL_SGIS_sharpen_texture", extStart, extEnd); - 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 */ + &__GLEW_SGIS_sharpen_texture, +#endif #ifdef GL_SGIS_texture4D - GLEW_SGIS_texture4D = _glewSearchExtension("GL_SGIS_texture4D", extStart, extEnd); - if (glewExperimental || GLEW_SGIS_texture4D) GLEW_SGIS_texture4D = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SGIS_texture4D */ + &__GLEW_SGIS_texture4D, +#endif #ifdef GL_SGIS_texture_border_clamp - GLEW_SGIS_texture_border_clamp = _glewSearchExtension("GL_SGIS_texture_border_clamp", extStart, extEnd); -#endif /* GL_SGIS_texture_border_clamp */ + &__GLEW_SGIS_texture_border_clamp, +#endif #ifdef GL_SGIS_texture_edge_clamp - GLEW_SGIS_texture_edge_clamp = _glewSearchExtension("GL_SGIS_texture_edge_clamp", extStart, extEnd); -#endif /* GL_SGIS_texture_edge_clamp */ + &__GLEW_SGIS_texture_edge_clamp, +#endif #ifdef GL_SGIS_texture_filter4 - GLEW_SGIS_texture_filter4 = _glewSearchExtension("GL_SGIS_texture_filter4", extStart, extEnd); - 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 */ + &__GLEW_SGIS_texture_filter4, +#endif #ifdef GL_SGIS_texture_lod - GLEW_SGIS_texture_lod = _glewSearchExtension("GL_SGIS_texture_lod", extStart, extEnd); -#endif /* GL_SGIS_texture_lod */ + &__GLEW_SGIS_texture_lod, +#endif #ifdef GL_SGIS_texture_select - GLEW_SGIS_texture_select = _glewSearchExtension("GL_SGIS_texture_select", extStart, extEnd); -#endif /* GL_SGIS_texture_select */ + &__GLEW_SGIS_texture_select, +#endif #ifdef GL_SGIX_async - GLEW_SGIX_async = _glewSearchExtension("GL_SGIX_async", extStart, extEnd); - if (glewExperimental || GLEW_SGIX_async) GLEW_SGIX_async = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SGIX_async */ + &__GLEW_SGIX_async, +#endif #ifdef GL_SGIX_async_histogram - GLEW_SGIX_async_histogram = _glewSearchExtension("GL_SGIX_async_histogram", extStart, extEnd); -#endif /* GL_SGIX_async_histogram */ + &__GLEW_SGIX_async_histogram, +#endif #ifdef GL_SGIX_async_pixel - GLEW_SGIX_async_pixel = _glewSearchExtension("GL_SGIX_async_pixel", extStart, extEnd); -#endif /* GL_SGIX_async_pixel */ + &__GLEW_SGIX_async_pixel, +#endif #ifdef GL_SGIX_blend_alpha_minmax - GLEW_SGIX_blend_alpha_minmax = _glewSearchExtension("GL_SGIX_blend_alpha_minmax", extStart, extEnd); -#endif /* GL_SGIX_blend_alpha_minmax */ + &__GLEW_SGIX_blend_alpha_minmax, +#endif #ifdef GL_SGIX_clipmap - GLEW_SGIX_clipmap = _glewSearchExtension("GL_SGIX_clipmap", extStart, extEnd); -#endif /* GL_SGIX_clipmap */ + &__GLEW_SGIX_clipmap, +#endif #ifdef GL_SGIX_convolution_accuracy - GLEW_SGIX_convolution_accuracy = _glewSearchExtension("GL_SGIX_convolution_accuracy", extStart, extEnd); -#endif /* GL_SGIX_convolution_accuracy */ + &__GLEW_SGIX_convolution_accuracy, +#endif #ifdef GL_SGIX_depth_texture - GLEW_SGIX_depth_texture = _glewSearchExtension("GL_SGIX_depth_texture", extStart, extEnd); -#endif /* GL_SGIX_depth_texture */ + &__GLEW_SGIX_depth_texture, +#endif #ifdef GL_SGIX_flush_raster - GLEW_SGIX_flush_raster = _glewSearchExtension("GL_SGIX_flush_raster", extStart, extEnd); - 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 */ + &__GLEW_SGIX_flush_raster, +#endif #ifdef GL_SGIX_fog_offset - GLEW_SGIX_fog_offset = _glewSearchExtension("GL_SGIX_fog_offset", extStart, extEnd); -#endif /* GL_SGIX_fog_offset */ + &__GLEW_SGIX_fog_offset, +#endif #ifdef GL_SGIX_fog_texture - GLEW_SGIX_fog_texture = _glewSearchExtension("GL_SGIX_fog_texture", extStart, extEnd); - 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 */ + &__GLEW_SGIX_fog_texture, +#endif #ifdef GL_SGIX_fragment_specular_lighting - GLEW_SGIX_fragment_specular_lighting = _glewSearchExtension("GL_SGIX_fragment_specular_lighting", extStart, extEnd); - 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 */ + &__GLEW_SGIX_fragment_specular_lighting, +#endif #ifdef GL_SGIX_framezoom - GLEW_SGIX_framezoom = _glewSearchExtension("GL_SGIX_framezoom", extStart, extEnd); - if (glewExperimental || GLEW_SGIX_framezoom) GLEW_SGIX_framezoom = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SGIX_framezoom */ + &__GLEW_SGIX_framezoom, +#endif #ifdef GL_SGIX_interlace - GLEW_SGIX_interlace = _glewSearchExtension("GL_SGIX_interlace", extStart, extEnd); -#endif /* GL_SGIX_interlace */ + &__GLEW_SGIX_interlace, +#endif #ifdef GL_SGIX_ir_instrument1 - GLEW_SGIX_ir_instrument1 = _glewSearchExtension("GL_SGIX_ir_instrument1", extStart, extEnd); -#endif /* GL_SGIX_ir_instrument1 */ + &__GLEW_SGIX_ir_instrument1, +#endif #ifdef GL_SGIX_list_priority - GLEW_SGIX_list_priority = _glewSearchExtension("GL_SGIX_list_priority", extStart, extEnd); -#endif /* GL_SGIX_list_priority */ + &__GLEW_SGIX_list_priority, +#endif #ifdef GL_SGIX_pixel_texture - GLEW_SGIX_pixel_texture = _glewSearchExtension("GL_SGIX_pixel_texture", extStart, extEnd); - 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 */ + &__GLEW_SGIX_pixel_texture, +#endif #ifdef GL_SGIX_pixel_texture_bits - GLEW_SGIX_pixel_texture_bits = _glewSearchExtension("GL_SGIX_pixel_texture_bits", extStart, extEnd); -#endif /* GL_SGIX_pixel_texture_bits */ + &__GLEW_SGIX_pixel_texture_bits, +#endif #ifdef GL_SGIX_reference_plane - GLEW_SGIX_reference_plane = _glewSearchExtension("GL_SGIX_reference_plane", extStart, extEnd); - 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 */ + &__GLEW_SGIX_reference_plane, +#endif #ifdef GL_SGIX_resample - GLEW_SGIX_resample = _glewSearchExtension("GL_SGIX_resample", extStart, extEnd); -#endif /* GL_SGIX_resample */ + &__GLEW_SGIX_resample, +#endif #ifdef GL_SGIX_shadow - GLEW_SGIX_shadow = _glewSearchExtension("GL_SGIX_shadow", extStart, extEnd); -#endif /* GL_SGIX_shadow */ + &__GLEW_SGIX_shadow, +#endif #ifdef GL_SGIX_shadow_ambient - GLEW_SGIX_shadow_ambient = _glewSearchExtension("GL_SGIX_shadow_ambient", extStart, extEnd); -#endif /* GL_SGIX_shadow_ambient */ + &__GLEW_SGIX_shadow_ambient, +#endif #ifdef GL_SGIX_sprite - GLEW_SGIX_sprite = _glewSearchExtension("GL_SGIX_sprite", extStart, extEnd); - if (glewExperimental || GLEW_SGIX_sprite) GLEW_SGIX_sprite = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SGIX_sprite */ + &__GLEW_SGIX_sprite, +#endif #ifdef GL_SGIX_tag_sample_buffer - GLEW_SGIX_tag_sample_buffer = _glewSearchExtension("GL_SGIX_tag_sample_buffer", extStart, extEnd); - 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 */ + &__GLEW_SGIX_tag_sample_buffer, +#endif #ifdef GL_SGIX_texture_add_env - GLEW_SGIX_texture_add_env = _glewSearchExtension("GL_SGIX_texture_add_env", extStart, extEnd); -#endif /* GL_SGIX_texture_add_env */ + &__GLEW_SGIX_texture_add_env, +#endif #ifdef GL_SGIX_texture_coordinate_clamp - GLEW_SGIX_texture_coordinate_clamp = _glewSearchExtension("GL_SGIX_texture_coordinate_clamp", extStart, extEnd); -#endif /* GL_SGIX_texture_coordinate_clamp */ + &__GLEW_SGIX_texture_coordinate_clamp, +#endif #ifdef GL_SGIX_texture_lod_bias - GLEW_SGIX_texture_lod_bias = _glewSearchExtension("GL_SGIX_texture_lod_bias", extStart, extEnd); -#endif /* GL_SGIX_texture_lod_bias */ + &__GLEW_SGIX_texture_lod_bias, +#endif #ifdef GL_SGIX_texture_multi_buffer - GLEW_SGIX_texture_multi_buffer = _glewSearchExtension("GL_SGIX_texture_multi_buffer", extStart, extEnd); -#endif /* GL_SGIX_texture_multi_buffer */ + &__GLEW_SGIX_texture_multi_buffer, +#endif #ifdef GL_SGIX_texture_range - GLEW_SGIX_texture_range = _glewSearchExtension("GL_SGIX_texture_range", extStart, extEnd); -#endif /* GL_SGIX_texture_range */ + &__GLEW_SGIX_texture_range, +#endif #ifdef GL_SGIX_texture_scale_bias - GLEW_SGIX_texture_scale_bias = _glewSearchExtension("GL_SGIX_texture_scale_bias", extStart, extEnd); -#endif /* GL_SGIX_texture_scale_bias */ + &__GLEW_SGIX_texture_scale_bias, +#endif #ifdef GL_SGIX_vertex_preclip - GLEW_SGIX_vertex_preclip = _glewSearchExtension("GL_SGIX_vertex_preclip", extStart, extEnd); -#endif /* GL_SGIX_vertex_preclip */ + &__GLEW_SGIX_vertex_preclip, +#endif #ifdef GL_SGIX_vertex_preclip_hint - GLEW_SGIX_vertex_preclip_hint = _glewSearchExtension("GL_SGIX_vertex_preclip_hint", extStart, extEnd); -#endif /* GL_SGIX_vertex_preclip_hint */ + &__GLEW_SGIX_vertex_preclip_hint, +#endif #ifdef GL_SGIX_ycrcb - GLEW_SGIX_ycrcb = _glewSearchExtension("GL_SGIX_ycrcb", extStart, extEnd); -#endif /* GL_SGIX_ycrcb */ + &__GLEW_SGIX_ycrcb, +#endif #ifdef GL_SGI_color_matrix - GLEW_SGI_color_matrix = _glewSearchExtension("GL_SGI_color_matrix", extStart, extEnd); -#endif /* GL_SGI_color_matrix */ + &__GLEW_SGI_color_matrix, +#endif #ifdef GL_SGI_color_table - GLEW_SGI_color_table = _glewSearchExtension("GL_SGI_color_table", extStart, extEnd); - 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 */ + &__GLEW_SGI_color_table, +#endif #ifdef GL_SGI_texture_color_table - GLEW_SGI_texture_color_table = _glewSearchExtension("GL_SGI_texture_color_table", extStart, extEnd); -#endif /* GL_SGI_texture_color_table */ + &__GLEW_SGI_texture_color_table, +#endif #ifdef GL_SUNX_constant_data - GLEW_SUNX_constant_data = _glewSearchExtension("GL_SUNX_constant_data", extStart, extEnd); - 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 */ + &__GLEW_SUNX_constant_data, +#endif #ifdef GL_SUN_convolution_border_modes - GLEW_SUN_convolution_border_modes = _glewSearchExtension("GL_SUN_convolution_border_modes", extStart, extEnd); -#endif /* GL_SUN_convolution_border_modes */ + &__GLEW_SUN_convolution_border_modes, +#endif #ifdef GL_SUN_global_alpha - GLEW_SUN_global_alpha = _glewSearchExtension("GL_SUN_global_alpha", extStart, extEnd); - 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 */ + &__GLEW_SUN_global_alpha, +#endif #ifdef GL_SUN_mesh_array - GLEW_SUN_mesh_array = _glewSearchExtension("GL_SUN_mesh_array", extStart, extEnd); -#endif /* GL_SUN_mesh_array */ + &__GLEW_SUN_mesh_array, +#endif #ifdef GL_SUN_read_video_pixels - GLEW_SUN_read_video_pixels = _glewSearchExtension("GL_SUN_read_video_pixels", extStart, extEnd); - 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 */ + &__GLEW_SUN_read_video_pixels, +#endif #ifdef GL_SUN_slice_accum - GLEW_SUN_slice_accum = _glewSearchExtension("GL_SUN_slice_accum", extStart, extEnd); -#endif /* GL_SUN_slice_accum */ + &__GLEW_SUN_slice_accum, +#endif #ifdef GL_SUN_triangle_list - GLEW_SUN_triangle_list = _glewSearchExtension("GL_SUN_triangle_list", extStart, extEnd); - 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 */ + &__GLEW_SUN_triangle_list, +#endif #ifdef GL_SUN_vertex - GLEW_SUN_vertex = _glewSearchExtension("GL_SUN_vertex", extStart, extEnd); - if (glewExperimental || GLEW_SUN_vertex) GLEW_SUN_vertex = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT); -#endif /* GL_SUN_vertex */ + &__GLEW_SUN_vertex, +#endif #ifdef GL_WIN_phong_shading - GLEW_WIN_phong_shading = _glewSearchExtension("GL_WIN_phong_shading", extStart, extEnd); -#endif /* GL_WIN_phong_shading */ + &__GLEW_WIN_phong_shading, +#endif #ifdef GL_WIN_specular_fog - GLEW_WIN_specular_fog = _glewSearchExtension("GL_WIN_specular_fog", extStart, extEnd); -#endif /* GL_WIN_specular_fog */ + &__GLEW_WIN_specular_fog, +#endif #ifdef GL_WIN_swap_hint - GLEW_WIN_swap_hint = _glewSearchExtension("GL_WIN_swap_hint", extStart, extEnd); - 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; + &__GLEW_WIN_swap_hint, +#endif + NULL +}; +static GLboolean _glewInit_GL_VERSION_1_2 (); +static GLboolean _glewInit_GL_VERSION_1_3 (); +static GLboolean _glewInit_GL_VERSION_1_4 (); +static GLboolean _glewInit_GL_VERSION_1_5 (); +static GLboolean _glewInit_GL_VERSION_2_0 (); +static GLboolean _glewInit_GL_VERSION_2_1 (); +static GLboolean _glewInit_GL_VERSION_3_0 (); +static GLboolean _glewInit_GL_VERSION_3_1 (); +static GLboolean _glewInit_GL_VERSION_3_2 (); +static GLboolean _glewInit_GL_VERSION_3_3 (); +static GLboolean _glewInit_GL_VERSION_4_0 (); +static GLboolean _glewInit_GL_VERSION_4_5 (); +static GLboolean _glewInit_GL_3DFX_tbuffer (); +static GLboolean _glewInit_GL_AMD_debug_output (); +static GLboolean _glewInit_GL_AMD_draw_buffers_blend (); +static GLboolean _glewInit_GL_AMD_interleaved_elements (); +static GLboolean _glewInit_GL_AMD_multi_draw_indirect (); +static GLboolean _glewInit_GL_AMD_name_gen_delete (); +static GLboolean _glewInit_GL_AMD_occlusion_query_event (); +static GLboolean _glewInit_GL_AMD_performance_monitor (); +static GLboolean _glewInit_GL_AMD_sample_positions (); +static GLboolean _glewInit_GL_AMD_sparse_texture (); +static GLboolean _glewInit_GL_AMD_stencil_operation_extended (); +static GLboolean _glewInit_GL_AMD_vertex_shader_tessellator (); +static GLboolean _glewInit_GL_ANGLE_framebuffer_blit (); +static GLboolean _glewInit_GL_ANGLE_framebuffer_multisample (); +static GLboolean _glewInit_GL_ANGLE_instanced_arrays (); +static GLboolean _glewInit_GL_ANGLE_timer_query (); +static GLboolean _glewInit_GL_ANGLE_translated_shader_source (); +static GLboolean _glewInit_GL_APPLE_element_array (); +static GLboolean _glewInit_GL_APPLE_fence (); +static GLboolean _glewInit_GL_APPLE_flush_buffer_range (); +static GLboolean _glewInit_GL_APPLE_object_purgeable (); +static GLboolean _glewInit_GL_APPLE_texture_range (); +static GLboolean _glewInit_GL_APPLE_vertex_array_object (); +static GLboolean _glewInit_GL_APPLE_vertex_array_range (); +static GLboolean _glewInit_GL_APPLE_vertex_program_evaluators (); +static GLboolean _glewInit_GL_ARB_ES2_compatibility (); +static GLboolean _glewInit_GL_ARB_ES3_1_compatibility (); +static GLboolean _glewInit_GL_ARB_ES3_2_compatibility (); +static GLboolean _glewInit_GL_ARB_base_instance (); +static GLboolean _glewInit_GL_ARB_bindless_texture (); +static GLboolean _glewInit_GL_ARB_blend_func_extended (); +static GLboolean _glewInit_GL_ARB_buffer_storage (); +static GLboolean _glewInit_GL_ARB_cl_event (); +static GLboolean _glewInit_GL_ARB_clear_buffer_object (); +static GLboolean _glewInit_GL_ARB_clear_texture (); +static GLboolean _glewInit_GL_ARB_clip_control (); +static GLboolean _glewInit_GL_ARB_color_buffer_float (); +static GLboolean _glewInit_GL_ARB_compute_shader (); +static GLboolean _glewInit_GL_ARB_compute_variable_group_size (); +static GLboolean _glewInit_GL_ARB_copy_buffer (); +static GLboolean _glewInit_GL_ARB_copy_image (); +static GLboolean _glewInit_GL_ARB_debug_output (); +static GLboolean _glewInit_GL_ARB_direct_state_access (); +static GLboolean _glewInit_GL_ARB_draw_buffers (); +static GLboolean _glewInit_GL_ARB_draw_buffers_blend (); +static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex (); +static GLboolean _glewInit_GL_ARB_draw_indirect (); +static GLboolean _glewInit_GL_ARB_framebuffer_no_attachments (); +static GLboolean _glewInit_GL_ARB_framebuffer_object (); +static GLboolean _glewInit_GL_ARB_geometry_shader4 (); +static GLboolean _glewInit_GL_ARB_get_program_binary (); +static GLboolean _glewInit_GL_ARB_get_texture_sub_image (); +static GLboolean _glewInit_GL_ARB_gl_spirv (); +static GLboolean _glewInit_GL_ARB_gpu_shader_fp64 (); +static GLboolean _glewInit_GL_ARB_gpu_shader_int64 (); +static GLboolean _glewInit_GL_ARB_imaging (); +static GLboolean _glewInit_GL_ARB_indirect_parameters (); +static GLboolean _glewInit_GL_ARB_instanced_arrays (); +static GLboolean _glewInit_GL_ARB_internalformat_query (); +static GLboolean _glewInit_GL_ARB_internalformat_query2 (); +static GLboolean _glewInit_GL_ARB_invalidate_subdata (); +static GLboolean _glewInit_GL_ARB_map_buffer_range (); +static GLboolean _glewInit_GL_ARB_matrix_palette (); +static GLboolean _glewInit_GL_ARB_multi_bind (); +static GLboolean _glewInit_GL_ARB_multi_draw_indirect (); +static GLboolean _glewInit_GL_ARB_multisample (); +static GLboolean _glewInit_GL_ARB_multitexture (); +static GLboolean _glewInit_GL_ARB_occlusion_query (); +static GLboolean _glewInit_GL_ARB_parallel_shader_compile (); +static GLboolean _glewInit_GL_ARB_point_parameters (); +static GLboolean _glewInit_GL_ARB_program_interface_query (); +static GLboolean _glewInit_GL_ARB_provoking_vertex (); +static GLboolean _glewInit_GL_ARB_robustness (); +static GLboolean _glewInit_GL_ARB_sample_locations (); +static GLboolean _glewInit_GL_ARB_sample_shading (); +static GLboolean _glewInit_GL_ARB_sampler_objects (); +static GLboolean _glewInit_GL_ARB_separate_shader_objects (); +static GLboolean _glewInit_GL_ARB_shader_atomic_counters (); +static GLboolean _glewInit_GL_ARB_shader_image_load_store (); +static GLboolean _glewInit_GL_ARB_shader_objects (); +static GLboolean _glewInit_GL_ARB_shader_storage_buffer_object (); +static GLboolean _glewInit_GL_ARB_shader_subroutine (); +static GLboolean _glewInit_GL_ARB_shading_language_include (); +static GLboolean _glewInit_GL_ARB_sparse_buffer (); +static GLboolean _glewInit_GL_ARB_sparse_texture (); +static GLboolean _glewInit_GL_ARB_sync (); +static GLboolean _glewInit_GL_ARB_tessellation_shader (); +static GLboolean _glewInit_GL_ARB_texture_barrier (); +static GLboolean _glewInit_GL_ARB_texture_buffer_object (); +static GLboolean _glewInit_GL_ARB_texture_buffer_range (); +static GLboolean _glewInit_GL_ARB_texture_compression (); +static GLboolean _glewInit_GL_ARB_texture_multisample (); +static GLboolean _glewInit_GL_ARB_texture_storage (); +static GLboolean _glewInit_GL_ARB_texture_storage_multisample (); +static GLboolean _glewInit_GL_ARB_texture_view (); +static GLboolean _glewInit_GL_ARB_timer_query (); +static GLboolean _glewInit_GL_ARB_transform_feedback2 (); +static GLboolean _glewInit_GL_ARB_transform_feedback3 (); +static GLboolean _glewInit_GL_ARB_transform_feedback_instanced (); +static GLboolean _glewInit_GL_ARB_transpose_matrix (); +static GLboolean _glewInit_GL_ARB_uniform_buffer_object (); +static GLboolean _glewInit_GL_ARB_vertex_array_object (); +static GLboolean _glewInit_GL_ARB_vertex_attrib_64bit (); +static GLboolean _glewInit_GL_ARB_vertex_attrib_binding (); +static GLboolean _glewInit_GL_ARB_vertex_blend (); +static GLboolean _glewInit_GL_ARB_vertex_buffer_object (); +static GLboolean _glewInit_GL_ARB_vertex_program (); +static GLboolean _glewInit_GL_ARB_vertex_shader (); +static GLboolean _glewInit_GL_ARB_vertex_type_2_10_10_10_rev (); +static GLboolean _glewInit_GL_ARB_viewport_array (); +static GLboolean _glewInit_GL_ARB_window_pos (); +static GLboolean _glewInit_GL_ATI_draw_buffers (); +static GLboolean _glewInit_GL_ATI_element_array (); +static GLboolean _glewInit_GL_ATI_envmap_bumpmap (); +static GLboolean _glewInit_GL_ATI_fragment_shader (); +static GLboolean _glewInit_GL_ATI_map_object_buffer (); +static GLboolean _glewInit_GL_ATI_pn_triangles (); +static GLboolean _glewInit_GL_ATI_separate_stencil (); +static GLboolean _glewInit_GL_ATI_vertex_array_object (); +static GLboolean _glewInit_GL_ATI_vertex_attrib_array_object (); +static GLboolean _glewInit_GL_ATI_vertex_streams (); +static GLboolean _glewInit_GL_EXT_bindable_uniform (); +static GLboolean _glewInit_GL_EXT_blend_color (); +static GLboolean _glewInit_GL_EXT_blend_equation_separate (); +static GLboolean _glewInit_GL_EXT_blend_func_separate (); +static GLboolean _glewInit_GL_EXT_blend_minmax (); +static GLboolean _glewInit_GL_EXT_color_subtable (); +static GLboolean _glewInit_GL_EXT_compiled_vertex_array (); +static GLboolean _glewInit_GL_EXT_convolution (); +static GLboolean _glewInit_GL_EXT_coordinate_frame (); +static GLboolean _glewInit_GL_EXT_copy_texture (); +static GLboolean _glewInit_GL_EXT_cull_vertex (); +static GLboolean _glewInit_GL_EXT_debug_label (); +static GLboolean _glewInit_GL_EXT_debug_marker (); +static GLboolean _glewInit_GL_EXT_depth_bounds_test (); +static GLboolean _glewInit_GL_EXT_direct_state_access (); +static GLboolean _glewInit_GL_EXT_draw_buffers2 (); +static GLboolean _glewInit_GL_EXT_draw_instanced (); +static GLboolean _glewInit_GL_EXT_draw_range_elements (); +static GLboolean _glewInit_GL_EXT_fog_coord (); +static GLboolean _glewInit_GL_EXT_fragment_lighting (); +static GLboolean _glewInit_GL_EXT_framebuffer_blit (); +static GLboolean _glewInit_GL_EXT_framebuffer_multisample (); +static GLboolean _glewInit_GL_EXT_framebuffer_object (); +static GLboolean _glewInit_GL_EXT_geometry_shader4 (); +static GLboolean _glewInit_GL_EXT_gpu_program_parameters (); +static GLboolean _glewInit_GL_EXT_gpu_shader4 (); +static GLboolean _glewInit_GL_EXT_histogram (); +static GLboolean _glewInit_GL_EXT_index_func (); +static GLboolean _glewInit_GL_EXT_index_material (); +static GLboolean _glewInit_GL_EXT_light_texture (); +static GLboolean _glewInit_GL_EXT_multi_draw_arrays (); +static GLboolean _glewInit_GL_EXT_multisample (); +static GLboolean _glewInit_GL_EXT_paletted_texture (); +static GLboolean _glewInit_GL_EXT_pixel_transform (); +static GLboolean _glewInit_GL_EXT_point_parameters (); +static GLboolean _glewInit_GL_EXT_polygon_offset (); +static GLboolean _glewInit_GL_EXT_polygon_offset_clamp (); +static GLboolean _glewInit_GL_EXT_provoking_vertex (); +static GLboolean _glewInit_GL_EXT_raster_multisample (); +static GLboolean _glewInit_GL_EXT_scene_marker (); +static GLboolean _glewInit_GL_EXT_secondary_color (); +static GLboolean _glewInit_GL_EXT_separate_shader_objects (); +static GLboolean _glewInit_GL_EXT_shader_image_load_store (); +static GLboolean _glewInit_GL_EXT_stencil_two_side (); +static GLboolean _glewInit_GL_EXT_subtexture (); +static GLboolean _glewInit_GL_EXT_texture3D (); +static GLboolean _glewInit_GL_EXT_texture_array (); +static GLboolean _glewInit_GL_EXT_texture_buffer_object (); +static GLboolean _glewInit_GL_EXT_texture_integer (); +static GLboolean _glewInit_GL_EXT_texture_object (); +static GLboolean _glewInit_GL_EXT_texture_perturb_normal (); +static GLboolean _glewInit_GL_EXT_timer_query (); +static GLboolean _glewInit_GL_EXT_transform_feedback (); +static GLboolean _glewInit_GL_EXT_vertex_array (); +static GLboolean _glewInit_GL_EXT_vertex_attrib_64bit (); +static GLboolean _glewInit_GL_EXT_vertex_shader (); +static GLboolean _glewInit_GL_EXT_vertex_weighting (); +static GLboolean _glewInit_GL_EXT_window_rectangles (); +static GLboolean _glewInit_GL_EXT_x11_sync_object (); +static GLboolean _glewInit_GL_GREMEDY_frame_terminator (); +static GLboolean _glewInit_GL_GREMEDY_string_marker (); +static GLboolean _glewInit_GL_HP_image_transform (); +static GLboolean _glewInit_GL_IBM_multimode_draw_arrays (); +static GLboolean _glewInit_GL_IBM_vertex_array_lists (); +static GLboolean _glewInit_GL_INTEL_map_texture (); +static GLboolean _glewInit_GL_INTEL_parallel_arrays (); +static GLboolean _glewInit_GL_INTEL_performance_query (); +static GLboolean _glewInit_GL_INTEL_texture_scissor (); +static GLboolean _glewInit_GL_KHR_blend_equation_advanced (); +static GLboolean _glewInit_GL_KHR_debug (); +static GLboolean _glewInit_GL_KHR_robustness (); +static GLboolean _glewInit_GL_KTX_buffer_region (); +static GLboolean _glewInit_GL_MESA_resize_buffers (); +static GLboolean _glewInit_GL_MESA_window_pos (); +static GLboolean _glewInit_GL_NVX_conditional_render (); +static GLboolean _glewInit_GL_NVX_linked_gpu_multicast (); +static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect (); +static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect_count (); +static GLboolean _glewInit_GL_NV_bindless_texture (); +static GLboolean _glewInit_GL_NV_blend_equation_advanced (); +static GLboolean _glewInit_GL_NV_clip_space_w_scaling (); +static GLboolean _glewInit_GL_NV_command_list (); +static GLboolean _glewInit_GL_NV_conditional_render (); +static GLboolean _glewInit_GL_NV_conservative_raster (); +static GLboolean _glewInit_GL_NV_conservative_raster_dilate (); +static GLboolean _glewInit_GL_NV_conservative_raster_pre_snap_triangles (); +static GLboolean _glewInit_GL_NV_copy_image (); +static GLboolean _glewInit_GL_NV_depth_buffer_float (); +static GLboolean _glewInit_GL_NV_draw_texture (); +static GLboolean _glewInit_GL_NV_draw_vulkan_image (); +static GLboolean _glewInit_GL_NV_evaluators (); +static GLboolean _glewInit_GL_NV_explicit_multisample (); +static GLboolean _glewInit_GL_NV_fence (); +static GLboolean _glewInit_GL_NV_fragment_coverage_to_color (); +static GLboolean _glewInit_GL_NV_fragment_program (); +static GLboolean _glewInit_GL_NV_framebuffer_multisample_coverage (); +static GLboolean _glewInit_GL_NV_geometry_program4 (); +static GLboolean _glewInit_GL_NV_gpu_multicast (); +static GLboolean _glewInit_GL_NV_gpu_program4 (); +static GLboolean _glewInit_GL_NV_gpu_shader5 (); +static GLboolean _glewInit_GL_NV_half_float (); +static GLboolean _glewInit_GL_NV_internalformat_sample_query (); +static GLboolean _glewInit_GL_NV_occlusion_query (); +static GLboolean _glewInit_GL_NV_parameter_buffer_object (); +static GLboolean _glewInit_GL_NV_path_rendering (); +static GLboolean _glewInit_GL_NV_pixel_data_range (); +static GLboolean _glewInit_GL_NV_point_sprite (); +static GLboolean _glewInit_GL_NV_present_video (); +static GLboolean _glewInit_GL_NV_primitive_restart (); +static GLboolean _glewInit_GL_NV_register_combiners (); +static GLboolean _glewInit_GL_NV_register_combiners2 (); +static GLboolean _glewInit_GL_NV_sample_locations (); +static GLboolean _glewInit_GL_NV_shader_buffer_load (); +static GLboolean _glewInit_GL_NV_texture_barrier (); +static GLboolean _glewInit_GL_NV_texture_multisample (); +static GLboolean _glewInit_GL_NV_transform_feedback (); +static GLboolean _glewInit_GL_NV_transform_feedback2 (); +static GLboolean _glewInit_GL_NV_vdpau_interop (); +static GLboolean _glewInit_GL_NV_vertex_array_range (); +static GLboolean _glewInit_GL_NV_vertex_attrib_integer_64bit (); +static GLboolean _glewInit_GL_NV_vertex_buffer_unified_memory (); +static GLboolean _glewInit_GL_NV_vertex_program (); +static GLboolean _glewInit_GL_NV_video_capture (); +static GLboolean _glewInit_GL_NV_viewport_swizzle (); +static GLboolean _glewInit_GL_OES_single_precision (); +static GLboolean _glewInit_GL_OVR_multiview (); +static GLboolean _glewInit_GL_REGAL_ES1_0_compatibility (); +static GLboolean _glewInit_GL_REGAL_ES1_1_compatibility (); +static GLboolean _glewInit_GL_REGAL_error_string (); +static GLboolean _glewInit_GL_REGAL_extension_query (); +static GLboolean _glewInit_GL_REGAL_log (); +static GLboolean _glewInit_GL_REGAL_proc_address (); +static GLboolean _glewInit_GL_SGIS_detail_texture (); +static GLboolean _glewInit_GL_SGIS_fog_function (); +static GLboolean _glewInit_GL_SGIS_multisample (); +static GLboolean _glewInit_GL_SGIS_sharpen_texture (); +static GLboolean _glewInit_GL_SGIS_texture4D (); +static GLboolean _glewInit_GL_SGIS_texture_filter4 (); +static GLboolean _glewInit_GL_SGIX_async (); +static GLboolean _glewInit_GL_SGIX_flush_raster (); +static GLboolean _glewInit_GL_SGIX_fog_texture (); +static GLboolean _glewInit_GL_SGIX_fragment_specular_lighting (); +static GLboolean _glewInit_GL_SGIX_framezoom (); +static GLboolean _glewInit_GL_SGIX_pixel_texture (); +static GLboolean _glewInit_GL_SGIX_reference_plane (); +static GLboolean _glewInit_GL_SGIX_sprite (); +static GLboolean _glewInit_GL_SGIX_tag_sample_buffer (); +static GLboolean _glewInit_GL_SGI_color_table (); +static GLboolean _glewInit_GL_SUNX_constant_data (); +static GLboolean _glewInit_GL_SUN_global_alpha (); +static GLboolean _glewInit_GL_SUN_read_video_pixels (); +static GLboolean _glewInit_GL_SUN_triangle_list (); +static GLboolean _glewInit_GL_SUN_vertex (); +static GLboolean _glewInit_GL_WIN_swap_hint (); -PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL; -PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB = NULL; -PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB = NULL; -PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB = NULL; - -PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB = NULL; - -PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB = NULL; - -PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB = NULL; -PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB = NULL; +#ifdef GL_VERSION_1_2 -PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB = NULL; -PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB = NULL; -PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB = NULL; -PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB = NULL; -PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB = NULL; +static GLboolean _glewInit_GL_VERSION_1_2 () +{ + GLboolean r = GL_FALSE; -PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB = NULL; -PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB = NULL; -PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB = NULL; + 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; -PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB = NULL; -PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB = NULL; -PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB = NULL; + return r; +} -PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT = NULL; -PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT = NULL; -PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT = NULL; -PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT = NULL; +#endif /* GL_VERSION_1_2 */ -PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT = NULL; +#ifdef GL_VERSION_1_3 -PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT = NULL; -PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT = NULL; +static GLboolean _glewInit_GL_VERSION_1_3 () +{ + GLboolean r = GL_FALSE; -PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT = NULL; -PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT = NULL; -PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT = NULL; -PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT = NULL; -PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT = NULL; + 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; -PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT = NULL; -PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT = NULL; -PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT = NULL; + return r; +} -PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT = NULL; -PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT = NULL; +#endif /* GL_VERSION_1_3 */ -PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D = NULL; -PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D = NULL; +#ifdef GL_VERSION_1_4 -PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D = NULL; -PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D = NULL; -PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D = NULL; -PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D = NULL; +static GLboolean _glewInit_GL_VERSION_1_4 () +{ + GLboolean r = GL_FALSE; -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_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; + 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 /* WGL_ARB_buffer_region */ +#endif /* GL_VERSION_1_4 */ -#ifdef WGL_ARB_create_context +#ifdef GL_VERSION_1_5 -static GLboolean _glewInit_WGL_ARB_create_context (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_1_5 () { GLboolean r = GL_FALSE; - r = ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateContextAttribsARB")) == NULL) || r; + 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 /* WGL_ARB_create_context */ +#endif /* GL_VERSION_1_5 */ -#ifdef WGL_ARB_extensions_string +#ifdef GL_VERSION_2_0 -static GLboolean _glewInit_WGL_ARB_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_2_0 () { GLboolean r = GL_FALSE; - r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r; - - return r; -} - -#endif /* WGL_ARB_extensions_string */ - -#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; + 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 /* WGL_ARB_make_current_read */ +#endif /* GL_VERSION_2_0 */ -#ifdef WGL_ARB_pbuffer +#ifdef GL_VERSION_2_1 -static GLboolean _glewInit_WGL_ARB_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_2_1 () { 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; + 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 /* WGL_ARB_pbuffer */ +#endif /* GL_VERSION_2_1 */ -#ifdef WGL_ARB_pixel_format +#ifdef GL_VERSION_3_0 -static GLboolean _glewInit_WGL_ARB_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_3_0 () { 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; + r = _glewInit_GL_ARB_framebuffer_object() || r; + r = _glewInit_GL_ARB_map_buffer_range() || r; + r = _glewInit_GL_ARB_uniform_buffer_object() || r; + r = _glewInit_GL_ARB_vertex_array_object() || r; + + 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; return r; } -#endif /* WGL_ARB_pixel_format */ +#endif /* GL_VERSION_3_0 */ -#ifdef WGL_ARB_render_texture +#ifdef GL_VERSION_3_1 -static GLboolean _glewInit_WGL_ARB_render_texture (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_3_1 () { 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; + r = _glewInit_GL_ARB_copy_buffer() || r; + + 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; return r; } -#endif /* WGL_ARB_render_texture */ +#endif /* GL_VERSION_3_1 */ -#ifdef WGL_EXT_display_color_table +#ifdef GL_VERSION_3_2 -static GLboolean _glewInit_WGL_EXT_display_color_table (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_3_2 () { 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; + r = _glewInit_GL_ARB_draw_elements_base_vertex() || r; + r = _glewInit_GL_ARB_provoking_vertex() || r; + r = _glewInit_GL_ARB_sync() || r; + r = _glewInit_GL_ARB_texture_multisample() || r; + + 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; return r; } -#endif /* WGL_EXT_display_color_table */ +#endif /* GL_VERSION_3_2 */ -#ifdef WGL_EXT_extensions_string +#ifdef GL_VERSION_3_3 -static GLboolean _glewInit_WGL_EXT_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_3_3 () { GLboolean r = GL_FALSE; - r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r; + r = ((glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisor")) == NULL) || r; return r; } -#endif /* WGL_EXT_extensions_string */ +#endif /* GL_VERSION_3_3 */ -#ifdef WGL_EXT_make_current_read +#ifdef GL_VERSION_4_0 -static GLboolean _glewInit_WGL_EXT_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_4_0 () { GLboolean r = GL_FALSE; - r = ((wglGetCurrentReadDCEXT = (PFNWGLGETCURRENTREADDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCEXT")) == NULL) || r; - r = ((wglMakeContextCurrentEXT = (PFNWGLMAKECONTEXTCURRENTEXTPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentEXT")) == NULL) || r; + 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 /* WGL_EXT_make_current_read */ +#endif /* GL_VERSION_4_0 */ -#ifdef WGL_EXT_pbuffer +#ifdef GL_VERSION_4_5 -static GLboolean _glewInit_WGL_EXT_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_VERSION_4_5 () { 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; + r = ((glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)glewGetProcAddress((const GLubyte*)"glGetGraphicsResetStatus")) == NULL) || r; + r = ((glGetnCompressedTexImage = (PFNGLGETNCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnCompressedTexImage")) == NULL) || r; + r = ((glGetnTexImage = (PFNGLGETNTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetnTexImage")) == NULL) || r; + r = ((glGetnUniformdv = (PFNGLGETNUNIFORMDVPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformdv")) == NULL) || r; return r; } -#endif /* WGL_EXT_pbuffer */ +#endif /* GL_VERSION_4_5 */ -#ifdef WGL_EXT_pixel_format +#ifdef GL_3DFX_tbuffer -static GLboolean _glewInit_WGL_EXT_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_3DFX_tbuffer () { 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; + r = ((glTbufferMask3DFX = (PFNGLTBUFFERMASK3DFXPROC)glewGetProcAddress((const GLubyte*)"glTbufferMask3DFX")) == NULL) || r; return r; } -#endif /* WGL_EXT_pixel_format */ +#endif /* GL_3DFX_tbuffer */ -#ifdef WGL_EXT_swap_control +#ifdef GL_AMD_debug_output -static GLboolean _glewInit_WGL_EXT_swap_control (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_debug_output () { GLboolean r = GL_FALSE; - r = ((wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetSwapIntervalEXT")) == NULL) || r; - r = ((wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglSwapIntervalEXT")) == NULL) || r; + 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 /* WGL_EXT_swap_control */ +#endif /* GL_AMD_debug_output */ -#ifdef WGL_I3D_digital_video_control +#ifdef GL_AMD_draw_buffers_blend -static GLboolean _glewInit_WGL_I3D_digital_video_control (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_draw_buffers_blend () { GLboolean r = GL_FALSE; - r = ((wglGetDigitalVideoParametersI3D = (PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetDigitalVideoParametersI3D")) == NULL) || r; - r = ((wglSetDigitalVideoParametersI3D = (PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetDigitalVideoParametersI3D")) == NULL) || r; + 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 /* WGL_I3D_digital_video_control */ +#endif /* GL_AMD_draw_buffers_blend */ -#ifdef WGL_I3D_gamma +#ifdef GL_AMD_interleaved_elements -static GLboolean _glewInit_WGL_I3D_gamma (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_interleaved_elements () { 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; + r = ((glVertexAttribParameteriAMD = (PFNGLVERTEXATTRIBPARAMETERIAMDPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribParameteriAMD")) == NULL) || r; return r; } -#endif /* WGL_I3D_gamma */ +#endif /* GL_AMD_interleaved_elements */ -#ifdef WGL_I3D_genlock +#ifdef GL_AMD_multi_draw_indirect -static GLboolean _glewInit_WGL_I3D_genlock (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_multi_draw_indirect () { 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; + r = ((glMultiDrawArraysIndirectAMD = (PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectAMD")) == NULL) || r; + r = ((glMultiDrawElementsIndirectAMD = (PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectAMD")) == NULL) || r; return r; } -#endif /* WGL_I3D_genlock */ +#endif /* GL_AMD_multi_draw_indirect */ -#ifdef WGL_I3D_image_buffer +#ifdef GL_AMD_name_gen_delete -static GLboolean _glewInit_WGL_I3D_image_buffer (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_name_gen_delete () { 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; + 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 /* WGL_I3D_image_buffer */ +#endif /* GL_AMD_name_gen_delete */ -#ifdef WGL_I3D_swap_frame_lock +#ifdef GL_AMD_occlusion_query_event -static GLboolean _glewInit_WGL_I3D_swap_frame_lock (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_occlusion_query_event () { 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; + r = ((glQueryObjectParameteruiAMD = (PFNGLQUERYOBJECTPARAMETERUIAMDPROC)glewGetProcAddress((const GLubyte*)"glQueryObjectParameteruiAMD")) == NULL) || r; return r; } -#endif /* WGL_I3D_swap_frame_lock */ +#endif /* GL_AMD_occlusion_query_event */ -#ifdef WGL_I3D_swap_frame_usage +#ifdef GL_AMD_performance_monitor -static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_performance_monitor () { 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; + 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 /* WGL_I3D_swap_frame_usage */ +#endif /* GL_AMD_performance_monitor */ -#ifdef WGL_NV_DX_interop +#ifdef GL_AMD_sample_positions -static GLboolean _glewInit_WGL_NV_DX_interop (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_sample_positions () { 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; + r = ((glSetMultisamplefvAMD = (PFNGLSETMULTISAMPLEFVAMDPROC)glewGetProcAddress((const GLubyte*)"glSetMultisamplefvAMD")) == NULL) || r; return r; } -#endif /* WGL_NV_DX_interop */ +#endif /* GL_AMD_sample_positions */ -#ifdef WGL_NV_copy_image +#ifdef GL_AMD_sparse_texture -static GLboolean _glewInit_WGL_NV_copy_image (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_sparse_texture () { GLboolean r = GL_FALSE; - r = ((wglCopyImageSubDataNV = (PFNWGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"wglCopyImageSubDataNV")) == NULL) || r; + r = ((glTexStorageSparseAMD = (PFNGLTEXSTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTexStorageSparseAMD")) == NULL) || r; + r = ((glTextureStorageSparseAMD = (PFNGLTEXTURESTORAGESPARSEAMDPROC)glewGetProcAddress((const GLubyte*)"glTextureStorageSparseAMD")) == NULL) || r; return r; } -#endif /* WGL_NV_copy_image */ +#endif /* GL_AMD_sparse_texture */ -#ifdef WGL_NV_delay_before_swap +#ifdef GL_AMD_stencil_operation_extended -static GLboolean _glewInit_WGL_NV_delay_before_swap (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_stencil_operation_extended () { GLboolean r = GL_FALSE; - r = ((wglDelayBeforeSwapNV = (PFNWGLDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"wglDelayBeforeSwapNV")) == NULL) || r; + r = ((glStencilOpValueAMD = (PFNGLSTENCILOPVALUEAMDPROC)glewGetProcAddress((const GLubyte*)"glStencilOpValueAMD")) == NULL) || r; return r; } -#endif /* WGL_NV_delay_before_swap */ +#endif /* GL_AMD_stencil_operation_extended */ -#ifdef WGL_NV_gpu_affinity +#ifdef GL_AMD_vertex_shader_tessellator -static GLboolean _glewInit_WGL_NV_gpu_affinity (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_AMD_vertex_shader_tessellator () { 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; + r = ((glTessellationFactorAMD = (PFNGLTESSELLATIONFACTORAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationFactorAMD")) == NULL) || r; + r = ((glTessellationModeAMD = (PFNGLTESSELLATIONMODEAMDPROC)glewGetProcAddress((const GLubyte*)"glTessellationModeAMD")) == NULL) || r; return r; } -#endif /* WGL_NV_gpu_affinity */ +#endif /* GL_AMD_vertex_shader_tessellator */ -#ifdef WGL_NV_present_video +#ifdef GL_ANGLE_framebuffer_blit -static GLboolean _glewInit_WGL_NV_present_video (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ANGLE_framebuffer_blit () { 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; + r = ((glBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferANGLE")) == NULL) || r; return r; } -#endif /* WGL_NV_present_video */ +#endif /* GL_ANGLE_framebuffer_blit */ -#ifdef WGL_NV_swap_group +#ifdef GL_ANGLE_framebuffer_multisample -static GLboolean _glewInit_WGL_NV_swap_group (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ANGLE_framebuffer_multisample () { 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; + r = ((glRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleANGLE")) == NULL) || r; return r; } -#endif /* WGL_NV_swap_group */ +#endif /* GL_ANGLE_framebuffer_multisample */ -#ifdef WGL_NV_vertex_array_range +#ifdef GL_ANGLE_instanced_arrays -static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ANGLE_instanced_arrays () { GLboolean r = GL_FALSE; - r = ((wglAllocateMemoryNV = (PFNWGLALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglAllocateMemoryNV")) == NULL) || r; - r = ((wglFreeMemoryNV = (PFNWGLFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglFreeMemoryNV")) == NULL) || r; + 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 /* WGL_NV_vertex_array_range */ +#endif /* GL_ANGLE_instanced_arrays */ -#ifdef WGL_NV_video_capture +#ifdef GL_ANGLE_timer_query -static GLboolean _glewInit_WGL_NV_video_capture (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ANGLE_timer_query () { 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; + 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 /* WGL_NV_video_capture */ +#endif /* GL_ANGLE_timer_query */ -#ifdef WGL_NV_video_output +#ifdef GL_ANGLE_translated_shader_source -static GLboolean _glewInit_WGL_NV_video_output (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ANGLE_translated_shader_source () { 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; + r = ((glGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)glewGetProcAddress((const GLubyte*)"glGetTranslatedShaderSourceANGLE")) == NULL) || r; return r; } -#endif /* WGL_NV_video_output */ +#endif /* GL_ANGLE_translated_shader_source */ -#ifdef WGL_OML_sync_control +#ifdef GL_APPLE_element_array -static GLboolean _glewInit_WGL_OML_sync_control (WGLEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_APPLE_element_array () { 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; + 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 /* WGL_OML_sync_control */ +#endif /* GL_APPLE_element_array */ -/* ------------------------------------------------------------------------- */ +#ifdef GL_APPLE_fence -static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; -static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; +static GLboolean _glewInit_GL_APPLE_fence () +{ + GLboolean r = GL_FALSE; -GLboolean GLEWAPIENTRY wglewGetExtension (const char* name) -{ - const GLubyte* start; - const GLubyte* end; - if (_wglewGetExtensionsStringARB == NULL) - if (_wglewGetExtensionsStringEXT == NULL) - return GL_FALSE; - else - start = (const GLubyte*)_wglewGetExtensionsStringEXT(); - else - start = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); - if (start == 0) - return GL_FALSE; - end = start + _glewStrLen(start); - return _glewSearchExtension(name, start, end); + 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; } -#ifdef GLEW_MX -GLenum GLEWAPIENTRY wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST) -#else -GLenum GLEWAPIENTRY wglewInit (WGLEW_CONTEXT_ARG_DEF_LIST) -#endif +#endif /* GL_APPLE_fence */ + +#ifdef GL_APPLE_flush_buffer_range + +static GLboolean _glewInit_GL_APPLE_flush_buffer_range () { - GLboolean crippled; - const GLubyte* extStart; - const GLubyte* extEnd; - /* 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) - extStart = (const GLubyte*)""; - else - extStart = (const GLubyte*)_wglewGetExtensionsStringEXT(); - else - extStart = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); - extEnd = extStart + _glewStrLen(extStart); - /* initialize extensions */ - crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; -#ifdef WGL_3DFX_multisample - WGLEW_3DFX_multisample = _glewSearchExtension("WGL_3DFX_multisample", extStart, extEnd); -#endif /* WGL_3DFX_multisample */ -#ifdef WGL_3DL_stereo_control - WGLEW_3DL_stereo_control = _glewSearchExtension("WGL_3DL_stereo_control", extStart, extEnd); - 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 = _glewSearchExtension("WGL_AMD_gpu_association", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_buffer_region", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_context_flush_control", extStart, extEnd); -#endif /* WGL_ARB_context_flush_control */ -#ifdef WGL_ARB_create_context - WGLEW_ARB_create_context = _glewSearchExtension("WGL_ARB_create_context", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_create_context_profile", extStart, extEnd); -#endif /* WGL_ARB_create_context_profile */ -#ifdef WGL_ARB_create_context_robustness - WGLEW_ARB_create_context_robustness = _glewSearchExtension("WGL_ARB_create_context_robustness", extStart, extEnd); -#endif /* WGL_ARB_create_context_robustness */ -#ifdef WGL_ARB_extensions_string - WGLEW_ARB_extensions_string = _glewSearchExtension("WGL_ARB_extensions_string", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_framebuffer_sRGB", extStart, extEnd); -#endif /* WGL_ARB_framebuffer_sRGB */ -#ifdef WGL_ARB_make_current_read - WGLEW_ARB_make_current_read = _glewSearchExtension("WGL_ARB_make_current_read", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_multisample", extStart, extEnd); -#endif /* WGL_ARB_multisample */ -#ifdef WGL_ARB_pbuffer - WGLEW_ARB_pbuffer = _glewSearchExtension("WGL_ARB_pbuffer", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_pixel_format", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_pixel_format_float", extStart, extEnd); -#endif /* WGL_ARB_pixel_format_float */ -#ifdef WGL_ARB_render_texture - WGLEW_ARB_render_texture = _glewSearchExtension("WGL_ARB_render_texture", extStart, extEnd); - 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 = _glewSearchExtension("WGL_ARB_robustness_application_isolation", extStart, extEnd); -#endif /* WGL_ARB_robustness_application_isolation */ -#ifdef WGL_ARB_robustness_share_group_isolation - WGLEW_ARB_robustness_share_group_isolation = _glewSearchExtension("WGL_ARB_robustness_share_group_isolation", extStart, extEnd); -#endif /* WGL_ARB_robustness_share_group_isolation */ -#ifdef WGL_ATI_pixel_format_float - WGLEW_ATI_pixel_format_float = _glewSearchExtension("WGL_ATI_pixel_format_float", extStart, extEnd); -#endif /* WGL_ATI_pixel_format_float */ -#ifdef WGL_ATI_render_texture_rectangle - WGLEW_ATI_render_texture_rectangle = _glewSearchExtension("WGL_ATI_render_texture_rectangle", extStart, extEnd); -#endif /* WGL_ATI_render_texture_rectangle */ -#ifdef WGL_EXT_create_context_es2_profile - WGLEW_EXT_create_context_es2_profile = _glewSearchExtension("WGL_EXT_create_context_es2_profile", extStart, extEnd); -#endif /* WGL_EXT_create_context_es2_profile */ -#ifdef WGL_EXT_create_context_es_profile - WGLEW_EXT_create_context_es_profile = _glewSearchExtension("WGL_EXT_create_context_es_profile", extStart, extEnd); -#endif /* WGL_EXT_create_context_es_profile */ -#ifdef WGL_EXT_depth_float - WGLEW_EXT_depth_float = _glewSearchExtension("WGL_EXT_depth_float", extStart, extEnd); -#endif /* WGL_EXT_depth_float */ -#ifdef WGL_EXT_display_color_table - WGLEW_EXT_display_color_table = _glewSearchExtension("WGL_EXT_display_color_table", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_extensions_string", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_framebuffer_sRGB", extStart, extEnd); -#endif /* WGL_EXT_framebuffer_sRGB */ -#ifdef WGL_EXT_make_current_read - WGLEW_EXT_make_current_read = _glewSearchExtension("WGL_EXT_make_current_read", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_multisample", extStart, extEnd); -#endif /* WGL_EXT_multisample */ -#ifdef WGL_EXT_pbuffer - WGLEW_EXT_pbuffer = _glewSearchExtension("WGL_EXT_pbuffer", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_pixel_format", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_pixel_format_packed_float", extStart, extEnd); -#endif /* WGL_EXT_pixel_format_packed_float */ -#ifdef WGL_EXT_swap_control - WGLEW_EXT_swap_control = _glewSearchExtension("WGL_EXT_swap_control", extStart, extEnd); - 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 = _glewSearchExtension("WGL_EXT_swap_control_tear", extStart, extEnd); -#endif /* WGL_EXT_swap_control_tear */ -#ifdef WGL_I3D_digital_video_control - WGLEW_I3D_digital_video_control = _glewSearchExtension("WGL_I3D_digital_video_control", extStart, extEnd); - 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 = _glewSearchExtension("WGL_I3D_gamma", extStart, extEnd); - 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 = _glewSearchExtension("WGL_I3D_genlock", extStart, extEnd); - 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 = _glewSearchExtension("WGL_I3D_image_buffer", extStart, extEnd); - 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 = _glewSearchExtension("WGL_I3D_swap_frame_lock", extStart, extEnd); - 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 = _glewSearchExtension("WGL_I3D_swap_frame_usage", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_DX_interop", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_DX_interop2", extStart, extEnd); -#endif /* WGL_NV_DX_interop2 */ -#ifdef WGL_NV_copy_image - WGLEW_NV_copy_image = _glewSearchExtension("WGL_NV_copy_image", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_delay_before_swap", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_float_buffer", extStart, extEnd); -#endif /* WGL_NV_float_buffer */ -#ifdef WGL_NV_gpu_affinity - WGLEW_NV_gpu_affinity = _glewSearchExtension("WGL_NV_gpu_affinity", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_multisample_coverage", extStart, extEnd); -#endif /* WGL_NV_multisample_coverage */ -#ifdef WGL_NV_present_video - WGLEW_NV_present_video = _glewSearchExtension("WGL_NV_present_video", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_render_depth_texture", extStart, extEnd); -#endif /* WGL_NV_render_depth_texture */ -#ifdef WGL_NV_render_texture_rectangle - WGLEW_NV_render_texture_rectangle = _glewSearchExtension("WGL_NV_render_texture_rectangle", extStart, extEnd); -#endif /* WGL_NV_render_texture_rectangle */ -#ifdef WGL_NV_swap_group - WGLEW_NV_swap_group = _glewSearchExtension("WGL_NV_swap_group", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_vertex_array_range", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_video_capture", extStart, extEnd); - 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 = _glewSearchExtension("WGL_NV_video_output", extStart, extEnd); - 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 = _glewSearchExtension("WGL_OML_sync_control", extStart, extEnd); - 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 */ + GLboolean r = GL_FALSE; - return GLEW_OK; + r = ((glBufferParameteriAPPLE = (PFNGLBUFFERPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBufferParameteriAPPLE")) == NULL) || r; + r = ((glFlushMappedBufferRangeAPPLE = (PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRangeAPPLE")) == NULL) || r; + + return r; } -#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) +#endif /* GL_APPLE_flush_buffer_range */ -PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL; +#ifdef GL_APPLE_object_purgeable -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; +static GLboolean _glewInit_GL_APPLE_object_purgeable () +{ + GLboolean r = GL_FALSE; -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; + 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; -PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB = NULL; + return r; +} -PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI = NULL; -PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI = NULL; -PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI = NULL; +#endif /* GL_APPLE_object_purgeable */ -PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT = NULL; -PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT = NULL; -PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT = NULL; -PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT = NULL; +#ifdef GL_APPLE_texture_range -PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT = NULL; +static GLboolean _glewInit_GL_APPLE_texture_range () +{ + GLboolean r = GL_FALSE; -PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT = NULL; -PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT = NULL; + r = ((glGetTexParameterPointervAPPLE = (PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterPointervAPPLE")) == NULL) || r; + r = ((glTextureRangeAPPLE = (PFNGLTEXTURERANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureRangeAPPLE")) == NULL) || r; -PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA = NULL; + return r; +} -PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA = NULL; +#endif /* GL_APPLE_texture_range */ -PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA = NULL; +#ifdef GL_APPLE_vertex_array_object -PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __glewXQueryCurrentRendererIntegerMESA = NULL; -PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __glewXQueryCurrentRendererStringMESA = NULL; -PFNGLXQUERYRENDERERINTEGERMESAPROC __glewXQueryRendererIntegerMESA = NULL; -PFNGLXQUERYRENDERERSTRINGMESAPROC __glewXQueryRendererStringMESA = NULL; +static GLboolean _glewInit_GL_APPLE_vertex_array_object () +{ + GLboolean r = GL_FALSE; -PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA = NULL; + 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; -PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA = NULL; + return r; +} -PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA = NULL; -PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA = NULL; +#endif /* GL_APPLE_vertex_array_object */ -PFNGLXCOPYBUFFERSUBDATANVPROC __glewXCopyBufferSubDataNV = NULL; -PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC __glewXNamedCopyBufferSubDataNV = NULL; +#ifdef GL_APPLE_vertex_array_range -PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV = NULL; +static GLboolean _glewInit_GL_APPLE_vertex_array_range () +{ + GLboolean r = GL_FALSE; -PFNGLXDELAYBEFORESWAPNVPROC __glewXDelayBeforeSwapNV = NULL; + 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; -PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV = NULL; -PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV = NULL; + return r; +} -PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV = NULL; -PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV = NULL; -PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV = NULL; -PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV = NULL; -PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV = NULL; -PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV = NULL; +#endif /* GL_APPLE_vertex_array_range */ -PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL; -PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL; +#ifdef GL_APPLE_vertex_program_evaluators -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; +static GLboolean _glewInit_GL_APPLE_vertex_program_evaluators () +{ + GLboolean r = GL_FALSE; -PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX = NULL; -PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX = NULL; -PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX = NULL; -PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX = NULL; -PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX = NULL; + 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; -PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX = NULL; -PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX = NULL; + return r; +} -PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX = NULL; +#endif /* GL_APPLE_vertex_program_evaluators */ -PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX = NULL; -PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX = NULL; -PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX = NULL; -PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX = NULL; -PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX = NULL; +#ifdef GL_ARB_ES2_compatibility -PFNGLXCUSHIONSGIPROC __glewXCushionSGI = NULL; +static GLboolean _glewInit_GL_ARB_ES2_compatibility () +{ + GLboolean r = GL_FALSE; -PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI = NULL; -PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI = NULL; + 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; -PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI = NULL; + return r; +} -PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI = NULL; -PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL; +#endif /* GL_ARB_ES2_compatibility */ -PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN = NULL; +#ifdef GL_ARB_ES3_1_compatibility -PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL; -PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL; +static GLboolean _glewInit_GL_ARB_ES3_1_compatibility () +{ + GLboolean r = GL_FALSE; -#if !defined(GLEW_MX) + r = ((glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)glewGetProcAddress((const GLubyte*)"glMemoryBarrierByRegion")) == NULL) || r; -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; + return r; +} -#endif /* !GLEW_MX */ +#endif /* GL_ARB_ES3_1_compatibility */ -#ifdef GLX_VERSION_1_2 +#ifdef GL_ARB_ES3_2_compatibility -static GLboolean _glewInit_GLX_VERSION_1_2 (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_ES3_2_compatibility () { GLboolean r = GL_FALSE; - r = ((glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentDisplay")) == NULL) || r; + r = ((glPrimitiveBoundingBoxARB = (PFNGLPRIMITIVEBOUNDINGBOXARBPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveBoundingBoxARB")) == NULL) || r; return r; } -#endif /* GLX_VERSION_1_2 */ +#endif /* GL_ARB_ES3_2_compatibility */ -#ifdef GLX_VERSION_1_3 +#ifdef GL_ARB_base_instance -static GLboolean _glewInit_GLX_VERSION_1_3 (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_base_instance () { 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; + 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 /* GLX_VERSION_1_3 */ +#endif /* GL_ARB_base_instance */ -#ifdef GLX_AMD_gpu_association +#ifdef GL_ARB_bindless_texture -static GLboolean _glewInit_GLX_AMD_gpu_association (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_bindless_texture () { 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; + 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 /* GLX_AMD_gpu_association */ +#endif /* GL_ARB_bindless_texture */ -#ifdef GLX_ARB_create_context +#ifdef GL_ARB_blend_func_extended -static GLboolean _glewInit_GLX_ARB_create_context (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_blend_func_extended () { GLboolean r = GL_FALSE; - r = ((glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB")) == NULL) || r; + r = ((glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)glewGetProcAddress((const GLubyte*)"glBindFragDataLocationIndexed")) == NULL) || r; + r = ((glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataIndex")) == NULL) || r; return r; } -#endif /* GLX_ARB_create_context */ +#endif /* GL_ARB_blend_func_extended */ -#ifdef GLX_ATI_render_texture +#ifdef GL_ARB_buffer_storage -static GLboolean _glewInit_GLX_ATI_render_texture (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_buffer_storage () { 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; + r = ((glBufferStorage = (PFNGLBUFFERSTORAGEPROC)glewGetProcAddress((const GLubyte*)"glBufferStorage")) == NULL) || r; + r = ((glNamedBufferStorageEXT = (PFNGLNAMEDBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glNamedBufferStorageEXT")) == NULL) || r; return r; } -#endif /* GLX_ATI_render_texture */ +#endif /* GL_ARB_buffer_storage */ -#ifdef GLX_EXT_import_context +#ifdef GL_ARB_cl_event -static GLboolean _glewInit_GLX_EXT_import_context (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_cl_event () { 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; + r = ((glCreateSyncFromCLeventARB = (PFNGLCREATESYNCFROMCLEVENTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateSyncFromCLeventARB")) == NULL) || r; return r; } -#endif /* GLX_EXT_import_context */ +#endif /* GL_ARB_cl_event */ -#ifdef GLX_EXT_swap_control +#ifdef GL_ARB_clear_buffer_object -static GLboolean _glewInit_GLX_EXT_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_clear_buffer_object () { GLboolean r = GL_FALSE; - r = ((glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")) == NULL) || r; + 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 /* GLX_EXT_swap_control */ +#endif /* GL_ARB_clear_buffer_object */ -#ifdef GLX_EXT_texture_from_pixmap +#ifdef GL_ARB_clear_texture -static GLboolean _glewInit_GLX_EXT_texture_from_pixmap (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_clear_texture () { GLboolean r = GL_FALSE; - r = ((glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageEXT")) == NULL) || r; - r = ((glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageEXT")) == NULL) || r; + r = ((glClearTexImage = (PFNGLCLEARTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexImage")) == NULL) || r; + r = ((glClearTexSubImage = (PFNGLCLEARTEXSUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glClearTexSubImage")) == NULL) || r; return r; } -#endif /* GLX_EXT_texture_from_pixmap */ +#endif /* GL_ARB_clear_texture */ -#ifdef GLX_MESA_agp_offset +#ifdef GL_ARB_clip_control -static GLboolean _glewInit_GLX_MESA_agp_offset (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_clip_control () { GLboolean r = GL_FALSE; - r = ((glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetAGPOffsetMESA")) == NULL) || r; + r = ((glClipControl = (PFNGLCLIPCONTROLPROC)glewGetProcAddress((const GLubyte*)"glClipControl")) == NULL) || r; return r; } -#endif /* GLX_MESA_agp_offset */ +#endif /* GL_ARB_clip_control */ -#ifdef GLX_MESA_copy_sub_buffer +#ifdef GL_ARB_color_buffer_float -static GLboolean _glewInit_GLX_MESA_copy_sub_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_color_buffer_float () { GLboolean r = GL_FALSE; - r = ((glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)glewGetProcAddress((const GLubyte*)"glXCopySubBufferMESA")) == NULL) || r; + r = ((glClampColorARB = (PFNGLCLAMPCOLORARBPROC)glewGetProcAddress((const GLubyte*)"glClampColorARB")) == NULL) || r; return r; } -#endif /* GLX_MESA_copy_sub_buffer */ +#endif /* GL_ARB_color_buffer_float */ -#ifdef GLX_MESA_pixmap_colormap +#ifdef GL_ARB_compute_shader -static GLboolean _glewInit_GLX_MESA_pixmap_colormap (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_compute_shader () { GLboolean r = GL_FALSE; - r = ((glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapMESA")) == NULL) || r; + r = ((glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)glewGetProcAddress((const GLubyte*)"glDispatchCompute")) == NULL) || r; + r = ((glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeIndirect")) == NULL) || r; return r; } -#endif /* GLX_MESA_pixmap_colormap */ +#endif /* GL_ARB_compute_shader */ -#ifdef GLX_MESA_query_renderer +#ifdef GL_ARB_compute_variable_group_size -static GLboolean _glewInit_GLX_MESA_query_renderer (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_compute_variable_group_size () { 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; + r = ((glDispatchComputeGroupSizeARB = (PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC)glewGetProcAddress((const GLubyte*)"glDispatchComputeGroupSizeARB")) == NULL) || r; return r; } -#endif /* GLX_MESA_query_renderer */ +#endif /* GL_ARB_compute_variable_group_size */ -#ifdef GLX_MESA_release_buffers +#ifdef GL_ARB_copy_buffer -static GLboolean _glewInit_GLX_MESA_release_buffers (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_copy_buffer () { GLboolean r = GL_FALSE; - r = ((glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glXReleaseBuffersMESA")) == NULL) || r; + r = ((glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyBufferSubData")) == NULL) || r; return r; } -#endif /* GLX_MESA_release_buffers */ +#endif /* GL_ARB_copy_buffer */ -#ifdef GLX_MESA_set_3dfx_mode +#ifdef GL_ARB_copy_image -static GLboolean _glewInit_GLX_MESA_set_3dfx_mode (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_copy_image () { GLboolean r = GL_FALSE; - r = ((glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)glewGetProcAddress((const GLubyte*)"glXSet3DfxModeMESA")) == NULL) || r; + r = ((glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubData")) == NULL) || r; return r; } -#endif /* GLX_MESA_set_3dfx_mode */ +#endif /* GL_ARB_copy_image */ -#ifdef GLX_MESA_swap_control +#ifdef GL_ARB_debug_output -static GLboolean _glewInit_GLX_MESA_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_debug_output () { GLboolean r = GL_FALSE; - r = ((glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetSwapIntervalMESA")) == NULL) || r; - r = ((glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalMESA")) == NULL) || r; + 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 /* GLX_MESA_swap_control */ +#endif /* GL_ARB_debug_output */ -#ifdef GLX_NV_copy_buffer +#ifdef GL_ARB_direct_state_access -static GLboolean _glewInit_GLX_NV_copy_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_direct_state_access () { GLboolean r = GL_FALSE; - r = ((glXCopyBufferSubDataNV = (PFNGLXCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyBufferSubDataNV")) == NULL) || r; - r = ((glXNamedCopyBufferSubDataNV = (PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXNamedCopyBufferSubDataNV")) == NULL) || r; + 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 /* GLX_NV_copy_buffer */ +#endif /* GL_ARB_direct_state_access */ -#ifdef GLX_NV_copy_image +#ifdef GL_ARB_draw_buffers -static GLboolean _glewInit_GLX_NV_copy_image (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_draw_buffers () { GLboolean r = GL_FALSE; - r = ((glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glXCopyImageSubDataNV")) == NULL) || r; + r = ((glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersARB")) == NULL) || r; return r; } -#endif /* GLX_NV_copy_image */ +#endif /* GL_ARB_draw_buffers */ -#ifdef GLX_NV_delay_before_swap +#ifdef GL_ARB_draw_buffers_blend -static GLboolean _glewInit_GLX_NV_delay_before_swap (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_draw_buffers_blend () { GLboolean r = GL_FALSE; - r = ((glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"glXDelayBeforeSwapNV")) == NULL) || r; + 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 /* GLX_NV_delay_before_swap */ +#endif /* GL_ARB_draw_buffers_blend */ -#ifdef GLX_NV_present_video +#ifdef GL_ARB_draw_elements_base_vertex -static GLboolean _glewInit_GLX_NV_present_video (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_draw_elements_base_vertex () { GLboolean r = GL_FALSE; - r = ((glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoDeviceNV")) == NULL) || r; - r = ((glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoDevicesNV")) == NULL) || r; + 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 /* GLX_NV_present_video */ +#endif /* GL_ARB_draw_elements_base_vertex */ -#ifdef GLX_NV_swap_group +#ifdef GL_ARB_draw_indirect -static GLboolean _glewInit_GLX_NV_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_draw_indirect () { 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; + r = ((glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysIndirect")) == NULL) || r; + r = ((glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsIndirect")) == NULL) || r; return r; } -#endif /* GLX_NV_swap_group */ +#endif /* GL_ARB_draw_indirect */ -#ifdef GLX_NV_vertex_array_range +#ifdef GL_ARB_framebuffer_no_attachments -static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_framebuffer_no_attachments () { GLboolean r = GL_FALSE; - r = ((glXAllocateMemoryNV = (PFNGLXALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXAllocateMemoryNV")) == NULL) || r; - r = ((glXFreeMemoryNV = (PFNGLXFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXFreeMemoryNV")) == NULL) || r; + 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 /* GLX_NV_vertex_array_range */ +#endif /* GL_ARB_framebuffer_no_attachments */ -#ifdef GLX_NV_video_capture +#ifdef GL_ARB_framebuffer_object -static GLboolean _glewInit_GLX_NV_video_capture (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_framebuffer_object () { 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; + 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 /* GLX_NV_video_capture */ +#endif /* GL_ARB_framebuffer_object */ -#ifdef GLX_NV_video_out +#ifdef GL_ARB_geometry_shader4 -static GLboolean _glewInit_GLX_NV_video_out (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_geometry_shader4 () { 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; + 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 /* GLX_NV_video_out */ +#endif /* GL_ARB_geometry_shader4 */ -#ifdef GLX_OML_sync_control +#ifdef GL_ARB_get_program_binary -static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_get_program_binary () { 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; + 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 /* GLX_OML_sync_control */ +#endif /* GL_ARB_get_program_binary */ -#ifdef GLX_SGIX_fbconfig +#ifdef GL_ARB_get_texture_sub_image -static GLboolean _glewInit_GLX_SGIX_fbconfig (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_get_texture_sub_image () { 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; + r = ((glGetCompressedTextureSubImage = (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTextureSubImage")) == NULL) || r; + r = ((glGetTextureSubImage = (PFNGLGETTEXTURESUBIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetTextureSubImage")) == NULL) || r; return r; } -#endif /* GLX_SGIX_fbconfig */ +#endif /* GL_ARB_get_texture_sub_image */ -#ifdef GLX_SGIX_hyperpipe +#ifdef GL_ARB_gl_spirv -static GLboolean _glewInit_GLX_SGIX_hyperpipe (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_gl_spirv () { 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; + r = ((glSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)glewGetProcAddress((const GLubyte*)"glSpecializeShaderARB")) == NULL) || r; return r; } -#endif /* GLX_SGIX_hyperpipe */ +#endif /* GL_ARB_gl_spirv */ -#ifdef GLX_SGIX_pbuffer +#ifdef GL_ARB_gpu_shader_fp64 -static GLboolean _glewInit_GLX_SGIX_pbuffer (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_gpu_shader_fp64 () { 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; + 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 /* GLX_SGIX_pbuffer */ +#endif /* GL_ARB_gpu_shader_fp64 */ -#ifdef GLX_SGIX_swap_barrier +#ifdef GL_ARB_gpu_shader_int64 -static GLboolean _glewInit_GLX_SGIX_swap_barrier (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_gpu_shader_int64 () { GLboolean r = GL_FALSE; - r = ((glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierSGIX")) == NULL) || r; - r = ((glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapBarriersSGIX")) == NULL) || r; + r = ((glGetUniformi64vARB = (PFNGLGETUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformi64vARB")) == NULL) || r; + r = ((glGetUniformui64vARB = (PFNGLGETUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformui64vARB")) == NULL) || r; + r = ((glGetnUniformi64vARB = (PFNGLGETNUNIFORMI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformi64vARB")) == NULL) || r; + r = ((glGetnUniformui64vARB = (PFNGLGETNUNIFORMUI64VARBPROC)glewGetProcAddress((const GLubyte*)"glGetnUniformui64vARB")) == NULL) || r; + r = ((glProgramUniform1i64ARB = (PFNGLPROGRAMUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64ARB")) == NULL) || r; + r = ((glProgramUniform1i64vARB = (PFNGLPROGRAMUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1i64vARB")) == NULL) || r; + r = ((glProgramUniform1ui64ARB = (PFNGLPROGRAMUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64ARB")) == NULL) || r; + r = ((glProgramUniform1ui64vARB = (PFNGLPROGRAMUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform1ui64vARB")) == NULL) || r; + r = ((glProgramUniform2i64ARB = (PFNGLPROGRAMUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64ARB")) == NULL) || r; + r = ((glProgramUniform2i64vARB = (PFNGLPROGRAMUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2i64vARB")) == NULL) || r; + r = ((glProgramUniform2ui64ARB = (PFNGLPROGRAMUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64ARB")) == NULL) || r; + r = ((glProgramUniform2ui64vARB = (PFNGLPROGRAMUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform2ui64vARB")) == NULL) || r; + r = ((glProgramUniform3i64ARB = (PFNGLPROGRAMUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64ARB")) == NULL) || r; + r = ((glProgramUniform3i64vARB = (PFNGLPROGRAMUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3i64vARB")) == NULL) || r; + r = ((glProgramUniform3ui64ARB = (PFNGLPROGRAMUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64ARB")) == NULL) || r; + r = ((glProgramUniform3ui64vARB = (PFNGLPROGRAMUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform3ui64vARB")) == NULL) || r; + r = ((glProgramUniform4i64ARB = (PFNGLPROGRAMUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64ARB")) == NULL) || r; + r = ((glProgramUniform4i64vARB = (PFNGLPROGRAMUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4i64vARB")) == NULL) || r; + r = ((glProgramUniform4ui64ARB = (PFNGLPROGRAMUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64ARB")) == NULL) || r; + r = ((glProgramUniform4ui64vARB = (PFNGLPROGRAMUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glProgramUniform4ui64vARB")) == NULL) || r; + r = ((glUniform1i64ARB = (PFNGLUNIFORM1I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64ARB")) == NULL) || r; + r = ((glUniform1i64vARB = (PFNGLUNIFORM1I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1i64vARB")) == NULL) || r; + r = ((glUniform1ui64ARB = (PFNGLUNIFORM1UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64ARB")) == NULL) || r; + r = ((glUniform1ui64vARB = (PFNGLUNIFORM1UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ui64vARB")) == NULL) || r; + r = ((glUniform2i64ARB = (PFNGLUNIFORM2I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64ARB")) == NULL) || r; + r = ((glUniform2i64vARB = (PFNGLUNIFORM2I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2i64vARB")) == NULL) || r; + r = ((glUniform2ui64ARB = (PFNGLUNIFORM2UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64ARB")) == NULL) || r; + r = ((glUniform2ui64vARB = (PFNGLUNIFORM2UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ui64vARB")) == NULL) || r; + r = ((glUniform3i64ARB = (PFNGLUNIFORM3I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64ARB")) == NULL) || r; + r = ((glUniform3i64vARB = (PFNGLUNIFORM3I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3i64vARB")) == NULL) || r; + r = ((glUniform3ui64ARB = (PFNGLUNIFORM3UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64ARB")) == NULL) || r; + r = ((glUniform3ui64vARB = (PFNGLUNIFORM3UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ui64vARB")) == NULL) || r; + r = ((glUniform4i64ARB = (PFNGLUNIFORM4I64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64ARB")) == NULL) || r; + r = ((glUniform4i64vARB = (PFNGLUNIFORM4I64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4i64vARB")) == NULL) || r; + r = ((glUniform4ui64ARB = (PFNGLUNIFORM4UI64ARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64ARB")) == NULL) || r; + r = ((glUniform4ui64vARB = (PFNGLUNIFORM4UI64VARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ui64vARB")) == NULL) || r; return r; } -#endif /* GLX_SGIX_swap_barrier */ +#endif /* GL_ARB_gpu_shader_int64 */ -#ifdef GLX_SGIX_swap_group +#ifdef GL_ARB_imaging -static GLboolean _glewInit_GLX_SGIX_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_imaging () { GLboolean r = GL_FALSE; - r = ((glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupSGIX")) == NULL) || r; + 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 /* GLX_SGIX_swap_group */ +#endif /* GL_ARB_imaging */ -#ifdef GLX_SGIX_video_resize +#ifdef GL_ARB_indirect_parameters -static GLboolean _glewInit_GLX_SGIX_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_indirect_parameters () { 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; + r = ((glMultiDrawArraysIndirectCountARB = (PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirectCountARB")) == NULL) || r; + r = ((glMultiDrawElementsIndirectCountARB = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirectCountARB")) == NULL) || r; return r; } -#endif /* GLX_SGIX_video_resize */ +#endif /* GL_ARB_indirect_parameters */ -#ifdef GLX_SGI_cushion +#ifdef GL_ARB_instanced_arrays -static GLboolean _glewInit_GLX_SGI_cushion (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_instanced_arrays () { GLboolean r = GL_FALSE; - r = ((glXCushionSGI = (PFNGLXCUSHIONSGIPROC)glewGetProcAddress((const GLubyte*)"glXCushionSGI")) == NULL) || r; + 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 /* GLX_SGI_cushion */ +#endif /* GL_ARB_instanced_arrays */ -#ifdef GLX_SGI_make_current_read +#ifdef GL_ARB_internalformat_query -static GLboolean _glewInit_GLX_SGI_make_current_read (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_internalformat_query () { GLboolean r = GL_FALSE; - r = ((glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawableSGI")) == NULL) || r; - r = ((glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)glewGetProcAddress((const GLubyte*)"glXMakeCurrentReadSGI")) == NULL) || r; + r = ((glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformativ")) == NULL) || r; return r; } -#endif /* GLX_SGI_make_current_read */ +#endif /* GL_ARB_internalformat_query */ -#ifdef GLX_SGI_swap_control +#ifdef GL_ARB_internalformat_query2 -static GLboolean _glewInit_GLX_SGI_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_internalformat_query2 () { GLboolean r = GL_FALSE; - r = ((glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalSGI")) == NULL) || r; + r = ((glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformati64v")) == NULL) || r; return r; } -#endif /* GLX_SGI_swap_control */ +#endif /* GL_ARB_internalformat_query2 */ -#ifdef GLX_SGI_video_sync +#ifdef GL_ARB_invalidate_subdata -static GLboolean _glewInit_GLX_SGI_video_sync (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_invalidate_subdata () { GLboolean r = GL_FALSE; - r = ((glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI")) == NULL) || r; - r = ((glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI")) == NULL) || r; + 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 /* GLX_SGI_video_sync */ +#endif /* GL_ARB_invalidate_subdata */ -#ifdef GLX_SUN_get_transparent_index +#ifdef GL_ARB_map_buffer_range -static GLboolean _glewInit_GLX_SUN_get_transparent_index (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_map_buffer_range () { GLboolean r = GL_FALSE; - r = ((glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)glewGetProcAddress((const GLubyte*)"glXGetTransparentIndexSUN")) == NULL) || r; + r = ((glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glFlushMappedBufferRange")) == NULL) || r; + r = ((glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)glewGetProcAddress((const GLubyte*)"glMapBufferRange")) == NULL) || r; return r; } -#endif /* GLX_SUN_get_transparent_index */ +#endif /* GL_ARB_map_buffer_range */ -#ifdef GLX_SUN_video_resize +#ifdef GL_ARB_matrix_palette -static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +static GLboolean _glewInit_GL_ARB_matrix_palette () { GLboolean r = GL_FALSE; - r = ((glXGetVideoResizeSUN = (PFNGLXGETVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoResizeSUN")) == NULL) || r; - r = ((glXVideoResizeSUN = (PFNGLXVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXVideoResizeSUN")) == NULL) || r; + 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 /* GLX_SUN_video_resize */ +#endif /* GL_ARB_matrix_palette */ -/* ------------------------------------------------------------------------ */ +#ifdef GL_ARB_multi_bind -GLboolean glxewGetExtension (const char* name) -{ - const GLubyte* start; - const GLubyte* end; +static GLboolean _glewInit_GL_ARB_multi_bind () +{ + GLboolean r = GL_FALSE; - if (glXGetCurrentDisplay == NULL) return GL_FALSE; - start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); - if (0 == start) return GL_FALSE; - end = start + _glewStrLen(start); - return _glewSearchExtension(name, start, end); + 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; } -#ifdef GLEW_MX -GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) -#else -GLenum glxewInit (GLXEW_CONTEXT_ARG_DEF_LIST) -#endif +#endif /* GL_ARB_multi_bind */ + +#ifdef GL_ARB_multi_draw_indirect + +static GLboolean _glewInit_GL_ARB_multi_draw_indirect () { - int major, minor; - const GLubyte* extStart; - const GLubyte* extEnd; - /* 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 */ - extStart = 0; - if (glXGetCurrentDisplay != NULL) - extStart = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); - if (extStart == 0) - extStart = (const GLubyte *)""; - extEnd = extStart + _glewStrLen(extStart); - /* 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 = _glewSearchExtension("GLX_3DFX_multisample", extStart, extEnd); -#endif /* GLX_3DFX_multisample */ -#ifdef GLX_AMD_gpu_association - GLXEW_AMD_gpu_association = _glewSearchExtension("GLX_AMD_gpu_association", extStart, extEnd); - 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 = _glewSearchExtension("GLX_ARB_context_flush_control", extStart, extEnd); -#endif /* GLX_ARB_context_flush_control */ -#ifdef GLX_ARB_create_context - GLXEW_ARB_create_context = _glewSearchExtension("GLX_ARB_create_context", extStart, extEnd); - 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 = _glewSearchExtension("GLX_ARB_create_context_profile", extStart, extEnd); -#endif /* GLX_ARB_create_context_profile */ -#ifdef GLX_ARB_create_context_robustness - GLXEW_ARB_create_context_robustness = _glewSearchExtension("GLX_ARB_create_context_robustness", extStart, extEnd); -#endif /* GLX_ARB_create_context_robustness */ -#ifdef GLX_ARB_fbconfig_float - GLXEW_ARB_fbconfig_float = _glewSearchExtension("GLX_ARB_fbconfig_float", extStart, extEnd); -#endif /* GLX_ARB_fbconfig_float */ -#ifdef GLX_ARB_framebuffer_sRGB - GLXEW_ARB_framebuffer_sRGB = _glewSearchExtension("GLX_ARB_framebuffer_sRGB", extStart, extEnd); -#endif /* GLX_ARB_framebuffer_sRGB */ -#ifdef GLX_ARB_get_proc_address - GLXEW_ARB_get_proc_address = _glewSearchExtension("GLX_ARB_get_proc_address", extStart, extEnd); -#endif /* GLX_ARB_get_proc_address */ -#ifdef GLX_ARB_multisample - GLXEW_ARB_multisample = _glewSearchExtension("GLX_ARB_multisample", extStart, extEnd); -#endif /* GLX_ARB_multisample */ -#ifdef GLX_ARB_robustness_application_isolation - GLXEW_ARB_robustness_application_isolation = _glewSearchExtension("GLX_ARB_robustness_application_isolation", extStart, extEnd); -#endif /* GLX_ARB_robustness_application_isolation */ -#ifdef GLX_ARB_robustness_share_group_isolation - GLXEW_ARB_robustness_share_group_isolation = _glewSearchExtension("GLX_ARB_robustness_share_group_isolation", extStart, extEnd); -#endif /* GLX_ARB_robustness_share_group_isolation */ -#ifdef GLX_ARB_vertex_buffer_object - GLXEW_ARB_vertex_buffer_object = _glewSearchExtension("GLX_ARB_vertex_buffer_object", extStart, extEnd); -#endif /* GLX_ARB_vertex_buffer_object */ -#ifdef GLX_ATI_pixel_format_float - GLXEW_ATI_pixel_format_float = _glewSearchExtension("GLX_ATI_pixel_format_float", extStart, extEnd); -#endif /* GLX_ATI_pixel_format_float */ -#ifdef GLX_ATI_render_texture - GLXEW_ATI_render_texture = _glewSearchExtension("GLX_ATI_render_texture", extStart, extEnd); - 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 = _glewSearchExtension("GLX_EXT_buffer_age", extStart, extEnd); -#endif /* GLX_EXT_buffer_age */ -#ifdef GLX_EXT_create_context_es2_profile - GLXEW_EXT_create_context_es2_profile = _glewSearchExtension("GLX_EXT_create_context_es2_profile", extStart, extEnd); -#endif /* GLX_EXT_create_context_es2_profile */ -#ifdef GLX_EXT_create_context_es_profile - GLXEW_EXT_create_context_es_profile = _glewSearchExtension("GLX_EXT_create_context_es_profile", extStart, extEnd); -#endif /* GLX_EXT_create_context_es_profile */ -#ifdef GLX_EXT_fbconfig_packed_float - GLXEW_EXT_fbconfig_packed_float = _glewSearchExtension("GLX_EXT_fbconfig_packed_float", extStart, extEnd); -#endif /* GLX_EXT_fbconfig_packed_float */ -#ifdef GLX_EXT_framebuffer_sRGB - GLXEW_EXT_framebuffer_sRGB = _glewSearchExtension("GLX_EXT_framebuffer_sRGB", extStart, extEnd); -#endif /* GLX_EXT_framebuffer_sRGB */ -#ifdef GLX_EXT_import_context - GLXEW_EXT_import_context = _glewSearchExtension("GLX_EXT_import_context", extStart, extEnd); - 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 = _glewSearchExtension("GLX_EXT_scene_marker", extStart, extEnd); -#endif /* GLX_EXT_scene_marker */ -#ifdef GLX_EXT_stereo_tree - GLXEW_EXT_stereo_tree = _glewSearchExtension("GLX_EXT_stereo_tree", extStart, extEnd); -#endif /* GLX_EXT_stereo_tree */ -#ifdef GLX_EXT_swap_control - GLXEW_EXT_swap_control = _glewSearchExtension("GLX_EXT_swap_control", extStart, extEnd); - 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 = _glewSearchExtension("GLX_EXT_swap_control_tear", extStart, extEnd); -#endif /* GLX_EXT_swap_control_tear */ -#ifdef GLX_EXT_texture_from_pixmap - GLXEW_EXT_texture_from_pixmap = _glewSearchExtension("GLX_EXT_texture_from_pixmap", extStart, extEnd); - 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 = _glewSearchExtension("GLX_EXT_visual_info", extStart, extEnd); -#endif /* GLX_EXT_visual_info */ -#ifdef GLX_EXT_visual_rating - GLXEW_EXT_visual_rating = _glewSearchExtension("GLX_EXT_visual_rating", extStart, extEnd); -#endif /* GLX_EXT_visual_rating */ -#ifdef GLX_INTEL_swap_event - GLXEW_INTEL_swap_event = _glewSearchExtension("GLX_INTEL_swap_event", extStart, extEnd); -#endif /* GLX_INTEL_swap_event */ -#ifdef GLX_MESA_agp_offset - GLXEW_MESA_agp_offset = _glewSearchExtension("GLX_MESA_agp_offset", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_copy_sub_buffer", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_pixmap_colormap", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_query_renderer", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_release_buffers", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_set_3dfx_mode", extStart, extEnd); - 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 = _glewSearchExtension("GLX_MESA_swap_control", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_copy_buffer", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_copy_image", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_delay_before_swap", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_float_buffer", extStart, extEnd); -#endif /* GLX_NV_float_buffer */ -#ifdef GLX_NV_multisample_coverage - GLXEW_NV_multisample_coverage = _glewSearchExtension("GLX_NV_multisample_coverage", extStart, extEnd); -#endif /* GLX_NV_multisample_coverage */ -#ifdef GLX_NV_present_video - GLXEW_NV_present_video = _glewSearchExtension("GLX_NV_present_video", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_swap_group", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_vertex_array_range", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_video_capture", extStart, extEnd); - 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 = _glewSearchExtension("GLX_NV_video_out", extStart, extEnd); - 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 = _glewSearchExtension("GLX_OML_swap_method", extStart, extEnd); -#endif /* GLX_OML_swap_method */ -#ifdef GLX_OML_sync_control - GLXEW_OML_sync_control = _glewSearchExtension("GLX_OML_sync_control", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIS_blended_overlay", extStart, extEnd); -#endif /* GLX_SGIS_blended_overlay */ -#ifdef GLX_SGIS_color_range - GLXEW_SGIS_color_range = _glewSearchExtension("GLX_SGIS_color_range", extStart, extEnd); -#endif /* GLX_SGIS_color_range */ -#ifdef GLX_SGIS_multisample - GLXEW_SGIS_multisample = _glewSearchExtension("GLX_SGIS_multisample", extStart, extEnd); -#endif /* GLX_SGIS_multisample */ -#ifdef GLX_SGIS_shared_multisample - GLXEW_SGIS_shared_multisample = _glewSearchExtension("GLX_SGIS_shared_multisample", extStart, extEnd); -#endif /* GLX_SGIS_shared_multisample */ -#ifdef GLX_SGIX_fbconfig - GLXEW_SGIX_fbconfig = _glewSearchExtension("GLX_SGIX_fbconfig", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_hyperpipe", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_pbuffer", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_swap_barrier", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_swap_group", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_video_resize", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGIX_visual_select_group", extStart, extEnd); -#endif /* GLX_SGIX_visual_select_group */ -#ifdef GLX_SGI_cushion - GLXEW_SGI_cushion = _glewSearchExtension("GLX_SGI_cushion", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGI_make_current_read", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGI_swap_control", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SGI_video_sync", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SUN_get_transparent_index", extStart, extEnd); - 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 = _glewSearchExtension("GLX_SUN_video_resize", extStart, extEnd); - 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 */ + GLboolean r = GL_FALSE; - return GLEW_OK; + r = ((glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysIndirect")) == NULL) || r; + r = ((glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsIndirect")) == NULL) || r; + + return r; } -#endif /* !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */ +#endif /* GL_ARB_multi_draw_indirect */ -/* ------------------------------------------------------------------------ */ +#ifdef GL_ARB_multisample -const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error) +static GLboolean _glewInit_GL_ARB_multisample () { - 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]; -} + GLboolean r = GL_FALSE; -const GLubyte * GLEWAPIENTRY glewGetString (GLenum name) -{ - static const GLubyte* _glewString[] = - { - (const GLubyte*)NULL, - (const GLubyte*)"1.13.0", - (const GLubyte*)"1", - (const GLubyte*)"13", - (const GLubyte*)"0" - }; - const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; - return _glewString[(size_t)name > max_string ? 0 : (size_t)name]; -} + r = ((glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverageARB")) == NULL) || r; -/* ------------------------------------------------------------------------ */ + return r; +} -GLboolean glewExperimental = GL_FALSE; +#endif /* GL_ARB_multisample */ -#if !defined(GLEW_MX) +#ifdef GL_ARB_multitexture -GLenum GLEWAPIENTRY glewInit (void) +static GLboolean _glewInit_GL_ARB_multitexture () { - GLenum r; - r = glewContextInit(); - if ( r != 0 ) return r; -#if defined(_WIN32) - return wglewInit(); -#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ - return glxewInit(); -#else - return r; -#endif /* _WIN32 */ -} + GLboolean r = GL_FALSE; -#endif /* !GLEW_MX */ -#ifdef GLEW_MX -GLboolean GLEWAPIENTRY glewContextIsSupported (const GLEWContext* ctx, const char* name) -#else -GLboolean GLEWAPIENTRY glewIsSupported (const char* name) + 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 () +{ + 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_parallel_shader_compile + +static GLboolean _glewInit_GL_ARB_parallel_shader_compile () +{ + GLboolean r = GL_FALSE; + + r = ((glMaxShaderCompilerThreadsARB = (PFNGLMAXSHADERCOMPILERTHREADSARBPROC)glewGetProcAddress((const GLubyte*)"glMaxShaderCompilerThreadsARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_parallel_shader_compile */ + +#ifdef GL_ARB_point_parameters + +static GLboolean _glewInit_GL_ARB_point_parameters () +{ + 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_program_interface_query + +static GLboolean _glewInit_GL_ARB_program_interface_query () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)glewGetProcAddress((const GLubyte*)"glProvokingVertex")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_provoking_vertex */ + +#ifdef GL_ARB_robustness + +static GLboolean _glewInit_GL_ARB_robustness () +{ + 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_sample_locations + +static GLboolean _glewInit_GL_ARB_sample_locations () +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferSampleLocationsfvARB = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glFramebufferSampleLocationsfvARB")) == NULL) || r; + r = ((glNamedFramebufferSampleLocationsfvARB = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC)glewGetProcAddress((const GLubyte*)"glNamedFramebufferSampleLocationsfvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_sample_locations */ + +#ifdef GL_ARB_sample_shading + +static GLboolean _glewInit_GL_ARB_sample_shading () +{ + 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 () +{ + 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_separate_shader_objects + +static GLboolean _glewInit_GL_ARB_separate_shader_objects () +{ + 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 () +{ + 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_image_load_store + +static GLboolean _glewInit_GL_ARB_shader_image_load_store () +{ + 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_objects + +static GLboolean _glewInit_GL_ARB_shader_objects () +{ + 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_storage_buffer_object + +static GLboolean _glewInit_GL_ARB_shader_storage_buffer_object () +{ + 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 () +{ + 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_shading_language_include + +static GLboolean _glewInit_GL_ARB_shading_language_include () +{ + 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_sparse_buffer + +static GLboolean _glewInit_GL_ARB_sparse_buffer () +{ + 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 () +{ + 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_sync + +static GLboolean _glewInit_GL_ARB_sync () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrier")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_barrier */ + +#ifdef GL_ARB_texture_buffer_object + +static GLboolean _glewInit_GL_ARB_texture_buffer_object () +{ + 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_range + +static GLboolean _glewInit_GL_ARB_texture_buffer_range () +{ + 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 () +{ + 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_multisample + +static GLboolean _glewInit_GL_ARB_texture_multisample () +{ + 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_storage + +static GLboolean _glewInit_GL_ARB_texture_storage () +{ + 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; + r = ((glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage1DEXT")) == NULL) || r; + r = ((glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DEXT")) == NULL) || r; + r = ((glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_storage */ + +#ifdef GL_ARB_texture_storage_multisample + +static GLboolean _glewInit_GL_ARB_texture_storage_multisample () +{ + GLboolean r = GL_FALSE; + + r = ((glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage2DMultisample")) == NULL) || r; + r = ((glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)glewGetProcAddress((const GLubyte*)"glTexStorage3DMultisample")) == NULL) || r; + r = ((glTextureStorage2DMultisampleEXT = (PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage2DMultisampleEXT")) == NULL) || r; + r = ((glTextureStorage3DMultisampleEXT = (PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureStorage3DMultisampleEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_storage_multisample */ + +#ifdef GL_ARB_texture_view + +static GLboolean _glewInit_GL_ARB_texture_view () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_transpose_matrix + +static GLboolean _glewInit_GL_ARB_transpose_matrix () +{ + 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 () +{ + 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_object + +static GLboolean _glewInit_GL_ARB_vertex_array_object () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_2_10_10_10_rev + +static GLboolean _glewInit_GL_ARB_vertex_type_2_10_10_10_rev () +{ + GLboolean r = GL_FALSE; + + 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 = ((glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1ui")) == NULL) || r; + r = ((glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP1uiv")) == NULL) || r; + r = ((glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2ui")) == NULL) || r; + r = ((glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP2uiv")) == NULL) || r; + r = ((glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3ui")) == NULL) || r; + r = ((glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP3uiv")) == NULL) || r; + r = ((glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4ui")) == NULL) || r; + r = ((glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribP4uiv")) == 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; + + return r; +} + +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifdef GL_ARB_viewport_array + +static GLboolean _glewInit_GL_ARB_viewport_array () +{ + 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 () +{ + 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_ATI_draw_buffers + +static GLboolean _glewInit_GL_ATI_draw_buffers () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_pn_triangles + +static GLboolean _glewInit_GL_ATI_pn_triangles () +{ + 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 () +{ + 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_vertex_array_object + +static GLboolean _glewInit_GL_ATI_vertex_array_object () +{ + 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 () +{ + 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 () +{ + 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_bindable_uniform + +static GLboolean _glewInit_GL_EXT_bindable_uniform () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_minmax + +static GLboolean _glewInit_GL_EXT_blend_minmax () +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_minmax */ + +#ifdef GL_EXT_color_subtable + +static GLboolean _glewInit_GL_EXT_color_subtable () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_multisample */ + +#ifdef GL_EXT_framebuffer_object + +static GLboolean _glewInit_GL_EXT_framebuffer_object () +{ + 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_geometry_shader4 + +static GLboolean _glewInit_GL_EXT_geometry_shader4 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_func + +static GLboolean _glewInit_GL_EXT_index_func () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glIndexMaterialEXT = (PFNGLINDEXMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexMaterialEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_index_material */ + +#ifdef GL_EXT_light_texture + +static GLboolean _glewInit_GL_EXT_light_texture () +{ + 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_multi_draw_arrays + +static GLboolean _glewInit_GL_EXT_multi_draw_arrays () +{ + 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 () +{ + 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_paletted_texture + +static GLboolean _glewInit_GL_EXT_paletted_texture () +{ + 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_transform + +static GLboolean _glewInit_GL_EXT_pixel_transform () +{ + 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_point_parameters + +static GLboolean _glewInit_GL_EXT_point_parameters () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glPolygonOffsetClampEXT = (PFNGLPOLYGONOFFSETCLAMPEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetClampEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifdef GL_EXT_provoking_vertex + +static GLboolean _glewInit_GL_EXT_provoking_vertex () +{ + 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 () +{ + 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_scene_marker + +static GLboolean _glewInit_GL_EXT_scene_marker () +{ + 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 () +{ + 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 () +{ + 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_shader_image_load_store + +static GLboolean _glewInit_GL_EXT_shader_image_load_store () +{ + 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_stencil_two_side + +static GLboolean _glewInit_GL_EXT_stencil_two_side () +{ + GLboolean r = GL_FALSE; + + r = ((glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveStencilFaceEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_stencil_two_side */ + +#ifdef GL_EXT_subtexture + +static GLboolean _glewInit_GL_EXT_subtexture () +{ + 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_texture3D + +static GLboolean _glewInit_GL_EXT_texture3D () +{ + 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 () +{ + 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 () +{ + 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_integer + +static GLboolean _glewInit_GL_EXT_texture_integer () +{ + 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_object + +static GLboolean _glewInit_GL_EXT_texture_object () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glTextureNormalEXT = (PFNGLTEXTURENORMALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureNormalEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_perturb_normal */ + +#ifdef GL_EXT_timer_query + +static GLboolean _glewInit_GL_EXT_timer_query () +{ + 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 () +{ + 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 () +{ + 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_attrib_64bit + +static GLboolean _glewInit_GL_EXT_vertex_attrib_64bit () +{ + 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 () +{ + 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 () +{ + 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_window_rectangles + +static GLboolean _glewInit_GL_EXT_window_rectangles () +{ + GLboolean r = GL_FALSE; + + r = ((glWindowRectanglesEXT = (PFNGLWINDOWRECTANGLESEXTPROC)glewGetProcAddress((const GLubyte*)"glWindowRectanglesEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_window_rectangles */ + +#ifdef GL_EXT_x11_sync_object + +static GLboolean _glewInit_GL_EXT_x11_sync_object () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glStringMarkerGREMEDY = (PFNGLSTRINGMARKERGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glStringMarkerGREMEDY")) == NULL) || r; + + return r; +} + +#endif /* GL_GREMEDY_string_marker */ + +#ifdef GL_HP_image_transform + +static GLboolean _glewInit_GL_HP_image_transform () +{ + 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_IBM_multimode_draw_arrays + +static GLboolean _glewInit_GL_IBM_multimode_draw_arrays () +{ + 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_vertex_array_lists + +static GLboolean _glewInit_GL_IBM_vertex_array_lists () +{ + 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_INTEL_map_texture + +static GLboolean _glewInit_GL_INTEL_map_texture () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glBlendBarrierKHR = (PFNGLBLENDBARRIERKHRPROC)glewGetProcAddress((const GLubyte*)"glBlendBarrierKHR")) == NULL) || r; + + return r; +} + +#endif /* GL_KHR_blend_equation_advanced */ + +#ifdef GL_KHR_debug + +static GLboolean _glewInit_GL_KHR_debug () +{ + 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_robustness + +static GLboolean _glewInit_GL_KHR_robustness () +{ + 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_KTX_buffer_region + +static GLboolean _glewInit_GL_KTX_buffer_region () +{ + 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_MESA_resize_buffers + +static GLboolean _glewInit_GL_MESA_resize_buffers () +{ + 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 () +{ + 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_NVX_conditional_render + +static GLboolean _glewInit_GL_NVX_conditional_render () +{ + 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_linked_gpu_multicast + +static GLboolean _glewInit_GL_NVX_linked_gpu_multicast () +{ + GLboolean r = GL_FALSE; + + r = ((glLGPUCopyImageSubDataNVX = (PFNGLLGPUCOPYIMAGESUBDATANVXPROC)glewGetProcAddress((const GLubyte*)"glLGPUCopyImageSubDataNVX")) == NULL) || r; + r = ((glLGPUInterlockNVX = (PFNGLLGPUINTERLOCKNVXPROC)glewGetProcAddress((const GLubyte*)"glLGPUInterlockNVX")) == NULL) || r; + r = ((glLGPUNamedBufferSubDataNVX = (PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC)glewGetProcAddress((const GLubyte*)"glLGPUNamedBufferSubDataNVX")) == NULL) || r; + + return r; +} + +#endif /* GL_NVX_linked_gpu_multicast */ + +#ifdef GL_NV_bindless_multi_draw_indirect + +static GLboolean _glewInit_GL_NV_bindless_multi_draw_indirect () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_clip_space_w_scaling + +static GLboolean _glewInit_GL_NV_clip_space_w_scaling () +{ + GLboolean r = GL_FALSE; + + r = ((glViewportPositionWScaleNV = (PFNGLVIEWPORTPOSITIONWSCALENVPROC)glewGetProcAddress((const GLubyte*)"glViewportPositionWScaleNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_clip_space_w_scaling */ + +#ifdef GL_NV_command_list + +static GLboolean _glewInit_GL_NV_command_list () +{ + GLboolean r = GL_FALSE; + + r = ((glCallCommandListNV = (PFNGLCALLCOMMANDLISTNVPROC)glewGetProcAddress((const GLubyte*)"glCallCommandListNV")) == NULL) || r; + r = ((glCommandListSegmentsNV = (PFNGLCOMMANDLISTSEGMENTSNVPROC)glewGetProcAddress((const GLubyte*)"glCommandListSegmentsNV")) == NULL) || r; + r = ((glCompileCommandListNV = (PFNGLCOMPILECOMMANDLISTNVPROC)glewGetProcAddress((const GLubyte*)"glCompileCommandListNV")) == NULL) || r; + r = ((glCreateCommandListsNV = (PFNGLCREATECOMMANDLISTSNVPROC)glewGetProcAddress((const GLubyte*)"glCreateCommandListsNV")) == NULL) || r; + r = ((glCreateStatesNV = (PFNGLCREATESTATESNVPROC)glewGetProcAddress((const GLubyte*)"glCreateStatesNV")) == NULL) || r; + r = ((glDeleteCommandListsNV = (PFNGLDELETECOMMANDLISTSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteCommandListsNV")) == NULL) || r; + r = ((glDeleteStatesNV = (PFNGLDELETESTATESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteStatesNV")) == NULL) || r; + r = ((glDrawCommandsAddressNV = (PFNGLDRAWCOMMANDSADDRESSNVPROC)glewGetProcAddress((const GLubyte*)"glDrawCommandsAddressNV")) == NULL) || r; + r = ((glDrawCommandsNV = (PFNGLDRAWCOMMANDSNVPROC)glewGetProcAddress((const GLubyte*)"glDrawCommandsNV")) == NULL) || r; + r = ((glDrawCommandsStatesAddressNV = (PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC)glewGetProcAddress((const GLubyte*)"glDrawCommandsStatesAddressNV")) == NULL) || r; + r = ((glDrawCommandsStatesNV = (PFNGLDRAWCOMMANDSSTATESNVPROC)glewGetProcAddress((const GLubyte*)"glDrawCommandsStatesNV")) == NULL) || r; + r = ((glGetCommandHeaderNV = (PFNGLGETCOMMANDHEADERNVPROC)glewGetProcAddress((const GLubyte*)"glGetCommandHeaderNV")) == NULL) || r; + r = ((glGetStageIndexNV = (PFNGLGETSTAGEINDEXNVPROC)glewGetProcAddress((const GLubyte*)"glGetStageIndexNV")) == NULL) || r; + r = ((glIsCommandListNV = (PFNGLISCOMMANDLISTNVPROC)glewGetProcAddress((const GLubyte*)"glIsCommandListNV")) == NULL) || r; + r = ((glIsStateNV = (PFNGLISSTATENVPROC)glewGetProcAddress((const GLubyte*)"glIsStateNV")) == NULL) || r; + r = ((glListDrawCommandsStatesClientNV = (PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC)glewGetProcAddress((const GLubyte*)"glListDrawCommandsStatesClientNV")) == NULL) || r; + r = ((glStateCaptureNV = (PFNGLSTATECAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glStateCaptureNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_command_list */ + +#ifdef GL_NV_conditional_render + +static GLboolean _glewInit_GL_NV_conditional_render () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glSubpixelPrecisionBiasNV = (PFNGLSUBPIXELPRECISIONBIASNVPROC)glewGetProcAddress((const GLubyte*)"glSubpixelPrecisionBiasNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conservative_raster */ + +#ifdef GL_NV_conservative_raster_dilate + +static GLboolean _glewInit_GL_NV_conservative_raster_dilate () +{ + GLboolean r = GL_FALSE; + + r = ((glConservativeRasterParameterfNV = (PFNGLCONSERVATIVERASTERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glConservativeRasterParameterfNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conservative_raster_dilate */ + +#ifdef GL_NV_conservative_raster_pre_snap_triangles + +static GLboolean _glewInit_GL_NV_conservative_raster_pre_snap_triangles () +{ + GLboolean r = GL_FALSE; + + r = ((glConservativeRasterParameteriNV = (PFNGLCONSERVATIVERASTERPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glConservativeRasterParameteriNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + +#ifdef GL_NV_copy_image + +static GLboolean _glewInit_GL_NV_copy_image () +{ + GLboolean r = GL_FALSE; + + r = ((glCopyImageSubDataNV = (PFNGLCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glCopyImageSubDataNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_copy_image */ + +#ifdef GL_NV_depth_buffer_float + +static GLboolean _glewInit_GL_NV_depth_buffer_float () +{ + 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_draw_texture + +static GLboolean _glewInit_GL_NV_draw_texture () +{ + GLboolean r = GL_FALSE; + + r = ((glDrawTextureNV = (PFNGLDRAWTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glDrawTextureNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_draw_texture */ + +#ifdef GL_NV_draw_vulkan_image + +static GLboolean _glewInit_GL_NV_draw_vulkan_image () +{ + GLboolean r = GL_FALSE; + + r = ((glDrawVkImageNV = (PFNGLDRAWVKIMAGENVPROC)glewGetProcAddress((const GLubyte*)"glDrawVkImageNV")) == NULL) || r; + r = ((glGetVkProcAddrNV = (PFNGLGETVKPROCADDRNVPROC)glewGetProcAddress((const GLubyte*)"glGetVkProcAddrNV")) == NULL) || r; + r = ((glSignalVkFenceNV = (PFNGLSIGNALVKFENCENVPROC)glewGetProcAddress((const GLubyte*)"glSignalVkFenceNV")) == NULL) || r; + r = ((glSignalVkSemaphoreNV = (PFNGLSIGNALVKSEMAPHORENVPROC)glewGetProcAddress((const GLubyte*)"glSignalVkSemaphoreNV")) == NULL) || r; + r = ((glWaitVkSemaphoreNV = (PFNGLWAITVKSEMAPHORENVPROC)glewGetProcAddress((const GLubyte*)"glWaitVkSemaphoreNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_draw_vulkan_image */ + +#ifdef GL_NV_evaluators + +static GLboolean _glewInit_GL_NV_evaluators () +{ + 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 () +{ + 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 () +{ + 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_fragment_coverage_to_color + +static GLboolean _glewInit_GL_NV_fragment_coverage_to_color () +{ + 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 () +{ + 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_framebuffer_multisample_coverage + +static GLboolean _glewInit_GL_NV_framebuffer_multisample_coverage () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glProgramVertexLimitNV = (PFNGLPROGRAMVERTEXLIMITNVPROC)glewGetProcAddress((const GLubyte*)"glProgramVertexLimitNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_geometry_program4 */ + +#ifdef GL_NV_gpu_multicast + +static GLboolean _glewInit_GL_NV_gpu_multicast () +{ + GLboolean r = GL_FALSE; + + r = ((glMulticastBarrierNV = (PFNGLMULTICASTBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastBarrierNV")) == NULL) || r; + r = ((glMulticastBlitFramebufferNV = (PFNGLMULTICASTBLITFRAMEBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastBlitFramebufferNV")) == NULL) || r; + r = ((glMulticastBufferSubDataNV = (PFNGLMULTICASTBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glMulticastBufferSubDataNV")) == NULL) || r; + r = ((glMulticastCopyBufferSubDataNV = (PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glMulticastCopyBufferSubDataNV")) == NULL) || r; + r = ((glMulticastCopyImageSubDataNV = (PFNGLMULTICASTCOPYIMAGESUBDATANVPROC)glewGetProcAddress((const GLubyte*)"glMulticastCopyImageSubDataNV")) == NULL) || r; + r = ((glMulticastFramebufferSampleLocationsfvNV = (PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastFramebufferSampleLocationsfvNV")) == NULL) || r; + r = ((glMulticastGetQueryObjecti64vNV = (PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastGetQueryObjecti64vNV")) == NULL) || r; + r = ((glMulticastGetQueryObjectivNV = (PFNGLMULTICASTGETQUERYOBJECTIVNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastGetQueryObjectivNV")) == NULL) || r; + r = ((glMulticastGetQueryObjectui64vNV = (PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastGetQueryObjectui64vNV")) == NULL) || r; + r = ((glMulticastGetQueryObjectuivNV = (PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastGetQueryObjectuivNV")) == NULL) || r; + r = ((glMulticastWaitSyncNV = (PFNGLMULTICASTWAITSYNCNVPROC)glewGetProcAddress((const GLubyte*)"glMulticastWaitSyncNV")) == NULL) || r; + r = ((glRenderGpuMaskNV = (PFNGLRENDERGPUMASKNVPROC)glewGetProcAddress((const GLubyte*)"glRenderGpuMaskNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_gpu_multicast */ + +#ifdef GL_NV_gpu_program4 + +static GLboolean _glewInit_GL_NV_gpu_program4 () +{ + 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_shader5 + +static GLboolean _glewInit_GL_NV_gpu_shader5 () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glGetInternalformatSampleivNV = (PFNGLGETINTERNALFORMATSAMPLEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetInternalformatSampleivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_internalformat_sample_query */ + +#ifdef GL_NV_occlusion_query + +static GLboolean _glewInit_GL_NV_occlusion_query () +{ + 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_parameter_buffer_object + +static GLboolean _glewInit_GL_NV_parameter_buffer_object () +{ + 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_path_rendering + +static GLboolean _glewInit_GL_NV_path_rendering () +{ + 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_pixel_data_range + +static GLboolean _glewInit_GL_NV_pixel_data_range () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_shader_buffer_load + +static GLboolean _glewInit_GL_NV_shader_buffer_load () +{ + 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_texture_barrier + +static GLboolean _glewInit_GL_NV_texture_barrier () +{ + GLboolean r = GL_FALSE; + + r = ((glTextureBarrierNV = (PFNGLTEXTUREBARRIERNVPROC)glewGetProcAddress((const GLubyte*)"glTextureBarrierNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_texture_barrier */ + +#ifdef GL_NV_texture_multisample + +static GLboolean _glewInit_GL_NV_texture_multisample () +{ + 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_transform_feedback + +static GLboolean _glewInit_GL_NV_transform_feedback () +{ + 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 () +{ + 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_vdpau_interop + +static GLboolean _glewInit_GL_NV_vdpau_interop () +{ + 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 () +{ + 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_attrib_integer_64bit + +static GLboolean _glewInit_GL_NV_vertex_attrib_integer_64bit () +{ + 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 () +{ + 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 () +{ + 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_video_capture + +static GLboolean _glewInit_GL_NV_video_capture () +{ + 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_NV_viewport_swizzle + +static GLboolean _glewInit_GL_NV_viewport_swizzle () +{ + GLboolean r = GL_FALSE; + + r = ((glViewportSwizzleNV = (PFNGLVIEWPORTSWIZZLENVPROC)glewGetProcAddress((const GLubyte*)"glViewportSwizzleNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_viewport_swizzle */ + +#ifdef GL_OES_single_precision + +static GLboolean _glewInit_GL_OES_single_precision () +{ + 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_OVR_multiview + +static GLboolean _glewInit_GL_OVR_multiview () +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureMultiviewOVR")) == NULL) || r; + + return r; +} + +#endif /* GL_OVR_multiview */ + +#ifdef GL_REGAL_ES1_0_compatibility + +static GLboolean _glewInit_GL_REGAL_ES1_0_compatibility () +{ + 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 () +{ + 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_error_string + +static GLboolean _glewInit_GL_REGAL_error_string () +{ + 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 () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glGetProcAddressREGAL = (PFNGLGETPROCADDRESSREGALPROC)glewGetProcAddress((const GLubyte*)"glGetProcAddressREGAL")) == NULL) || r; + + return r; +} + +#endif /* GL_REGAL_proc_address */ + +#ifdef GL_SGIS_detail_texture + +static GLboolean _glewInit_GL_SGIS_detail_texture () +{ + 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 () +{ + 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_multisample + +static GLboolean _glewInit_GL_SGIS_multisample () +{ + 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_sharpen_texture + +static GLboolean _glewInit_GL_SGIS_sharpen_texture () +{ + 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 () +{ + 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_filter4 + +static GLboolean _glewInit_GL_SGIS_texture_filter4 () +{ + 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_SGIX_async + +static GLboolean _glewInit_GL_SGIX_async () +{ + 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_flush_raster + +static GLboolean _glewInit_GL_SGIX_flush_raster () +{ + GLboolean r = GL_FALSE; + + r = ((glFlushRasterSGIX = (PFNGLFLUSHRASTERSGIXPROC)glewGetProcAddress((const GLubyte*)"glFlushRasterSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_flush_raster */ + +#ifdef GL_SGIX_fog_texture + +static GLboolean _glewInit_GL_SGIX_fog_texture () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glFrameZoomSGIX = (PFNGLFRAMEZOOMSGIXPROC)glewGetProcAddress((const GLubyte*)"glFrameZoomSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_framezoom */ + +#ifdef GL_SGIX_pixel_texture + +static GLboolean _glewInit_GL_SGIX_pixel_texture () +{ + GLboolean r = GL_FALSE; + + r = ((glPixelTexGenSGIX = (PFNGLPIXELTEXGENSGIXPROC)glewGetProcAddress((const GLubyte*)"glPixelTexGenSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_pixel_texture */ + +#ifdef GL_SGIX_reference_plane + +static GLboolean _glewInit_GL_SGIX_reference_plane () +{ + GLboolean r = GL_FALSE; + + r = ((glReferencePlaneSGIX = (PFNGLREFERENCEPLANESGIXPROC)glewGetProcAddress((const GLubyte*)"glReferencePlaneSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_reference_plane */ + +#ifdef GL_SGIX_sprite + +static GLboolean _glewInit_GL_SGIX_sprite () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glTagSampleBufferSGIX = (PFNGLTAGSAMPLEBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glTagSampleBufferSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_tag_sample_buffer */ + +#ifdef GL_SGI_color_table + +static GLboolean _glewInit_GL_SGI_color_table () +{ + 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_SUNX_constant_data + +static GLboolean _glewInit_GL_SUNX_constant_data () +{ + GLboolean r = GL_FALSE; + + r = ((glFinishTextureSUNX = (PFNGLFINISHTEXTURESUNXPROC)glewGetProcAddress((const GLubyte*)"glFinishTextureSUNX")) == NULL) || r; + + return r; +} + +#endif /* GL_SUNX_constant_data */ + +#ifdef GL_SUN_global_alpha + +static GLboolean _glewInit_GL_SUN_global_alpha () +{ + 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_read_video_pixels + +static GLboolean _glewInit_GL_SUN_read_video_pixels () +{ + GLboolean r = GL_FALSE; + + r = ((glReadVideoPixelsSUN = (PFNGLREADVIDEOPIXELSSUNPROC)glewGetProcAddress((const GLubyte*)"glReadVideoPixelsSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_read_video_pixels */ + +#ifdef GL_SUN_triangle_list + +static GLboolean _glewInit_GL_SUN_triangle_list () +{ + 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 () +{ + 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_swap_hint + +static GLboolean _glewInit_GL_WIN_swap_hint () +{ + GLboolean r = GL_FALSE; + + r = ((glAddSwapHintRectWIN = (PFNGLADDSWAPHINTRECTWINPROC)glewGetProcAddress((const GLubyte*)"glAddSwapHintRectWIN")) == NULL) || r; + + return r; +} + +#endif /* GL_WIN_swap_hint */ + +/* ------------------------------------------------------------------------- */ + +static int _glewExtensionCompare(const char *s1, const char *s2) +{ + /* http://www.chanduthedev.com/2012/07/strcmp-implementation-in-c.html */ + while (*s1 || *s2) + { + if (*s1 > *s2) + return 1; + if (*s1 < *s2) + return -1; + s1++; + s2++; + } + return 0; +} + +static ptrdiff_t _glewBsearchExtension(const char* name) +{ + ptrdiff_t lo = 0, hi = sizeof(_glewExtensionLookup) / sizeof(char*) - 2; + + while (lo <= hi) + { + ptrdiff_t mid = (lo + hi) / 2; + const int cmp = _glewExtensionCompare(name, _glewExtensionLookup[mid]); + if (cmp < 0) hi = mid - 1; + else if (cmp > 0) lo = mid + 1; + else return mid; + } + return -1; +} + +static GLboolean *_glewGetExtensionString(const char *name) +{ + ptrdiff_t n = _glewBsearchExtension(name); + if (n >= 0) return &_glewExtensionString[n]; + return NULL; +} + +static GLboolean *_glewGetExtensionEnable(const char *name) +{ + ptrdiff_t n = _glewBsearchExtension(name); + if (n >= 0) return _glewExtensionEnabled[n]; + return NULL; +} + +static const char *_glewNextSpace(const char *i) +{ + const char *j = i; + if (j) + while (*j!=' ' && *j) ++j; + return j; +} + +static const char *_glewNextNonSpace(const char *i) +{ + const char *j = i; + if (j) + while (*j==' ') ++j; + return j; +} + +GLboolean GLEWAPIENTRY glewGetExtension (const char* name) +{ + GLboolean *enable = _glewGetExtensionString(name); + if (enable) + return *enable; + return GL_FALSE; +} + +/* ------------------------------------------------------------------------- */ + +typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GLAPIENTRY * PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params); + +static GLenum GLEWAPIENTRY glewContextInit () +{ + PFNGLGETSTRINGPROC getString; + const GLubyte* s; + GLuint dot; + GLint major, minor; + size_t n; + + #ifdef _WIN32 + getString = glGetString; + #else + getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString"); + if (!getString) + return GLEW_ERROR_NO_GL_VERSION; + #endif + + /* query opengl version */ + s = getString(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; + } + + for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n) + _glewExtensionString[n] = GL_FALSE; + + if (GLEW_VERSION_3_0) + { + GLint n = 0; + GLint i; + PFNGLGETINTEGERVPROC getIntegerv; + PFNGLGETSTRINGIPROC getStringi; + const char *ext; + GLboolean *enable; + + #ifdef _WIN32 + getIntegerv = glGetIntegerv; + #else + getIntegerv = (PFNGLGETINTEGERVPROC) glewGetProcAddress((const GLubyte*)"glGetIntegerv"); + #endif + + if (getIntegerv) + getIntegerv(GL_NUM_EXTENSIONS, &n); + + /* glGetStringi is OpenGL 3.0 */ + getStringi = (PFNGLGETSTRINGIPROC) glewGetProcAddress((const GLubyte*)"glGetStringi"); + if (getStringi) + for (i = 0; i= (ptrdiff_t) sizeof(ext)) + continue; + _glewStrCopy(ext, i, ' '); + + /* Based on extension string(s), glewGetExtension purposes */ + enable = _glewGetExtensionString(ext); + if (enable) + *enable = GL_TRUE; + + /* Based on extension string(s), experimental mode, glewIsSupported purposes */ + enable = _glewGetExtensionEnable(ext); + if (enable) + *enable = GL_TRUE; + } + } + } +#ifdef GL_VERSION_1_2 + if (glewExperimental || GLEW_VERSION_1_2) GLEW_VERSION_1_2 = !_glewInit_GL_VERSION_1_2(); +#endif /* GL_VERSION_1_2 */ +#ifdef GL_VERSION_1_3 + if (glewExperimental || GLEW_VERSION_1_3) GLEW_VERSION_1_3 = !_glewInit_GL_VERSION_1_3(); +#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(); +#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(); +#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(); +#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(); +#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(); +#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(); +#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(); +#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(); +#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(); +#endif /* GL_VERSION_4_0 */ +#ifdef GL_VERSION_4_5 + if (glewExperimental || GLEW_VERSION_4_5) GLEW_VERSION_4_5 = !_glewInit_GL_VERSION_4_5(); +#endif /* GL_VERSION_4_5 */ +#ifdef GL_3DFX_tbuffer + if (glewExperimental || GLEW_3DFX_tbuffer) GLEW_3DFX_tbuffer = !_glewInit_GL_3DFX_tbuffer(); +#endif /* GL_3DFX_tbuffer */ +#ifdef GL_AMD_debug_output + if (glewExperimental || GLEW_AMD_debug_output) GLEW_AMD_debug_output = !_glewInit_GL_AMD_debug_output(); +#endif /* GL_AMD_debug_output */ +#ifdef GL_AMD_draw_buffers_blend + if (glewExperimental || GLEW_AMD_draw_buffers_blend) GLEW_AMD_draw_buffers_blend = !_glewInit_GL_AMD_draw_buffers_blend(); +#endif /* GL_AMD_draw_buffers_blend */ +#ifdef GL_AMD_interleaved_elements + if (glewExperimental || GLEW_AMD_interleaved_elements) GLEW_AMD_interleaved_elements = !_glewInit_GL_AMD_interleaved_elements(); +#endif /* GL_AMD_interleaved_elements */ +#ifdef GL_AMD_multi_draw_indirect + if (glewExperimental || GLEW_AMD_multi_draw_indirect) GLEW_AMD_multi_draw_indirect = !_glewInit_GL_AMD_multi_draw_indirect(); +#endif /* GL_AMD_multi_draw_indirect */ +#ifdef GL_AMD_name_gen_delete + if (glewExperimental || GLEW_AMD_name_gen_delete) GLEW_AMD_name_gen_delete = !_glewInit_GL_AMD_name_gen_delete(); +#endif /* GL_AMD_name_gen_delete */ +#ifdef GL_AMD_occlusion_query_event + if (glewExperimental || GLEW_AMD_occlusion_query_event) GLEW_AMD_occlusion_query_event = !_glewInit_GL_AMD_occlusion_query_event(); +#endif /* GL_AMD_occlusion_query_event */ +#ifdef GL_AMD_performance_monitor + if (glewExperimental || GLEW_AMD_performance_monitor) GLEW_AMD_performance_monitor = !_glewInit_GL_AMD_performance_monitor(); +#endif /* GL_AMD_performance_monitor */ +#ifdef GL_AMD_sample_positions + if (glewExperimental || GLEW_AMD_sample_positions) GLEW_AMD_sample_positions = !_glewInit_GL_AMD_sample_positions(); +#endif /* GL_AMD_sample_positions */ +#ifdef GL_AMD_sparse_texture + if (glewExperimental || GLEW_AMD_sparse_texture) GLEW_AMD_sparse_texture = !_glewInit_GL_AMD_sparse_texture(); +#endif /* GL_AMD_sparse_texture */ +#ifdef GL_AMD_stencil_operation_extended + if (glewExperimental || GLEW_AMD_stencil_operation_extended) GLEW_AMD_stencil_operation_extended = !_glewInit_GL_AMD_stencil_operation_extended(); +#endif /* GL_AMD_stencil_operation_extended */ +#ifdef GL_AMD_vertex_shader_tessellator + if (glewExperimental || GLEW_AMD_vertex_shader_tessellator) GLEW_AMD_vertex_shader_tessellator = !_glewInit_GL_AMD_vertex_shader_tessellator(); +#endif /* GL_AMD_vertex_shader_tessellator */ +#ifdef GL_ANGLE_framebuffer_blit + if (glewExperimental || GLEW_ANGLE_framebuffer_blit) GLEW_ANGLE_framebuffer_blit = !_glewInit_GL_ANGLE_framebuffer_blit(); +#endif /* GL_ANGLE_framebuffer_blit */ +#ifdef GL_ANGLE_framebuffer_multisample + if (glewExperimental || GLEW_ANGLE_framebuffer_multisample) GLEW_ANGLE_framebuffer_multisample = !_glewInit_GL_ANGLE_framebuffer_multisample(); +#endif /* GL_ANGLE_framebuffer_multisample */ +#ifdef GL_ANGLE_instanced_arrays + if (glewExperimental || GLEW_ANGLE_instanced_arrays) GLEW_ANGLE_instanced_arrays = !_glewInit_GL_ANGLE_instanced_arrays(); +#endif /* GL_ANGLE_instanced_arrays */ +#ifdef GL_ANGLE_timer_query + if (glewExperimental || GLEW_ANGLE_timer_query) GLEW_ANGLE_timer_query = !_glewInit_GL_ANGLE_timer_query(); +#endif /* GL_ANGLE_timer_query */ +#ifdef GL_ANGLE_translated_shader_source + if (glewExperimental || GLEW_ANGLE_translated_shader_source) GLEW_ANGLE_translated_shader_source = !_glewInit_GL_ANGLE_translated_shader_source(); +#endif /* GL_ANGLE_translated_shader_source */ +#ifdef GL_APPLE_element_array + if (glewExperimental || GLEW_APPLE_element_array) GLEW_APPLE_element_array = !_glewInit_GL_APPLE_element_array(); +#endif /* GL_APPLE_element_array */ +#ifdef GL_APPLE_fence + if (glewExperimental || GLEW_APPLE_fence) GLEW_APPLE_fence = !_glewInit_GL_APPLE_fence(); +#endif /* GL_APPLE_fence */ +#ifdef GL_APPLE_flush_buffer_range + if (glewExperimental || GLEW_APPLE_flush_buffer_range) GLEW_APPLE_flush_buffer_range = !_glewInit_GL_APPLE_flush_buffer_range(); +#endif /* GL_APPLE_flush_buffer_range */ +#ifdef GL_APPLE_object_purgeable + if (glewExperimental || GLEW_APPLE_object_purgeable) GLEW_APPLE_object_purgeable = !_glewInit_GL_APPLE_object_purgeable(); +#endif /* GL_APPLE_object_purgeable */ +#ifdef GL_APPLE_texture_range + if (glewExperimental || GLEW_APPLE_texture_range) GLEW_APPLE_texture_range = !_glewInit_GL_APPLE_texture_range(); +#endif /* GL_APPLE_texture_range */ +#ifdef GL_APPLE_vertex_array_object + if (glewExperimental || GLEW_APPLE_vertex_array_object) GLEW_APPLE_vertex_array_object = !_glewInit_GL_APPLE_vertex_array_object(); +#endif /* GL_APPLE_vertex_array_object */ +#ifdef GL_APPLE_vertex_array_range + if (glewExperimental || GLEW_APPLE_vertex_array_range) GLEW_APPLE_vertex_array_range = !_glewInit_GL_APPLE_vertex_array_range(); +#endif /* GL_APPLE_vertex_array_range */ +#ifdef GL_APPLE_vertex_program_evaluators + if (glewExperimental || GLEW_APPLE_vertex_program_evaluators) GLEW_APPLE_vertex_program_evaluators = !_glewInit_GL_APPLE_vertex_program_evaluators(); +#endif /* GL_APPLE_vertex_program_evaluators */ +#ifdef GL_ARB_ES2_compatibility + if (glewExperimental || GLEW_ARB_ES2_compatibility) GLEW_ARB_ES2_compatibility = !_glewInit_GL_ARB_ES2_compatibility(); +#endif /* GL_ARB_ES2_compatibility */ +#ifdef GL_ARB_ES3_1_compatibility + if (glewExperimental || GLEW_ARB_ES3_1_compatibility) GLEW_ARB_ES3_1_compatibility = !_glewInit_GL_ARB_ES3_1_compatibility(); +#endif /* GL_ARB_ES3_1_compatibility */ +#ifdef GL_ARB_ES3_2_compatibility + if (glewExperimental || GLEW_ARB_ES3_2_compatibility) GLEW_ARB_ES3_2_compatibility = !_glewInit_GL_ARB_ES3_2_compatibility(); +#endif /* GL_ARB_ES3_2_compatibility */ +#ifdef GL_ARB_base_instance + if (glewExperimental || GLEW_ARB_base_instance) GLEW_ARB_base_instance = !_glewInit_GL_ARB_base_instance(); +#endif /* GL_ARB_base_instance */ +#ifdef GL_ARB_bindless_texture + if (glewExperimental || GLEW_ARB_bindless_texture) GLEW_ARB_bindless_texture = !_glewInit_GL_ARB_bindless_texture(); +#endif /* GL_ARB_bindless_texture */ +#ifdef GL_ARB_blend_func_extended + if (glewExperimental || GLEW_ARB_blend_func_extended) GLEW_ARB_blend_func_extended = !_glewInit_GL_ARB_blend_func_extended(); +#endif /* GL_ARB_blend_func_extended */ +#ifdef GL_ARB_buffer_storage + if (glewExperimental || GLEW_ARB_buffer_storage) GLEW_ARB_buffer_storage = !_glewInit_GL_ARB_buffer_storage(); +#endif /* GL_ARB_buffer_storage */ +#ifdef GL_ARB_cl_event + if (glewExperimental || GLEW_ARB_cl_event) GLEW_ARB_cl_event = !_glewInit_GL_ARB_cl_event(); +#endif /* GL_ARB_cl_event */ +#ifdef GL_ARB_clear_buffer_object + if (glewExperimental || GLEW_ARB_clear_buffer_object) GLEW_ARB_clear_buffer_object = !_glewInit_GL_ARB_clear_buffer_object(); +#endif /* GL_ARB_clear_buffer_object */ +#ifdef GL_ARB_clear_texture + if (glewExperimental || GLEW_ARB_clear_texture) GLEW_ARB_clear_texture = !_glewInit_GL_ARB_clear_texture(); +#endif /* GL_ARB_clear_texture */ +#ifdef GL_ARB_clip_control + if (glewExperimental || GLEW_ARB_clip_control) GLEW_ARB_clip_control = !_glewInit_GL_ARB_clip_control(); +#endif /* GL_ARB_clip_control */ +#ifdef GL_ARB_color_buffer_float + if (glewExperimental || GLEW_ARB_color_buffer_float) GLEW_ARB_color_buffer_float = !_glewInit_GL_ARB_color_buffer_float(); +#endif /* GL_ARB_color_buffer_float */ +#ifdef GL_ARB_compute_shader + if (glewExperimental || GLEW_ARB_compute_shader) GLEW_ARB_compute_shader = !_glewInit_GL_ARB_compute_shader(); +#endif /* GL_ARB_compute_shader */ +#ifdef 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(); +#endif /* GL_ARB_compute_variable_group_size */ +#ifdef GL_ARB_copy_buffer + if (glewExperimental || GLEW_ARB_copy_buffer) GLEW_ARB_copy_buffer = !_glewInit_GL_ARB_copy_buffer(); +#endif /* GL_ARB_copy_buffer */ +#ifdef GL_ARB_copy_image + if (glewExperimental || GLEW_ARB_copy_image) GLEW_ARB_copy_image = !_glewInit_GL_ARB_copy_image(); +#endif /* GL_ARB_copy_image */ +#ifdef GL_ARB_debug_output + if (glewExperimental || GLEW_ARB_debug_output) GLEW_ARB_debug_output = !_glewInit_GL_ARB_debug_output(); +#endif /* GL_ARB_debug_output */ +#ifdef GL_ARB_direct_state_access + if (glewExperimental || GLEW_ARB_direct_state_access) GLEW_ARB_direct_state_access = !_glewInit_GL_ARB_direct_state_access(); +#endif /* GL_ARB_direct_state_access */ +#ifdef GL_ARB_draw_buffers + if (glewExperimental || GLEW_ARB_draw_buffers) GLEW_ARB_draw_buffers = !_glewInit_GL_ARB_draw_buffers(); +#endif /* GL_ARB_draw_buffers */ +#ifdef GL_ARB_draw_buffers_blend + if (glewExperimental || GLEW_ARB_draw_buffers_blend) GLEW_ARB_draw_buffers_blend = !_glewInit_GL_ARB_draw_buffers_blend(); +#endif /* GL_ARB_draw_buffers_blend */ +#ifdef 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(); +#endif /* GL_ARB_draw_elements_base_vertex */ +#ifdef GL_ARB_draw_indirect + if (glewExperimental || GLEW_ARB_draw_indirect) GLEW_ARB_draw_indirect = !_glewInit_GL_ARB_draw_indirect(); +#endif /* GL_ARB_draw_indirect */ +#ifdef GL_ARB_framebuffer_no_attachments + if (glewExperimental || GLEW_ARB_framebuffer_no_attachments) GLEW_ARB_framebuffer_no_attachments = !_glewInit_GL_ARB_framebuffer_no_attachments(); +#endif /* GL_ARB_framebuffer_no_attachments */ +#ifdef GL_ARB_framebuffer_object + if (glewExperimental || GLEW_ARB_framebuffer_object) GLEW_ARB_framebuffer_object = !_glewInit_GL_ARB_framebuffer_object(); +#endif /* GL_ARB_framebuffer_object */ +#ifdef GL_ARB_geometry_shader4 + if (glewExperimental || GLEW_ARB_geometry_shader4) GLEW_ARB_geometry_shader4 = !_glewInit_GL_ARB_geometry_shader4(); +#endif /* GL_ARB_geometry_shader4 */ +#ifdef GL_ARB_get_program_binary + if (glewExperimental || GLEW_ARB_get_program_binary) GLEW_ARB_get_program_binary = !_glewInit_GL_ARB_get_program_binary(); +#endif /* GL_ARB_get_program_binary */ +#ifdef 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(); +#endif /* GL_ARB_get_texture_sub_image */ +#ifdef GL_ARB_gl_spirv + if (glewExperimental || GLEW_ARB_gl_spirv) GLEW_ARB_gl_spirv = !_glewInit_GL_ARB_gl_spirv(); +#endif /* GL_ARB_gl_spirv */ +#ifdef GL_ARB_gpu_shader_fp64 + if (glewExperimental || GLEW_ARB_gpu_shader_fp64) GLEW_ARB_gpu_shader_fp64 = !_glewInit_GL_ARB_gpu_shader_fp64(); +#endif /* GL_ARB_gpu_shader_fp64 */ +#ifdef GL_ARB_gpu_shader_int64 + if (glewExperimental || GLEW_ARB_gpu_shader_int64) GLEW_ARB_gpu_shader_int64 = !_glewInit_GL_ARB_gpu_shader_int64(); +#endif /* GL_ARB_gpu_shader_int64 */ +#ifdef GL_ARB_imaging + if (glewExperimental || GLEW_ARB_imaging) GLEW_ARB_imaging = !_glewInit_GL_ARB_imaging(); +#endif /* GL_ARB_imaging */ +#ifdef GL_ARB_indirect_parameters + if (glewExperimental || GLEW_ARB_indirect_parameters) GLEW_ARB_indirect_parameters = !_glewInit_GL_ARB_indirect_parameters(); +#endif /* GL_ARB_indirect_parameters */ +#ifdef GL_ARB_instanced_arrays + if (glewExperimental || GLEW_ARB_instanced_arrays) GLEW_ARB_instanced_arrays = !_glewInit_GL_ARB_instanced_arrays(); +#endif /* GL_ARB_instanced_arrays */ +#ifdef GL_ARB_internalformat_query + if (glewExperimental || GLEW_ARB_internalformat_query) GLEW_ARB_internalformat_query = !_glewInit_GL_ARB_internalformat_query(); +#endif /* GL_ARB_internalformat_query */ +#ifdef GL_ARB_internalformat_query2 + if (glewExperimental || GLEW_ARB_internalformat_query2) GLEW_ARB_internalformat_query2 = !_glewInit_GL_ARB_internalformat_query2(); +#endif /* GL_ARB_internalformat_query2 */ +#ifdef GL_ARB_invalidate_subdata + if (glewExperimental || GLEW_ARB_invalidate_subdata) GLEW_ARB_invalidate_subdata = !_glewInit_GL_ARB_invalidate_subdata(); +#endif /* GL_ARB_invalidate_subdata */ +#ifdef GL_ARB_map_buffer_range + if (glewExperimental || GLEW_ARB_map_buffer_range) GLEW_ARB_map_buffer_range = !_glewInit_GL_ARB_map_buffer_range(); +#endif /* GL_ARB_map_buffer_range */ +#ifdef GL_ARB_matrix_palette + if (glewExperimental || GLEW_ARB_matrix_palette) GLEW_ARB_matrix_palette = !_glewInit_GL_ARB_matrix_palette(); +#endif /* GL_ARB_matrix_palette */ +#ifdef GL_ARB_multi_bind + if (glewExperimental || GLEW_ARB_multi_bind) GLEW_ARB_multi_bind = !_glewInit_GL_ARB_multi_bind(); +#endif /* GL_ARB_multi_bind */ +#ifdef GL_ARB_multi_draw_indirect + if (glewExperimental || GLEW_ARB_multi_draw_indirect) GLEW_ARB_multi_draw_indirect = !_glewInit_GL_ARB_multi_draw_indirect(); +#endif /* GL_ARB_multi_draw_indirect */ +#ifdef GL_ARB_multisample + if (glewExperimental || GLEW_ARB_multisample) GLEW_ARB_multisample = !_glewInit_GL_ARB_multisample(); +#endif /* GL_ARB_multisample */ +#ifdef GL_ARB_multitexture + if (glewExperimental || GLEW_ARB_multitexture) GLEW_ARB_multitexture = !_glewInit_GL_ARB_multitexture(); +#endif /* GL_ARB_multitexture */ +#ifdef GL_ARB_occlusion_query + if (glewExperimental || GLEW_ARB_occlusion_query) GLEW_ARB_occlusion_query = !_glewInit_GL_ARB_occlusion_query(); +#endif /* GL_ARB_occlusion_query */ +#ifdef GL_ARB_parallel_shader_compile + if (glewExperimental || GLEW_ARB_parallel_shader_compile) GLEW_ARB_parallel_shader_compile = !_glewInit_GL_ARB_parallel_shader_compile(); +#endif /* GL_ARB_parallel_shader_compile */ +#ifdef GL_ARB_point_parameters + if (glewExperimental || GLEW_ARB_point_parameters) GLEW_ARB_point_parameters = !_glewInit_GL_ARB_point_parameters(); +#endif /* GL_ARB_point_parameters */ +#ifdef GL_ARB_program_interface_query + if (glewExperimental || GLEW_ARB_program_interface_query) GLEW_ARB_program_interface_query = !_glewInit_GL_ARB_program_interface_query(); +#endif /* GL_ARB_program_interface_query */ +#ifdef GL_ARB_provoking_vertex + if (glewExperimental || GLEW_ARB_provoking_vertex) GLEW_ARB_provoking_vertex = !_glewInit_GL_ARB_provoking_vertex(); +#endif /* GL_ARB_provoking_vertex */ +#ifdef GL_ARB_robustness + if (glewExperimental || GLEW_ARB_robustness) GLEW_ARB_robustness = !_glewInit_GL_ARB_robustness(); +#endif /* GL_ARB_robustness */ +#ifdef GL_ARB_sample_locations + if (glewExperimental || GLEW_ARB_sample_locations) GLEW_ARB_sample_locations = !_glewInit_GL_ARB_sample_locations(); +#endif /* GL_ARB_sample_locations */ +#ifdef GL_ARB_sample_shading + if (glewExperimental || GLEW_ARB_sample_shading) GLEW_ARB_sample_shading = !_glewInit_GL_ARB_sample_shading(); +#endif /* GL_ARB_sample_shading */ +#ifdef GL_ARB_sampler_objects + if (glewExperimental || GLEW_ARB_sampler_objects) GLEW_ARB_sampler_objects = !_glewInit_GL_ARB_sampler_objects(); +#endif /* GL_ARB_sampler_objects */ +#ifdef GL_ARB_separate_shader_objects + if (glewExperimental || GLEW_ARB_separate_shader_objects) GLEW_ARB_separate_shader_objects = !_glewInit_GL_ARB_separate_shader_objects(); +#endif /* GL_ARB_separate_shader_objects */ +#ifdef GL_ARB_shader_atomic_counters + if (glewExperimental || GLEW_ARB_shader_atomic_counters) GLEW_ARB_shader_atomic_counters = !_glewInit_GL_ARB_shader_atomic_counters(); +#endif /* GL_ARB_shader_atomic_counters */ +#ifdef 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(); +#endif /* GL_ARB_shader_image_load_store */ +#ifdef GL_ARB_shader_objects + if (glewExperimental || GLEW_ARB_shader_objects) GLEW_ARB_shader_objects = !_glewInit_GL_ARB_shader_objects(); +#endif /* GL_ARB_shader_objects */ +#ifdef 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(); +#endif /* GL_ARB_shader_storage_buffer_object */ +#ifdef GL_ARB_shader_subroutine + if (glewExperimental || GLEW_ARB_shader_subroutine) GLEW_ARB_shader_subroutine = !_glewInit_GL_ARB_shader_subroutine(); +#endif /* GL_ARB_shader_subroutine */ +#ifdef GL_ARB_shading_language_include + if (glewExperimental || GLEW_ARB_shading_language_include) GLEW_ARB_shading_language_include = !_glewInit_GL_ARB_shading_language_include(); +#endif /* GL_ARB_shading_language_include */ +#ifdef GL_ARB_sparse_buffer + if (glewExperimental || GLEW_ARB_sparse_buffer) GLEW_ARB_sparse_buffer = !_glewInit_GL_ARB_sparse_buffer(); +#endif /* GL_ARB_sparse_buffer */ +#ifdef GL_ARB_sparse_texture + if (glewExperimental || GLEW_ARB_sparse_texture) GLEW_ARB_sparse_texture = !_glewInit_GL_ARB_sparse_texture(); +#endif /* GL_ARB_sparse_texture */ +#ifdef GL_ARB_sync + if (glewExperimental || GLEW_ARB_sync) GLEW_ARB_sync = !_glewInit_GL_ARB_sync(); +#endif /* GL_ARB_sync */ +#ifdef GL_ARB_tessellation_shader + if (glewExperimental || GLEW_ARB_tessellation_shader) GLEW_ARB_tessellation_shader = !_glewInit_GL_ARB_tessellation_shader(); +#endif /* GL_ARB_tessellation_shader */ +#ifdef GL_ARB_texture_barrier + if (glewExperimental || GLEW_ARB_texture_barrier) GLEW_ARB_texture_barrier = !_glewInit_GL_ARB_texture_barrier(); +#endif /* GL_ARB_texture_barrier */ +#ifdef GL_ARB_texture_buffer_object + if (glewExperimental || GLEW_ARB_texture_buffer_object) GLEW_ARB_texture_buffer_object = !_glewInit_GL_ARB_texture_buffer_object(); +#endif /* GL_ARB_texture_buffer_object */ +#ifdef GL_ARB_texture_buffer_range + if (glewExperimental || GLEW_ARB_texture_buffer_range) GLEW_ARB_texture_buffer_range = !_glewInit_GL_ARB_texture_buffer_range(); +#endif /* GL_ARB_texture_buffer_range */ +#ifdef GL_ARB_texture_compression + if (glewExperimental || GLEW_ARB_texture_compression) GLEW_ARB_texture_compression = !_glewInit_GL_ARB_texture_compression(); +#endif /* GL_ARB_texture_compression */ +#ifdef GL_ARB_texture_multisample + if (glewExperimental || GLEW_ARB_texture_multisample) GLEW_ARB_texture_multisample = !_glewInit_GL_ARB_texture_multisample(); +#endif /* GL_ARB_texture_multisample */ +#ifdef GL_ARB_texture_storage + if (glewExperimental || GLEW_ARB_texture_storage) GLEW_ARB_texture_storage = !_glewInit_GL_ARB_texture_storage(); +#endif /* GL_ARB_texture_storage */ +#ifdef GL_ARB_texture_storage_multisample + if (glewExperimental || GLEW_ARB_texture_storage_multisample) GLEW_ARB_texture_storage_multisample = !_glewInit_GL_ARB_texture_storage_multisample(); +#endif /* GL_ARB_texture_storage_multisample */ +#ifdef GL_ARB_texture_view + if (glewExperimental || GLEW_ARB_texture_view) GLEW_ARB_texture_view = !_glewInit_GL_ARB_texture_view(); +#endif /* GL_ARB_texture_view */ +#ifdef GL_ARB_timer_query + if (glewExperimental || GLEW_ARB_timer_query) GLEW_ARB_timer_query = !_glewInit_GL_ARB_timer_query(); +#endif /* GL_ARB_timer_query */ +#ifdef GL_ARB_transform_feedback2 + if (glewExperimental || GLEW_ARB_transform_feedback2) GLEW_ARB_transform_feedback2 = !_glewInit_GL_ARB_transform_feedback2(); +#endif /* GL_ARB_transform_feedback2 */ +#ifdef GL_ARB_transform_feedback3 + if (glewExperimental || GLEW_ARB_transform_feedback3) GLEW_ARB_transform_feedback3 = !_glewInit_GL_ARB_transform_feedback3(); +#endif /* GL_ARB_transform_feedback3 */ +#ifdef GL_ARB_transform_feedback_instanced + if (glewExperimental || GLEW_ARB_transform_feedback_instanced) GLEW_ARB_transform_feedback_instanced = !_glewInit_GL_ARB_transform_feedback_instanced(); +#endif /* GL_ARB_transform_feedback_instanced */ +#ifdef GL_ARB_transpose_matrix + if (glewExperimental || GLEW_ARB_transpose_matrix) GLEW_ARB_transpose_matrix = !_glewInit_GL_ARB_transpose_matrix(); +#endif /* GL_ARB_transpose_matrix */ +#ifdef GL_ARB_uniform_buffer_object + if (glewExperimental || GLEW_ARB_uniform_buffer_object) GLEW_ARB_uniform_buffer_object = !_glewInit_GL_ARB_uniform_buffer_object(); +#endif /* GL_ARB_uniform_buffer_object */ +#ifdef GL_ARB_vertex_array_object + if (glewExperimental || GLEW_ARB_vertex_array_object) GLEW_ARB_vertex_array_object = !_glewInit_GL_ARB_vertex_array_object(); +#endif /* GL_ARB_vertex_array_object */ +#ifdef GL_ARB_vertex_attrib_64bit + if (glewExperimental || GLEW_ARB_vertex_attrib_64bit) GLEW_ARB_vertex_attrib_64bit = !_glewInit_GL_ARB_vertex_attrib_64bit(); +#endif /* GL_ARB_vertex_attrib_64bit */ +#ifdef GL_ARB_vertex_attrib_binding + if (glewExperimental || GLEW_ARB_vertex_attrib_binding) GLEW_ARB_vertex_attrib_binding = !_glewInit_GL_ARB_vertex_attrib_binding(); +#endif /* GL_ARB_vertex_attrib_binding */ +#ifdef GL_ARB_vertex_blend + if (glewExperimental || GLEW_ARB_vertex_blend) GLEW_ARB_vertex_blend = !_glewInit_GL_ARB_vertex_blend(); +#endif /* GL_ARB_vertex_blend */ +#ifdef GL_ARB_vertex_buffer_object + if (glewExperimental || GLEW_ARB_vertex_buffer_object) GLEW_ARB_vertex_buffer_object = !_glewInit_GL_ARB_vertex_buffer_object(); +#endif /* GL_ARB_vertex_buffer_object */ +#ifdef GL_ARB_vertex_program + if (glewExperimental || GLEW_ARB_vertex_program) GLEW_ARB_vertex_program = !_glewInit_GL_ARB_vertex_program(); +#endif /* GL_ARB_vertex_program */ +#ifdef GL_ARB_vertex_shader + if (glewExperimental || GLEW_ARB_vertex_shader) { GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(); _glewInit_GL_ARB_vertex_program(); } +#endif /* GL_ARB_vertex_shader */ +#ifdef 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(); +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ +#ifdef GL_ARB_viewport_array + if (glewExperimental || GLEW_ARB_viewport_array) GLEW_ARB_viewport_array = !_glewInit_GL_ARB_viewport_array(); +#endif /* GL_ARB_viewport_array */ +#ifdef GL_ARB_window_pos + if (glewExperimental || GLEW_ARB_window_pos) GLEW_ARB_window_pos = !_glewInit_GL_ARB_window_pos(); +#endif /* GL_ARB_window_pos */ +#ifdef GL_ATI_draw_buffers + if (glewExperimental || GLEW_ATI_draw_buffers) GLEW_ATI_draw_buffers = !_glewInit_GL_ATI_draw_buffers(); +#endif /* GL_ATI_draw_buffers */ +#ifdef GL_ATI_element_array + if (glewExperimental || GLEW_ATI_element_array) GLEW_ATI_element_array = !_glewInit_GL_ATI_element_array(); +#endif /* GL_ATI_element_array */ +#ifdef GL_ATI_envmap_bumpmap + if (glewExperimental || GLEW_ATI_envmap_bumpmap) GLEW_ATI_envmap_bumpmap = !_glewInit_GL_ATI_envmap_bumpmap(); +#endif /* GL_ATI_envmap_bumpmap */ +#ifdef GL_ATI_fragment_shader + if (glewExperimental || GLEW_ATI_fragment_shader) GLEW_ATI_fragment_shader = !_glewInit_GL_ATI_fragment_shader(); +#endif /* GL_ATI_fragment_shader */ +#ifdef GL_ATI_map_object_buffer + if (glewExperimental || GLEW_ATI_map_object_buffer) GLEW_ATI_map_object_buffer = !_glewInit_GL_ATI_map_object_buffer(); +#endif /* GL_ATI_map_object_buffer */ +#ifdef GL_ATI_pn_triangles + if (glewExperimental || GLEW_ATI_pn_triangles) GLEW_ATI_pn_triangles = !_glewInit_GL_ATI_pn_triangles(); +#endif /* GL_ATI_pn_triangles */ +#ifdef GL_ATI_separate_stencil + if (glewExperimental || GLEW_ATI_separate_stencil) GLEW_ATI_separate_stencil = !_glewInit_GL_ATI_separate_stencil(); +#endif /* GL_ATI_separate_stencil */ +#ifdef GL_ATI_vertex_array_object + if (glewExperimental || GLEW_ATI_vertex_array_object) GLEW_ATI_vertex_array_object = !_glewInit_GL_ATI_vertex_array_object(); +#endif /* GL_ATI_vertex_array_object */ +#ifdef 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(); +#endif /* GL_ATI_vertex_attrib_array_object */ +#ifdef GL_ATI_vertex_streams + if (glewExperimental || GLEW_ATI_vertex_streams) GLEW_ATI_vertex_streams = !_glewInit_GL_ATI_vertex_streams(); +#endif /* GL_ATI_vertex_streams */ +#ifdef GL_EXT_bindable_uniform + if (glewExperimental || GLEW_EXT_bindable_uniform) GLEW_EXT_bindable_uniform = !_glewInit_GL_EXT_bindable_uniform(); +#endif /* GL_EXT_bindable_uniform */ +#ifdef GL_EXT_blend_color + if (glewExperimental || GLEW_EXT_blend_color) GLEW_EXT_blend_color = !_glewInit_GL_EXT_blend_color(); +#endif /* GL_EXT_blend_color */ +#ifdef GL_EXT_blend_equation_separate + if (glewExperimental || GLEW_EXT_blend_equation_separate) GLEW_EXT_blend_equation_separate = !_glewInit_GL_EXT_blend_equation_separate(); +#endif /* GL_EXT_blend_equation_separate */ +#ifdef GL_EXT_blend_func_separate + if (glewExperimental || GLEW_EXT_blend_func_separate) GLEW_EXT_blend_func_separate = !_glewInit_GL_EXT_blend_func_separate(); +#endif /* GL_EXT_blend_func_separate */ +#ifdef GL_EXT_blend_minmax + if (glewExperimental || GLEW_EXT_blend_minmax) GLEW_EXT_blend_minmax = !_glewInit_GL_EXT_blend_minmax(); +#endif /* GL_EXT_blend_minmax */ +#ifdef GL_EXT_color_subtable + if (glewExperimental || GLEW_EXT_color_subtable) GLEW_EXT_color_subtable = !_glewInit_GL_EXT_color_subtable(); +#endif /* GL_EXT_color_subtable */ +#ifdef GL_EXT_compiled_vertex_array + if (glewExperimental || GLEW_EXT_compiled_vertex_array) GLEW_EXT_compiled_vertex_array = !_glewInit_GL_EXT_compiled_vertex_array(); +#endif /* GL_EXT_compiled_vertex_array */ +#ifdef GL_EXT_convolution + if (glewExperimental || GLEW_EXT_convolution) GLEW_EXT_convolution = !_glewInit_GL_EXT_convolution(); +#endif /* GL_EXT_convolution */ +#ifdef GL_EXT_coordinate_frame + if (glewExperimental || GLEW_EXT_coordinate_frame) GLEW_EXT_coordinate_frame = !_glewInit_GL_EXT_coordinate_frame(); +#endif /* GL_EXT_coordinate_frame */ +#ifdef GL_EXT_copy_texture + if (glewExperimental || GLEW_EXT_copy_texture) GLEW_EXT_copy_texture = !_glewInit_GL_EXT_copy_texture(); +#endif /* GL_EXT_copy_texture */ +#ifdef GL_EXT_cull_vertex + if (glewExperimental || GLEW_EXT_cull_vertex) GLEW_EXT_cull_vertex = !_glewInit_GL_EXT_cull_vertex(); +#endif /* GL_EXT_cull_vertex */ +#ifdef GL_EXT_debug_label + if (glewExperimental || GLEW_EXT_debug_label) GLEW_EXT_debug_label = !_glewInit_GL_EXT_debug_label(); +#endif /* GL_EXT_debug_label */ +#ifdef GL_EXT_debug_marker + if (glewExperimental || GLEW_EXT_debug_marker) GLEW_EXT_debug_marker = !_glewInit_GL_EXT_debug_marker(); +#endif /* GL_EXT_debug_marker */ +#ifdef GL_EXT_depth_bounds_test + if (glewExperimental || GLEW_EXT_depth_bounds_test) GLEW_EXT_depth_bounds_test = !_glewInit_GL_EXT_depth_bounds_test(); +#endif /* GL_EXT_depth_bounds_test */ +#ifdef GL_EXT_direct_state_access + if (glewExperimental || GLEW_EXT_direct_state_access) GLEW_EXT_direct_state_access = !_glewInit_GL_EXT_direct_state_access(); +#endif /* GL_EXT_direct_state_access */ +#ifdef GL_EXT_draw_buffers2 + if (glewExperimental || GLEW_EXT_draw_buffers2) GLEW_EXT_draw_buffers2 = !_glewInit_GL_EXT_draw_buffers2(); +#endif /* GL_EXT_draw_buffers2 */ +#ifdef GL_EXT_draw_instanced + if (glewExperimental || GLEW_EXT_draw_instanced) GLEW_EXT_draw_instanced = !_glewInit_GL_EXT_draw_instanced(); +#endif /* GL_EXT_draw_instanced */ +#ifdef GL_EXT_draw_range_elements + if (glewExperimental || GLEW_EXT_draw_range_elements) GLEW_EXT_draw_range_elements = !_glewInit_GL_EXT_draw_range_elements(); +#endif /* GL_EXT_draw_range_elements */ +#ifdef GL_EXT_fog_coord + if (glewExperimental || GLEW_EXT_fog_coord) GLEW_EXT_fog_coord = !_glewInit_GL_EXT_fog_coord(); +#endif /* GL_EXT_fog_coord */ +#ifdef GL_EXT_fragment_lighting + if (glewExperimental || GLEW_EXT_fragment_lighting) GLEW_EXT_fragment_lighting = !_glewInit_GL_EXT_fragment_lighting(); +#endif /* GL_EXT_fragment_lighting */ +#ifdef GL_EXT_framebuffer_blit + if (glewExperimental || GLEW_EXT_framebuffer_blit) GLEW_EXT_framebuffer_blit = !_glewInit_GL_EXT_framebuffer_blit(); +#endif /* GL_EXT_framebuffer_blit */ +#ifdef GL_EXT_framebuffer_multisample + if (glewExperimental || GLEW_EXT_framebuffer_multisample) GLEW_EXT_framebuffer_multisample = !_glewInit_GL_EXT_framebuffer_multisample(); +#endif /* GL_EXT_framebuffer_multisample */ +#ifdef GL_EXT_framebuffer_object + if (glewExperimental || GLEW_EXT_framebuffer_object) GLEW_EXT_framebuffer_object = !_glewInit_GL_EXT_framebuffer_object(); +#endif /* GL_EXT_framebuffer_object */ +#ifdef GL_EXT_geometry_shader4 + if (glewExperimental || GLEW_EXT_geometry_shader4) GLEW_EXT_geometry_shader4 = !_glewInit_GL_EXT_geometry_shader4(); +#endif /* GL_EXT_geometry_shader4 */ +#ifdef GL_EXT_gpu_program_parameters + if (glewExperimental || GLEW_EXT_gpu_program_parameters) GLEW_EXT_gpu_program_parameters = !_glewInit_GL_EXT_gpu_program_parameters(); +#endif /* GL_EXT_gpu_program_parameters */ +#ifdef GL_EXT_gpu_shader4 + if (glewExperimental || GLEW_EXT_gpu_shader4) GLEW_EXT_gpu_shader4 = !_glewInit_GL_EXT_gpu_shader4(); +#endif /* GL_EXT_gpu_shader4 */ +#ifdef GL_EXT_histogram + if (glewExperimental || GLEW_EXT_histogram) GLEW_EXT_histogram = !_glewInit_GL_EXT_histogram(); +#endif /* GL_EXT_histogram */ +#ifdef GL_EXT_index_func + if (glewExperimental || GLEW_EXT_index_func) GLEW_EXT_index_func = !_glewInit_GL_EXT_index_func(); +#endif /* GL_EXT_index_func */ +#ifdef GL_EXT_index_material + if (glewExperimental || GLEW_EXT_index_material) GLEW_EXT_index_material = !_glewInit_GL_EXT_index_material(); +#endif /* GL_EXT_index_material */ +#ifdef GL_EXT_light_texture + if (glewExperimental || GLEW_EXT_light_texture) GLEW_EXT_light_texture = !_glewInit_GL_EXT_light_texture(); +#endif /* GL_EXT_light_texture */ +#ifdef GL_EXT_multi_draw_arrays + if (glewExperimental || GLEW_EXT_multi_draw_arrays) GLEW_EXT_multi_draw_arrays = !_glewInit_GL_EXT_multi_draw_arrays(); +#endif /* GL_EXT_multi_draw_arrays */ +#ifdef GL_EXT_multisample + if (glewExperimental || GLEW_EXT_multisample) GLEW_EXT_multisample = !_glewInit_GL_EXT_multisample(); +#endif /* GL_EXT_multisample */ +#ifdef GL_EXT_paletted_texture + if (glewExperimental || GLEW_EXT_paletted_texture) GLEW_EXT_paletted_texture = !_glewInit_GL_EXT_paletted_texture(); +#endif /* GL_EXT_paletted_texture */ +#ifdef GL_EXT_pixel_transform + if (glewExperimental || GLEW_EXT_pixel_transform) GLEW_EXT_pixel_transform = !_glewInit_GL_EXT_pixel_transform(); +#endif /* GL_EXT_pixel_transform */ +#ifdef GL_EXT_point_parameters + if (glewExperimental || GLEW_EXT_point_parameters) GLEW_EXT_point_parameters = !_glewInit_GL_EXT_point_parameters(); +#endif /* GL_EXT_point_parameters */ +#ifdef GL_EXT_polygon_offset + if (glewExperimental || GLEW_EXT_polygon_offset) GLEW_EXT_polygon_offset = !_glewInit_GL_EXT_polygon_offset(); +#endif /* GL_EXT_polygon_offset */ +#ifdef GL_EXT_polygon_offset_clamp + if (glewExperimental || GLEW_EXT_polygon_offset_clamp) GLEW_EXT_polygon_offset_clamp = !_glewInit_GL_EXT_polygon_offset_clamp(); +#endif /* GL_EXT_polygon_offset_clamp */ +#ifdef GL_EXT_provoking_vertex + if (glewExperimental || GLEW_EXT_provoking_vertex) GLEW_EXT_provoking_vertex = !_glewInit_GL_EXT_provoking_vertex(); +#endif /* GL_EXT_provoking_vertex */ +#ifdef GL_EXT_raster_multisample + if (glewExperimental || GLEW_EXT_raster_multisample) GLEW_EXT_raster_multisample = !_glewInit_GL_EXT_raster_multisample(); +#endif /* GL_EXT_raster_multisample */ +#ifdef GL_EXT_scene_marker + if (glewExperimental || GLEW_EXT_scene_marker) GLEW_EXT_scene_marker = !_glewInit_GL_EXT_scene_marker(); +#endif /* GL_EXT_scene_marker */ +#ifdef GL_EXT_secondary_color + if (glewExperimental || GLEW_EXT_secondary_color) GLEW_EXT_secondary_color = !_glewInit_GL_EXT_secondary_color(); +#endif /* GL_EXT_secondary_color */ +#ifdef GL_EXT_separate_shader_objects + if (glewExperimental || GLEW_EXT_separate_shader_objects) GLEW_EXT_separate_shader_objects = !_glewInit_GL_EXT_separate_shader_objects(); +#endif /* GL_EXT_separate_shader_objects */ +#ifdef 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(); +#endif /* GL_EXT_shader_image_load_store */ +#ifdef GL_EXT_stencil_two_side + if (glewExperimental || GLEW_EXT_stencil_two_side) GLEW_EXT_stencil_two_side = !_glewInit_GL_EXT_stencil_two_side(); +#endif /* GL_EXT_stencil_two_side */ +#ifdef GL_EXT_subtexture + if (glewExperimental || GLEW_EXT_subtexture) GLEW_EXT_subtexture = !_glewInit_GL_EXT_subtexture(); +#endif /* GL_EXT_subtexture */ +#ifdef GL_EXT_texture3D + if (glewExperimental || GLEW_EXT_texture3D) GLEW_EXT_texture3D = !_glewInit_GL_EXT_texture3D(); +#endif /* GL_EXT_texture3D */ +#ifdef GL_EXT_texture_array + if (glewExperimental || GLEW_EXT_texture_array) GLEW_EXT_texture_array = !_glewInit_GL_EXT_texture_array(); +#endif /* GL_EXT_texture_array */ +#ifdef GL_EXT_texture_buffer_object + if (glewExperimental || GLEW_EXT_texture_buffer_object) GLEW_EXT_texture_buffer_object = !_glewInit_GL_EXT_texture_buffer_object(); +#endif /* GL_EXT_texture_buffer_object */ +#ifdef GL_EXT_texture_integer + if (glewExperimental || GLEW_EXT_texture_integer) GLEW_EXT_texture_integer = !_glewInit_GL_EXT_texture_integer(); +#endif /* GL_EXT_texture_integer */ +#ifdef GL_EXT_texture_object + if (glewExperimental || GLEW_EXT_texture_object) GLEW_EXT_texture_object = !_glewInit_GL_EXT_texture_object(); +#endif /* GL_EXT_texture_object */ +#ifdef GL_EXT_texture_perturb_normal + if (glewExperimental || GLEW_EXT_texture_perturb_normal) GLEW_EXT_texture_perturb_normal = !_glewInit_GL_EXT_texture_perturb_normal(); +#endif /* GL_EXT_texture_perturb_normal */ +#ifdef GL_EXT_timer_query + if (glewExperimental || GLEW_EXT_timer_query) GLEW_EXT_timer_query = !_glewInit_GL_EXT_timer_query(); +#endif /* GL_EXT_timer_query */ +#ifdef GL_EXT_transform_feedback + if (glewExperimental || GLEW_EXT_transform_feedback) GLEW_EXT_transform_feedback = !_glewInit_GL_EXT_transform_feedback(); +#endif /* GL_EXT_transform_feedback */ +#ifdef GL_EXT_vertex_array + if (glewExperimental || GLEW_EXT_vertex_array) GLEW_EXT_vertex_array = !_glewInit_GL_EXT_vertex_array(); +#endif /* GL_EXT_vertex_array */ +#ifdef GL_EXT_vertex_attrib_64bit + if (glewExperimental || GLEW_EXT_vertex_attrib_64bit) GLEW_EXT_vertex_attrib_64bit = !_glewInit_GL_EXT_vertex_attrib_64bit(); +#endif /* GL_EXT_vertex_attrib_64bit */ +#ifdef GL_EXT_vertex_shader + if (glewExperimental || GLEW_EXT_vertex_shader) GLEW_EXT_vertex_shader = !_glewInit_GL_EXT_vertex_shader(); +#endif /* GL_EXT_vertex_shader */ +#ifdef GL_EXT_vertex_weighting + if (glewExperimental || GLEW_EXT_vertex_weighting) GLEW_EXT_vertex_weighting = !_glewInit_GL_EXT_vertex_weighting(); +#endif /* GL_EXT_vertex_weighting */ +#ifdef GL_EXT_window_rectangles + if (glewExperimental || GLEW_EXT_window_rectangles) GLEW_EXT_window_rectangles = !_glewInit_GL_EXT_window_rectangles(); +#endif /* GL_EXT_window_rectangles */ +#ifdef GL_EXT_x11_sync_object + if (glewExperimental || GLEW_EXT_x11_sync_object) GLEW_EXT_x11_sync_object = !_glewInit_GL_EXT_x11_sync_object(); +#endif /* GL_EXT_x11_sync_object */ +#ifdef GL_GREMEDY_frame_terminator + if (glewExperimental || GLEW_GREMEDY_frame_terminator) GLEW_GREMEDY_frame_terminator = !_glewInit_GL_GREMEDY_frame_terminator(); +#endif /* GL_GREMEDY_frame_terminator */ +#ifdef GL_GREMEDY_string_marker + if (glewExperimental || GLEW_GREMEDY_string_marker) GLEW_GREMEDY_string_marker = !_glewInit_GL_GREMEDY_string_marker(); +#endif /* GL_GREMEDY_string_marker */ +#ifdef GL_HP_image_transform + if (glewExperimental || GLEW_HP_image_transform) GLEW_HP_image_transform = !_glewInit_GL_HP_image_transform(); +#endif /* GL_HP_image_transform */ +#ifdef GL_IBM_multimode_draw_arrays + if (glewExperimental || GLEW_IBM_multimode_draw_arrays) GLEW_IBM_multimode_draw_arrays = !_glewInit_GL_IBM_multimode_draw_arrays(); +#endif /* GL_IBM_multimode_draw_arrays */ +#ifdef GL_IBM_vertex_array_lists + if (glewExperimental || GLEW_IBM_vertex_array_lists) GLEW_IBM_vertex_array_lists = !_glewInit_GL_IBM_vertex_array_lists(); +#endif /* GL_IBM_vertex_array_lists */ +#ifdef GL_INTEL_map_texture + if (glewExperimental || GLEW_INTEL_map_texture) GLEW_INTEL_map_texture = !_glewInit_GL_INTEL_map_texture(); +#endif /* GL_INTEL_map_texture */ +#ifdef GL_INTEL_parallel_arrays + if (glewExperimental || GLEW_INTEL_parallel_arrays) GLEW_INTEL_parallel_arrays = !_glewInit_GL_INTEL_parallel_arrays(); +#endif /* GL_INTEL_parallel_arrays */ +#ifdef GL_INTEL_performance_query + if (glewExperimental || GLEW_INTEL_performance_query) GLEW_INTEL_performance_query = !_glewInit_GL_INTEL_performance_query(); +#endif /* GL_INTEL_performance_query */ +#ifdef GL_INTEL_texture_scissor + if (glewExperimental || GLEW_INTEL_texture_scissor) GLEW_INTEL_texture_scissor = !_glewInit_GL_INTEL_texture_scissor(); +#endif /* GL_INTEL_texture_scissor */ +#ifdef GL_KHR_blend_equation_advanced + if (glewExperimental || GLEW_KHR_blend_equation_advanced) GLEW_KHR_blend_equation_advanced = !_glewInit_GL_KHR_blend_equation_advanced(); +#endif /* GL_KHR_blend_equation_advanced */ +#ifdef GL_KHR_debug + if (glewExperimental || GLEW_KHR_debug) GLEW_KHR_debug = !_glewInit_GL_KHR_debug(); +#endif /* GL_KHR_debug */ +#ifdef GL_KHR_robustness + if (glewExperimental || GLEW_KHR_robustness) GLEW_KHR_robustness = !_glewInit_GL_KHR_robustness(); +#endif /* GL_KHR_robustness */ +#ifdef GL_KTX_buffer_region + if (glewExperimental || GLEW_KTX_buffer_region) GLEW_KTX_buffer_region = !_glewInit_GL_KTX_buffer_region(); +#endif /* GL_KTX_buffer_region */ +#ifdef GL_MESA_resize_buffers + if (glewExperimental || GLEW_MESA_resize_buffers) GLEW_MESA_resize_buffers = !_glewInit_GL_MESA_resize_buffers(); +#endif /* GL_MESA_resize_buffers */ +#ifdef GL_MESA_window_pos + if (glewExperimental || GLEW_MESA_window_pos) GLEW_MESA_window_pos = !_glewInit_GL_MESA_window_pos(); +#endif /* GL_MESA_window_pos */ +#ifdef GL_NVX_conditional_render + if (glewExperimental || GLEW_NVX_conditional_render) GLEW_NVX_conditional_render = !_glewInit_GL_NVX_conditional_render(); +#endif /* GL_NVX_conditional_render */ +#ifdef GL_NVX_linked_gpu_multicast + if (glewExperimental || GLEW_NVX_linked_gpu_multicast) GLEW_NVX_linked_gpu_multicast = !_glewInit_GL_NVX_linked_gpu_multicast(); +#endif /* GL_NVX_linked_gpu_multicast */ +#ifdef 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(); +#endif /* GL_NV_bindless_multi_draw_indirect */ +#ifdef 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(); +#endif /* GL_NV_bindless_multi_draw_indirect_count */ +#ifdef GL_NV_bindless_texture + if (glewExperimental || GLEW_NV_bindless_texture) GLEW_NV_bindless_texture = !_glewInit_GL_NV_bindless_texture(); +#endif /* GL_NV_bindless_texture */ +#ifdef GL_NV_blend_equation_advanced + if (glewExperimental || GLEW_NV_blend_equation_advanced) GLEW_NV_blend_equation_advanced = !_glewInit_GL_NV_blend_equation_advanced(); +#endif /* GL_NV_blend_equation_advanced */ +#ifdef GL_NV_clip_space_w_scaling + if (glewExperimental || GLEW_NV_clip_space_w_scaling) GLEW_NV_clip_space_w_scaling = !_glewInit_GL_NV_clip_space_w_scaling(); +#endif /* GL_NV_clip_space_w_scaling */ +#ifdef GL_NV_command_list + if (glewExperimental || GLEW_NV_command_list) GLEW_NV_command_list = !_glewInit_GL_NV_command_list(); +#endif /* GL_NV_command_list */ +#ifdef GL_NV_conditional_render + if (glewExperimental || GLEW_NV_conditional_render) GLEW_NV_conditional_render = !_glewInit_GL_NV_conditional_render(); +#endif /* GL_NV_conditional_render */ +#ifdef GL_NV_conservative_raster + if (glewExperimental || GLEW_NV_conservative_raster) GLEW_NV_conservative_raster = !_glewInit_GL_NV_conservative_raster(); +#endif /* GL_NV_conservative_raster */ +#ifdef GL_NV_conservative_raster_dilate + if (glewExperimental || GLEW_NV_conservative_raster_dilate) GLEW_NV_conservative_raster_dilate = !_glewInit_GL_NV_conservative_raster_dilate(); +#endif /* GL_NV_conservative_raster_dilate */ +#ifdef GL_NV_conservative_raster_pre_snap_triangles + if (glewExperimental || GLEW_NV_conservative_raster_pre_snap_triangles) GLEW_NV_conservative_raster_pre_snap_triangles = !_glewInit_GL_NV_conservative_raster_pre_snap_triangles(); +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ +#ifdef GL_NV_copy_image + if (glewExperimental || GLEW_NV_copy_image) GLEW_NV_copy_image = !_glewInit_GL_NV_copy_image(); +#endif /* GL_NV_copy_image */ +#ifdef GL_NV_depth_buffer_float + if (glewExperimental || GLEW_NV_depth_buffer_float) GLEW_NV_depth_buffer_float = !_glewInit_GL_NV_depth_buffer_float(); +#endif /* GL_NV_depth_buffer_float */ +#ifdef GL_NV_draw_texture + if (glewExperimental || GLEW_NV_draw_texture) GLEW_NV_draw_texture = !_glewInit_GL_NV_draw_texture(); +#endif /* GL_NV_draw_texture */ +#ifdef GL_NV_draw_vulkan_image + if (glewExperimental || GLEW_NV_draw_vulkan_image) GLEW_NV_draw_vulkan_image = !_glewInit_GL_NV_draw_vulkan_image(); +#endif /* GL_NV_draw_vulkan_image */ +#ifdef GL_NV_evaluators + if (glewExperimental || GLEW_NV_evaluators) GLEW_NV_evaluators = !_glewInit_GL_NV_evaluators(); +#endif /* GL_NV_evaluators */ +#ifdef GL_NV_explicit_multisample + if (glewExperimental || GLEW_NV_explicit_multisample) GLEW_NV_explicit_multisample = !_glewInit_GL_NV_explicit_multisample(); +#endif /* GL_NV_explicit_multisample */ +#ifdef GL_NV_fence + if (glewExperimental || GLEW_NV_fence) GLEW_NV_fence = !_glewInit_GL_NV_fence(); +#endif /* GL_NV_fence */ +#ifdef 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(); +#endif /* GL_NV_fragment_coverage_to_color */ +#ifdef GL_NV_fragment_program + if (glewExperimental || GLEW_NV_fragment_program) GLEW_NV_fragment_program = !_glewInit_GL_NV_fragment_program(); +#endif /* GL_NV_fragment_program */ +#ifdef GL_NV_framebuffer_multisample_coverage + if (glewExperimental || GLEW_NV_framebuffer_multisample_coverage) GLEW_NV_framebuffer_multisample_coverage = !_glewInit_GL_NV_framebuffer_multisample_coverage(); +#endif /* GL_NV_framebuffer_multisample_coverage */ +#ifdef GL_NV_geometry_program4 + if (glewExperimental || GLEW_NV_geometry_program4) GLEW_NV_geometry_program4 = !_glewInit_GL_NV_geometry_program4(); +#endif /* GL_NV_geometry_program4 */ +#ifdef GL_NV_gpu_multicast + if (glewExperimental || GLEW_NV_gpu_multicast) GLEW_NV_gpu_multicast = !_glewInit_GL_NV_gpu_multicast(); +#endif /* GL_NV_gpu_multicast */ +#ifdef GL_NV_gpu_program4 + if (glewExperimental || GLEW_NV_gpu_program4) GLEW_NV_gpu_program4 = !_glewInit_GL_NV_gpu_program4(); +#endif /* GL_NV_gpu_program4 */ +#ifdef GL_NV_gpu_shader5 + if (glewExperimental || GLEW_NV_gpu_shader5) GLEW_NV_gpu_shader5 = !_glewInit_GL_NV_gpu_shader5(); +#endif /* GL_NV_gpu_shader5 */ +#ifdef GL_NV_half_float + if (glewExperimental || GLEW_NV_half_float) GLEW_NV_half_float = !_glewInit_GL_NV_half_float(); +#endif /* GL_NV_half_float */ +#ifdef GL_NV_internalformat_sample_query + if (glewExperimental || GLEW_NV_internalformat_sample_query) GLEW_NV_internalformat_sample_query = !_glewInit_GL_NV_internalformat_sample_query(); +#endif /* GL_NV_internalformat_sample_query */ +#ifdef GL_NV_occlusion_query + if (glewExperimental || GLEW_NV_occlusion_query) GLEW_NV_occlusion_query = !_glewInit_GL_NV_occlusion_query(); +#endif /* GL_NV_occlusion_query */ +#ifdef GL_NV_parameter_buffer_object + if (glewExperimental || GLEW_NV_parameter_buffer_object) GLEW_NV_parameter_buffer_object = !_glewInit_GL_NV_parameter_buffer_object(); +#endif /* GL_NV_parameter_buffer_object */ +#ifdef GL_NV_path_rendering + if (glewExperimental || GLEW_NV_path_rendering) GLEW_NV_path_rendering = !_glewInit_GL_NV_path_rendering(); +#endif /* GL_NV_path_rendering */ +#ifdef GL_NV_pixel_data_range + if (glewExperimental || GLEW_NV_pixel_data_range) GLEW_NV_pixel_data_range = !_glewInit_GL_NV_pixel_data_range(); +#endif /* GL_NV_pixel_data_range */ +#ifdef GL_NV_point_sprite + if (glewExperimental || GLEW_NV_point_sprite) GLEW_NV_point_sprite = !_glewInit_GL_NV_point_sprite(); +#endif /* GL_NV_point_sprite */ +#ifdef GL_NV_present_video + if (glewExperimental || GLEW_NV_present_video) GLEW_NV_present_video = !_glewInit_GL_NV_present_video(); +#endif /* GL_NV_present_video */ +#ifdef GL_NV_primitive_restart + if (glewExperimental || GLEW_NV_primitive_restart) GLEW_NV_primitive_restart = !_glewInit_GL_NV_primitive_restart(); +#endif /* GL_NV_primitive_restart */ +#ifdef GL_NV_register_combiners + if (glewExperimental || GLEW_NV_register_combiners) GLEW_NV_register_combiners = !_glewInit_GL_NV_register_combiners(); +#endif /* GL_NV_register_combiners */ +#ifdef GL_NV_register_combiners2 + if (glewExperimental || GLEW_NV_register_combiners2) GLEW_NV_register_combiners2 = !_glewInit_GL_NV_register_combiners2(); +#endif /* GL_NV_register_combiners2 */ +#ifdef GL_NV_sample_locations + if (glewExperimental || GLEW_NV_sample_locations) GLEW_NV_sample_locations = !_glewInit_GL_NV_sample_locations(); +#endif /* GL_NV_sample_locations */ +#ifdef GL_NV_shader_buffer_load + if (glewExperimental || GLEW_NV_shader_buffer_load) GLEW_NV_shader_buffer_load = !_glewInit_GL_NV_shader_buffer_load(); +#endif /* GL_NV_shader_buffer_load */ +#ifdef GL_NV_texture_barrier + if (glewExperimental || GLEW_NV_texture_barrier) GLEW_NV_texture_barrier = !_glewInit_GL_NV_texture_barrier(); +#endif /* GL_NV_texture_barrier */ +#ifdef GL_NV_texture_multisample + if (glewExperimental || GLEW_NV_texture_multisample) GLEW_NV_texture_multisample = !_glewInit_GL_NV_texture_multisample(); +#endif /* GL_NV_texture_multisample */ +#ifdef GL_NV_transform_feedback + if (glewExperimental || GLEW_NV_transform_feedback) GLEW_NV_transform_feedback = !_glewInit_GL_NV_transform_feedback(); +#endif /* GL_NV_transform_feedback */ +#ifdef GL_NV_transform_feedback2 + if (glewExperimental || GLEW_NV_transform_feedback2) GLEW_NV_transform_feedback2 = !_glewInit_GL_NV_transform_feedback2(); +#endif /* GL_NV_transform_feedback2 */ +#ifdef GL_NV_vdpau_interop + if (glewExperimental || GLEW_NV_vdpau_interop) GLEW_NV_vdpau_interop = !_glewInit_GL_NV_vdpau_interop(); +#endif /* GL_NV_vdpau_interop */ +#ifdef GL_NV_vertex_array_range + if (glewExperimental || GLEW_NV_vertex_array_range) GLEW_NV_vertex_array_range = !_glewInit_GL_NV_vertex_array_range(); +#endif /* GL_NV_vertex_array_range */ +#ifdef 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(); +#endif /* GL_NV_vertex_attrib_integer_64bit */ +#ifdef 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(); +#endif /* GL_NV_vertex_buffer_unified_memory */ +#ifdef GL_NV_vertex_program + if (glewExperimental || GLEW_NV_vertex_program) GLEW_NV_vertex_program = !_glewInit_GL_NV_vertex_program(); +#endif /* GL_NV_vertex_program */ +#ifdef GL_NV_video_capture + if (glewExperimental || GLEW_NV_video_capture) GLEW_NV_video_capture = !_glewInit_GL_NV_video_capture(); +#endif /* GL_NV_video_capture */ +#ifdef GL_NV_viewport_swizzle + if (glewExperimental || GLEW_NV_viewport_swizzle) GLEW_NV_viewport_swizzle = !_glewInit_GL_NV_viewport_swizzle(); +#endif /* GL_NV_viewport_swizzle */ +#ifdef GL_OES_single_precision + if (glewExperimental || GLEW_OES_single_precision) GLEW_OES_single_precision = !_glewInit_GL_OES_single_precision(); +#endif /* GL_OES_single_precision */ +#ifdef GL_OVR_multiview + if (glewExperimental || GLEW_OVR_multiview) GLEW_OVR_multiview = !_glewInit_GL_OVR_multiview(); +#endif /* GL_OVR_multiview */ +#ifdef GL_REGAL_ES1_0_compatibility + if (glewExperimental || GLEW_REGAL_ES1_0_compatibility) GLEW_REGAL_ES1_0_compatibility = !_glewInit_GL_REGAL_ES1_0_compatibility(); +#endif /* GL_REGAL_ES1_0_compatibility */ +#ifdef GL_REGAL_ES1_1_compatibility + if (glewExperimental || GLEW_REGAL_ES1_1_compatibility) GLEW_REGAL_ES1_1_compatibility = !_glewInit_GL_REGAL_ES1_1_compatibility(); +#endif /* GL_REGAL_ES1_1_compatibility */ +#ifdef GL_REGAL_error_string + if (glewExperimental || GLEW_REGAL_error_string) GLEW_REGAL_error_string = !_glewInit_GL_REGAL_error_string(); +#endif /* GL_REGAL_error_string */ +#ifdef GL_REGAL_extension_query + if (glewExperimental || GLEW_REGAL_extension_query) GLEW_REGAL_extension_query = !_glewInit_GL_REGAL_extension_query(); +#endif /* GL_REGAL_extension_query */ +#ifdef GL_REGAL_log + if (glewExperimental || GLEW_REGAL_log) GLEW_REGAL_log = !_glewInit_GL_REGAL_log(); +#endif /* GL_REGAL_log */ +#ifdef GL_REGAL_proc_address + if (glewExperimental || GLEW_REGAL_proc_address) GLEW_REGAL_proc_address = !_glewInit_GL_REGAL_proc_address(); +#endif /* GL_REGAL_proc_address */ +#ifdef GL_SGIS_detail_texture + if (glewExperimental || GLEW_SGIS_detail_texture) GLEW_SGIS_detail_texture = !_glewInit_GL_SGIS_detail_texture(); +#endif /* GL_SGIS_detail_texture */ +#ifdef GL_SGIS_fog_function + if (glewExperimental || GLEW_SGIS_fog_function) GLEW_SGIS_fog_function = !_glewInit_GL_SGIS_fog_function(); +#endif /* GL_SGIS_fog_function */ +#ifdef GL_SGIS_multisample + if (glewExperimental || GLEW_SGIS_multisample) GLEW_SGIS_multisample = !_glewInit_GL_SGIS_multisample(); +#endif /* GL_SGIS_multisample */ +#ifdef GL_SGIS_sharpen_texture + if (glewExperimental || GLEW_SGIS_sharpen_texture) GLEW_SGIS_sharpen_texture = !_glewInit_GL_SGIS_sharpen_texture(); +#endif /* GL_SGIS_sharpen_texture */ +#ifdef GL_SGIS_texture4D + if (glewExperimental || GLEW_SGIS_texture4D) GLEW_SGIS_texture4D = !_glewInit_GL_SGIS_texture4D(); +#endif /* GL_SGIS_texture4D */ +#ifdef GL_SGIS_texture_filter4 + if (glewExperimental || GLEW_SGIS_texture_filter4) GLEW_SGIS_texture_filter4 = !_glewInit_GL_SGIS_texture_filter4(); +#endif /* GL_SGIS_texture_filter4 */ +#ifdef GL_SGIX_async + if (glewExperimental || GLEW_SGIX_async) GLEW_SGIX_async = !_glewInit_GL_SGIX_async(); +#endif /* GL_SGIX_async */ +#ifdef GL_SGIX_flush_raster + if (glewExperimental || GLEW_SGIX_flush_raster) GLEW_SGIX_flush_raster = !_glewInit_GL_SGIX_flush_raster(); +#endif /* GL_SGIX_flush_raster */ +#ifdef GL_SGIX_fog_texture + if (glewExperimental || GLEW_SGIX_fog_texture) GLEW_SGIX_fog_texture = !_glewInit_GL_SGIX_fog_texture(); +#endif /* GL_SGIX_fog_texture */ +#ifdef GL_SGIX_fragment_specular_lighting + if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) GLEW_SGIX_fragment_specular_lighting = !_glewInit_GL_SGIX_fragment_specular_lighting(); +#endif /* GL_SGIX_fragment_specular_lighting */ +#ifdef GL_SGIX_framezoom + if (glewExperimental || GLEW_SGIX_framezoom) GLEW_SGIX_framezoom = !_glewInit_GL_SGIX_framezoom(); +#endif /* GL_SGIX_framezoom */ +#ifdef GL_SGIX_pixel_texture + if (glewExperimental || GLEW_SGIX_pixel_texture) GLEW_SGIX_pixel_texture = !_glewInit_GL_SGIX_pixel_texture(); +#endif /* GL_SGIX_pixel_texture */ +#ifdef GL_SGIX_reference_plane + if (glewExperimental || GLEW_SGIX_reference_plane) GLEW_SGIX_reference_plane = !_glewInit_GL_SGIX_reference_plane(); +#endif /* GL_SGIX_reference_plane */ +#ifdef GL_SGIX_sprite + if (glewExperimental || GLEW_SGIX_sprite) GLEW_SGIX_sprite = !_glewInit_GL_SGIX_sprite(); +#endif /* GL_SGIX_sprite */ +#ifdef GL_SGIX_tag_sample_buffer + if (glewExperimental || GLEW_SGIX_tag_sample_buffer) GLEW_SGIX_tag_sample_buffer = !_glewInit_GL_SGIX_tag_sample_buffer(); +#endif /* GL_SGIX_tag_sample_buffer */ +#ifdef GL_SGI_color_table + if (glewExperimental || GLEW_SGI_color_table) GLEW_SGI_color_table = !_glewInit_GL_SGI_color_table(); +#endif /* GL_SGI_color_table */ +#ifdef GL_SUNX_constant_data + if (glewExperimental || GLEW_SUNX_constant_data) GLEW_SUNX_constant_data = !_glewInit_GL_SUNX_constant_data(); +#endif /* GL_SUNX_constant_data */ +#ifdef GL_SUN_global_alpha + if (glewExperimental || GLEW_SUN_global_alpha) GLEW_SUN_global_alpha = !_glewInit_GL_SUN_global_alpha(); +#endif /* GL_SUN_global_alpha */ +#ifdef GL_SUN_read_video_pixels + if (glewExperimental || GLEW_SUN_read_video_pixels) GLEW_SUN_read_video_pixels = !_glewInit_GL_SUN_read_video_pixels(); +#endif /* GL_SUN_read_video_pixels */ +#ifdef GL_SUN_triangle_list + if (glewExperimental || GLEW_SUN_triangle_list) GLEW_SUN_triangle_list = !_glewInit_GL_SUN_triangle_list(); +#endif /* GL_SUN_triangle_list */ +#ifdef GL_SUN_vertex + if (glewExperimental || GLEW_SUN_vertex) GLEW_SUN_vertex = !_glewInit_GL_SUN_vertex(); +#endif /* GL_SUN_vertex */ +#ifdef GL_WIN_swap_hint + if (glewExperimental || GLEW_WIN_swap_hint) GLEW_WIN_swap_hint = !_glewInit_GL_WIN_swap_hint(); +#endif /* GL_WIN_swap_hint */ +#ifdef GL_NV_fragment_program4 + GLEW_NV_fragment_program4 = GLEW_NV_gpu_program4; +#endif /* GL_NV_fragment_program4 */ +#ifdef GL_NV_geometry_program4 + GLEW_NV_geometry_program4 = GLEW_NV_gpu_program4; +#endif /* GL_NV_geometry_program4 */ +#ifdef GL_NV_tessellation_program5 + GLEW_NV_tessellation_program5 = GLEW_NV_gpu_program5; +#endif /* GL_NV_tessellation_program5 */ +#ifdef GL_NV_vertex_program4 + GLEW_NV_vertex_program4 = GLEW_NV_gpu_program4; +#endif /* GL_NV_vertex_program4 */ + + return GLEW_OK; +} + + +#if defined(GLEW_OSMESA) + +#elif defined(GLEW_EGL) + +PFNEGLCHOOSECONFIGPROC __eglewChooseConfig = NULL; +PFNEGLCOPYBUFFERSPROC __eglewCopyBuffers = NULL; +PFNEGLCREATECONTEXTPROC __eglewCreateContext = NULL; +PFNEGLCREATEPBUFFERSURFACEPROC __eglewCreatePbufferSurface = NULL; +PFNEGLCREATEPIXMAPSURFACEPROC __eglewCreatePixmapSurface = NULL; +PFNEGLCREATEWINDOWSURFACEPROC __eglewCreateWindowSurface = NULL; +PFNEGLDESTROYCONTEXTPROC __eglewDestroyContext = NULL; +PFNEGLDESTROYSURFACEPROC __eglewDestroySurface = NULL; +PFNEGLGETCONFIGATTRIBPROC __eglewGetConfigAttrib = NULL; +PFNEGLGETCONFIGSPROC __eglewGetConfigs = NULL; +PFNEGLGETCURRENTDISPLAYPROC __eglewGetCurrentDisplay = NULL; +PFNEGLGETCURRENTSURFACEPROC __eglewGetCurrentSurface = NULL; +PFNEGLGETDISPLAYPROC __eglewGetDisplay = NULL; +PFNEGLGETERRORPROC __eglewGetError = NULL; +PFNEGLINITIALIZEPROC __eglewInitialize = NULL; +PFNEGLMAKECURRENTPROC __eglewMakeCurrent = NULL; +PFNEGLQUERYCONTEXTPROC __eglewQueryContext = NULL; +PFNEGLQUERYSTRINGPROC __eglewQueryString = NULL; +PFNEGLQUERYSURFACEPROC __eglewQuerySurface = NULL; +PFNEGLSWAPBUFFERSPROC __eglewSwapBuffers = NULL; +PFNEGLTERMINATEPROC __eglewTerminate = NULL; +PFNEGLWAITGLPROC __eglewWaitGL = NULL; +PFNEGLWAITNATIVEPROC __eglewWaitNative = NULL; + +PFNEGLBINDTEXIMAGEPROC __eglewBindTexImage = NULL; +PFNEGLRELEASETEXIMAGEPROC __eglewReleaseTexImage = NULL; +PFNEGLSURFACEATTRIBPROC __eglewSurfaceAttrib = NULL; +PFNEGLSWAPINTERVALPROC __eglewSwapInterval = NULL; + +PFNEGLBINDAPIPROC __eglewBindAPI = NULL; +PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC __eglewCreatePbufferFromClientBuffer = NULL; +PFNEGLQUERYAPIPROC __eglewQueryAPI = NULL; +PFNEGLRELEASETHREADPROC __eglewReleaseThread = NULL; +PFNEGLWAITCLIENTPROC __eglewWaitClient = NULL; + +PFNEGLGETCURRENTCONTEXTPROC __eglewGetCurrentContext = NULL; + +PFNEGLCLIENTWAITSYNCPROC __eglewClientWaitSync = NULL; +PFNEGLCREATEIMAGEPROC __eglewCreateImage = NULL; +PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC __eglewCreatePlatformPixmapSurface = NULL; +PFNEGLCREATEPLATFORMWINDOWSURFACEPROC __eglewCreatePlatformWindowSurface = NULL; +PFNEGLCREATESYNCPROC __eglewCreateSync = NULL; +PFNEGLDESTROYIMAGEPROC __eglewDestroyImage = NULL; +PFNEGLDESTROYSYNCPROC __eglewDestroySync = NULL; +PFNEGLGETPLATFORMDISPLAYPROC __eglewGetPlatformDisplay = NULL; +PFNEGLGETSYNCATTRIBPROC __eglewGetSyncAttrib = NULL; +PFNEGLWAITSYNCPROC __eglewWaitSync = NULL; + +PFNEGLSETBLOBCACHEFUNCSANDROIDPROC __eglewSetBlobCacheFuncsANDROID = NULL; + +PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC __eglewCreateNativeClientBufferANDROID = NULL; + +PFNEGLDUPNATIVEFENCEFDANDROIDPROC __eglewDupNativeFenceFDANDROID = NULL; + +PFNEGLPRESENTATIONTIMEANDROIDPROC __eglewPresentationTimeANDROID = NULL; + +PFNEGLQUERYSURFACEPOINTERANGLEPROC __eglewQuerySurfacePointerANGLE = NULL; + +PFNEGLQUERYDEVICESEXTPROC __eglewQueryDevicesEXT = NULL; + +PFNEGLQUERYDEVICEATTRIBEXTPROC __eglewQueryDeviceAttribEXT = NULL; +PFNEGLQUERYDEVICESTRINGEXTPROC __eglewQueryDeviceStringEXT = NULL; +PFNEGLQUERYDISPLAYATTRIBEXTPROC __eglewQueryDisplayAttribEXT = NULL; + +PFNEGLGETOUTPUTLAYERSEXTPROC __eglewGetOutputLayersEXT = NULL; +PFNEGLGETOUTPUTPORTSEXTPROC __eglewGetOutputPortsEXT = NULL; +PFNEGLOUTPUTLAYERATTRIBEXTPROC __eglewOutputLayerAttribEXT = NULL; +PFNEGLOUTPUTPORTATTRIBEXTPROC __eglewOutputPortAttribEXT = NULL; +PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC __eglewQueryOutputLayerAttribEXT = NULL; +PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC __eglewQueryOutputLayerStringEXT = NULL; +PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC __eglewQueryOutputPortAttribEXT = NULL; +PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC __eglewQueryOutputPortStringEXT = NULL; + +PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC __eglewCreatePlatformPixmapSurfaceEXT = NULL; +PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC __eglewCreatePlatformWindowSurfaceEXT = NULL; +PFNEGLGETPLATFORMDISPLAYEXTPROC __eglewGetPlatformDisplayEXT = NULL; + +PFNEGLSTREAMCONSUMEROUTPUTEXTPROC __eglewStreamConsumerOutputEXT = NULL; + +PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC __eglewSwapBuffersWithDamageEXT = NULL; + +PFNEGLCREATEPIXMAPSURFACEHIPROC __eglewCreatePixmapSurfaceHI = NULL; + +PFNEGLCREATESYNC64KHRPROC __eglewCreateSync64KHR = NULL; + +PFNEGLDEBUGMESSAGECONTROLKHRPROC __eglewDebugMessageControlKHR = NULL; +PFNEGLLABELOBJECTKHRPROC __eglewLabelObjectKHR = NULL; +PFNEGLQUERYDEBUGKHRPROC __eglewQueryDebugKHR = NULL; + +PFNEGLCREATEIMAGEKHRPROC __eglewCreateImageKHR = NULL; +PFNEGLDESTROYIMAGEKHRPROC __eglewDestroyImageKHR = NULL; + +PFNEGLLOCKSURFACEKHRPROC __eglewLockSurfaceKHR = NULL; +PFNEGLUNLOCKSURFACEKHRPROC __eglewUnlockSurfaceKHR = NULL; + +PFNEGLQUERYSURFACE64KHRPROC __eglewQuerySurface64KHR = NULL; + +PFNEGLSETDAMAGEREGIONKHRPROC __eglewSetDamageRegionKHR = NULL; + +PFNEGLCLIENTWAITSYNCKHRPROC __eglewClientWaitSyncKHR = NULL; +PFNEGLCREATESYNCKHRPROC __eglewCreateSyncKHR = NULL; +PFNEGLDESTROYSYNCKHRPROC __eglewDestroySyncKHR = NULL; +PFNEGLGETSYNCATTRIBKHRPROC __eglewGetSyncAttribKHR = NULL; +PFNEGLSIGNALSYNCKHRPROC __eglewSignalSyncKHR = NULL; + +PFNEGLCREATESTREAMKHRPROC __eglewCreateStreamKHR = NULL; +PFNEGLDESTROYSTREAMKHRPROC __eglewDestroyStreamKHR = NULL; +PFNEGLQUERYSTREAMKHRPROC __eglewQueryStreamKHR = NULL; +PFNEGLQUERYSTREAMU64KHRPROC __eglewQueryStreamu64KHR = NULL; +PFNEGLSTREAMATTRIBKHRPROC __eglewStreamAttribKHR = NULL; + +PFNEGLSTREAMCONSUMERACQUIREKHRPROC __eglewStreamConsumerAcquireKHR = NULL; +PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC __eglewStreamConsumerGLTextureExternalKHR = NULL; +PFNEGLSTREAMCONSUMERRELEASEKHRPROC __eglewStreamConsumerReleaseKHR = NULL; + +PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC __eglewCreateStreamFromFileDescriptorKHR = NULL; +PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC __eglewGetStreamFileDescriptorKHR = NULL; + +PFNEGLQUERYSTREAMTIMEKHRPROC __eglewQueryStreamTimeKHR = NULL; + +PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC __eglewCreateStreamProducerSurfaceKHR = NULL; + +PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC __eglewSwapBuffersWithDamageKHR = NULL; + +PFNEGLWAITSYNCKHRPROC __eglewWaitSyncKHR = NULL; + +PFNEGLCREATEDRMIMAGEMESAPROC __eglewCreateDRMImageMESA = NULL; +PFNEGLEXPORTDRMIMAGEMESAPROC __eglewExportDRMImageMESA = NULL; + +PFNEGLEXPORTDMABUFIMAGEMESAPROC __eglewExportDMABUFImageMESA = NULL; +PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC __eglewExportDMABUFImageQueryMESA = NULL; + +PFNEGLSWAPBUFFERSREGIONNOKPROC __eglewSwapBuffersRegionNOK = NULL; + +PFNEGLSWAPBUFFERSREGION2NOKPROC __eglewSwapBuffersRegion2NOK = NULL; + +PFNEGLQUERYNATIVEDISPLAYNVPROC __eglewQueryNativeDisplayNV = NULL; +PFNEGLQUERYNATIVEPIXMAPNVPROC __eglewQueryNativePixmapNV = NULL; +PFNEGLQUERYNATIVEWINDOWNVPROC __eglewQueryNativeWindowNV = NULL; + +PFNEGLPOSTSUBBUFFERNVPROC __eglewPostSubBufferNV = NULL; + +PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC __eglewStreamConsumerGLTextureExternalAttribsNV = NULL; + +PFNEGLQUERYDISPLAYATTRIBNVPROC __eglewQueryDisplayAttribNV = NULL; +PFNEGLQUERYSTREAMMETADATANVPROC __eglewQueryStreamMetadataNV = NULL; +PFNEGLSETSTREAMMETADATANVPROC __eglewSetStreamMetadataNV = NULL; + +PFNEGLCREATESTREAMSYNCNVPROC __eglewCreateStreamSyncNV = NULL; + +PFNEGLCLIENTWAITSYNCNVPROC __eglewClientWaitSyncNV = NULL; +PFNEGLCREATEFENCESYNCNVPROC __eglewCreateFenceSyncNV = NULL; +PFNEGLDESTROYSYNCNVPROC __eglewDestroySyncNV = NULL; +PFNEGLFENCENVPROC __eglewFenceNV = NULL; +PFNEGLGETSYNCATTRIBNVPROC __eglewGetSyncAttribNV = NULL; +PFNEGLSIGNALSYNCNVPROC __eglewSignalSyncNV = NULL; + +PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC __eglewGetSystemTimeFrequencyNV = NULL; +PFNEGLGETSYSTEMTIMENVPROC __eglewGetSystemTimeNV = NULL; +GLboolean __EGLEW_VERSION_1_0 = GL_FALSE; +GLboolean __EGLEW_VERSION_1_1 = GL_FALSE; +GLboolean __EGLEW_VERSION_1_2 = GL_FALSE; +GLboolean __EGLEW_VERSION_1_3 = GL_FALSE; +GLboolean __EGLEW_VERSION_1_4 = GL_FALSE; +GLboolean __EGLEW_VERSION_1_5 = GL_FALSE; +GLboolean __EGLEW_ANDROID_blob_cache = GL_FALSE; +GLboolean __EGLEW_ANDROID_create_native_client_buffer = GL_FALSE; +GLboolean __EGLEW_ANDROID_framebuffer_target = GL_FALSE; +GLboolean __EGLEW_ANDROID_front_buffer_auto_refresh = GL_FALSE; +GLboolean __EGLEW_ANDROID_image_native_buffer = GL_FALSE; +GLboolean __EGLEW_ANDROID_native_fence_sync = GL_FALSE; +GLboolean __EGLEW_ANDROID_presentation_time = GL_FALSE; +GLboolean __EGLEW_ANDROID_recordable = GL_FALSE; +GLboolean __EGLEW_ANGLE_d3d_share_handle_client_buffer = GL_FALSE; +GLboolean __EGLEW_ANGLE_device_d3d = GL_FALSE; +GLboolean __EGLEW_ANGLE_query_surface_pointer = GL_FALSE; +GLboolean __EGLEW_ANGLE_surface_d3d_texture_2d_share_handle = GL_FALSE; +GLboolean __EGLEW_ANGLE_window_fixed_size = GL_FALSE; +GLboolean __EGLEW_ARM_pixmap_multisample_discard = GL_FALSE; +GLboolean __EGLEW_EXT_buffer_age = GL_FALSE; +GLboolean __EGLEW_EXT_client_extensions = GL_FALSE; +GLboolean __EGLEW_EXT_create_context_robustness = GL_FALSE; +GLboolean __EGLEW_EXT_device_base = GL_FALSE; +GLboolean __EGLEW_EXT_device_drm = GL_FALSE; +GLboolean __EGLEW_EXT_device_enumeration = GL_FALSE; +GLboolean __EGLEW_EXT_device_openwf = GL_FALSE; +GLboolean __EGLEW_EXT_device_query = GL_FALSE; +GLboolean __EGLEW_EXT_image_dma_buf_import = GL_FALSE; +GLboolean __EGLEW_EXT_multiview_window = GL_FALSE; +GLboolean __EGLEW_EXT_output_base = GL_FALSE; +GLboolean __EGLEW_EXT_output_drm = GL_FALSE; +GLboolean __EGLEW_EXT_output_openwf = GL_FALSE; +GLboolean __EGLEW_EXT_platform_base = GL_FALSE; +GLboolean __EGLEW_EXT_platform_device = GL_FALSE; +GLboolean __EGLEW_EXT_platform_wayland = GL_FALSE; +GLboolean __EGLEW_EXT_platform_x11 = GL_FALSE; +GLboolean __EGLEW_EXT_protected_content = GL_FALSE; +GLboolean __EGLEW_EXT_protected_surface = GL_FALSE; +GLboolean __EGLEW_EXT_stream_consumer_egloutput = GL_FALSE; +GLboolean __EGLEW_EXT_swap_buffers_with_damage = GL_FALSE; +GLboolean __EGLEW_EXT_yuv_surface = GL_FALSE; +GLboolean __EGLEW_HI_clientpixmap = GL_FALSE; +GLboolean __EGLEW_HI_colorformats = GL_FALSE; +GLboolean __EGLEW_IMG_context_priority = GL_FALSE; +GLboolean __EGLEW_IMG_image_plane_attribs = GL_FALSE; +GLboolean __EGLEW_KHR_cl_event = GL_FALSE; +GLboolean __EGLEW_KHR_cl_event2 = GL_FALSE; +GLboolean __EGLEW_KHR_client_get_all_proc_addresses = GL_FALSE; +GLboolean __EGLEW_KHR_config_attribs = GL_FALSE; +GLboolean __EGLEW_KHR_create_context = GL_FALSE; +GLboolean __EGLEW_KHR_create_context_no_error = GL_FALSE; +GLboolean __EGLEW_KHR_debug = GL_FALSE; +GLboolean __EGLEW_KHR_fence_sync = GL_FALSE; +GLboolean __EGLEW_KHR_get_all_proc_addresses = GL_FALSE; +GLboolean __EGLEW_KHR_gl_colorspace = GL_FALSE; +GLboolean __EGLEW_KHR_gl_renderbuffer_image = GL_FALSE; +GLboolean __EGLEW_KHR_gl_texture_2D_image = GL_FALSE; +GLboolean __EGLEW_KHR_gl_texture_3D_image = GL_FALSE; +GLboolean __EGLEW_KHR_gl_texture_cubemap_image = GL_FALSE; +GLboolean __EGLEW_KHR_image = GL_FALSE; +GLboolean __EGLEW_KHR_image_base = GL_FALSE; +GLboolean __EGLEW_KHR_image_pixmap = GL_FALSE; +GLboolean __EGLEW_KHR_lock_surface = GL_FALSE; +GLboolean __EGLEW_KHR_lock_surface2 = GL_FALSE; +GLboolean __EGLEW_KHR_lock_surface3 = GL_FALSE; +GLboolean __EGLEW_KHR_mutable_render_buffer = GL_FALSE; +GLboolean __EGLEW_KHR_partial_update = GL_FALSE; +GLboolean __EGLEW_KHR_platform_android = GL_FALSE; +GLboolean __EGLEW_KHR_platform_gbm = GL_FALSE; +GLboolean __EGLEW_KHR_platform_wayland = GL_FALSE; +GLboolean __EGLEW_KHR_platform_x11 = GL_FALSE; +GLboolean __EGLEW_KHR_reusable_sync = GL_FALSE; +GLboolean __EGLEW_KHR_stream = GL_FALSE; +GLboolean __EGLEW_KHR_stream_consumer_gltexture = GL_FALSE; +GLboolean __EGLEW_KHR_stream_cross_process_fd = GL_FALSE; +GLboolean __EGLEW_KHR_stream_fifo = GL_FALSE; +GLboolean __EGLEW_KHR_stream_producer_aldatalocator = GL_FALSE; +GLboolean __EGLEW_KHR_stream_producer_eglsurface = GL_FALSE; +GLboolean __EGLEW_KHR_surfaceless_context = GL_FALSE; +GLboolean __EGLEW_KHR_swap_buffers_with_damage = GL_FALSE; +GLboolean __EGLEW_KHR_vg_parent_image = GL_FALSE; +GLboolean __EGLEW_KHR_wait_sync = GL_FALSE; +GLboolean __EGLEW_MESA_drm_image = GL_FALSE; +GLboolean __EGLEW_MESA_image_dma_buf_export = GL_FALSE; +GLboolean __EGLEW_MESA_platform_gbm = GL_FALSE; +GLboolean __EGLEW_NOK_swap_region = GL_FALSE; +GLboolean __EGLEW_NOK_swap_region2 = GL_FALSE; +GLboolean __EGLEW_NOK_texture_from_pixmap = GL_FALSE; +GLboolean __EGLEW_NV_3dvision_surface = GL_FALSE; +GLboolean __EGLEW_NV_coverage_sample = GL_FALSE; +GLboolean __EGLEW_NV_coverage_sample_resolve = GL_FALSE; +GLboolean __EGLEW_NV_cuda_event = GL_FALSE; +GLboolean __EGLEW_NV_depth_nonlinear = GL_FALSE; +GLboolean __EGLEW_NV_device_cuda = GL_FALSE; +GLboolean __EGLEW_NV_native_query = GL_FALSE; +GLboolean __EGLEW_NV_post_convert_rounding = GL_FALSE; +GLboolean __EGLEW_NV_post_sub_buffer = GL_FALSE; +GLboolean __EGLEW_NV_robustness_video_memory_purge = GL_FALSE; +GLboolean __EGLEW_NV_stream_consumer_gltexture_yuv = GL_FALSE; +GLboolean __EGLEW_NV_stream_metadata = GL_FALSE; +GLboolean __EGLEW_NV_stream_sync = GL_FALSE; +GLboolean __EGLEW_NV_sync = GL_FALSE; +GLboolean __EGLEW_NV_system_time = GL_FALSE; +GLboolean __EGLEW_TIZEN_image_native_buffer = GL_FALSE; +GLboolean __EGLEW_TIZEN_image_native_surface = GL_FALSE; +#ifdef EGL_VERSION_1_0 + +static GLboolean _glewInit_EGL_VERSION_1_0 () +{ + GLboolean r = GL_FALSE; + + r = ((eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)glewGetProcAddress((const GLubyte*)"eglChooseConfig")) == NULL) || r; + r = ((eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC)glewGetProcAddress((const GLubyte*)"eglCopyBuffers")) == NULL) || r; + r = ((eglCreateContext = (PFNEGLCREATECONTEXTPROC)glewGetProcAddress((const GLubyte*)"eglCreateContext")) == NULL) || r; + r = ((eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglCreatePbufferSurface")) == NULL) || r; + r = ((eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglCreatePixmapSurface")) == NULL) || r; + r = ((eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglCreateWindowSurface")) == NULL) || r; + r = ((eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"eglDestroyContext")) == NULL) || r; + r = ((eglDestroySurface = (PFNEGLDESTROYSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglDestroySurface")) == NULL) || r; + r = ((eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC)glewGetProcAddress((const GLubyte*)"eglGetConfigAttrib")) == NULL) || r; + r = ((eglGetConfigs = (PFNEGLGETCONFIGSPROC)glewGetProcAddress((const GLubyte*)"eglGetConfigs")) == NULL) || r; + r = ((eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"eglGetCurrentDisplay")) == NULL) || r; + r = ((eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglGetCurrentSurface")) == NULL) || r; + r = ((eglGetDisplay = (PFNEGLGETDISPLAYPROC)glewGetProcAddress((const GLubyte*)"eglGetDisplay")) == NULL) || r; + r = ((eglGetError = (PFNEGLGETERRORPROC)glewGetProcAddress((const GLubyte*)"eglGetError")) == NULL) || r; + r = ((eglInitialize = (PFNEGLINITIALIZEPROC)glewGetProcAddress((const GLubyte*)"eglInitialize")) == NULL) || r; + r = ((eglMakeCurrent = (PFNEGLMAKECURRENTPROC)glewGetProcAddress((const GLubyte*)"eglMakeCurrent")) == NULL) || r; + r = ((eglQueryContext = (PFNEGLQUERYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryContext")) == NULL) || r; + r = ((eglQueryString = (PFNEGLQUERYSTRINGPROC)glewGetProcAddress((const GLubyte*)"eglQueryString")) == NULL) || r; + r = ((eglQuerySurface = (PFNEGLQUERYSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglQuerySurface")) == NULL) || r; + r = ((eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC)glewGetProcAddress((const GLubyte*)"eglSwapBuffers")) == NULL) || r; + r = ((eglTerminate = (PFNEGLTERMINATEPROC)glewGetProcAddress((const GLubyte*)"eglTerminate")) == NULL) || r; + r = ((eglWaitGL = (PFNEGLWAITGLPROC)glewGetProcAddress((const GLubyte*)"eglWaitGL")) == NULL) || r; + r = ((eglWaitNative = (PFNEGLWAITNATIVEPROC)glewGetProcAddress((const GLubyte*)"eglWaitNative")) == NULL) || r; + + return r; +} + +#endif /* EGL_VERSION_1_0 */ + +#ifdef EGL_VERSION_1_1 + +static GLboolean _glewInit_EGL_VERSION_1_1 () +{ + GLboolean r = GL_FALSE; + + r = ((eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"eglBindTexImage")) == NULL) || r; + r = ((eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"eglReleaseTexImage")) == NULL) || r; + r = ((eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC)glewGetProcAddress((const GLubyte*)"eglSurfaceAttrib")) == NULL) || r; + r = ((eglSwapInterval = (PFNEGLSWAPINTERVALPROC)glewGetProcAddress((const GLubyte*)"eglSwapInterval")) == NULL) || r; + + return r; +} + +#endif /* EGL_VERSION_1_1 */ + +#ifdef EGL_VERSION_1_2 + +static GLboolean _glewInit_EGL_VERSION_1_2 () +{ + GLboolean r = GL_FALSE; + + r = ((eglBindAPI = (PFNEGLBINDAPIPROC)glewGetProcAddress((const GLubyte*)"eglBindAPI")) == NULL) || r; + r = ((eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)glewGetProcAddress((const GLubyte*)"eglCreatePbufferFromClientBuffer")) == NULL) || r; + r = ((eglQueryAPI = (PFNEGLQUERYAPIPROC)glewGetProcAddress((const GLubyte*)"eglQueryAPI")) == NULL) || r; + r = ((eglReleaseThread = (PFNEGLRELEASETHREADPROC)glewGetProcAddress((const GLubyte*)"eglReleaseThread")) == NULL) || r; + r = ((eglWaitClient = (PFNEGLWAITCLIENTPROC)glewGetProcAddress((const GLubyte*)"eglWaitClient")) == NULL) || r; + + return r; +} + +#endif /* EGL_VERSION_1_2 */ + +#ifdef EGL_VERSION_1_4 + +static GLboolean _glewInit_EGL_VERSION_1_4 () +{ + GLboolean r = GL_FALSE; + + r = ((eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)glewGetProcAddress((const GLubyte*)"eglGetCurrentContext")) == NULL) || r; + + return r; +} + +#endif /* EGL_VERSION_1_4 */ + +#ifdef EGL_VERSION_1_5 + +static GLboolean _glewInit_EGL_VERSION_1_5 () +{ + GLboolean r = GL_FALSE; + + r = ((eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"eglClientWaitSync")) == NULL) || r; + r = ((eglCreateImage = (PFNEGLCREATEIMAGEPROC)glewGetProcAddress((const GLubyte*)"eglCreateImage")) == NULL) || r; + r = ((eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglCreatePlatformPixmapSurface")) == NULL) || r; + r = ((eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)glewGetProcAddress((const GLubyte*)"eglCreatePlatformWindowSurface")) == NULL) || r; + r = ((eglCreateSync = (PFNEGLCREATESYNCPROC)glewGetProcAddress((const GLubyte*)"eglCreateSync")) == NULL) || r; + r = ((eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)glewGetProcAddress((const GLubyte*)"eglDestroyImage")) == NULL) || r; + r = ((eglDestroySync = (PFNEGLDESTROYSYNCPROC)glewGetProcAddress((const GLubyte*)"eglDestroySync")) == NULL) || r; + r = ((eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC)glewGetProcAddress((const GLubyte*)"eglGetPlatformDisplay")) == NULL) || r; + r = ((eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC)glewGetProcAddress((const GLubyte*)"eglGetSyncAttrib")) == NULL) || r; + r = ((eglWaitSync = (PFNEGLWAITSYNCPROC)glewGetProcAddress((const GLubyte*)"eglWaitSync")) == NULL) || r; + + return r; +} + +#endif /* EGL_VERSION_1_5 */ + +#ifdef EGL_ANDROID_blob_cache + +static GLboolean _glewInit_EGL_ANDROID_blob_cache () +{ + GLboolean r = GL_FALSE; + + r = ((eglSetBlobCacheFuncsANDROID = (PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)glewGetProcAddress((const GLubyte*)"eglSetBlobCacheFuncsANDROID")) == NULL) || r; + + return r; +} + +#endif /* EGL_ANDROID_blob_cache */ + +#ifdef EGL_ANDROID_create_native_client_buffer + +static GLboolean _glewInit_EGL_ANDROID_create_native_client_buffer () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateNativeClientBufferANDROID = (PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC)glewGetProcAddress((const GLubyte*)"eglCreateNativeClientBufferANDROID")) == NULL) || r; + + return r; +} + +#endif /* EGL_ANDROID_create_native_client_buffer */ + +#ifdef EGL_ANDROID_native_fence_sync + +static GLboolean _glewInit_EGL_ANDROID_native_fence_sync () +{ + GLboolean r = GL_FALSE; + + r = ((eglDupNativeFenceFDANDROID = (PFNEGLDUPNATIVEFENCEFDANDROIDPROC)glewGetProcAddress((const GLubyte*)"eglDupNativeFenceFDANDROID")) == NULL) || r; + + return r; +} + +#endif /* EGL_ANDROID_native_fence_sync */ + +#ifdef EGL_ANDROID_presentation_time + +static GLboolean _glewInit_EGL_ANDROID_presentation_time () +{ + GLboolean r = GL_FALSE; + + r = ((eglPresentationTimeANDROID = (PFNEGLPRESENTATIONTIMEANDROIDPROC)glewGetProcAddress((const GLubyte*)"eglPresentationTimeANDROID")) == NULL) || r; + + return r; +} + +#endif /* EGL_ANDROID_presentation_time */ + +#ifdef EGL_ANGLE_query_surface_pointer + +static GLboolean _glewInit_EGL_ANGLE_query_surface_pointer () +{ + GLboolean r = GL_FALSE; + + r = ((eglQuerySurfacePointerANGLE = (PFNEGLQUERYSURFACEPOINTERANGLEPROC)glewGetProcAddress((const GLubyte*)"eglQuerySurfacePointerANGLE")) == NULL) || r; + + return r; +} + +#endif /* EGL_ANGLE_query_surface_pointer */ + +#ifdef EGL_EXT_device_enumeration + +static GLboolean _glewInit_EGL_EXT_device_enumeration () +{ + GLboolean r = GL_FALSE; + + r = ((eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryDevicesEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_device_enumeration */ + +#ifdef EGL_EXT_device_query + +static GLboolean _glewInit_EGL_EXT_device_query () +{ + GLboolean r = GL_FALSE; + + r = ((eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryDeviceAttribEXT")) == NULL) || r; + r = ((eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryDeviceStringEXT")) == NULL) || r; + r = ((eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryDisplayAttribEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_device_query */ + +#ifdef EGL_EXT_output_base + +static GLboolean _glewInit_EGL_EXT_output_base () +{ + GLboolean r = GL_FALSE; + + r = ((eglGetOutputLayersEXT = (PFNEGLGETOUTPUTLAYERSEXTPROC)glewGetProcAddress((const GLubyte*)"eglGetOutputLayersEXT")) == NULL) || r; + r = ((eglGetOutputPortsEXT = (PFNEGLGETOUTPUTPORTSEXTPROC)glewGetProcAddress((const GLubyte*)"eglGetOutputPortsEXT")) == NULL) || r; + r = ((eglOutputLayerAttribEXT = (PFNEGLOUTPUTLAYERATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglOutputLayerAttribEXT")) == NULL) || r; + r = ((eglOutputPortAttribEXT = (PFNEGLOUTPUTPORTATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglOutputPortAttribEXT")) == NULL) || r; + r = ((eglQueryOutputLayerAttribEXT = (PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryOutputLayerAttribEXT")) == NULL) || r; + r = ((eglQueryOutputLayerStringEXT = (PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryOutputLayerStringEXT")) == NULL) || r; + r = ((eglQueryOutputPortAttribEXT = (PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryOutputPortAttribEXT")) == NULL) || r; + r = ((eglQueryOutputPortStringEXT = (PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"eglQueryOutputPortStringEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_output_base */ + +#ifdef EGL_EXT_platform_base + +static GLboolean _glewInit_EGL_EXT_platform_base () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)glewGetProcAddress((const GLubyte*)"eglCreatePlatformPixmapSurfaceEXT")) == NULL) || r; + r = ((eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)glewGetProcAddress((const GLubyte*)"eglCreatePlatformWindowSurfaceEXT")) == NULL) || r; + r = ((eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)glewGetProcAddress((const GLubyte*)"eglGetPlatformDisplayEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_platform_base */ + +#ifdef EGL_EXT_stream_consumer_egloutput + +static GLboolean _glewInit_EGL_EXT_stream_consumer_egloutput () +{ + GLboolean r = GL_FALSE; + + r = ((eglStreamConsumerOutputEXT = (PFNEGLSTREAMCONSUMEROUTPUTEXTPROC)glewGetProcAddress((const GLubyte*)"eglStreamConsumerOutputEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_stream_consumer_egloutput */ + +#ifdef EGL_EXT_swap_buffers_with_damage + +static GLboolean _glewInit_EGL_EXT_swap_buffers_with_damage () +{ + GLboolean r = GL_FALSE; + + r = ((eglSwapBuffersWithDamageEXT = (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)glewGetProcAddress((const GLubyte*)"eglSwapBuffersWithDamageEXT")) == NULL) || r; + + return r; +} + +#endif /* EGL_EXT_swap_buffers_with_damage */ + +#ifdef EGL_HI_clientpixmap + +static GLboolean _glewInit_EGL_HI_clientpixmap () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreatePixmapSurfaceHI = (PFNEGLCREATEPIXMAPSURFACEHIPROC)glewGetProcAddress((const GLubyte*)"eglCreatePixmapSurfaceHI")) == NULL) || r; + + return r; +} + +#endif /* EGL_HI_clientpixmap */ + +#ifdef EGL_KHR_cl_event2 + +static GLboolean _glewInit_EGL_KHR_cl_event2 () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateSync64KHR = (PFNEGLCREATESYNC64KHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateSync64KHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_cl_event2 */ + +#ifdef EGL_KHR_debug + +static GLboolean _glewInit_EGL_KHR_debug () +{ + GLboolean r = GL_FALSE; + + r = ((eglDebugMessageControlKHR = (PFNEGLDEBUGMESSAGECONTROLKHRPROC)glewGetProcAddress((const GLubyte*)"eglDebugMessageControlKHR")) == NULL) || r; + r = ((eglLabelObjectKHR = (PFNEGLLABELOBJECTKHRPROC)glewGetProcAddress((const GLubyte*)"eglLabelObjectKHR")) == NULL) || r; + r = ((eglQueryDebugKHR = (PFNEGLQUERYDEBUGKHRPROC)glewGetProcAddress((const GLubyte*)"eglQueryDebugKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_debug */ + +#ifdef EGL_KHR_image + +static GLboolean _glewInit_EGL_KHR_image () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateImageKHR")) == NULL) || r; + r = ((eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)glewGetProcAddress((const GLubyte*)"eglDestroyImageKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_image */ + +#ifdef EGL_KHR_lock_surface + +static GLboolean _glewInit_EGL_KHR_lock_surface () +{ + GLboolean r = GL_FALSE; + + r = ((eglLockSurfaceKHR = (PFNEGLLOCKSURFACEKHRPROC)glewGetProcAddress((const GLubyte*)"eglLockSurfaceKHR")) == NULL) || r; + r = ((eglUnlockSurfaceKHR = (PFNEGLUNLOCKSURFACEKHRPROC)glewGetProcAddress((const GLubyte*)"eglUnlockSurfaceKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_lock_surface */ + +#ifdef EGL_KHR_lock_surface3 + +static GLboolean _glewInit_EGL_KHR_lock_surface3 () +{ + GLboolean r = GL_FALSE; + + r = ((eglQuerySurface64KHR = (PFNEGLQUERYSURFACE64KHRPROC)glewGetProcAddress((const GLubyte*)"eglQuerySurface64KHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_lock_surface3 */ + +#ifdef EGL_KHR_partial_update + +static GLboolean _glewInit_EGL_KHR_partial_update () +{ + GLboolean r = GL_FALSE; + + r = ((eglSetDamageRegionKHR = (PFNEGLSETDAMAGEREGIONKHRPROC)glewGetProcAddress((const GLubyte*)"eglSetDamageRegionKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_partial_update */ + +#ifdef EGL_KHR_reusable_sync + +static GLboolean _glewInit_EGL_KHR_reusable_sync () +{ + GLboolean r = GL_FALSE; + + r = ((eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)glewGetProcAddress((const GLubyte*)"eglClientWaitSyncKHR")) == NULL) || r; + r = ((eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateSyncKHR")) == NULL) || r; + r = ((eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)glewGetProcAddress((const GLubyte*)"eglDestroySyncKHR")) == NULL) || r; + r = ((eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC)glewGetProcAddress((const GLubyte*)"eglGetSyncAttribKHR")) == NULL) || r; + r = ((eglSignalSyncKHR = (PFNEGLSIGNALSYNCKHRPROC)glewGetProcAddress((const GLubyte*)"eglSignalSyncKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_reusable_sync */ + +#ifdef EGL_KHR_stream + +static GLboolean _glewInit_EGL_KHR_stream () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateStreamKHR = (PFNEGLCREATESTREAMKHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateStreamKHR")) == NULL) || r; + r = ((eglDestroyStreamKHR = (PFNEGLDESTROYSTREAMKHRPROC)glewGetProcAddress((const GLubyte*)"eglDestroyStreamKHR")) == NULL) || r; + r = ((eglQueryStreamKHR = (PFNEGLQUERYSTREAMKHRPROC)glewGetProcAddress((const GLubyte*)"eglQueryStreamKHR")) == NULL) || r; + r = ((eglQueryStreamu64KHR = (PFNEGLQUERYSTREAMU64KHRPROC)glewGetProcAddress((const GLubyte*)"eglQueryStreamu64KHR")) == NULL) || r; + r = ((eglStreamAttribKHR = (PFNEGLSTREAMATTRIBKHRPROC)glewGetProcAddress((const GLubyte*)"eglStreamAttribKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_stream */ + +#ifdef EGL_KHR_stream_consumer_gltexture + +static GLboolean _glewInit_EGL_KHR_stream_consumer_gltexture () +{ + GLboolean r = GL_FALSE; + + r = ((eglStreamConsumerAcquireKHR = (PFNEGLSTREAMCONSUMERACQUIREKHRPROC)glewGetProcAddress((const GLubyte*)"eglStreamConsumerAcquireKHR")) == NULL) || r; + r = ((eglStreamConsumerGLTextureExternalKHR = (PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)glewGetProcAddress((const GLubyte*)"eglStreamConsumerGLTextureExternalKHR")) == NULL) || r; + r = ((eglStreamConsumerReleaseKHR = (PFNEGLSTREAMCONSUMERRELEASEKHRPROC)glewGetProcAddress((const GLubyte*)"eglStreamConsumerReleaseKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_stream_consumer_gltexture */ + +#ifdef EGL_KHR_stream_cross_process_fd + +static GLboolean _glewInit_EGL_KHR_stream_cross_process_fd () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateStreamFromFileDescriptorKHR = (PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateStreamFromFileDescriptorKHR")) == NULL) || r; + r = ((eglGetStreamFileDescriptorKHR = (PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)glewGetProcAddress((const GLubyte*)"eglGetStreamFileDescriptorKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_stream_cross_process_fd */ + +#ifdef EGL_KHR_stream_fifo + +static GLboolean _glewInit_EGL_KHR_stream_fifo () +{ + GLboolean r = GL_FALSE; + + r = ((eglQueryStreamTimeKHR = (PFNEGLQUERYSTREAMTIMEKHRPROC)glewGetProcAddress((const GLubyte*)"eglQueryStreamTimeKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_stream_fifo */ + +#ifdef EGL_KHR_stream_producer_eglsurface + +static GLboolean _glewInit_EGL_KHR_stream_producer_eglsurface () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateStreamProducerSurfaceKHR = (PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)glewGetProcAddress((const GLubyte*)"eglCreateStreamProducerSurfaceKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_stream_producer_eglsurface */ + +#ifdef EGL_KHR_swap_buffers_with_damage + +static GLboolean _glewInit_EGL_KHR_swap_buffers_with_damage () +{ + GLboolean r = GL_FALSE; + + r = ((eglSwapBuffersWithDamageKHR = (PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC)glewGetProcAddress((const GLubyte*)"eglSwapBuffersWithDamageKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_swap_buffers_with_damage */ + +#ifdef EGL_KHR_wait_sync + +static GLboolean _glewInit_EGL_KHR_wait_sync () +{ + GLboolean r = GL_FALSE; + + r = ((eglWaitSyncKHR = (PFNEGLWAITSYNCKHRPROC)glewGetProcAddress((const GLubyte*)"eglWaitSyncKHR")) == NULL) || r; + + return r; +} + +#endif /* EGL_KHR_wait_sync */ + +#ifdef EGL_MESA_drm_image + +static GLboolean _glewInit_EGL_MESA_drm_image () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateDRMImageMESA = (PFNEGLCREATEDRMIMAGEMESAPROC)glewGetProcAddress((const GLubyte*)"eglCreateDRMImageMESA")) == NULL) || r; + r = ((eglExportDRMImageMESA = (PFNEGLEXPORTDRMIMAGEMESAPROC)glewGetProcAddress((const GLubyte*)"eglExportDRMImageMESA")) == NULL) || r; + + return r; +} + +#endif /* EGL_MESA_drm_image */ + +#ifdef EGL_MESA_image_dma_buf_export + +static GLboolean _glewInit_EGL_MESA_image_dma_buf_export () +{ + GLboolean r = GL_FALSE; + + r = ((eglExportDMABUFImageMESA = (PFNEGLEXPORTDMABUFIMAGEMESAPROC)glewGetProcAddress((const GLubyte*)"eglExportDMABUFImageMESA")) == NULL) || r; + r = ((eglExportDMABUFImageQueryMESA = (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC)glewGetProcAddress((const GLubyte*)"eglExportDMABUFImageQueryMESA")) == NULL) || r; + + return r; +} + +#endif /* EGL_MESA_image_dma_buf_export */ + +#ifdef EGL_NOK_swap_region + +static GLboolean _glewInit_EGL_NOK_swap_region () +{ + GLboolean r = GL_FALSE; + + r = ((eglSwapBuffersRegionNOK = (PFNEGLSWAPBUFFERSREGIONNOKPROC)glewGetProcAddress((const GLubyte*)"eglSwapBuffersRegionNOK")) == NULL) || r; + + return r; +} + +#endif /* EGL_NOK_swap_region */ + +#ifdef EGL_NOK_swap_region2 + +static GLboolean _glewInit_EGL_NOK_swap_region2 () +{ + GLboolean r = GL_FALSE; + + r = ((eglSwapBuffersRegion2NOK = (PFNEGLSWAPBUFFERSREGION2NOKPROC)glewGetProcAddress((const GLubyte*)"eglSwapBuffersRegion2NOK")) == NULL) || r; + + return r; +} + +#endif /* EGL_NOK_swap_region2 */ + +#ifdef EGL_NV_native_query + +static GLboolean _glewInit_EGL_NV_native_query () +{ + GLboolean r = GL_FALSE; + + r = ((eglQueryNativeDisplayNV = (PFNEGLQUERYNATIVEDISPLAYNVPROC)glewGetProcAddress((const GLubyte*)"eglQueryNativeDisplayNV")) == NULL) || r; + r = ((eglQueryNativePixmapNV = (PFNEGLQUERYNATIVEPIXMAPNVPROC)glewGetProcAddress((const GLubyte*)"eglQueryNativePixmapNV")) == NULL) || r; + r = ((eglQueryNativeWindowNV = (PFNEGLQUERYNATIVEWINDOWNVPROC)glewGetProcAddress((const GLubyte*)"eglQueryNativeWindowNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_native_query */ + +#ifdef EGL_NV_post_sub_buffer + +static GLboolean _glewInit_EGL_NV_post_sub_buffer () +{ + GLboolean r = GL_FALSE; + + r = ((eglPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"eglPostSubBufferNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_post_sub_buffer */ + +#ifdef EGL_NV_stream_consumer_gltexture_yuv + +static GLboolean _glewInit_EGL_NV_stream_consumer_gltexture_yuv () +{ + GLboolean r = GL_FALSE; + + r = ((eglStreamConsumerGLTextureExternalAttribsNV = (PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC)glewGetProcAddress((const GLubyte*)"eglStreamConsumerGLTextureExternalAttribsNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ + +#ifdef EGL_NV_stream_metadata + +static GLboolean _glewInit_EGL_NV_stream_metadata () +{ + GLboolean r = GL_FALSE; + + r = ((eglQueryDisplayAttribNV = (PFNEGLQUERYDISPLAYATTRIBNVPROC)glewGetProcAddress((const GLubyte*)"eglQueryDisplayAttribNV")) == NULL) || r; + r = ((eglQueryStreamMetadataNV = (PFNEGLQUERYSTREAMMETADATANVPROC)glewGetProcAddress((const GLubyte*)"eglQueryStreamMetadataNV")) == NULL) || r; + r = ((eglSetStreamMetadataNV = (PFNEGLSETSTREAMMETADATANVPROC)glewGetProcAddress((const GLubyte*)"eglSetStreamMetadataNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_stream_metadata */ + +#ifdef EGL_NV_stream_sync + +static GLboolean _glewInit_EGL_NV_stream_sync () +{ + GLboolean r = GL_FALSE; + + r = ((eglCreateStreamSyncNV = (PFNEGLCREATESTREAMSYNCNVPROC)glewGetProcAddress((const GLubyte*)"eglCreateStreamSyncNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_stream_sync */ + +#ifdef EGL_NV_sync + +static GLboolean _glewInit_EGL_NV_sync () +{ + GLboolean r = GL_FALSE; + + r = ((eglClientWaitSyncNV = (PFNEGLCLIENTWAITSYNCNVPROC)glewGetProcAddress((const GLubyte*)"eglClientWaitSyncNV")) == NULL) || r; + r = ((eglCreateFenceSyncNV = (PFNEGLCREATEFENCESYNCNVPROC)glewGetProcAddress((const GLubyte*)"eglCreateFenceSyncNV")) == NULL) || r; + r = ((eglDestroySyncNV = (PFNEGLDESTROYSYNCNVPROC)glewGetProcAddress((const GLubyte*)"eglDestroySyncNV")) == NULL) || r; + r = ((eglFenceNV = (PFNEGLFENCENVPROC)glewGetProcAddress((const GLubyte*)"eglFenceNV")) == NULL) || r; + r = ((eglGetSyncAttribNV = (PFNEGLGETSYNCATTRIBNVPROC)glewGetProcAddress((const GLubyte*)"eglGetSyncAttribNV")) == NULL) || r; + r = ((eglSignalSyncNV = (PFNEGLSIGNALSYNCNVPROC)glewGetProcAddress((const GLubyte*)"eglSignalSyncNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_sync */ + +#ifdef EGL_NV_system_time + +static GLboolean _glewInit_EGL_NV_system_time () +{ + GLboolean r = GL_FALSE; + + r = ((eglGetSystemTimeFrequencyNV = (PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)glewGetProcAddress((const GLubyte*)"eglGetSystemTimeFrequencyNV")) == NULL) || r; + r = ((eglGetSystemTimeNV = (PFNEGLGETSYSTEMTIMENVPROC)glewGetProcAddress((const GLubyte*)"eglGetSystemTimeNV")) == NULL) || r; + + return r; +} + +#endif /* EGL_NV_system_time */ + + /* ------------------------------------------------------------------------ */ + +GLboolean eglewGetExtension (const char* name) +{ + const GLubyte* start; + const GLubyte* end; + + start = (const GLubyte*) eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +GLenum eglewInit (EGLDisplay display) +{ + EGLint major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; + PFNEGLINITIALIZEPROC initialize = NULL; + PFNEGLQUERYSTRINGPROC queryString = NULL; + + /* Load necessary entry points */ + initialize = (PFNEGLINITIALIZEPROC) glewGetProcAddress("eglInitialize"); + queryString = (PFNEGLQUERYSTRINGPROC) glewGetProcAddress("eglQueryString"); + if (!initialize || !queryString) + return 1; + + /* query EGK version */ + if (initialize(display, &major, &minor) != EGL_TRUE) + return 1; + + EGLEW_VERSION_1_5 = ( major > 1 ) || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_4 = EGLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_3 = EGLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_2 = EGLEW_VERSION_1_3 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_1 = EGLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_0 = EGLEW_VERSION_1_1 == GL_TRUE || ( major == 1 && minor >= 0 ) ? GL_TRUE : GL_FALSE; + + /* query EGL extension string */ + extStart = (const GLubyte*) queryString(display, EGL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); + + /* initialize extensions */ +#ifdef EGL_VERSION_1_0 + if (glewExperimental || EGLEW_VERSION_1_0) EGLEW_VERSION_1_0 = !_glewInit_EGL_VERSION_1_0(); +#endif /* EGL_VERSION_1_0 */ +#ifdef EGL_VERSION_1_1 + if (glewExperimental || EGLEW_VERSION_1_1) EGLEW_VERSION_1_1 = !_glewInit_EGL_VERSION_1_1(); +#endif /* EGL_VERSION_1_1 */ +#ifdef EGL_VERSION_1_2 + if (glewExperimental || EGLEW_VERSION_1_2) EGLEW_VERSION_1_2 = !_glewInit_EGL_VERSION_1_2(); +#endif /* EGL_VERSION_1_2 */ +#ifdef EGL_VERSION_1_4 + if (glewExperimental || EGLEW_VERSION_1_4) EGLEW_VERSION_1_4 = !_glewInit_EGL_VERSION_1_4(); +#endif /* EGL_VERSION_1_4 */ +#ifdef EGL_VERSION_1_5 + if (glewExperimental || EGLEW_VERSION_1_5) EGLEW_VERSION_1_5 = !_glewInit_EGL_VERSION_1_5(); +#endif /* EGL_VERSION_1_5 */ +#ifdef EGL_ANDROID_blob_cache + EGLEW_ANDROID_blob_cache = _glewSearchExtension("EGL_ANDROID_blob_cache", extStart, extEnd); + if (glewExperimental || EGLEW_ANDROID_blob_cache) EGLEW_ANDROID_blob_cache = !_glewInit_EGL_ANDROID_blob_cache(); +#endif /* EGL_ANDROID_blob_cache */ +#ifdef EGL_ANDROID_create_native_client_buffer + EGLEW_ANDROID_create_native_client_buffer = _glewSearchExtension("EGL_ANDROID_create_native_client_buffer", extStart, extEnd); + if (glewExperimental || EGLEW_ANDROID_create_native_client_buffer) EGLEW_ANDROID_create_native_client_buffer = !_glewInit_EGL_ANDROID_create_native_client_buffer(); +#endif /* EGL_ANDROID_create_native_client_buffer */ +#ifdef EGL_ANDROID_framebuffer_target + EGLEW_ANDROID_framebuffer_target = _glewSearchExtension("EGL_ANDROID_framebuffer_target", extStart, extEnd); +#endif /* EGL_ANDROID_framebuffer_target */ +#ifdef EGL_ANDROID_front_buffer_auto_refresh + EGLEW_ANDROID_front_buffer_auto_refresh = _glewSearchExtension("EGL_ANDROID_front_buffer_auto_refresh", extStart, extEnd); +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ +#ifdef EGL_ANDROID_image_native_buffer + EGLEW_ANDROID_image_native_buffer = _glewSearchExtension("EGL_ANDROID_image_native_buffer", extStart, extEnd); +#endif /* EGL_ANDROID_image_native_buffer */ +#ifdef EGL_ANDROID_native_fence_sync + EGLEW_ANDROID_native_fence_sync = _glewSearchExtension("EGL_ANDROID_native_fence_sync", extStart, extEnd); + if (glewExperimental || EGLEW_ANDROID_native_fence_sync) EGLEW_ANDROID_native_fence_sync = !_glewInit_EGL_ANDROID_native_fence_sync(); +#endif /* EGL_ANDROID_native_fence_sync */ +#ifdef EGL_ANDROID_presentation_time + EGLEW_ANDROID_presentation_time = _glewSearchExtension("EGL_ANDROID_presentation_time", extStart, extEnd); + if (glewExperimental || EGLEW_ANDROID_presentation_time) EGLEW_ANDROID_presentation_time = !_glewInit_EGL_ANDROID_presentation_time(); +#endif /* EGL_ANDROID_presentation_time */ +#ifdef EGL_ANDROID_recordable + EGLEW_ANDROID_recordable = _glewSearchExtension("EGL_ANDROID_recordable", extStart, extEnd); +#endif /* EGL_ANDROID_recordable */ +#ifdef EGL_ANGLE_d3d_share_handle_client_buffer + EGLEW_ANGLE_d3d_share_handle_client_buffer = _glewSearchExtension("EGL_ANGLE_d3d_share_handle_client_buffer", extStart, extEnd); +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ +#ifdef EGL_ANGLE_device_d3d + EGLEW_ANGLE_device_d3d = _glewSearchExtension("EGL_ANGLE_device_d3d", extStart, extEnd); +#endif /* EGL_ANGLE_device_d3d */ +#ifdef EGL_ANGLE_query_surface_pointer + EGLEW_ANGLE_query_surface_pointer = _glewSearchExtension("EGL_ANGLE_query_surface_pointer", extStart, extEnd); + if (glewExperimental || EGLEW_ANGLE_query_surface_pointer) EGLEW_ANGLE_query_surface_pointer = !_glewInit_EGL_ANGLE_query_surface_pointer(); +#endif /* EGL_ANGLE_query_surface_pointer */ +#ifdef EGL_ANGLE_surface_d3d_texture_2d_share_handle + EGLEW_ANGLE_surface_d3d_texture_2d_share_handle = _glewSearchExtension("EGL_ANGLE_surface_d3d_texture_2d_share_handle", extStart, extEnd); +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ +#ifdef EGL_ANGLE_window_fixed_size + EGLEW_ANGLE_window_fixed_size = _glewSearchExtension("EGL_ANGLE_window_fixed_size", extStart, extEnd); +#endif /* EGL_ANGLE_window_fixed_size */ +#ifdef EGL_ARM_pixmap_multisample_discard + EGLEW_ARM_pixmap_multisample_discard = _glewSearchExtension("EGL_ARM_pixmap_multisample_discard", extStart, extEnd); +#endif /* EGL_ARM_pixmap_multisample_discard */ +#ifdef EGL_EXT_buffer_age + EGLEW_EXT_buffer_age = _glewSearchExtension("EGL_EXT_buffer_age", extStart, extEnd); +#endif /* EGL_EXT_buffer_age */ +#ifdef EGL_EXT_client_extensions + EGLEW_EXT_client_extensions = _glewSearchExtension("EGL_EXT_client_extensions", extStart, extEnd); +#endif /* EGL_EXT_client_extensions */ +#ifdef EGL_EXT_create_context_robustness + EGLEW_EXT_create_context_robustness = _glewSearchExtension("EGL_EXT_create_context_robustness", extStart, extEnd); +#endif /* EGL_EXT_create_context_robustness */ +#ifdef EGL_EXT_device_base + EGLEW_EXT_device_base = _glewSearchExtension("EGL_EXT_device_base", extStart, extEnd); +#endif /* EGL_EXT_device_base */ +#ifdef EGL_EXT_device_drm + EGLEW_EXT_device_drm = _glewSearchExtension("EGL_EXT_device_drm", extStart, extEnd); +#endif /* EGL_EXT_device_drm */ +#ifdef EGL_EXT_device_enumeration + EGLEW_EXT_device_enumeration = _glewSearchExtension("EGL_EXT_device_enumeration", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_device_enumeration) EGLEW_EXT_device_enumeration = !_glewInit_EGL_EXT_device_enumeration(); +#endif /* EGL_EXT_device_enumeration */ +#ifdef EGL_EXT_device_openwf + EGLEW_EXT_device_openwf = _glewSearchExtension("EGL_EXT_device_openwf", extStart, extEnd); +#endif /* EGL_EXT_device_openwf */ +#ifdef EGL_EXT_device_query + EGLEW_EXT_device_query = _glewSearchExtension("EGL_EXT_device_query", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_device_query) EGLEW_EXT_device_query = !_glewInit_EGL_EXT_device_query(); +#endif /* EGL_EXT_device_query */ +#ifdef EGL_EXT_image_dma_buf_import + EGLEW_EXT_image_dma_buf_import = _glewSearchExtension("EGL_EXT_image_dma_buf_import", extStart, extEnd); +#endif /* EGL_EXT_image_dma_buf_import */ +#ifdef EGL_EXT_multiview_window + EGLEW_EXT_multiview_window = _glewSearchExtension("EGL_EXT_multiview_window", extStart, extEnd); +#endif /* EGL_EXT_multiview_window */ +#ifdef EGL_EXT_output_base + EGLEW_EXT_output_base = _glewSearchExtension("EGL_EXT_output_base", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_output_base) EGLEW_EXT_output_base = !_glewInit_EGL_EXT_output_base(); +#endif /* EGL_EXT_output_base */ +#ifdef EGL_EXT_output_drm + EGLEW_EXT_output_drm = _glewSearchExtension("EGL_EXT_output_drm", extStart, extEnd); +#endif /* EGL_EXT_output_drm */ +#ifdef EGL_EXT_output_openwf + EGLEW_EXT_output_openwf = _glewSearchExtension("EGL_EXT_output_openwf", extStart, extEnd); +#endif /* EGL_EXT_output_openwf */ +#ifdef EGL_EXT_platform_base + EGLEW_EXT_platform_base = _glewSearchExtension("EGL_EXT_platform_base", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_platform_base) EGLEW_EXT_platform_base = !_glewInit_EGL_EXT_platform_base(); +#endif /* EGL_EXT_platform_base */ +#ifdef EGL_EXT_platform_device + EGLEW_EXT_platform_device = _glewSearchExtension("EGL_EXT_platform_device", extStart, extEnd); +#endif /* EGL_EXT_platform_device */ +#ifdef EGL_EXT_platform_wayland + EGLEW_EXT_platform_wayland = _glewSearchExtension("EGL_EXT_platform_wayland", extStart, extEnd); +#endif /* EGL_EXT_platform_wayland */ +#ifdef EGL_EXT_platform_x11 + EGLEW_EXT_platform_x11 = _glewSearchExtension("EGL_EXT_platform_x11", extStart, extEnd); +#endif /* EGL_EXT_platform_x11 */ +#ifdef EGL_EXT_protected_content + EGLEW_EXT_protected_content = _glewSearchExtension("EGL_EXT_protected_content", extStart, extEnd); +#endif /* EGL_EXT_protected_content */ +#ifdef EGL_EXT_protected_surface + EGLEW_EXT_protected_surface = _glewSearchExtension("EGL_EXT_protected_surface", extStart, extEnd); +#endif /* EGL_EXT_protected_surface */ +#ifdef EGL_EXT_stream_consumer_egloutput + EGLEW_EXT_stream_consumer_egloutput = _glewSearchExtension("EGL_EXT_stream_consumer_egloutput", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_stream_consumer_egloutput) EGLEW_EXT_stream_consumer_egloutput = !_glewInit_EGL_EXT_stream_consumer_egloutput(); +#endif /* EGL_EXT_stream_consumer_egloutput */ +#ifdef EGL_EXT_swap_buffers_with_damage + EGLEW_EXT_swap_buffers_with_damage = _glewSearchExtension("EGL_EXT_swap_buffers_with_damage", extStart, extEnd); + if (glewExperimental || EGLEW_EXT_swap_buffers_with_damage) EGLEW_EXT_swap_buffers_with_damage = !_glewInit_EGL_EXT_swap_buffers_with_damage(); +#endif /* EGL_EXT_swap_buffers_with_damage */ +#ifdef EGL_EXT_yuv_surface + EGLEW_EXT_yuv_surface = _glewSearchExtension("EGL_EXT_yuv_surface", extStart, extEnd); +#endif /* EGL_EXT_yuv_surface */ +#ifdef EGL_HI_clientpixmap + EGLEW_HI_clientpixmap = _glewSearchExtension("EGL_HI_clientpixmap", extStart, extEnd); + if (glewExperimental || EGLEW_HI_clientpixmap) EGLEW_HI_clientpixmap = !_glewInit_EGL_HI_clientpixmap(); +#endif /* EGL_HI_clientpixmap */ +#ifdef EGL_HI_colorformats + EGLEW_HI_colorformats = _glewSearchExtension("EGL_HI_colorformats", extStart, extEnd); +#endif /* EGL_HI_colorformats */ +#ifdef EGL_IMG_context_priority + EGLEW_IMG_context_priority = _glewSearchExtension("EGL_IMG_context_priority", extStart, extEnd); +#endif /* EGL_IMG_context_priority */ +#ifdef EGL_IMG_image_plane_attribs + EGLEW_IMG_image_plane_attribs = _glewSearchExtension("EGL_IMG_image_plane_attribs", extStart, extEnd); +#endif /* EGL_IMG_image_plane_attribs */ +#ifdef EGL_KHR_cl_event + EGLEW_KHR_cl_event = _glewSearchExtension("EGL_KHR_cl_event", extStart, extEnd); +#endif /* EGL_KHR_cl_event */ +#ifdef EGL_KHR_cl_event2 + EGLEW_KHR_cl_event2 = _glewSearchExtension("EGL_KHR_cl_event2", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_cl_event2) EGLEW_KHR_cl_event2 = !_glewInit_EGL_KHR_cl_event2(); +#endif /* EGL_KHR_cl_event2 */ +#ifdef EGL_KHR_client_get_all_proc_addresses + EGLEW_KHR_client_get_all_proc_addresses = _glewSearchExtension("EGL_KHR_client_get_all_proc_addresses", extStart, extEnd); +#endif /* EGL_KHR_client_get_all_proc_addresses */ +#ifdef EGL_KHR_config_attribs + EGLEW_KHR_config_attribs = _glewSearchExtension("EGL_KHR_config_attribs", extStart, extEnd); +#endif /* EGL_KHR_config_attribs */ +#ifdef EGL_KHR_create_context + EGLEW_KHR_create_context = _glewSearchExtension("EGL_KHR_create_context", extStart, extEnd); +#endif /* EGL_KHR_create_context */ +#ifdef EGL_KHR_create_context_no_error + EGLEW_KHR_create_context_no_error = _glewSearchExtension("EGL_KHR_create_context_no_error", extStart, extEnd); +#endif /* EGL_KHR_create_context_no_error */ +#ifdef EGL_KHR_debug + EGLEW_KHR_debug = _glewSearchExtension("EGL_KHR_debug", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_debug) EGLEW_KHR_debug = !_glewInit_EGL_KHR_debug(); +#endif /* EGL_KHR_debug */ +#ifdef EGL_KHR_fence_sync + EGLEW_KHR_fence_sync = _glewSearchExtension("EGL_KHR_fence_sync", extStart, extEnd); +#endif /* EGL_KHR_fence_sync */ +#ifdef EGL_KHR_get_all_proc_addresses + EGLEW_KHR_get_all_proc_addresses = _glewSearchExtension("EGL_KHR_get_all_proc_addresses", extStart, extEnd); +#endif /* EGL_KHR_get_all_proc_addresses */ +#ifdef EGL_KHR_gl_colorspace + EGLEW_KHR_gl_colorspace = _glewSearchExtension("EGL_KHR_gl_colorspace", extStart, extEnd); +#endif /* EGL_KHR_gl_colorspace */ +#ifdef EGL_KHR_gl_renderbuffer_image + EGLEW_KHR_gl_renderbuffer_image = _glewSearchExtension("EGL_KHR_gl_renderbuffer_image", extStart, extEnd); +#endif /* EGL_KHR_gl_renderbuffer_image */ +#ifdef EGL_KHR_gl_texture_2D_image + EGLEW_KHR_gl_texture_2D_image = _glewSearchExtension("EGL_KHR_gl_texture_2D_image", extStart, extEnd); +#endif /* EGL_KHR_gl_texture_2D_image */ +#ifdef EGL_KHR_gl_texture_3D_image + EGLEW_KHR_gl_texture_3D_image = _glewSearchExtension("EGL_KHR_gl_texture_3D_image", extStart, extEnd); +#endif /* EGL_KHR_gl_texture_3D_image */ +#ifdef EGL_KHR_gl_texture_cubemap_image + EGLEW_KHR_gl_texture_cubemap_image = _glewSearchExtension("EGL_KHR_gl_texture_cubemap_image", extStart, extEnd); +#endif /* EGL_KHR_gl_texture_cubemap_image */ +#ifdef EGL_KHR_image + EGLEW_KHR_image = _glewSearchExtension("EGL_KHR_image", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_image) EGLEW_KHR_image = !_glewInit_EGL_KHR_image(); +#endif /* EGL_KHR_image */ +#ifdef EGL_KHR_image_base + EGLEW_KHR_image_base = _glewSearchExtension("EGL_KHR_image_base", extStart, extEnd); +#endif /* EGL_KHR_image_base */ +#ifdef EGL_KHR_image_pixmap + EGLEW_KHR_image_pixmap = _glewSearchExtension("EGL_KHR_image_pixmap", extStart, extEnd); +#endif /* EGL_KHR_image_pixmap */ +#ifdef EGL_KHR_lock_surface + EGLEW_KHR_lock_surface = _glewSearchExtension("EGL_KHR_lock_surface", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_lock_surface) EGLEW_KHR_lock_surface = !_glewInit_EGL_KHR_lock_surface(); +#endif /* EGL_KHR_lock_surface */ +#ifdef EGL_KHR_lock_surface2 + EGLEW_KHR_lock_surface2 = _glewSearchExtension("EGL_KHR_lock_surface2", extStart, extEnd); +#endif /* EGL_KHR_lock_surface2 */ +#ifdef EGL_KHR_lock_surface3 + EGLEW_KHR_lock_surface3 = _glewSearchExtension("EGL_KHR_lock_surface3", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_lock_surface3) EGLEW_KHR_lock_surface3 = !_glewInit_EGL_KHR_lock_surface3(); +#endif /* EGL_KHR_lock_surface3 */ +#ifdef EGL_KHR_mutable_render_buffer + EGLEW_KHR_mutable_render_buffer = _glewSearchExtension("EGL_KHR_mutable_render_buffer", extStart, extEnd); +#endif /* EGL_KHR_mutable_render_buffer */ +#ifdef EGL_KHR_partial_update + EGLEW_KHR_partial_update = _glewSearchExtension("EGL_KHR_partial_update", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_partial_update) EGLEW_KHR_partial_update = !_glewInit_EGL_KHR_partial_update(); +#endif /* EGL_KHR_partial_update */ +#ifdef EGL_KHR_platform_android + EGLEW_KHR_platform_android = _glewSearchExtension("EGL_KHR_platform_android", extStart, extEnd); +#endif /* EGL_KHR_platform_android */ +#ifdef EGL_KHR_platform_gbm + EGLEW_KHR_platform_gbm = _glewSearchExtension("EGL_KHR_platform_gbm", extStart, extEnd); +#endif /* EGL_KHR_platform_gbm */ +#ifdef EGL_KHR_platform_wayland + EGLEW_KHR_platform_wayland = _glewSearchExtension("EGL_KHR_platform_wayland", extStart, extEnd); +#endif /* EGL_KHR_platform_wayland */ +#ifdef EGL_KHR_platform_x11 + EGLEW_KHR_platform_x11 = _glewSearchExtension("EGL_KHR_platform_x11", extStart, extEnd); +#endif /* EGL_KHR_platform_x11 */ +#ifdef EGL_KHR_reusable_sync + EGLEW_KHR_reusable_sync = _glewSearchExtension("EGL_KHR_reusable_sync", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_reusable_sync) EGLEW_KHR_reusable_sync = !_glewInit_EGL_KHR_reusable_sync(); +#endif /* EGL_KHR_reusable_sync */ +#ifdef EGL_KHR_stream + EGLEW_KHR_stream = _glewSearchExtension("EGL_KHR_stream", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_stream) EGLEW_KHR_stream = !_glewInit_EGL_KHR_stream(); +#endif /* EGL_KHR_stream */ +#ifdef EGL_KHR_stream_consumer_gltexture + EGLEW_KHR_stream_consumer_gltexture = _glewSearchExtension("EGL_KHR_stream_consumer_gltexture", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_stream_consumer_gltexture) EGLEW_KHR_stream_consumer_gltexture = !_glewInit_EGL_KHR_stream_consumer_gltexture(); +#endif /* EGL_KHR_stream_consumer_gltexture */ +#ifdef EGL_KHR_stream_cross_process_fd + EGLEW_KHR_stream_cross_process_fd = _glewSearchExtension("EGL_KHR_stream_cross_process_fd", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_stream_cross_process_fd) EGLEW_KHR_stream_cross_process_fd = !_glewInit_EGL_KHR_stream_cross_process_fd(); +#endif /* EGL_KHR_stream_cross_process_fd */ +#ifdef EGL_KHR_stream_fifo + EGLEW_KHR_stream_fifo = _glewSearchExtension("EGL_KHR_stream_fifo", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_stream_fifo) EGLEW_KHR_stream_fifo = !_glewInit_EGL_KHR_stream_fifo(); +#endif /* EGL_KHR_stream_fifo */ +#ifdef EGL_KHR_stream_producer_aldatalocator + EGLEW_KHR_stream_producer_aldatalocator = _glewSearchExtension("EGL_KHR_stream_producer_aldatalocator", extStart, extEnd); +#endif /* EGL_KHR_stream_producer_aldatalocator */ +#ifdef EGL_KHR_stream_producer_eglsurface + EGLEW_KHR_stream_producer_eglsurface = _glewSearchExtension("EGL_KHR_stream_producer_eglsurface", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_stream_producer_eglsurface) EGLEW_KHR_stream_producer_eglsurface = !_glewInit_EGL_KHR_stream_producer_eglsurface(); +#endif /* EGL_KHR_stream_producer_eglsurface */ +#ifdef EGL_KHR_surfaceless_context + EGLEW_KHR_surfaceless_context = _glewSearchExtension("EGL_KHR_surfaceless_context", extStart, extEnd); +#endif /* EGL_KHR_surfaceless_context */ +#ifdef EGL_KHR_swap_buffers_with_damage + EGLEW_KHR_swap_buffers_with_damage = _glewSearchExtension("EGL_KHR_swap_buffers_with_damage", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_swap_buffers_with_damage) EGLEW_KHR_swap_buffers_with_damage = !_glewInit_EGL_KHR_swap_buffers_with_damage(); +#endif /* EGL_KHR_swap_buffers_with_damage */ +#ifdef EGL_KHR_vg_parent_image + EGLEW_KHR_vg_parent_image = _glewSearchExtension("EGL_KHR_vg_parent_image", extStart, extEnd); +#endif /* EGL_KHR_vg_parent_image */ +#ifdef EGL_KHR_wait_sync + EGLEW_KHR_wait_sync = _glewSearchExtension("EGL_KHR_wait_sync", extStart, extEnd); + if (glewExperimental || EGLEW_KHR_wait_sync) EGLEW_KHR_wait_sync = !_glewInit_EGL_KHR_wait_sync(); +#endif /* EGL_KHR_wait_sync */ +#ifdef EGL_MESA_drm_image + EGLEW_MESA_drm_image = _glewSearchExtension("EGL_MESA_drm_image", extStart, extEnd); + if (glewExperimental || EGLEW_MESA_drm_image) EGLEW_MESA_drm_image = !_glewInit_EGL_MESA_drm_image(); +#endif /* EGL_MESA_drm_image */ +#ifdef EGL_MESA_image_dma_buf_export + EGLEW_MESA_image_dma_buf_export = _glewSearchExtension("EGL_MESA_image_dma_buf_export", extStart, extEnd); + if (glewExperimental || EGLEW_MESA_image_dma_buf_export) EGLEW_MESA_image_dma_buf_export = !_glewInit_EGL_MESA_image_dma_buf_export(); +#endif /* EGL_MESA_image_dma_buf_export */ +#ifdef EGL_MESA_platform_gbm + EGLEW_MESA_platform_gbm = _glewSearchExtension("EGL_MESA_platform_gbm", extStart, extEnd); +#endif /* EGL_MESA_platform_gbm */ +#ifdef EGL_NOK_swap_region + EGLEW_NOK_swap_region = _glewSearchExtension("EGL_NOK_swap_region", extStart, extEnd); + if (glewExperimental || EGLEW_NOK_swap_region) EGLEW_NOK_swap_region = !_glewInit_EGL_NOK_swap_region(); +#endif /* EGL_NOK_swap_region */ +#ifdef EGL_NOK_swap_region2 + EGLEW_NOK_swap_region2 = _glewSearchExtension("EGL_NOK_swap_region2", extStart, extEnd); + if (glewExperimental || EGLEW_NOK_swap_region2) EGLEW_NOK_swap_region2 = !_glewInit_EGL_NOK_swap_region2(); +#endif /* EGL_NOK_swap_region2 */ +#ifdef EGL_NOK_texture_from_pixmap + EGLEW_NOK_texture_from_pixmap = _glewSearchExtension("EGL_NOK_texture_from_pixmap", extStart, extEnd); +#endif /* EGL_NOK_texture_from_pixmap */ +#ifdef EGL_NV_3dvision_surface + EGLEW_NV_3dvision_surface = _glewSearchExtension("EGL_NV_3dvision_surface", extStart, extEnd); +#endif /* EGL_NV_3dvision_surface */ +#ifdef EGL_NV_coverage_sample + EGLEW_NV_coverage_sample = _glewSearchExtension("EGL_NV_coverage_sample", extStart, extEnd); +#endif /* EGL_NV_coverage_sample */ +#ifdef EGL_NV_coverage_sample_resolve + EGLEW_NV_coverage_sample_resolve = _glewSearchExtension("EGL_NV_coverage_sample_resolve", extStart, extEnd); +#endif /* EGL_NV_coverage_sample_resolve */ +#ifdef EGL_NV_cuda_event + EGLEW_NV_cuda_event = _glewSearchExtension("EGL_NV_cuda_event", extStart, extEnd); +#endif /* EGL_NV_cuda_event */ +#ifdef EGL_NV_depth_nonlinear + EGLEW_NV_depth_nonlinear = _glewSearchExtension("EGL_NV_depth_nonlinear", extStart, extEnd); +#endif /* EGL_NV_depth_nonlinear */ +#ifdef EGL_NV_device_cuda + EGLEW_NV_device_cuda = _glewSearchExtension("EGL_NV_device_cuda", extStart, extEnd); +#endif /* EGL_NV_device_cuda */ +#ifdef EGL_NV_native_query + EGLEW_NV_native_query = _glewSearchExtension("EGL_NV_native_query", extStart, extEnd); + if (glewExperimental || EGLEW_NV_native_query) EGLEW_NV_native_query = !_glewInit_EGL_NV_native_query(); +#endif /* EGL_NV_native_query */ +#ifdef EGL_NV_post_convert_rounding + EGLEW_NV_post_convert_rounding = _glewSearchExtension("EGL_NV_post_convert_rounding", extStart, extEnd); +#endif /* EGL_NV_post_convert_rounding */ +#ifdef EGL_NV_post_sub_buffer + EGLEW_NV_post_sub_buffer = _glewSearchExtension("EGL_NV_post_sub_buffer", extStart, extEnd); + if (glewExperimental || EGLEW_NV_post_sub_buffer) EGLEW_NV_post_sub_buffer = !_glewInit_EGL_NV_post_sub_buffer(); +#endif /* EGL_NV_post_sub_buffer */ +#ifdef EGL_NV_robustness_video_memory_purge + EGLEW_NV_robustness_video_memory_purge = _glewSearchExtension("EGL_NV_robustness_video_memory_purge", extStart, extEnd); +#endif /* EGL_NV_robustness_video_memory_purge */ +#ifdef EGL_NV_stream_consumer_gltexture_yuv + EGLEW_NV_stream_consumer_gltexture_yuv = _glewSearchExtension("EGL_NV_stream_consumer_gltexture_yuv", extStart, extEnd); + if (glewExperimental || EGLEW_NV_stream_consumer_gltexture_yuv) EGLEW_NV_stream_consumer_gltexture_yuv = !_glewInit_EGL_NV_stream_consumer_gltexture_yuv(); +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ +#ifdef EGL_NV_stream_metadata + EGLEW_NV_stream_metadata = _glewSearchExtension("EGL_NV_stream_metadata", extStart, extEnd); + if (glewExperimental || EGLEW_NV_stream_metadata) EGLEW_NV_stream_metadata = !_glewInit_EGL_NV_stream_metadata(); +#endif /* EGL_NV_stream_metadata */ +#ifdef EGL_NV_stream_sync + EGLEW_NV_stream_sync = _glewSearchExtension("EGL_NV_stream_sync", extStart, extEnd); + if (glewExperimental || EGLEW_NV_stream_sync) EGLEW_NV_stream_sync = !_glewInit_EGL_NV_stream_sync(); +#endif /* EGL_NV_stream_sync */ +#ifdef EGL_NV_sync + EGLEW_NV_sync = _glewSearchExtension("EGL_NV_sync", extStart, extEnd); + if (glewExperimental || EGLEW_NV_sync) EGLEW_NV_sync = !_glewInit_EGL_NV_sync(); +#endif /* EGL_NV_sync */ +#ifdef EGL_NV_system_time + EGLEW_NV_system_time = _glewSearchExtension("EGL_NV_system_time", extStart, extEnd); + if (glewExperimental || EGLEW_NV_system_time) EGLEW_NV_system_time = !_glewInit_EGL_NV_system_time(); +#endif /* EGL_NV_system_time */ +#ifdef EGL_TIZEN_image_native_buffer + EGLEW_TIZEN_image_native_buffer = _glewSearchExtension("EGL_TIZEN_image_native_buffer", extStart, extEnd); +#endif /* EGL_TIZEN_image_native_buffer */ +#ifdef EGL_TIZEN_image_native_surface + EGLEW_TIZEN_image_native_surface = _glewSearchExtension("EGL_TIZEN_image_native_surface", extStart, extEnd); +#endif /* EGL_TIZEN_image_native_surface */ + + return GLEW_OK; +} + +#elif defined(_WIN32) + +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; +#ifdef WGL_3DL_stereo_control + +static GLboolean _glewInit_WGL_3DL_stereo_control () +{ + 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 () +{ + 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 () +{ + 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_create_context + +static GLboolean _glewInit_WGL_ARB_create_context () +{ + GLboolean r = GL_FALSE; + + r = ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateContextAttribsARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_create_context */ + +#ifdef WGL_ARB_extensions_string + +static GLboolean _glewInit_WGL_ARB_extensions_string () +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_extensions_string */ + +#ifdef WGL_ARB_make_current_read + +static GLboolean _glewInit_WGL_ARB_make_current_read () +{ + 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_pbuffer + +static GLboolean _glewInit_WGL_ARB_pbuffer () +{ + 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 () +{ + 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_render_texture + +static GLboolean _glewInit_WGL_ARB_render_texture () +{ + 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_EXT_display_color_table + +static GLboolean _glewInit_WGL_EXT_display_color_table () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_extensions_string */ + +#ifdef WGL_EXT_make_current_read + +static GLboolean _glewInit_WGL_EXT_make_current_read () +{ + 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_pbuffer + +static GLboolean _glewInit_WGL_EXT_pbuffer () +{ + 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 () +{ + 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_swap_control + +static GLboolean _glewInit_WGL_EXT_swap_control () +{ + 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_I3D_digital_video_control + +static GLboolean _glewInit_WGL_I3D_digital_video_control () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_copy_image + +static GLboolean _glewInit_WGL_NV_copy_image () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((wglDelayBeforeSwapNV = (PFNWGLDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"wglDelayBeforeSwapNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_delay_before_swap */ + +#ifdef WGL_NV_gpu_affinity + +static GLboolean _glewInit_WGL_NV_gpu_affinity () +{ + 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_present_video + +static GLboolean _glewInit_WGL_NV_present_video () +{ + 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_swap_group + +static GLboolean _glewInit_WGL_NV_swap_group () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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) +{ + const GLubyte* start; + const GLubyte* end; + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) + return GL_FALSE; + else + start = (const GLubyte*)_wglewGetExtensionsStringEXT(); + else + start = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +GLenum GLEWAPIENTRY wglewInit () +{ + GLboolean crippled; + const GLubyte* extStart; + const GLubyte* extEnd; + /* 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) + extStart = (const GLubyte*)""; + else + extStart = (const GLubyte*)_wglewGetExtensionsStringEXT(); + else + extStart = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + extEnd = extStart + _glewStrLen(extStart); + /* initialize extensions */ + crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; +#ifdef WGL_3DFX_multisample + WGLEW_3DFX_multisample = _glewSearchExtension("WGL_3DFX_multisample", extStart, extEnd); +#endif /* WGL_3DFX_multisample */ +#ifdef WGL_3DL_stereo_control + WGLEW_3DL_stereo_control = _glewSearchExtension("WGL_3DL_stereo_control", extStart, extEnd); + if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) WGLEW_3DL_stereo_control= !_glewInit_WGL_3DL_stereo_control(); +#endif /* WGL_3DL_stereo_control */ +#ifdef WGL_AMD_gpu_association + WGLEW_AMD_gpu_association = _glewSearchExtension("WGL_AMD_gpu_association", extStart, extEnd); + if (glewExperimental || WGLEW_AMD_gpu_association|| crippled) WGLEW_AMD_gpu_association= !_glewInit_WGL_AMD_gpu_association(); +#endif /* WGL_AMD_gpu_association */ +#ifdef WGL_ARB_buffer_region + WGLEW_ARB_buffer_region = _glewSearchExtension("WGL_ARB_buffer_region", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) WGLEW_ARB_buffer_region= !_glewInit_WGL_ARB_buffer_region(); +#endif /* WGL_ARB_buffer_region */ +#ifdef WGL_ARB_context_flush_control + WGLEW_ARB_context_flush_control = _glewSearchExtension("WGL_ARB_context_flush_control", extStart, extEnd); +#endif /* WGL_ARB_context_flush_control */ +#ifdef WGL_ARB_create_context + WGLEW_ARB_create_context = _glewSearchExtension("WGL_ARB_create_context", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_create_context|| crippled) WGLEW_ARB_create_context= !_glewInit_WGL_ARB_create_context(); +#endif /* WGL_ARB_create_context */ +#ifdef WGL_ARB_create_context_profile + WGLEW_ARB_create_context_profile = _glewSearchExtension("WGL_ARB_create_context_profile", extStart, extEnd); +#endif /* WGL_ARB_create_context_profile */ +#ifdef WGL_ARB_create_context_robustness + WGLEW_ARB_create_context_robustness = _glewSearchExtension("WGL_ARB_create_context_robustness", extStart, extEnd); +#endif /* WGL_ARB_create_context_robustness */ +#ifdef WGL_ARB_extensions_string + WGLEW_ARB_extensions_string = _glewSearchExtension("WGL_ARB_extensions_string", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) WGLEW_ARB_extensions_string= !_glewInit_WGL_ARB_extensions_string(); +#endif /* WGL_ARB_extensions_string */ +#ifdef WGL_ARB_framebuffer_sRGB + WGLEW_ARB_framebuffer_sRGB = _glewSearchExtension("WGL_ARB_framebuffer_sRGB", extStart, extEnd); +#endif /* WGL_ARB_framebuffer_sRGB */ +#ifdef WGL_ARB_make_current_read + WGLEW_ARB_make_current_read = _glewSearchExtension("WGL_ARB_make_current_read", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) WGLEW_ARB_make_current_read= !_glewInit_WGL_ARB_make_current_read(); +#endif /* WGL_ARB_make_current_read */ +#ifdef WGL_ARB_multisample + WGLEW_ARB_multisample = _glewSearchExtension("WGL_ARB_multisample", extStart, extEnd); +#endif /* WGL_ARB_multisample */ +#ifdef WGL_ARB_pbuffer + WGLEW_ARB_pbuffer = _glewSearchExtension("WGL_ARB_pbuffer", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) WGLEW_ARB_pbuffer= !_glewInit_WGL_ARB_pbuffer(); +#endif /* WGL_ARB_pbuffer */ +#ifdef WGL_ARB_pixel_format + WGLEW_ARB_pixel_format = _glewSearchExtension("WGL_ARB_pixel_format", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) WGLEW_ARB_pixel_format= !_glewInit_WGL_ARB_pixel_format(); +#endif /* WGL_ARB_pixel_format */ +#ifdef WGL_ARB_pixel_format_float + WGLEW_ARB_pixel_format_float = _glewSearchExtension("WGL_ARB_pixel_format_float", extStart, extEnd); +#endif /* WGL_ARB_pixel_format_float */ +#ifdef WGL_ARB_render_texture + WGLEW_ARB_render_texture = _glewSearchExtension("WGL_ARB_render_texture", extStart, extEnd); + if (glewExperimental || WGLEW_ARB_render_texture|| crippled) WGLEW_ARB_render_texture= !_glewInit_WGL_ARB_render_texture(); +#endif /* WGL_ARB_render_texture */ +#ifdef WGL_ARB_robustness_application_isolation + WGLEW_ARB_robustness_application_isolation = _glewSearchExtension("WGL_ARB_robustness_application_isolation", extStart, extEnd); +#endif /* WGL_ARB_robustness_application_isolation */ +#ifdef WGL_ARB_robustness_share_group_isolation + WGLEW_ARB_robustness_share_group_isolation = _glewSearchExtension("WGL_ARB_robustness_share_group_isolation", extStart, extEnd); +#endif /* WGL_ARB_robustness_share_group_isolation */ +#ifdef WGL_ATI_pixel_format_float + WGLEW_ATI_pixel_format_float = _glewSearchExtension("WGL_ATI_pixel_format_float", extStart, extEnd); +#endif /* WGL_ATI_pixel_format_float */ +#ifdef WGL_ATI_render_texture_rectangle + WGLEW_ATI_render_texture_rectangle = _glewSearchExtension("WGL_ATI_render_texture_rectangle", extStart, extEnd); +#endif /* WGL_ATI_render_texture_rectangle */ +#ifdef WGL_EXT_create_context_es2_profile + WGLEW_EXT_create_context_es2_profile = _glewSearchExtension("WGL_EXT_create_context_es2_profile", extStart, extEnd); +#endif /* WGL_EXT_create_context_es2_profile */ +#ifdef WGL_EXT_create_context_es_profile + WGLEW_EXT_create_context_es_profile = _glewSearchExtension("WGL_EXT_create_context_es_profile", extStart, extEnd); +#endif /* WGL_EXT_create_context_es_profile */ +#ifdef WGL_EXT_depth_float + WGLEW_EXT_depth_float = _glewSearchExtension("WGL_EXT_depth_float", extStart, extEnd); +#endif /* WGL_EXT_depth_float */ +#ifdef WGL_EXT_display_color_table + WGLEW_EXT_display_color_table = _glewSearchExtension("WGL_EXT_display_color_table", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) WGLEW_EXT_display_color_table= !_glewInit_WGL_EXT_display_color_table(); +#endif /* WGL_EXT_display_color_table */ +#ifdef WGL_EXT_extensions_string + WGLEW_EXT_extensions_string = _glewSearchExtension("WGL_EXT_extensions_string", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) WGLEW_EXT_extensions_string= !_glewInit_WGL_EXT_extensions_string(); +#endif /* WGL_EXT_extensions_string */ +#ifdef WGL_EXT_framebuffer_sRGB + WGLEW_EXT_framebuffer_sRGB = _glewSearchExtension("WGL_EXT_framebuffer_sRGB", extStart, extEnd); +#endif /* WGL_EXT_framebuffer_sRGB */ +#ifdef WGL_EXT_make_current_read + WGLEW_EXT_make_current_read = _glewSearchExtension("WGL_EXT_make_current_read", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) WGLEW_EXT_make_current_read= !_glewInit_WGL_EXT_make_current_read(); +#endif /* WGL_EXT_make_current_read */ +#ifdef WGL_EXT_multisample + WGLEW_EXT_multisample = _glewSearchExtension("WGL_EXT_multisample", extStart, extEnd); +#endif /* WGL_EXT_multisample */ +#ifdef WGL_EXT_pbuffer + WGLEW_EXT_pbuffer = _glewSearchExtension("WGL_EXT_pbuffer", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) WGLEW_EXT_pbuffer= !_glewInit_WGL_EXT_pbuffer(); +#endif /* WGL_EXT_pbuffer */ +#ifdef WGL_EXT_pixel_format + WGLEW_EXT_pixel_format = _glewSearchExtension("WGL_EXT_pixel_format", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) WGLEW_EXT_pixel_format= !_glewInit_WGL_EXT_pixel_format(); +#endif /* WGL_EXT_pixel_format */ +#ifdef WGL_EXT_pixel_format_packed_float + WGLEW_EXT_pixel_format_packed_float = _glewSearchExtension("WGL_EXT_pixel_format_packed_float", extStart, extEnd); +#endif /* WGL_EXT_pixel_format_packed_float */ +#ifdef WGL_EXT_swap_control + WGLEW_EXT_swap_control = _glewSearchExtension("WGL_EXT_swap_control", extStart, extEnd); + if (glewExperimental || WGLEW_EXT_swap_control|| crippled) WGLEW_EXT_swap_control= !_glewInit_WGL_EXT_swap_control(); +#endif /* WGL_EXT_swap_control */ +#ifdef WGL_EXT_swap_control_tear + WGLEW_EXT_swap_control_tear = _glewSearchExtension("WGL_EXT_swap_control_tear", extStart, extEnd); +#endif /* WGL_EXT_swap_control_tear */ +#ifdef WGL_I3D_digital_video_control + WGLEW_I3D_digital_video_control = _glewSearchExtension("WGL_I3D_digital_video_control", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) WGLEW_I3D_digital_video_control= !_glewInit_WGL_I3D_digital_video_control(); +#endif /* WGL_I3D_digital_video_control */ +#ifdef WGL_I3D_gamma + WGLEW_I3D_gamma = _glewSearchExtension("WGL_I3D_gamma", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_gamma|| crippled) WGLEW_I3D_gamma= !_glewInit_WGL_I3D_gamma(); +#endif /* WGL_I3D_gamma */ +#ifdef WGL_I3D_genlock + WGLEW_I3D_genlock = _glewSearchExtension("WGL_I3D_genlock", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_genlock|| crippled) WGLEW_I3D_genlock= !_glewInit_WGL_I3D_genlock(); +#endif /* WGL_I3D_genlock */ +#ifdef WGL_I3D_image_buffer + WGLEW_I3D_image_buffer = _glewSearchExtension("WGL_I3D_image_buffer", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) WGLEW_I3D_image_buffer= !_glewInit_WGL_I3D_image_buffer(); +#endif /* WGL_I3D_image_buffer */ +#ifdef WGL_I3D_swap_frame_lock + WGLEW_I3D_swap_frame_lock = _glewSearchExtension("WGL_I3D_swap_frame_lock", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) WGLEW_I3D_swap_frame_lock= !_glewInit_WGL_I3D_swap_frame_lock(); +#endif /* WGL_I3D_swap_frame_lock */ +#ifdef WGL_I3D_swap_frame_usage + WGLEW_I3D_swap_frame_usage = _glewSearchExtension("WGL_I3D_swap_frame_usage", extStart, extEnd); + if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) WGLEW_I3D_swap_frame_usage= !_glewInit_WGL_I3D_swap_frame_usage(); +#endif /* WGL_I3D_swap_frame_usage */ +#ifdef WGL_NV_DX_interop + WGLEW_NV_DX_interop = _glewSearchExtension("WGL_NV_DX_interop", extStart, extEnd); + if (glewExperimental || WGLEW_NV_DX_interop|| crippled) WGLEW_NV_DX_interop= !_glewInit_WGL_NV_DX_interop(); +#endif /* WGL_NV_DX_interop */ +#ifdef WGL_NV_DX_interop2 + WGLEW_NV_DX_interop2 = _glewSearchExtension("WGL_NV_DX_interop2", extStart, extEnd); +#endif /* WGL_NV_DX_interop2 */ +#ifdef WGL_NV_copy_image + WGLEW_NV_copy_image = _glewSearchExtension("WGL_NV_copy_image", extStart, extEnd); + if (glewExperimental || WGLEW_NV_copy_image|| crippled) WGLEW_NV_copy_image= !_glewInit_WGL_NV_copy_image(); +#endif /* WGL_NV_copy_image */ +#ifdef WGL_NV_delay_before_swap + WGLEW_NV_delay_before_swap = _glewSearchExtension("WGL_NV_delay_before_swap", extStart, extEnd); + if (glewExperimental || WGLEW_NV_delay_before_swap|| crippled) WGLEW_NV_delay_before_swap= !_glewInit_WGL_NV_delay_before_swap(); +#endif /* WGL_NV_delay_before_swap */ +#ifdef WGL_NV_float_buffer + WGLEW_NV_float_buffer = _glewSearchExtension("WGL_NV_float_buffer", extStart, extEnd); +#endif /* WGL_NV_float_buffer */ +#ifdef WGL_NV_gpu_affinity + WGLEW_NV_gpu_affinity = _glewSearchExtension("WGL_NV_gpu_affinity", extStart, extEnd); + if (glewExperimental || WGLEW_NV_gpu_affinity|| crippled) WGLEW_NV_gpu_affinity= !_glewInit_WGL_NV_gpu_affinity(); +#endif /* WGL_NV_gpu_affinity */ +#ifdef WGL_NV_multisample_coverage + WGLEW_NV_multisample_coverage = _glewSearchExtension("WGL_NV_multisample_coverage", extStart, extEnd); +#endif /* WGL_NV_multisample_coverage */ +#ifdef WGL_NV_present_video + WGLEW_NV_present_video = _glewSearchExtension("WGL_NV_present_video", extStart, extEnd); + if (glewExperimental || WGLEW_NV_present_video|| crippled) WGLEW_NV_present_video= !_glewInit_WGL_NV_present_video(); +#endif /* WGL_NV_present_video */ +#ifdef WGL_NV_render_depth_texture + WGLEW_NV_render_depth_texture = _glewSearchExtension("WGL_NV_render_depth_texture", extStart, extEnd); +#endif /* WGL_NV_render_depth_texture */ +#ifdef WGL_NV_render_texture_rectangle + WGLEW_NV_render_texture_rectangle = _glewSearchExtension("WGL_NV_render_texture_rectangle", extStart, extEnd); +#endif /* WGL_NV_render_texture_rectangle */ +#ifdef WGL_NV_swap_group + WGLEW_NV_swap_group = _glewSearchExtension("WGL_NV_swap_group", extStart, extEnd); + if (glewExperimental || WGLEW_NV_swap_group|| crippled) WGLEW_NV_swap_group= !_glewInit_WGL_NV_swap_group(); +#endif /* WGL_NV_swap_group */ +#ifdef WGL_NV_vertex_array_range + WGLEW_NV_vertex_array_range = _glewSearchExtension("WGL_NV_vertex_array_range", extStart, extEnd); + if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) WGLEW_NV_vertex_array_range= !_glewInit_WGL_NV_vertex_array_range(); +#endif /* WGL_NV_vertex_array_range */ +#ifdef WGL_NV_video_capture + WGLEW_NV_video_capture = _glewSearchExtension("WGL_NV_video_capture", extStart, extEnd); + if (glewExperimental || WGLEW_NV_video_capture|| crippled) WGLEW_NV_video_capture= !_glewInit_WGL_NV_video_capture(); +#endif /* WGL_NV_video_capture */ +#ifdef WGL_NV_video_output + WGLEW_NV_video_output = _glewSearchExtension("WGL_NV_video_output", extStart, extEnd); + if (glewExperimental || WGLEW_NV_video_output|| crippled) WGLEW_NV_video_output= !_glewInit_WGL_NV_video_output(); +#endif /* WGL_NV_video_output */ +#ifdef WGL_OML_sync_control + WGLEW_OML_sync_control = _glewSearchExtension("WGL_OML_sync_control", extStart, extEnd); + if (glewExperimental || WGLEW_OML_sync_control|| crippled) WGLEW_OML_sync_control= !_glewInit_WGL_OML_sync_control(); +#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; + +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_libglvnd = 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_robustness_video_memory_purge = 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; +#ifdef GLX_VERSION_1_2 + +static GLboolean _glewInit_GLX_VERSION_1_2 () +{ + 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 () +{ + 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_AMD_gpu_association + +static GLboolean _glewInit_GLX_AMD_gpu_association () +{ + 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_create_context + +static GLboolean _glewInit_GLX_ARB_create_context () +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB")) == NULL) || r; + + return r; +} + +#endif /* GLX_ARB_create_context */ + +#ifdef GLX_ATI_render_texture + +static GLboolean _glewInit_GLX_ATI_render_texture () +{ + 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_import_context + +static GLboolean _glewInit_GLX_EXT_import_context () +{ + 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_swap_control + +static GLboolean _glewInit_GLX_EXT_swap_control () +{ + GLboolean r = GL_FALSE; + + r = ((glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalEXT")) == NULL) || r; + + return r; +} + +#endif /* GLX_EXT_swap_control */ + +#ifdef GLX_EXT_texture_from_pixmap + +static GLboolean _glewInit_GLX_EXT_texture_from_pixmap () +{ + 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_MESA_agp_offset + +static GLboolean _glewInit_GLX_MESA_agp_offset () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + GLboolean r = GL_FALSE; + + r = ((glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)glewGetProcAddress((const GLubyte*)"glXDelayBeforeSwapNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_delay_before_swap */ + +#ifdef GLX_NV_present_video + +static GLboolean _glewInit_GLX_NV_present_video () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_sync_control + +static GLboolean _glewInit_GLX_OML_sync_control () +{ + 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_SGIX_fbconfig + +static GLboolean _glewInit_GLX_SGIX_fbconfig () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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_SGI_cushion + +static GLboolean _glewInit_GLX_SGI_cushion () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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 () +{ + 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) +{ + const GLubyte* start; + const GLubyte* end; + + if (glXGetCurrentDisplay == NULL) return GL_FALSE; + start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); +} + +GLenum glxewInit () +{ + int major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; + /* initialize core GLX 1.2 */ + if (_glewInit_GLX_VERSION_1_2()) 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 */ + extStart = 0; + if (glXGetCurrentDisplay != NULL) + extStart = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); + /* initialize extensions */ +#ifdef GLX_VERSION_1_3 + if (glewExperimental || GLXEW_VERSION_1_3) GLXEW_VERSION_1_3 = !_glewInit_GLX_VERSION_1_3(); +#endif /* GLX_VERSION_1_3 */ +#ifdef GLX_3DFX_multisample + GLXEW_3DFX_multisample = _glewSearchExtension("GLX_3DFX_multisample", extStart, extEnd); +#endif /* GLX_3DFX_multisample */ +#ifdef GLX_AMD_gpu_association + GLXEW_AMD_gpu_association = _glewSearchExtension("GLX_AMD_gpu_association", extStart, extEnd); + if (glewExperimental || GLXEW_AMD_gpu_association) GLXEW_AMD_gpu_association = !_glewInit_GLX_AMD_gpu_association(); +#endif /* GLX_AMD_gpu_association */ +#ifdef GLX_ARB_context_flush_control + GLXEW_ARB_context_flush_control = _glewSearchExtension("GLX_ARB_context_flush_control", extStart, extEnd); +#endif /* GLX_ARB_context_flush_control */ +#ifdef GLX_ARB_create_context + GLXEW_ARB_create_context = _glewSearchExtension("GLX_ARB_create_context", extStart, extEnd); + if (glewExperimental || GLXEW_ARB_create_context) GLXEW_ARB_create_context = !_glewInit_GLX_ARB_create_context(); +#endif /* GLX_ARB_create_context */ +#ifdef GLX_ARB_create_context_profile + GLXEW_ARB_create_context_profile = _glewSearchExtension("GLX_ARB_create_context_profile", extStart, extEnd); +#endif /* GLX_ARB_create_context_profile */ +#ifdef GLX_ARB_create_context_robustness + GLXEW_ARB_create_context_robustness = _glewSearchExtension("GLX_ARB_create_context_robustness", extStart, extEnd); +#endif /* GLX_ARB_create_context_robustness */ +#ifdef GLX_ARB_fbconfig_float + GLXEW_ARB_fbconfig_float = _glewSearchExtension("GLX_ARB_fbconfig_float", extStart, extEnd); +#endif /* GLX_ARB_fbconfig_float */ +#ifdef GLX_ARB_framebuffer_sRGB + GLXEW_ARB_framebuffer_sRGB = _glewSearchExtension("GLX_ARB_framebuffer_sRGB", extStart, extEnd); +#endif /* GLX_ARB_framebuffer_sRGB */ +#ifdef GLX_ARB_get_proc_address + GLXEW_ARB_get_proc_address = _glewSearchExtension("GLX_ARB_get_proc_address", extStart, extEnd); +#endif /* GLX_ARB_get_proc_address */ +#ifdef GLX_ARB_multisample + GLXEW_ARB_multisample = _glewSearchExtension("GLX_ARB_multisample", extStart, extEnd); +#endif /* GLX_ARB_multisample */ +#ifdef GLX_ARB_robustness_application_isolation + GLXEW_ARB_robustness_application_isolation = _glewSearchExtension("GLX_ARB_robustness_application_isolation", extStart, extEnd); +#endif /* GLX_ARB_robustness_application_isolation */ +#ifdef GLX_ARB_robustness_share_group_isolation + GLXEW_ARB_robustness_share_group_isolation = _glewSearchExtension("GLX_ARB_robustness_share_group_isolation", extStart, extEnd); +#endif /* GLX_ARB_robustness_share_group_isolation */ +#ifdef GLX_ARB_vertex_buffer_object + GLXEW_ARB_vertex_buffer_object = _glewSearchExtension("GLX_ARB_vertex_buffer_object", extStart, extEnd); +#endif /* GLX_ARB_vertex_buffer_object */ +#ifdef GLX_ATI_pixel_format_float + GLXEW_ATI_pixel_format_float = _glewSearchExtension("GLX_ATI_pixel_format_float", extStart, extEnd); +#endif /* GLX_ATI_pixel_format_float */ +#ifdef GLX_ATI_render_texture + GLXEW_ATI_render_texture = _glewSearchExtension("GLX_ATI_render_texture", extStart, extEnd); + if (glewExperimental || GLXEW_ATI_render_texture) GLXEW_ATI_render_texture = !_glewInit_GLX_ATI_render_texture(); +#endif /* GLX_ATI_render_texture */ +#ifdef GLX_EXT_buffer_age + GLXEW_EXT_buffer_age = _glewSearchExtension("GLX_EXT_buffer_age", extStart, extEnd); +#endif /* GLX_EXT_buffer_age */ +#ifdef GLX_EXT_create_context_es2_profile + GLXEW_EXT_create_context_es2_profile = _glewSearchExtension("GLX_EXT_create_context_es2_profile", extStart, extEnd); +#endif /* GLX_EXT_create_context_es2_profile */ +#ifdef GLX_EXT_create_context_es_profile + GLXEW_EXT_create_context_es_profile = _glewSearchExtension("GLX_EXT_create_context_es_profile", extStart, extEnd); +#endif /* GLX_EXT_create_context_es_profile */ +#ifdef GLX_EXT_fbconfig_packed_float + GLXEW_EXT_fbconfig_packed_float = _glewSearchExtension("GLX_EXT_fbconfig_packed_float", extStart, extEnd); +#endif /* GLX_EXT_fbconfig_packed_float */ +#ifdef GLX_EXT_framebuffer_sRGB + GLXEW_EXT_framebuffer_sRGB = _glewSearchExtension("GLX_EXT_framebuffer_sRGB", extStart, extEnd); +#endif /* GLX_EXT_framebuffer_sRGB */ +#ifdef GLX_EXT_import_context + GLXEW_EXT_import_context = _glewSearchExtension("GLX_EXT_import_context", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_import_context) GLXEW_EXT_import_context = !_glewInit_GLX_EXT_import_context(); +#endif /* GLX_EXT_import_context */ +#ifdef GLX_EXT_libglvnd + GLXEW_EXT_libglvnd = _glewSearchExtension("GLX_EXT_libglvnd", extStart, extEnd); +#endif /* GLX_EXT_libglvnd */ +#ifdef GLX_EXT_scene_marker + GLXEW_EXT_scene_marker = _glewSearchExtension("GLX_EXT_scene_marker", extStart, extEnd); +#endif /* GLX_EXT_scene_marker */ +#ifdef GLX_EXT_stereo_tree + GLXEW_EXT_stereo_tree = _glewSearchExtension("GLX_EXT_stereo_tree", extStart, extEnd); +#endif /* GLX_EXT_stereo_tree */ +#ifdef GLX_EXT_swap_control + GLXEW_EXT_swap_control = _glewSearchExtension("GLX_EXT_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_swap_control) GLXEW_EXT_swap_control = !_glewInit_GLX_EXT_swap_control(); +#endif /* GLX_EXT_swap_control */ +#ifdef GLX_EXT_swap_control_tear + GLXEW_EXT_swap_control_tear = _glewSearchExtension("GLX_EXT_swap_control_tear", extStart, extEnd); +#endif /* GLX_EXT_swap_control_tear */ +#ifdef GLX_EXT_texture_from_pixmap + GLXEW_EXT_texture_from_pixmap = _glewSearchExtension("GLX_EXT_texture_from_pixmap", extStart, extEnd); + if (glewExperimental || GLXEW_EXT_texture_from_pixmap) GLXEW_EXT_texture_from_pixmap = !_glewInit_GLX_EXT_texture_from_pixmap(); +#endif /* GLX_EXT_texture_from_pixmap */ +#ifdef GLX_EXT_visual_info + GLXEW_EXT_visual_info = _glewSearchExtension("GLX_EXT_visual_info", extStart, extEnd); +#endif /* GLX_EXT_visual_info */ +#ifdef GLX_EXT_visual_rating + GLXEW_EXT_visual_rating = _glewSearchExtension("GLX_EXT_visual_rating", extStart, extEnd); +#endif /* GLX_EXT_visual_rating */ +#ifdef GLX_INTEL_swap_event + GLXEW_INTEL_swap_event = _glewSearchExtension("GLX_INTEL_swap_event", extStart, extEnd); +#endif /* GLX_INTEL_swap_event */ +#ifdef GLX_MESA_agp_offset + GLXEW_MESA_agp_offset = _glewSearchExtension("GLX_MESA_agp_offset", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_agp_offset) GLXEW_MESA_agp_offset = !_glewInit_GLX_MESA_agp_offset(); +#endif /* GLX_MESA_agp_offset */ +#ifdef GLX_MESA_copy_sub_buffer + GLXEW_MESA_copy_sub_buffer = _glewSearchExtension("GLX_MESA_copy_sub_buffer", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_copy_sub_buffer) GLXEW_MESA_copy_sub_buffer = !_glewInit_GLX_MESA_copy_sub_buffer(); +#endif /* GLX_MESA_copy_sub_buffer */ +#ifdef GLX_MESA_pixmap_colormap + GLXEW_MESA_pixmap_colormap = _glewSearchExtension("GLX_MESA_pixmap_colormap", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_pixmap_colormap) GLXEW_MESA_pixmap_colormap = !_glewInit_GLX_MESA_pixmap_colormap(); +#endif /* GLX_MESA_pixmap_colormap */ +#ifdef GLX_MESA_query_renderer + GLXEW_MESA_query_renderer = _glewSearchExtension("GLX_MESA_query_renderer", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_query_renderer) GLXEW_MESA_query_renderer = !_glewInit_GLX_MESA_query_renderer(); +#endif /* GLX_MESA_query_renderer */ +#ifdef GLX_MESA_release_buffers + GLXEW_MESA_release_buffers = _glewSearchExtension("GLX_MESA_release_buffers", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_release_buffers) GLXEW_MESA_release_buffers = !_glewInit_GLX_MESA_release_buffers(); +#endif /* GLX_MESA_release_buffers */ +#ifdef GLX_MESA_set_3dfx_mode + GLXEW_MESA_set_3dfx_mode = _glewSearchExtension("GLX_MESA_set_3dfx_mode", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_set_3dfx_mode) GLXEW_MESA_set_3dfx_mode = !_glewInit_GLX_MESA_set_3dfx_mode(); +#endif /* GLX_MESA_set_3dfx_mode */ +#ifdef GLX_MESA_swap_control + GLXEW_MESA_swap_control = _glewSearchExtension("GLX_MESA_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_MESA_swap_control) GLXEW_MESA_swap_control = !_glewInit_GLX_MESA_swap_control(); +#endif /* GLX_MESA_swap_control */ +#ifdef GLX_NV_copy_buffer + GLXEW_NV_copy_buffer = _glewSearchExtension("GLX_NV_copy_buffer", extStart, extEnd); + if (glewExperimental || GLXEW_NV_copy_buffer) GLXEW_NV_copy_buffer = !_glewInit_GLX_NV_copy_buffer(); +#endif /* GLX_NV_copy_buffer */ +#ifdef GLX_NV_copy_image + GLXEW_NV_copy_image = _glewSearchExtension("GLX_NV_copy_image", extStart, extEnd); + if (glewExperimental || GLXEW_NV_copy_image) GLXEW_NV_copy_image = !_glewInit_GLX_NV_copy_image(); +#endif /* GLX_NV_copy_image */ +#ifdef GLX_NV_delay_before_swap + GLXEW_NV_delay_before_swap = _glewSearchExtension("GLX_NV_delay_before_swap", extStart, extEnd); + if (glewExperimental || GLXEW_NV_delay_before_swap) GLXEW_NV_delay_before_swap = !_glewInit_GLX_NV_delay_before_swap(); +#endif /* GLX_NV_delay_before_swap */ +#ifdef GLX_NV_float_buffer + GLXEW_NV_float_buffer = _glewSearchExtension("GLX_NV_float_buffer", extStart, extEnd); +#endif /* GLX_NV_float_buffer */ +#ifdef GLX_NV_multisample_coverage + GLXEW_NV_multisample_coverage = _glewSearchExtension("GLX_NV_multisample_coverage", extStart, extEnd); +#endif /* GLX_NV_multisample_coverage */ +#ifdef GLX_NV_present_video + GLXEW_NV_present_video = _glewSearchExtension("GLX_NV_present_video", extStart, extEnd); + if (glewExperimental || GLXEW_NV_present_video) GLXEW_NV_present_video = !_glewInit_GLX_NV_present_video(); +#endif /* GLX_NV_present_video */ +#ifdef GLX_NV_robustness_video_memory_purge + GLXEW_NV_robustness_video_memory_purge = _glewSearchExtension("GLX_NV_robustness_video_memory_purge", extStart, extEnd); +#endif /* GLX_NV_robustness_video_memory_purge */ +#ifdef GLX_NV_swap_group + GLXEW_NV_swap_group = _glewSearchExtension("GLX_NV_swap_group", extStart, extEnd); + if (glewExperimental || GLXEW_NV_swap_group) GLXEW_NV_swap_group = !_glewInit_GLX_NV_swap_group(); +#endif /* GLX_NV_swap_group */ +#ifdef GLX_NV_vertex_array_range + GLXEW_NV_vertex_array_range = _glewSearchExtension("GLX_NV_vertex_array_range", extStart, extEnd); + if (glewExperimental || GLXEW_NV_vertex_array_range) GLXEW_NV_vertex_array_range = !_glewInit_GLX_NV_vertex_array_range(); +#endif /* GLX_NV_vertex_array_range */ +#ifdef GLX_NV_video_capture + GLXEW_NV_video_capture = _glewSearchExtension("GLX_NV_video_capture", extStart, extEnd); + if (glewExperimental || GLXEW_NV_video_capture) GLXEW_NV_video_capture = !_glewInit_GLX_NV_video_capture(); +#endif /* GLX_NV_video_capture */ +#ifdef GLX_NV_video_out + GLXEW_NV_video_out = _glewSearchExtension("GLX_NV_video_out", extStart, extEnd); + if (glewExperimental || GLXEW_NV_video_out) GLXEW_NV_video_out = !_glewInit_GLX_NV_video_out(); +#endif /* GLX_NV_video_out */ +#ifdef GLX_OML_swap_method + GLXEW_OML_swap_method = _glewSearchExtension("GLX_OML_swap_method", extStart, extEnd); +#endif /* GLX_OML_swap_method */ +#ifdef GLX_OML_sync_control + GLXEW_OML_sync_control = _glewSearchExtension("GLX_OML_sync_control", extStart, extEnd); + if (glewExperimental || GLXEW_OML_sync_control) GLXEW_OML_sync_control = !_glewInit_GLX_OML_sync_control(); +#endif /* GLX_OML_sync_control */ +#ifdef GLX_SGIS_blended_overlay + GLXEW_SGIS_blended_overlay = _glewSearchExtension("GLX_SGIS_blended_overlay", extStart, extEnd); +#endif /* GLX_SGIS_blended_overlay */ +#ifdef GLX_SGIS_color_range + GLXEW_SGIS_color_range = _glewSearchExtension("GLX_SGIS_color_range", extStart, extEnd); +#endif /* GLX_SGIS_color_range */ +#ifdef GLX_SGIS_multisample + GLXEW_SGIS_multisample = _glewSearchExtension("GLX_SGIS_multisample", extStart, extEnd); +#endif /* GLX_SGIS_multisample */ +#ifdef GLX_SGIS_shared_multisample + GLXEW_SGIS_shared_multisample = _glewSearchExtension("GLX_SGIS_shared_multisample", extStart, extEnd); +#endif /* GLX_SGIS_shared_multisample */ +#ifdef GLX_SGIX_fbconfig + GLXEW_SGIX_fbconfig = _glewSearchExtension("GLX_SGIX_fbconfig", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_fbconfig) GLXEW_SGIX_fbconfig = !_glewInit_GLX_SGIX_fbconfig(); +#endif /* GLX_SGIX_fbconfig */ +#ifdef GLX_SGIX_hyperpipe + GLXEW_SGIX_hyperpipe = _glewSearchExtension("GLX_SGIX_hyperpipe", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_hyperpipe) GLXEW_SGIX_hyperpipe = !_glewInit_GLX_SGIX_hyperpipe(); +#endif /* GLX_SGIX_hyperpipe */ +#ifdef GLX_SGIX_pbuffer + GLXEW_SGIX_pbuffer = _glewSearchExtension("GLX_SGIX_pbuffer", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_pbuffer) GLXEW_SGIX_pbuffer = !_glewInit_GLX_SGIX_pbuffer(); +#endif /* GLX_SGIX_pbuffer */ +#ifdef GLX_SGIX_swap_barrier + GLXEW_SGIX_swap_barrier = _glewSearchExtension("GLX_SGIX_swap_barrier", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_swap_barrier) GLXEW_SGIX_swap_barrier = !_glewInit_GLX_SGIX_swap_barrier(); +#endif /* GLX_SGIX_swap_barrier */ +#ifdef GLX_SGIX_swap_group + GLXEW_SGIX_swap_group = _glewSearchExtension("GLX_SGIX_swap_group", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_swap_group) GLXEW_SGIX_swap_group = !_glewInit_GLX_SGIX_swap_group(); +#endif /* GLX_SGIX_swap_group */ +#ifdef GLX_SGIX_video_resize + GLXEW_SGIX_video_resize = _glewSearchExtension("GLX_SGIX_video_resize", extStart, extEnd); + if (glewExperimental || GLXEW_SGIX_video_resize) GLXEW_SGIX_video_resize = !_glewInit_GLX_SGIX_video_resize(); +#endif /* GLX_SGIX_video_resize */ +#ifdef GLX_SGIX_visual_select_group + GLXEW_SGIX_visual_select_group = _glewSearchExtension("GLX_SGIX_visual_select_group", extStart, extEnd); +#endif /* GLX_SGIX_visual_select_group */ +#ifdef GLX_SGI_cushion + GLXEW_SGI_cushion = _glewSearchExtension("GLX_SGI_cushion", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_cushion) GLXEW_SGI_cushion = !_glewInit_GLX_SGI_cushion(); +#endif /* GLX_SGI_cushion */ +#ifdef GLX_SGI_make_current_read + GLXEW_SGI_make_current_read = _glewSearchExtension("GLX_SGI_make_current_read", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_make_current_read) GLXEW_SGI_make_current_read = !_glewInit_GLX_SGI_make_current_read(); +#endif /* GLX_SGI_make_current_read */ +#ifdef GLX_SGI_swap_control + GLXEW_SGI_swap_control = _glewSearchExtension("GLX_SGI_swap_control", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_swap_control) GLXEW_SGI_swap_control = !_glewInit_GLX_SGI_swap_control(); +#endif /* GLX_SGI_swap_control */ +#ifdef GLX_SGI_video_sync + GLXEW_SGI_video_sync = _glewSearchExtension("GLX_SGI_video_sync", extStart, extEnd); + if (glewExperimental || GLXEW_SGI_video_sync) GLXEW_SGI_video_sync = !_glewInit_GLX_SGI_video_sync(); +#endif /* GLX_SGI_video_sync */ +#ifdef GLX_SUN_get_transparent_index + GLXEW_SUN_get_transparent_index = _glewSearchExtension("GLX_SUN_get_transparent_index", extStart, extEnd); + if (glewExperimental || GLXEW_SUN_get_transparent_index) GLXEW_SUN_get_transparent_index = !_glewInit_GLX_SUN_get_transparent_index(); +#endif /* GLX_SUN_get_transparent_index */ +#ifdef GLX_SUN_video_resize + GLXEW_SUN_video_resize = _glewSearchExtension("GLX_SUN_video_resize", extStart, extEnd); + if (glewExperimental || GLXEW_SUN_video_resize) GLXEW_SUN_video_resize = !_glewInit_GLX_SUN_video_resize(); +#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*)"2.0.0", + (const GLubyte*)"2", + (const GLubyte*)"0", + (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; + +GLenum GLEWAPIENTRY glewInit (void) +{ + GLenum r; +#if defined(GLEW_EGL) + PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL; +#endif + r = glewContextInit(); + if ( r != 0 ) return r; +#if defined(GLEW_EGL) + getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay"); + return eglewInit(getCurrentDisplay()); +#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__) + return r; +#elif defined(_WIN32) + return wglewInit(); +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ + return glxewInit(); +#else + return r; +#endif /* _WIN32 */ +} + +#if defined(_WIN32) && defined(GLEW_BUILD) && defined(__GNUC__) +/* GCC requires a DLL entry point even without any standard library included. */ +/* Types extracted from windows.h to avoid polluting the rest of the file. */ +int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved) +{ + (void) instance; + (void) reason; + (void) reserved; + return 1; +} +#endif +GLboolean GLEWAPIENTRY glewIsSupported (const char* name) +{ + const GLubyte* pos = (const 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_explicit_vertex_parameter + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_explicit_vertex_parameter", 32)) + { + ret = GLEW_AMD_shader_explicit_vertex_parameter; + 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_2_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_2_compatibility", 19)) + { + ret = GLEW_ARB_ES3_2_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 -{ - const GLubyte* pos = (const 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)) +#ifdef GL_ARB_explicit_attrib_location + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_attrib_location", 24)) { - ret = GLEW_VERSION_1_2; + ret = GLEW_ARB_explicit_attrib_location; continue; } #endif -#ifdef GL_VERSION_1_2_1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2_1", 5)) +#ifdef GL_ARB_explicit_uniform_location + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_uniform_location", 25)) { - ret = GLEW_VERSION_1_2_1; + ret = GLEW_ARB_explicit_uniform_location; continue; } #endif -#ifdef GL_VERSION_1_3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) +#ifdef GL_ARB_fragment_coord_conventions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coord_conventions", 26)) { - ret = GLEW_VERSION_1_3; + ret = GLEW_ARB_fragment_coord_conventions; continue; } #endif -#ifdef GL_VERSION_1_4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) +#ifdef GL_ARB_fragment_layer_viewport + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_layer_viewport", 23)) { - ret = GLEW_VERSION_1_4; + ret = GLEW_ARB_fragment_layer_viewport; continue; } #endif -#ifdef GL_VERSION_1_5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3)) +#ifdef GL_ARB_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) { - ret = GLEW_VERSION_1_5; + ret = GLEW_ARB_fragment_program; continue; } #endif -#ifdef GL_VERSION_2_0 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_0", 3)) +#ifdef GL_ARB_fragment_program_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23)) { - ret = GLEW_VERSION_2_0; + ret = GLEW_ARB_fragment_program_shadow; continue; } #endif -#ifdef GL_VERSION_2_1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_1", 3)) +#ifdef GL_ARB_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) { - ret = GLEW_VERSION_2_1; + ret = GLEW_ARB_fragment_shader; continue; } #endif -#ifdef GL_VERSION_3_0 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_0", 3)) +#ifdef GL_ARB_fragment_shader_interlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) { - ret = GLEW_VERSION_3_0; + ret = GLEW_ARB_fragment_shader_interlock; continue; } #endif -#ifdef GL_VERSION_3_1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_1", 3)) +#ifdef GL_ARB_framebuffer_no_attachments + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_no_attachments", 26)) { - ret = GLEW_VERSION_3_1; + ret = GLEW_ARB_framebuffer_no_attachments; continue; } #endif -#ifdef GL_VERSION_3_2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_2", 3)) +#ifdef GL_ARB_framebuffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) { - ret = GLEW_VERSION_3_2; + ret = GLEW_ARB_framebuffer_object; continue; } #endif -#ifdef GL_VERSION_3_3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"3_3", 3)) +#ifdef GL_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_VERSION_3_3; + ret = GLEW_ARB_framebuffer_sRGB; continue; } #endif -#ifdef GL_VERSION_4_0 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_0", 3)) +#ifdef GL_ARB_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { - ret = GLEW_VERSION_4_0; + ret = GLEW_ARB_geometry_shader4; continue; } #endif -#ifdef GL_VERSION_4_1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_1", 3)) +#ifdef GL_ARB_get_program_binary + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_program_binary", 18)) { - ret = GLEW_VERSION_4_1; + ret = GLEW_ARB_get_program_binary; continue; } #endif -#ifdef GL_VERSION_4_2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_2", 3)) +#ifdef GL_ARB_get_texture_sub_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_texture_sub_image", 21)) { - ret = GLEW_VERSION_4_2; + ret = GLEW_ARB_get_texture_sub_image; continue; } #endif -#ifdef GL_VERSION_4_3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_3", 3)) +#ifdef GL_ARB_gl_spirv + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_spirv", 8)) { - ret = GLEW_VERSION_4_3; + ret = GLEW_ARB_gl_spirv; continue; } #endif -#ifdef GL_VERSION_4_4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_4", 3)) +#ifdef GL_ARB_gpu_shader5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) { - ret = GLEW_VERSION_4_4; + ret = GLEW_ARB_gpu_shader5; continue; } #endif -#ifdef GL_VERSION_4_5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"4_5", 3)) +#ifdef GL_ARB_gpu_shader_fp64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_fp64", 15)) { - ret = GLEW_VERSION_4_5; + ret = GLEW_ARB_gpu_shader_fp64; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) - { -#ifdef GL_3DFX_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef GL_ARB_gpu_shader_int64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16)) { - ret = GLEW_3DFX_multisample; + ret = GLEW_ARB_gpu_shader_int64; continue; } #endif -#ifdef GL_3DFX_tbuffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"tbuffer", 7)) +#ifdef GL_ARB_half_float_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16)) { - ret = GLEW_3DFX_tbuffer; + ret = GLEW_ARB_half_float_pixel; continue; } #endif -#ifdef GL_3DFX_texture_compression_FXT1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_FXT1", 24)) +#ifdef GL_ARB_half_float_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_vertex", 17)) { - ret = GLEW_3DFX_texture_compression_FXT1; + ret = GLEW_ARB_half_float_vertex; 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)) +#ifdef GL_ARB_imaging + if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7)) { - ret = GLEW_AMD_blend_minmax_factor; + ret = GLEW_ARB_imaging; continue; } #endif -#ifdef GL_AMD_conservative_depth - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) +#ifdef GL_ARB_indirect_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"indirect_parameters", 19)) { - ret = GLEW_AMD_conservative_depth; + ret = GLEW_ARB_indirect_parameters; continue; } #endif -#ifdef GL_AMD_debug_output - if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) +#ifdef GL_ARB_instanced_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) { - ret = GLEW_AMD_debug_output; + ret = GLEW_ARB_instanced_arrays; continue; } #endif -#ifdef GL_AMD_depth_clamp_separate - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp_separate", 20)) +#ifdef GL_ARB_internalformat_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query", 20)) { - ret = GLEW_AMD_depth_clamp_separate; + ret = GLEW_ARB_internalformat_query; continue; } #endif -#ifdef GL_AMD_draw_buffers_blend - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) +#ifdef GL_ARB_internalformat_query2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query2", 21)) { - ret = GLEW_AMD_draw_buffers_blend; + ret = GLEW_ARB_internalformat_query2; continue; } #endif -#ifdef GL_AMD_gcn_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gcn_shader", 10)) +#ifdef GL_ARB_invalidate_subdata + if (_glewStrSame3(&pos, &len, (const GLubyte*)"invalidate_subdata", 18)) { - ret = GLEW_AMD_gcn_shader; + ret = GLEW_ARB_invalidate_subdata; continue; } #endif -#ifdef GL_AMD_gpu_shader_int64 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16)) +#ifdef GL_ARB_map_buffer_alignment + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_alignment", 20)) { - ret = GLEW_AMD_gpu_shader_int64; + ret = GLEW_ARB_map_buffer_alignment; continue; } #endif -#ifdef GL_AMD_interleaved_elements - if (_glewStrSame3(&pos, &len, (const GLubyte*)"interleaved_elements", 20)) +#ifdef GL_ARB_map_buffer_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_range", 16)) { - ret = GLEW_AMD_interleaved_elements; + ret = GLEW_ARB_map_buffer_range; continue; } #endif -#ifdef GL_AMD_multi_draw_indirect +#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_AMD_multi_draw_indirect; + ret = GLEW_ARB_multi_draw_indirect; continue; } #endif -#ifdef GL_AMD_name_gen_delete - if (_glewStrSame3(&pos, &len, (const GLubyte*)"name_gen_delete", 15)) +#ifdef GL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_AMD_name_gen_delete; + ret = GLEW_ARB_multisample; continue; } #endif -#ifdef GL_AMD_occlusion_query_event - if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query_event", 21)) +#ifdef GL_ARB_multitexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12)) { - ret = GLEW_AMD_occlusion_query_event; + 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_parallel_shader_compile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_shader_compile", 23)) + { + ret = GLEW_ARB_parallel_shader_compile; + 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_AMD_performance_monitor - if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_monitor", 19)) +#ifdef GL_ARB_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) { - ret = GLEW_AMD_performance_monitor; + ret = GLEW_ARB_point_sprite; continue; } #endif -#ifdef GL_AMD_pinned_memory - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pinned_memory", 13)) +#ifdef GL_ARB_post_depth_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) { - ret = GLEW_AMD_pinned_memory; + ret = GLEW_ARB_post_depth_coverage; continue; } #endif -#ifdef GL_AMD_query_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) +#ifdef GL_ARB_program_interface_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_interface_query", 23)) { - ret = GLEW_AMD_query_buffer_object; + ret = GLEW_ARB_program_interface_query; continue; } #endif -#ifdef GL_AMD_sample_positions - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_positions", 16)) +#ifdef GL_ARB_provoking_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) { - ret = GLEW_AMD_sample_positions; + ret = GLEW_ARB_provoking_vertex; continue; } #endif -#ifdef GL_AMD_seamless_cubemap_per_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) +#ifdef GL_ARB_query_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) { - ret = GLEW_AMD_seamless_cubemap_per_texture; + ret = GLEW_ARB_query_buffer_object; continue; } #endif -#ifdef GL_AMD_shader_atomic_counter_ops - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25)) +#ifdef GL_ARB_robust_buffer_access_behavior + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) { - ret = GLEW_AMD_shader_atomic_counter_ops; + ret = GLEW_ARB_robust_buffer_access_behavior; continue; } #endif -#ifdef GL_AMD_shader_stencil_export - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) +#ifdef GL_ARB_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) { - ret = GLEW_AMD_shader_stencil_export; + ret = GLEW_ARB_robustness; continue; } #endif -#ifdef GL_AMD_shader_stencil_value_export - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_value_export", 27)) +#ifdef GL_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) { - ret = GLEW_AMD_shader_stencil_value_export; + ret = GLEW_ARB_robustness_application_isolation; continue; } #endif -#ifdef GL_AMD_shader_trinary_minmax - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_trinary_minmax", 21)) +#ifdef GL_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) { - ret = GLEW_AMD_shader_trinary_minmax; + ret = GLEW_ARB_robustness_share_group_isolation; continue; } #endif -#ifdef GL_AMD_sparse_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14)) +#ifdef GL_ARB_sample_locations + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) { - ret = GLEW_AMD_sparse_texture; + ret = GLEW_ARB_sample_locations; continue; } #endif -#ifdef GL_AMD_stencil_operation_extended - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_operation_extended", 26)) +#ifdef GL_ARB_sample_shading + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_shading", 14)) { - ret = GLEW_AMD_stencil_operation_extended; + ret = GLEW_ARB_sample_shading; continue; } #endif -#ifdef GL_AMD_texture_texture4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_texture4", 16)) +#ifdef GL_ARB_sampler_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sampler_objects", 15)) { - ret = GLEW_AMD_texture_texture4; + ret = GLEW_ARB_sampler_objects; continue; } #endif -#ifdef GL_AMD_transform_feedback3_lines_triangles - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3_lines_triangles", 35)) +#ifdef GL_ARB_seamless_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cube_map", 17)) { - ret = GLEW_AMD_transform_feedback3_lines_triangles; + ret = GLEW_ARB_seamless_cube_map; continue; } #endif -#ifdef GL_AMD_transform_feedback4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback4", 19)) +#ifdef GL_ARB_seamless_cubemap_per_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) { - ret = GLEW_AMD_transform_feedback4; + ret = GLEW_ARB_seamless_cubemap_per_texture; continue; } #endif -#ifdef GL_AMD_vertex_shader_layer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_layer", 19)) +#ifdef GL_ARB_separate_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) { - ret = GLEW_AMD_vertex_shader_layer; + ret = GLEW_ARB_separate_shader_objects; continue; } #endif -#ifdef GL_AMD_vertex_shader_tessellator - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_tessellator", 25)) +#ifdef GL_ARB_shader_atomic_counter_ops + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25)) { - ret = GLEW_AMD_vertex_shader_tessellator; + ret = GLEW_ARB_shader_atomic_counter_ops; continue; } #endif -#ifdef GL_AMD_vertex_shader_viewport_index - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_viewport_index", 28)) +#ifdef GL_ARB_shader_atomic_counters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) { - ret = GLEW_AMD_vertex_shader_viewport_index; + ret = GLEW_ARB_shader_atomic_counters; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ANGLE_", 6)) - { -#ifdef GL_ANGLE_depth_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) +#ifdef GL_ARB_shader_ballot + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_ballot", 13)) { - ret = GLEW_ANGLE_depth_texture; + ret = GLEW_ARB_shader_ballot; continue; } #endif -#ifdef GL_ANGLE_framebuffer_blit - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) +#ifdef GL_ARB_shader_bit_encoding + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_bit_encoding", 19)) { - ret = GLEW_ANGLE_framebuffer_blit; + ret = GLEW_ARB_shader_bit_encoding; continue; } #endif -#ifdef GL_ANGLE_framebuffer_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) +#ifdef GL_ARB_shader_clock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_clock", 12)) { - ret = GLEW_ANGLE_framebuffer_multisample; + ret = GLEW_ARB_shader_clock; continue; } #endif -#ifdef GL_ANGLE_instanced_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) +#ifdef GL_ARB_shader_draw_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_draw_parameters", 22)) { - ret = GLEW_ANGLE_instanced_arrays; + ret = GLEW_ARB_shader_draw_parameters; continue; } #endif -#ifdef GL_ANGLE_pack_reverse_row_order - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_reverse_row_order", 22)) +#ifdef GL_ARB_shader_group_vote + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_group_vote", 17)) { - ret = GLEW_ANGLE_pack_reverse_row_order; + ret = GLEW_ARB_shader_group_vote; continue; } #endif -#ifdef GL_ANGLE_program_binary - if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_binary", 14)) +#ifdef GL_ARB_shader_image_load_store + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) { - ret = GLEW_ANGLE_program_binary; + ret = GLEW_ARB_shader_image_load_store; continue; } #endif -#ifdef GL_ANGLE_texture_compression_dxt1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) +#ifdef GL_ARB_shader_image_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_size", 17)) { - ret = GLEW_ANGLE_texture_compression_dxt1; + ret = GLEW_ARB_shader_image_size; continue; } #endif -#ifdef GL_ANGLE_texture_compression_dxt3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt3", 24)) +#ifdef GL_ARB_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14)) { - ret = GLEW_ANGLE_texture_compression_dxt3; + ret = GLEW_ARB_shader_objects; continue; } #endif -#ifdef GL_ANGLE_texture_compression_dxt5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt5", 24)) +#ifdef GL_ARB_shader_precision + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_precision", 16)) { - ret = GLEW_ANGLE_texture_compression_dxt5; + ret = GLEW_ARB_shader_precision; continue; } #endif -#ifdef GL_ANGLE_texture_usage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_usage", 13)) +#ifdef GL_ARB_shader_stencil_export + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) { - ret = GLEW_ANGLE_texture_usage; + ret = GLEW_ARB_shader_stencil_export; continue; } #endif -#ifdef GL_ANGLE_timer_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) +#ifdef GL_ARB_shader_storage_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) { - ret = GLEW_ANGLE_timer_query; + ret = GLEW_ARB_shader_storage_buffer_object; continue; } #endif -#ifdef GL_ANGLE_translated_shader_source - if (_glewStrSame3(&pos, &len, (const GLubyte*)"translated_shader_source", 24)) +#ifdef GL_ARB_shader_subroutine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_subroutine", 17)) { - ret = GLEW_ANGLE_translated_shader_source; + ret = GLEW_ARB_shader_subroutine; 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)) +#ifdef GL_ARB_shader_texture_image_samples + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_image_samples", 28)) { - ret = GLEW_APPLE_aux_depth_stencil; + ret = GLEW_ARB_shader_texture_image_samples; continue; } #endif -#ifdef GL_APPLE_client_storage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_storage", 14)) +#ifdef GL_ARB_shader_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) { - ret = GLEW_APPLE_client_storage; + ret = GLEW_ARB_shader_texture_lod; continue; } #endif -#ifdef GL_APPLE_element_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) +#ifdef GL_ARB_shader_viewport_layer_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_viewport_layer_array", 27)) { - ret = GLEW_APPLE_element_array; + ret = GLEW_ARB_shader_viewport_layer_array; continue; } #endif -#ifdef GL_APPLE_fence - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) +#ifdef GL_ARB_shading_language_100 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20)) { - ret = GLEW_APPLE_fence; + ret = GLEW_ARB_shading_language_100; continue; } #endif -#ifdef GL_APPLE_float_pixels - if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_pixels", 12)) +#ifdef GL_ARB_shading_language_420pack + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_420pack", 24)) { - ret = GLEW_APPLE_float_pixels; + ret = GLEW_ARB_shading_language_420pack; continue; } #endif -#ifdef GL_APPLE_flush_buffer_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_buffer_range", 18)) +#ifdef GL_ARB_shading_language_include + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_include", 24)) { - ret = GLEW_APPLE_flush_buffer_range; + ret = GLEW_ARB_shading_language_include; continue; } #endif -#ifdef GL_APPLE_object_purgeable - if (_glewStrSame3(&pos, &len, (const GLubyte*)"object_purgeable", 16)) +#ifdef GL_ARB_shading_language_packing + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_packing", 24)) { - ret = GLEW_APPLE_object_purgeable; + ret = GLEW_ARB_shading_language_packing; continue; } #endif -#ifdef GL_APPLE_pixel_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer", 12)) +#ifdef GL_ARB_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) { - ret = GLEW_APPLE_pixel_buffer; + ret = GLEW_ARB_shadow; continue; } #endif -#ifdef GL_APPLE_rgb_422 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"rgb_422", 7)) +#ifdef GL_ARB_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) { - ret = GLEW_APPLE_rgb_422; + ret = GLEW_ARB_shadow_ambient; continue; } #endif -#ifdef GL_APPLE_row_bytes - if (_glewStrSame3(&pos, &len, (const GLubyte*)"row_bytes", 9)) +#ifdef GL_ARB_sparse_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_buffer", 13)) { - ret = GLEW_APPLE_row_bytes; + ret = GLEW_ARB_sparse_buffer; continue; } #endif -#ifdef GL_APPLE_specular_vector - if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_vector", 15)) +#ifdef GL_ARB_sparse_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14)) { - ret = GLEW_APPLE_specular_vector; + ret = GLEW_ARB_sparse_texture; continue; } #endif -#ifdef GL_APPLE_texture_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) +#ifdef GL_ARB_sparse_texture2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) { - ret = GLEW_APPLE_texture_range; + ret = GLEW_ARB_sparse_texture2; continue; } #endif -#ifdef GL_APPLE_transform_hint - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_hint", 14)) +#ifdef GL_ARB_sparse_texture_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture_clamp", 20)) { - ret = GLEW_APPLE_transform_hint; + ret = GLEW_ARB_sparse_texture_clamp; continue; } #endif -#ifdef GL_APPLE_vertex_array_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) +#ifdef GL_ARB_stencil_texturing + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_texturing", 17)) { - ret = GLEW_APPLE_vertex_array_object; + ret = GLEW_ARB_stencil_texturing; continue; } #endif -#ifdef GL_APPLE_vertex_array_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) +#ifdef GL_ARB_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4)) { - ret = GLEW_APPLE_vertex_array_range; + ret = GLEW_ARB_sync; continue; } #endif -#ifdef GL_APPLE_vertex_program_evaluators - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program_evaluators", 25)) +#ifdef GL_ARB_tessellation_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_shader", 19)) { - ret = GLEW_APPLE_vertex_program_evaluators; + ret = GLEW_ARB_tessellation_shader; continue; } #endif -#ifdef GL_APPLE_ycbcr_422 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_422", 9)) +#ifdef GL_ARB_texture_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) { - ret = GLEW_APPLE_ycbcr_422; + ret = GLEW_ARB_texture_barrier; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) - { -#ifdef GL_ARB_ES2_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES2_compatibility", 17)) +#ifdef GL_ARB_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) { - ret = GLEW_ARB_ES2_compatibility; + ret = GLEW_ARB_texture_border_clamp; continue; } #endif -#ifdef GL_ARB_ES3_1_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_1_compatibility", 19)) +#ifdef GL_ARB_texture_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) { - ret = GLEW_ARB_ES3_1_compatibility; + ret = GLEW_ARB_texture_buffer_object; continue; } #endif -#ifdef GL_ARB_ES3_2_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_2_compatibility", 19)) +#ifdef GL_ARB_texture_buffer_object_rgb32 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object_rgb32", 27)) { - ret = GLEW_ARB_ES3_2_compatibility; + ret = GLEW_ARB_texture_buffer_object_rgb32; continue; } #endif -#ifdef GL_ARB_ES3_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES3_compatibility", 17)) +#ifdef GL_ARB_texture_buffer_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_range", 20)) { - ret = GLEW_ARB_ES3_compatibility; + ret = GLEW_ARB_texture_buffer_range; continue; } #endif -#ifdef GL_ARB_arrays_of_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"arrays_of_arrays", 16)) +#ifdef GL_ARB_texture_compression + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19)) { - ret = GLEW_ARB_arrays_of_arrays; + ret = GLEW_ARB_texture_compression; continue; } #endif -#ifdef GL_ARB_base_instance - if (_glewStrSame3(&pos, &len, (const GLubyte*)"base_instance", 13)) +#ifdef GL_ARB_texture_compression_bptc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_bptc", 24)) { - ret = GLEW_ARB_base_instance; + ret = GLEW_ARB_texture_compression_bptc; continue; } #endif -#ifdef GL_ARB_bindless_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) +#ifdef GL_ARB_texture_compression_rgtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) { - ret = GLEW_ARB_bindless_texture; + ret = GLEW_ARB_texture_compression_rgtc; continue; } #endif -#ifdef GL_ARB_blend_func_extended - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_extended", 19)) +#ifdef GL_ARB_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) { - ret = GLEW_ARB_blend_func_extended; + ret = GLEW_ARB_texture_cube_map; continue; } #endif -#ifdef GL_ARB_buffer_storage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_storage", 14)) +#ifdef GL_ARB_texture_cube_map_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map_array", 22)) { - ret = GLEW_ARB_buffer_storage; + ret = GLEW_ARB_texture_cube_map_array; continue; } #endif -#ifdef GL_ARB_cl_event - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event", 8)) +#ifdef GL_ARB_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) { - ret = GLEW_ARB_cl_event; + ret = GLEW_ARB_texture_env_add; continue; } #endif -#ifdef GL_ARB_clear_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_buffer_object", 19)) +#ifdef GL_ARB_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) { - ret = GLEW_ARB_clear_buffer_object; + ret = GLEW_ARB_texture_env_combine; continue; } #endif -#ifdef GL_ARB_clear_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"clear_texture", 13)) +#ifdef GL_ARB_texture_env_crossbar + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20)) { - ret = GLEW_ARB_clear_texture; + ret = GLEW_ARB_texture_env_crossbar; continue; } #endif -#ifdef GL_ARB_clip_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_control", 12)) +#ifdef GL_ARB_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) { - ret = GLEW_ARB_clip_control; + ret = GLEW_ARB_texture_env_dot3; continue; } #endif -#ifdef GL_ARB_color_buffer_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_buffer_float", 18)) +#ifdef GL_ARB_texture_filter_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) { - ret = GLEW_ARB_color_buffer_float; + ret = GLEW_ARB_texture_filter_minmax; continue; } #endif -#ifdef GL_ARB_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compatibility", 13)) +#ifdef GL_ARB_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) { - ret = GLEW_ARB_compatibility; + ret = GLEW_ARB_texture_float; continue; } #endif -#ifdef GL_ARB_compressed_texture_pixel_storage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_texture_pixel_storage", 32)) +#ifdef GL_ARB_texture_gather + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_gather", 14)) { - ret = GLEW_ARB_compressed_texture_pixel_storage; + ret = GLEW_ARB_texture_gather; continue; } #endif -#ifdef GL_ARB_compute_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_shader", 14)) +#ifdef GL_ARB_texture_mirror_clamp_to_edge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp_to_edge", 28)) { - ret = GLEW_ARB_compute_shader; + ret = GLEW_ARB_texture_mirror_clamp_to_edge; continue; } #endif -#ifdef GL_ARB_compute_variable_group_size - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_variable_group_size", 27)) +#ifdef GL_ARB_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) { - ret = GLEW_ARB_compute_variable_group_size; + ret = GLEW_ARB_texture_mirrored_repeat; continue; } #endif -#ifdef GL_ARB_conditional_render_inverted - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render_inverted", 27)) +#ifdef GL_ARB_texture_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) { - ret = GLEW_ARB_conditional_render_inverted; + ret = GLEW_ARB_texture_multisample; continue; } #endif -#ifdef GL_ARB_conservative_depth - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) +#ifdef GL_ARB_texture_non_power_of_two + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24)) { - ret = GLEW_ARB_conservative_depth; + ret = GLEW_ARB_texture_non_power_of_two; continue; } #endif -#ifdef GL_ARB_copy_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) +#ifdef GL_ARB_texture_query_levels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_levels", 20)) { - ret = GLEW_ARB_copy_buffer; + ret = GLEW_ARB_texture_query_levels; continue; } #endif -#ifdef GL_ARB_copy_image - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) +#ifdef GL_ARB_texture_query_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_lod", 17)) { - ret = GLEW_ARB_copy_image; + ret = GLEW_ARB_texture_query_lod; continue; } #endif -#ifdef GL_ARB_cull_distance - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_distance", 13)) +#ifdef GL_ARB_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { - ret = GLEW_ARB_cull_distance; + ret = GLEW_ARB_texture_rectangle; continue; } #endif -#ifdef GL_ARB_debug_output - if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_output", 12)) +#ifdef GL_ARB_texture_rg + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rg", 10)) { - ret = GLEW_ARB_debug_output; + ret = GLEW_ARB_texture_rg; continue; } #endif -#ifdef GL_ARB_depth_buffer_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) +#ifdef GL_ARB_texture_rgb10_a2ui + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rgb10_a2ui", 18)) { - ret = GLEW_ARB_depth_buffer_float; + ret = GLEW_ARB_texture_rgb10_a2ui; continue; } #endif -#ifdef GL_ARB_depth_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) +#ifdef GL_ARB_texture_stencil8 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stencil8", 16)) { - ret = GLEW_ARB_depth_clamp; + ret = GLEW_ARB_texture_stencil8; continue; } #endif -#ifdef GL_ARB_depth_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) +#ifdef GL_ARB_texture_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage", 15)) { - ret = GLEW_ARB_depth_texture; + ret = GLEW_ARB_texture_storage; continue; } #endif -#ifdef GL_ARB_derivative_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"derivative_control", 18)) +#ifdef GL_ARB_texture_storage_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage_multisample", 27)) { - ret = GLEW_ARB_derivative_control; + ret = GLEW_ARB_texture_storage_multisample; continue; } #endif -#ifdef GL_ARB_direct_state_access - if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) +#ifdef GL_ARB_texture_swizzle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) { - ret = GLEW_ARB_direct_state_access; + ret = GLEW_ARB_texture_swizzle; continue; } #endif -#ifdef GL_ARB_draw_buffers - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) +#ifdef GL_ARB_texture_view + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_view", 12)) { - ret = GLEW_ARB_draw_buffers; + ret = GLEW_ARB_texture_view; continue; } #endif -#ifdef GL_ARB_draw_buffers_blend - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers_blend", 18)) +#ifdef GL_ARB_timer_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) { - ret = GLEW_ARB_draw_buffers_blend; + ret = GLEW_ARB_timer_query; continue; } #endif -#ifdef GL_ARB_draw_elements_base_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_elements_base_vertex", 25)) +#ifdef GL_ARB_transform_feedback2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) { - ret = GLEW_ARB_draw_elements_base_vertex; + ret = GLEW_ARB_transform_feedback2; continue; } #endif -#ifdef GL_ARB_draw_indirect - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_indirect", 13)) +#ifdef GL_ARB_transform_feedback3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3", 19)) { - ret = GLEW_ARB_draw_indirect; + ret = GLEW_ARB_transform_feedback3; continue; } #endif -#ifdef GL_ARB_draw_instanced - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) +#ifdef GL_ARB_transform_feedback_instanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_instanced", 28)) { - ret = GLEW_ARB_draw_instanced; + ret = GLEW_ARB_transform_feedback_instanced; continue; } #endif -#ifdef GL_ARB_enhanced_layouts - if (_glewStrSame3(&pos, &len, (const GLubyte*)"enhanced_layouts", 16)) +#ifdef GL_ARB_transform_feedback_overflow_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_overflow_query", 33)) { - ret = GLEW_ARB_enhanced_layouts; + ret = GLEW_ARB_transform_feedback_overflow_query; continue; } #endif -#ifdef GL_ARB_explicit_attrib_location - if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_attrib_location", 24)) +#ifdef GL_ARB_transpose_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16)) { - ret = GLEW_ARB_explicit_attrib_location; + ret = GLEW_ARB_transpose_matrix; continue; } #endif -#ifdef GL_ARB_explicit_uniform_location - if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_uniform_location", 25)) +#ifdef GL_ARB_uniform_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_object", 21)) { - ret = GLEW_ARB_explicit_uniform_location; + ret = GLEW_ARB_uniform_buffer_object; continue; } #endif -#ifdef GL_ARB_fragment_coord_conventions - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coord_conventions", 26)) +#ifdef GL_ARB_vertex_array_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) { - ret = GLEW_ARB_fragment_coord_conventions; + ret = GLEW_ARB_vertex_array_bgra; continue; } #endif -#ifdef GL_ARB_fragment_layer_viewport - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_layer_viewport", 23)) +#ifdef GL_ARB_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) { - ret = GLEW_ARB_fragment_layer_viewport; + ret = GLEW_ARB_vertex_array_object; continue; } #endif -#ifdef GL_ARB_fragment_program - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) +#ifdef GL_ARB_vertex_attrib_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) { - ret = GLEW_ARB_fragment_program; + ret = GLEW_ARB_vertex_attrib_64bit; continue; } #endif -#ifdef GL_ARB_fragment_program_shadow - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23)) +#ifdef GL_ARB_vertex_attrib_binding + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_binding", 21)) { - ret = GLEW_ARB_fragment_program_shadow; + ret = GLEW_ARB_vertex_attrib_binding; continue; } #endif -#ifdef GL_ARB_fragment_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) +#ifdef GL_ARB_vertex_blend + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12)) { - ret = GLEW_ARB_fragment_shader; + ret = GLEW_ARB_vertex_blend; continue; } #endif -#ifdef GL_ARB_fragment_shader_interlock - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) +#ifdef GL_ARB_vertex_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) { - ret = GLEW_ARB_fragment_shader_interlock; + ret = GLEW_ARB_vertex_buffer_object; continue; } #endif -#ifdef GL_ARB_framebuffer_no_attachments - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_no_attachments", 26)) +#ifdef GL_ARB_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) { - ret = GLEW_ARB_framebuffer_no_attachments; + ret = GLEW_ARB_vertex_program; continue; } #endif -#ifdef GL_ARB_framebuffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) +#ifdef GL_ARB_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) { - ret = GLEW_ARB_framebuffer_object; + ret = GLEW_ARB_vertex_shader; continue; } #endif -#ifdef GL_ARB_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#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_framebuffer_sRGB; + ret = GLEW_ARB_vertex_type_10f_11f_11f_rev; continue; } #endif -#ifdef GL_ARB_geometry_shader4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) +#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_geometry_shader4; + ret = GLEW_ARB_vertex_type_2_10_10_10_rev; continue; } #endif -#ifdef GL_ARB_get_program_binary - if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_program_binary", 18)) +#ifdef GL_ARB_viewport_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array", 14)) { - ret = GLEW_ARB_get_program_binary; + ret = GLEW_ARB_viewport_array; continue; } #endif -#ifdef GL_ARB_get_texture_sub_image - if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_texture_sub_image", 21)) +#ifdef GL_ARB_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) { - ret = GLEW_ARB_get_texture_sub_image; + ret = GLEW_ARB_window_pos; continue; } #endif -#ifdef GL_ARB_gpu_shader5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5)) + { +#ifdef GL_ATIX_point_sprites + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13)) { - ret = GLEW_ARB_gpu_shader5; + ret = GLEW_ATIX_point_sprites; continue; } #endif -#ifdef GL_ARB_gpu_shader_fp64 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_fp64", 15)) +#ifdef GL_ATIX_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) { - ret = GLEW_ARB_gpu_shader_fp64; + ret = GLEW_ATIX_texture_env_combine3; continue; } #endif -#ifdef GL_ARB_gpu_shader_int64 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader_int64", 16)) +#ifdef GL_ATIX_texture_env_route + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17)) { - ret = GLEW_ARB_gpu_shader_int64; + ret = GLEW_ATIX_texture_env_route; continue; } #endif -#ifdef GL_ARB_half_float_pixel - if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16)) +#ifdef GL_ATIX_vertex_shader_output_point_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31)) { - ret = GLEW_ARB_half_float_pixel; + ret = GLEW_ATIX_vertex_shader_output_point_size; continue; } #endif -#ifdef GL_ARB_half_float_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_vertex", 17)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef GL_ATI_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) { - ret = GLEW_ARB_half_float_vertex; + ret = GLEW_ATI_draw_buffers; continue; } #endif -#ifdef GL_ARB_imaging - if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7)) +#ifdef GL_ATI_element_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) { - ret = GLEW_ARB_imaging; + ret = GLEW_ATI_element_array; continue; } #endif -#ifdef GL_ARB_indirect_parameters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"indirect_parameters", 19)) +#ifdef GL_ATI_envmap_bumpmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14)) { - ret = GLEW_ARB_indirect_parameters; + ret = GLEW_ATI_envmap_bumpmap; continue; } #endif -#ifdef GL_ARB_instanced_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"instanced_arrays", 16)) +#ifdef GL_ATI_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) { - ret = GLEW_ARB_instanced_arrays; + ret = GLEW_ATI_fragment_shader; continue; } #endif -#ifdef GL_ARB_internalformat_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query", 20)) +#ifdef GL_ATI_map_object_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17)) { - ret = GLEW_ARB_internalformat_query; + ret = GLEW_ATI_map_object_buffer; continue; } #endif -#ifdef GL_ARB_internalformat_query2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_query2", 21)) +#ifdef GL_ATI_meminfo + if (_glewStrSame3(&pos, &len, (const GLubyte*)"meminfo", 7)) { - ret = GLEW_ARB_internalformat_query2; + ret = GLEW_ATI_meminfo; continue; } #endif -#ifdef GL_ARB_invalidate_subdata - if (_glewStrSame3(&pos, &len, (const GLubyte*)"invalidate_subdata", 18)) +#ifdef GL_ATI_pn_triangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12)) { - ret = GLEW_ARB_invalidate_subdata; + ret = GLEW_ATI_pn_triangles; continue; } #endif -#ifdef GL_ARB_map_buffer_alignment - if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_alignment", 20)) +#ifdef GL_ATI_separate_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16)) { - ret = GLEW_ARB_map_buffer_alignment; + ret = GLEW_ATI_separate_stencil; continue; } #endif -#ifdef GL_ARB_map_buffer_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_buffer_range", 16)) +#ifdef GL_ATI_shader_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) { - ret = GLEW_ARB_map_buffer_range; + ret = GLEW_ATI_shader_texture_lod; continue; } #endif -#ifdef GL_ARB_matrix_palette - if (_glewStrSame3(&pos, &len, (const GLubyte*)"matrix_palette", 14)) +#ifdef GL_ATI_text_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20)) { - ret = GLEW_ARB_matrix_palette; + ret = GLEW_ATI_text_fragment_shader; continue; } #endif -#ifdef GL_ARB_multi_bind - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_bind", 10)) +#ifdef GL_ATI_texture_compression_3dc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23)) { - ret = GLEW_ARB_multi_bind; + ret = GLEW_ATI_texture_compression_3dc; continue; } #endif -#ifdef GL_ARB_multi_draw_indirect - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_indirect", 19)) +#ifdef GL_ATI_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) { - ret = GLEW_ARB_multi_draw_indirect; + ret = GLEW_ATI_texture_env_combine3; continue; } #endif -#ifdef GL_ARB_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef GL_ATI_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) { - ret = GLEW_ARB_multisample; + ret = GLEW_ATI_texture_float; continue; } #endif -#ifdef GL_ARB_multitexture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12)) +#ifdef GL_ATI_texture_mirror_once + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19)) { - ret = GLEW_ARB_multitexture; + ret = GLEW_ATI_texture_mirror_once; continue; } #endif -#ifdef GL_ARB_occlusion_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) +#ifdef GL_ATI_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) { - ret = GLEW_ARB_occlusion_query; + ret = GLEW_ATI_vertex_array_object; continue; } #endif -#ifdef GL_ARB_occlusion_query2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query2", 16)) +#ifdef GL_ATI_vertex_attrib_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26)) { - ret = GLEW_ARB_occlusion_query2; + ret = GLEW_ATI_vertex_attrib_array_object; continue; } #endif -#ifdef GL_ARB_parallel_shader_compile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_shader_compile", 23)) +#ifdef GL_ATI_vertex_streams + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14)) { - ret = GLEW_ARB_parallel_shader_compile; + ret = GLEW_ATI_vertex_streams; continue; } #endif -#ifdef GL_ARB_pipeline_statistics_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pipeline_statistics_query", 25)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EGL_", 4)) + { +#ifdef GL_EGL_NV_robustness_video_memory_purge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"NV_robustness_video_memory_purge", 32)) { - ret = GLEW_ARB_pipeline_statistics_query; + ret = GLEW_EGL_NV_robustness_video_memory_purge; continue; } #endif -#ifdef GL_ARB_pixel_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GL_EXT_422_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10)) { - ret = GLEW_ARB_pixel_buffer_object; + ret = GLEW_EXT_422_pixels; continue; } #endif -#ifdef GL_ARB_point_parameters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) +#ifdef GL_EXT_Cg_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9)) { - ret = GLEW_ARB_point_parameters; + ret = GLEW_EXT_Cg_shader; continue; } #endif -#ifdef GL_ARB_point_sprite - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) +#ifdef GL_EXT_abgr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4)) { - ret = GLEW_ARB_point_sprite; + ret = GLEW_EXT_abgr; continue; } #endif -#ifdef GL_ARB_post_depth_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) +#ifdef GL_EXT_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4)) { - ret = GLEW_ARB_post_depth_coverage; + ret = GLEW_EXT_bgra; continue; } #endif -#ifdef GL_ARB_program_interface_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"program_interface_query", 23)) +#ifdef GL_EXT_bindable_uniform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindable_uniform", 16)) { - ret = GLEW_ARB_program_interface_query; + ret = GLEW_EXT_bindable_uniform; continue; } #endif -#ifdef GL_ARB_provoking_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) +#ifdef GL_EXT_blend_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11)) { - ret = GLEW_ARB_provoking_vertex; + ret = GLEW_EXT_blend_color; continue; } #endif -#ifdef GL_ARB_query_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_buffer_object", 19)) +#ifdef GL_EXT_blend_equation_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23)) { - ret = GLEW_ARB_query_buffer_object; + ret = GLEW_EXT_blend_equation_separate; continue; } #endif -#ifdef GL_ARB_robust_buffer_access_behavior - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) +#ifdef GL_EXT_blend_func_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19)) { - ret = GLEW_ARB_robust_buffer_access_behavior; + ret = GLEW_EXT_blend_func_separate; continue; } #endif -#ifdef GL_ARB_robustness - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) +#ifdef GL_EXT_blend_logic_op + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14)) { - ret = GLEW_ARB_robustness; + ret = GLEW_EXT_blend_logic_op; continue; } #endif -#ifdef GL_ARB_robustness_application_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) +#ifdef GL_EXT_blend_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12)) { - ret = GLEW_ARB_robustness_application_isolation; + ret = GLEW_EXT_blend_minmax; continue; } #endif -#ifdef GL_ARB_robustness_share_group_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) +#ifdef GL_EXT_blend_subtract + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14)) { - ret = GLEW_ARB_robustness_share_group_isolation; + ret = GLEW_EXT_blend_subtract; continue; } #endif -#ifdef GL_ARB_sample_locations - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) +#ifdef GL_EXT_clip_volume_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16)) { - ret = GLEW_ARB_sample_locations; + ret = GLEW_EXT_clip_volume_hint; continue; } #endif -#ifdef GL_ARB_sample_shading - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_shading", 14)) +#ifdef GL_EXT_cmyka + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5)) { - ret = GLEW_ARB_sample_shading; + ret = GLEW_EXT_cmyka; continue; } #endif -#ifdef GL_ARB_sampler_objects - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sampler_objects", 15)) +#ifdef GL_EXT_color_subtable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14)) { - ret = GLEW_ARB_sampler_objects; + ret = GLEW_EXT_color_subtable; continue; } #endif -#ifdef GL_ARB_seamless_cube_map - if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cube_map", 17)) +#ifdef GL_EXT_compiled_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21)) { - ret = GLEW_ARB_seamless_cube_map; + ret = GLEW_EXT_compiled_vertex_array; continue; } #endif -#ifdef GL_ARB_seamless_cubemap_per_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) +#ifdef GL_EXT_convolution + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11)) { - ret = GLEW_ARB_seamless_cubemap_per_texture; + ret = GLEW_EXT_convolution; continue; } #endif -#ifdef GL_ARB_separate_shader_objects - if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) +#ifdef GL_EXT_coordinate_frame + if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16)) { - ret = GLEW_ARB_separate_shader_objects; + ret = GLEW_EXT_coordinate_frame; continue; } #endif -#ifdef GL_ARB_shader_atomic_counter_ops - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counter_ops", 25)) +#ifdef GL_EXT_copy_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12)) { - ret = GLEW_ARB_shader_atomic_counter_ops; + ret = GLEW_EXT_copy_texture; continue; } #endif -#ifdef GL_ARB_shader_atomic_counters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) +#ifdef GL_EXT_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) { - ret = GLEW_ARB_shader_atomic_counters; + ret = GLEW_EXT_cull_vertex; continue; } #endif -#ifdef GL_ARB_shader_ballot - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_ballot", 13)) +#ifdef GL_EXT_debug_label + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_label", 11)) { - ret = GLEW_ARB_shader_ballot; + ret = GLEW_EXT_debug_label; continue; } #endif -#ifdef GL_ARB_shader_bit_encoding - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_bit_encoding", 19)) +#ifdef GL_EXT_debug_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12)) { - ret = GLEW_ARB_shader_bit_encoding; + ret = GLEW_EXT_debug_marker; continue; } #endif -#ifdef GL_ARB_shader_clock - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_clock", 12)) +#ifdef GL_EXT_depth_bounds_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17)) { - ret = GLEW_ARB_shader_clock; + ret = GLEW_EXT_depth_bounds_test; continue; } #endif -#ifdef GL_ARB_shader_draw_parameters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_draw_parameters", 22)) +#ifdef GL_EXT_direct_state_access + if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) { - ret = GLEW_ARB_shader_draw_parameters; + ret = GLEW_EXT_direct_state_access; continue; } #endif -#ifdef GL_ARB_shader_group_vote - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_group_vote", 17)) +#ifdef GL_EXT_draw_buffers2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers2", 13)) { - ret = GLEW_ARB_shader_group_vote; + ret = GLEW_EXT_draw_buffers2; continue; } #endif -#ifdef GL_ARB_shader_image_load_store - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) +#ifdef GL_EXT_draw_instanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) { - ret = GLEW_ARB_shader_image_load_store; + ret = GLEW_EXT_draw_instanced; continue; } #endif -#ifdef GL_ARB_shader_image_size - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_size", 17)) +#ifdef GL_EXT_draw_range_elements + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19)) { - ret = GLEW_ARB_shader_image_size; + ret = GLEW_EXT_draw_range_elements; continue; } #endif -#ifdef GL_ARB_shader_objects - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14)) +#ifdef GL_EXT_fog_coord + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9)) { - ret = GLEW_ARB_shader_objects; + ret = GLEW_EXT_fog_coord; continue; } #endif -#ifdef GL_ARB_shader_precision - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_precision", 16)) +#ifdef GL_EXT_fragment_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17)) { - ret = GLEW_ARB_shader_precision; + ret = GLEW_EXT_fragment_lighting; continue; } #endif -#ifdef GL_ARB_shader_stencil_export - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_stencil_export", 21)) +#ifdef GL_EXT_framebuffer_blit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) { - ret = GLEW_ARB_shader_stencil_export; + ret = GLEW_EXT_framebuffer_blit; continue; } #endif -#ifdef GL_ARB_shader_storage_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) +#ifdef GL_EXT_framebuffer_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) { - ret = GLEW_ARB_shader_storage_buffer_object; + ret = GLEW_EXT_framebuffer_multisample; continue; } #endif -#ifdef GL_ARB_shader_subroutine - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_subroutine", 17)) +#ifdef GL_EXT_framebuffer_multisample_blit_scaled + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_blit_scaled", 35)) { - ret = GLEW_ARB_shader_subroutine; + ret = GLEW_EXT_framebuffer_multisample_blit_scaled; continue; } #endif -#ifdef GL_ARB_shader_texture_image_samples - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_image_samples", 28)) +#ifdef GL_EXT_framebuffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) { - ret = GLEW_ARB_shader_texture_image_samples; + ret = GLEW_EXT_framebuffer_object; continue; } #endif -#ifdef GL_ARB_shader_texture_lod - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) +#ifdef GL_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_ARB_shader_texture_lod; + ret = GLEW_EXT_framebuffer_sRGB; continue; } #endif -#ifdef GL_ARB_shader_viewport_layer_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_viewport_layer_array", 27)) +#ifdef GL_EXT_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { - ret = GLEW_ARB_shader_viewport_layer_array; + ret = GLEW_EXT_geometry_shader4; continue; } #endif -#ifdef GL_ARB_shading_language_100 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20)) +#ifdef GL_EXT_gpu_program_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_parameters", 22)) { - ret = GLEW_ARB_shading_language_100; + ret = GLEW_EXT_gpu_program_parameters; continue; } #endif -#ifdef GL_ARB_shading_language_420pack - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_420pack", 24)) +#ifdef GL_EXT_gpu_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader4", 11)) { - ret = GLEW_ARB_shading_language_420pack; + ret = GLEW_EXT_gpu_shader4; continue; } #endif -#ifdef GL_ARB_shading_language_include - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_include", 24)) +#ifdef GL_EXT_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9)) { - ret = GLEW_ARB_shading_language_include; + ret = GLEW_EXT_histogram; continue; } #endif -#ifdef GL_ARB_shading_language_packing - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_packing", 24)) +#ifdef GL_EXT_index_array_formats + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19)) { - ret = GLEW_ARB_shading_language_packing; + ret = GLEW_EXT_index_array_formats; continue; } #endif -#ifdef GL_ARB_shadow - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) +#ifdef GL_EXT_index_func + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10)) { - ret = GLEW_ARB_shadow; + ret = GLEW_EXT_index_func; continue; } #endif -#ifdef GL_ARB_shadow_ambient - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) +#ifdef GL_EXT_index_material + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14)) { - ret = GLEW_ARB_shadow_ambient; + ret = GLEW_EXT_index_material; continue; } #endif -#ifdef GL_ARB_sparse_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_buffer", 13)) +#ifdef GL_EXT_index_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13)) { - ret = GLEW_ARB_sparse_buffer; + ret = GLEW_EXT_index_texture; continue; } #endif -#ifdef GL_ARB_sparse_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture", 14)) +#ifdef GL_EXT_light_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13)) { - ret = GLEW_ARB_sparse_texture; + ret = GLEW_EXT_light_texture; continue; } #endif -#ifdef GL_ARB_sparse_texture2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) +#ifdef GL_EXT_misc_attribute + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14)) { - ret = GLEW_ARB_sparse_texture2; + ret = GLEW_EXT_misc_attribute; continue; } #endif -#ifdef GL_ARB_sparse_texture_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture_clamp", 20)) +#ifdef GL_EXT_multi_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17)) { - ret = GLEW_ARB_sparse_texture_clamp; + ret = GLEW_EXT_multi_draw_arrays; continue; } #endif -#ifdef GL_ARB_stencil_texturing - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_texturing", 17)) +#ifdef GL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_ARB_stencil_texturing; + ret = GLEW_EXT_multisample; continue; } #endif -#ifdef GL_ARB_sync - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4)) +#ifdef GL_EXT_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) { - ret = GLEW_ARB_sync; + ret = GLEW_EXT_packed_depth_stencil; continue; } #endif -#ifdef GL_ARB_tessellation_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_shader", 19)) +#ifdef GL_EXT_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_float", 12)) { - ret = GLEW_ARB_tessellation_shader; + ret = GLEW_EXT_packed_float; continue; } #endif -#ifdef GL_ARB_texture_barrier - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) +#ifdef GL_EXT_packed_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13)) { - ret = GLEW_ARB_texture_barrier; + ret = GLEW_EXT_packed_pixels; continue; } #endif -#ifdef GL_ARB_texture_border_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) +#ifdef GL_EXT_paletted_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16)) { - ret = GLEW_ARB_texture_border_clamp; + ret = GLEW_EXT_paletted_texture; continue; } #endif -#ifdef GL_ARB_texture_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) +#ifdef GL_EXT_pixel_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) { - ret = GLEW_ARB_texture_buffer_object; + ret = GLEW_EXT_pixel_buffer_object; continue; } #endif -#ifdef GL_ARB_texture_buffer_object_rgb32 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object_rgb32", 27)) +#ifdef GL_EXT_pixel_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15)) { - ret = GLEW_ARB_texture_buffer_object_rgb32; + ret = GLEW_EXT_pixel_transform; continue; } #endif -#ifdef GL_ARB_texture_buffer_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_range", 20)) +#ifdef GL_EXT_pixel_transform_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27)) { - ret = GLEW_ARB_texture_buffer_range; + ret = GLEW_EXT_pixel_transform_color_table; continue; } #endif -#ifdef GL_ARB_texture_compression - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19)) +#ifdef GL_EXT_point_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) { - ret = GLEW_ARB_texture_compression; + ret = GLEW_EXT_point_parameters; continue; } #endif -#ifdef GL_ARB_texture_compression_bptc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_bptc", 24)) +#ifdef GL_EXT_polygon_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14)) { - ret = GLEW_ARB_texture_compression_bptc; + ret = GLEW_EXT_polygon_offset; continue; } #endif -#ifdef GL_ARB_texture_compression_rgtc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) +#ifdef GL_EXT_polygon_offset_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset_clamp", 20)) { - ret = GLEW_ARB_texture_compression_rgtc; + ret = GLEW_EXT_polygon_offset_clamp; continue; } #endif -#ifdef GL_ARB_texture_cube_map - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) +#ifdef GL_EXT_post_depth_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) { - ret = GLEW_ARB_texture_cube_map; + ret = GLEW_EXT_post_depth_coverage; continue; } #endif -#ifdef GL_ARB_texture_cube_map_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map_array", 22)) +#ifdef GL_EXT_provoking_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) { - ret = GLEW_ARB_texture_cube_map_array; + ret = GLEW_EXT_provoking_vertex; continue; } #endif -#ifdef GL_ARB_texture_env_add - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) +#ifdef GL_EXT_raster_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"raster_multisample", 18)) { - ret = GLEW_ARB_texture_env_add; + ret = GLEW_EXT_raster_multisample; continue; } #endif -#ifdef GL_ARB_texture_env_combine - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) +#ifdef GL_EXT_rescale_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14)) { - ret = GLEW_ARB_texture_env_combine; + ret = GLEW_EXT_rescale_normal; continue; } #endif -#ifdef GL_ARB_texture_env_crossbar - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20)) +#ifdef GL_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) { - ret = GLEW_ARB_texture_env_crossbar; + ret = GLEW_EXT_scene_marker; continue; } #endif -#ifdef GL_ARB_texture_env_dot3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) +#ifdef GL_EXT_secondary_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15)) { - ret = GLEW_ARB_texture_env_dot3; + ret = GLEW_EXT_secondary_color; continue; } #endif -#ifdef GL_ARB_texture_filter_minmax - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) +#ifdef GL_EXT_separate_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) { - ret = GLEW_ARB_texture_filter_minmax; + ret = GLEW_EXT_separate_shader_objects; continue; } #endif -#ifdef GL_ARB_texture_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) +#ifdef GL_EXT_separate_specular_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23)) { - ret = GLEW_ARB_texture_float; + ret = GLEW_EXT_separate_specular_color; continue; } #endif -#ifdef GL_ARB_texture_gather - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_gather", 14)) +#ifdef GL_EXT_shader_image_load_formatted + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_formatted", 27)) { - ret = GLEW_ARB_texture_gather; + ret = GLEW_EXT_shader_image_load_formatted; continue; } #endif -#ifdef GL_ARB_texture_mirror_clamp_to_edge - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp_to_edge", 28)) +#ifdef GL_EXT_shader_image_load_store + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) { - ret = GLEW_ARB_texture_mirror_clamp_to_edge; + ret = GLEW_EXT_shader_image_load_store; continue; } #endif -#ifdef GL_ARB_texture_mirrored_repeat - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) +#ifdef GL_EXT_shader_integer_mix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_integer_mix", 18)) { - ret = GLEW_ARB_texture_mirrored_repeat; + ret = GLEW_EXT_shader_integer_mix; continue; } #endif -#ifdef GL_ARB_texture_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) +#ifdef GL_EXT_shadow_funcs + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12)) { - ret = GLEW_ARB_texture_multisample; + ret = GLEW_EXT_shadow_funcs; continue; } #endif -#ifdef GL_ARB_texture_non_power_of_two - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24)) +#ifdef GL_EXT_shared_texture_palette + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22)) { - ret = GLEW_ARB_texture_non_power_of_two; + ret = GLEW_EXT_shared_texture_palette; continue; } #endif -#ifdef GL_ARB_texture_query_levels - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_levels", 20)) +#ifdef GL_EXT_sparse_texture2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) { - ret = GLEW_ARB_texture_query_levels; + ret = GLEW_EXT_sparse_texture2; continue; } #endif -#ifdef GL_ARB_texture_query_lod - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_query_lod", 17)) +#ifdef GL_EXT_stencil_clear_tag + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17)) { - ret = GLEW_ARB_texture_query_lod; + ret = GLEW_EXT_stencil_clear_tag; continue; } #endif -#ifdef GL_ARB_texture_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) +#ifdef GL_EXT_stencil_two_side + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16)) { - ret = GLEW_ARB_texture_rectangle; + ret = GLEW_EXT_stencil_two_side; continue; } #endif -#ifdef GL_ARB_texture_rg - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rg", 10)) +#ifdef GL_EXT_stencil_wrap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12)) { - ret = GLEW_ARB_texture_rg; + ret = GLEW_EXT_stencil_wrap; continue; } #endif -#ifdef GL_ARB_texture_rgb10_a2ui - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rgb10_a2ui", 18)) +#ifdef GL_EXT_subtexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10)) { - ret = GLEW_ARB_texture_rgb10_a2ui; + ret = GLEW_EXT_subtexture; continue; } #endif -#ifdef GL_ARB_texture_stencil8 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stencil8", 16)) +#ifdef GL_EXT_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7)) { - ret = GLEW_ARB_texture_stencil8; + ret = GLEW_EXT_texture; continue; } #endif -#ifdef GL_ARB_texture_storage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage", 15)) +#ifdef GL_EXT_texture3D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9)) { - ret = GLEW_ARB_texture_storage; + ret = GLEW_EXT_texture3D; continue; } #endif -#ifdef GL_ARB_texture_storage_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_storage_multisample", 27)) +#ifdef GL_EXT_texture_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_array", 13)) { - ret = GLEW_ARB_texture_storage_multisample; + ret = GLEW_EXT_texture_array; continue; } #endif -#ifdef GL_ARB_texture_swizzle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) +#ifdef GL_EXT_texture_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) { - ret = GLEW_ARB_texture_swizzle; + ret = GLEW_EXT_texture_buffer_object; continue; } #endif -#ifdef GL_ARB_texture_view - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_view", 12)) +#ifdef GL_EXT_texture_compression_dxt1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) { - ret = GLEW_ARB_texture_view; + ret = GLEW_EXT_texture_compression_dxt1; continue; } #endif -#ifdef GL_ARB_timer_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) +#ifdef GL_EXT_texture_compression_latc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_latc", 24)) { - ret = GLEW_ARB_timer_query; + ret = GLEW_EXT_texture_compression_latc; continue; } #endif -#ifdef GL_ARB_transform_feedback2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) +#ifdef GL_EXT_texture_compression_rgtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) { - ret = GLEW_ARB_transform_feedback2; + ret = GLEW_EXT_texture_compression_rgtc; continue; } #endif -#ifdef GL_ARB_transform_feedback3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback3", 19)) +#ifdef GL_EXT_texture_compression_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24)) { - ret = GLEW_ARB_transform_feedback3; + ret = GLEW_EXT_texture_compression_s3tc; continue; } #endif -#ifdef GL_ARB_transform_feedback_instanced - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_instanced", 28)) +#ifdef GL_EXT_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) { - ret = GLEW_ARB_transform_feedback_instanced; + ret = GLEW_EXT_texture_cube_map; continue; } #endif -#ifdef GL_ARB_transform_feedback_overflow_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback_overflow_query", 33)) +#ifdef GL_EXT_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) { - ret = GLEW_ARB_transform_feedback_overflow_query; + ret = GLEW_EXT_texture_edge_clamp; continue; } #endif -#ifdef GL_ARB_transpose_matrix - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16)) +#ifdef GL_EXT_texture_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11)) { - ret = GLEW_ARB_transpose_matrix; + ret = GLEW_EXT_texture_env; continue; } #endif -#ifdef GL_ARB_uniform_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_object", 21)) +#ifdef GL_EXT_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) { - ret = GLEW_ARB_uniform_buffer_object; + ret = GLEW_EXT_texture_env_add; continue; } #endif -#ifdef GL_ARB_vertex_array_bgra - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) +#ifdef GL_EXT_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) { - ret = GLEW_ARB_vertex_array_bgra; + ret = GLEW_EXT_texture_env_combine; continue; } #endif -#ifdef GL_ARB_vertex_array_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) +#ifdef GL_EXT_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) { - ret = GLEW_ARB_vertex_array_object; + ret = GLEW_EXT_texture_env_dot3; continue; } #endif -#ifdef GL_ARB_vertex_attrib_64bit - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) +#ifdef GL_EXT_texture_filter_anisotropic + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26)) { - ret = GLEW_ARB_vertex_attrib_64bit; + ret = GLEW_EXT_texture_filter_anisotropic; continue; } #endif -#ifdef GL_ARB_vertex_attrib_binding - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_binding", 21)) +#ifdef GL_EXT_texture_filter_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) { - ret = GLEW_ARB_vertex_attrib_binding; + ret = GLEW_EXT_texture_filter_minmax; continue; } #endif -#ifdef GL_ARB_vertex_blend - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12)) +#ifdef GL_EXT_texture_integer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_integer", 15)) { - ret = GLEW_ARB_vertex_blend; + ret = GLEW_EXT_texture_integer; continue; } #endif -#ifdef GL_ARB_vertex_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) +#ifdef GL_EXT_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) { - ret = GLEW_ARB_vertex_buffer_object; + ret = GLEW_EXT_texture_lod_bias; continue; } #endif -#ifdef GL_ARB_vertex_program - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) +#ifdef GL_EXT_texture_mirror_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20)) { - ret = GLEW_ARB_vertex_program; + ret = GLEW_EXT_texture_mirror_clamp; continue; } #endif -#ifdef GL_ARB_vertex_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) +#ifdef GL_EXT_texture_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14)) { - ret = GLEW_ARB_vertex_shader; + ret = GLEW_EXT_texture_object; continue; } #endif -#ifdef GL_ARB_vertex_type_10f_11f_11f_rev - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_type_10f_11f_11f_rev", 27)) +#ifdef GL_EXT_texture_perturb_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22)) { - ret = GLEW_ARB_vertex_type_10f_11f_11f_rev; + ret = GLEW_EXT_texture_perturb_normal; 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)) +#ifdef GL_EXT_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { - ret = GLEW_ARB_vertex_type_2_10_10_10_rev; + ret = GLEW_EXT_texture_rectangle; continue; } #endif -#ifdef GL_ARB_viewport_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array", 14)) +#ifdef GL_EXT_texture_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12)) { - ret = GLEW_ARB_viewport_array; + ret = GLEW_EXT_texture_sRGB; continue; } #endif -#ifdef GL_ARB_window_pos - if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) +#ifdef GL_EXT_texture_sRGB_decode + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB_decode", 19)) { - ret = GLEW_ARB_window_pos; + ret = GLEW_EXT_texture_sRGB_decode; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5)) - { -#ifdef GL_ATIX_point_sprites - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13)) +#ifdef GL_EXT_texture_shared_exponent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shared_exponent", 23)) { - ret = GLEW_ATIX_point_sprites; + ret = GLEW_EXT_texture_shared_exponent; continue; } #endif -#ifdef GL_ATIX_texture_env_combine3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) +#ifdef GL_EXT_texture_snorm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_snorm", 13)) { - ret = GLEW_ATIX_texture_env_combine3; + ret = GLEW_EXT_texture_snorm; continue; } #endif -#ifdef GL_ATIX_texture_env_route - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17)) +#ifdef GL_EXT_texture_swizzle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) { - ret = GLEW_ATIX_texture_env_route; + ret = GLEW_EXT_texture_swizzle; continue; } #endif -#ifdef GL_ATIX_vertex_shader_output_point_size - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31)) +#ifdef GL_EXT_timer_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) { - ret = GLEW_ATIX_vertex_shader_output_point_size; + ret = GLEW_EXT_timer_query; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) - { -#ifdef GL_ATI_draw_buffers - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) +#ifdef GL_EXT_transform_feedback + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) { - ret = GLEW_ATI_draw_buffers; + ret = GLEW_EXT_transform_feedback; continue; } #endif -#ifdef GL_ATI_element_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) +#ifdef GL_EXT_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12)) { - ret = GLEW_ATI_element_array; + ret = GLEW_EXT_vertex_array; continue; } #endif -#ifdef GL_ATI_envmap_bumpmap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14)) +#ifdef GL_EXT_vertex_array_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) { - ret = GLEW_ATI_envmap_bumpmap; + ret = GLEW_EXT_vertex_array_bgra; continue; } #endif -#ifdef GL_ATI_fragment_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) +#ifdef GL_EXT_vertex_attrib_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) { - ret = GLEW_ATI_fragment_shader; + ret = GLEW_EXT_vertex_attrib_64bit; continue; } #endif -#ifdef GL_ATI_map_object_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17)) +#ifdef GL_EXT_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) { - ret = GLEW_ATI_map_object_buffer; + ret = GLEW_EXT_vertex_shader; continue; } #endif -#ifdef GL_ATI_meminfo - if (_glewStrSame3(&pos, &len, (const GLubyte*)"meminfo", 7)) +#ifdef GL_EXT_vertex_weighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16)) { - ret = GLEW_ATI_meminfo; + ret = GLEW_EXT_vertex_weighting; continue; } #endif -#ifdef GL_ATI_pn_triangles - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12)) +#ifdef GL_EXT_window_rectangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_rectangles", 17)) { - ret = GLEW_ATI_pn_triangles; + ret = GLEW_EXT_window_rectangles; continue; } #endif -#ifdef GL_ATI_separate_stencil - if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16)) +#ifdef GL_EXT_x11_sync_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15)) { - ret = GLEW_ATI_separate_stencil; + ret = GLEW_EXT_x11_sync_object; continue; } #endif -#ifdef GL_ATI_shader_texture_lod - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_texture_lod", 18)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) + { +#ifdef GL_GREMEDY_frame_terminator + if (_glewStrSame3(&pos, &len, (const GLubyte*)"frame_terminator", 16)) { - ret = GLEW_ATI_shader_texture_lod; + ret = GLEW_GREMEDY_frame_terminator; continue; } #endif -#ifdef GL_ATI_text_fragment_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20)) +#ifdef GL_GREMEDY_string_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13)) { - ret = GLEW_ATI_text_fragment_shader; + ret = GLEW_GREMEDY_string_marker; continue; } #endif -#ifdef GL_ATI_texture_compression_3dc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23)) + } + 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_ATI_texture_compression_3dc; + ret = GLEW_HP_convolution_border_modes; continue; } #endif -#ifdef GL_ATI_texture_env_combine3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) +#ifdef GL_HP_image_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15)) { - ret = GLEW_ATI_texture_env_combine3; + ret = GLEW_HP_image_transform; continue; } #endif -#ifdef GL_ATI_texture_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) +#ifdef GL_HP_occlusion_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14)) { - ret = GLEW_ATI_texture_float; + ret = GLEW_HP_occlusion_test; continue; } #endif -#ifdef GL_ATI_texture_mirror_once - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19)) +#ifdef GL_HP_texture_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16)) { - ret = GLEW_ATI_texture_mirror_once; + ret = GLEW_HP_texture_lighting; continue; } #endif -#ifdef GL_ATI_vertex_array_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4)) + { +#ifdef GL_IBM_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) { - ret = GLEW_ATI_vertex_array_object; + ret = GLEW_IBM_cull_vertex; continue; } #endif -#ifdef GL_ATI_vertex_attrib_array_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26)) +#ifdef GL_IBM_multimode_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21)) { - ret = GLEW_ATI_vertex_attrib_array_object; + ret = GLEW_IBM_multimode_draw_arrays; continue; } #endif -#ifdef GL_ATI_vertex_streams - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14)) +#ifdef GL_IBM_rasterpos_clip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14)) { - ret = GLEW_ATI_vertex_streams; + ret = GLEW_IBM_rasterpos_clip; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) - { -#ifdef GL_EXT_422_pixels - if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10)) +#ifdef GL_IBM_static_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11)) { - ret = GLEW_EXT_422_pixels; + ret = GLEW_IBM_static_data; continue; } #endif -#ifdef GL_EXT_Cg_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9)) +#ifdef GL_IBM_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) { - ret = GLEW_EXT_Cg_shader; + ret = GLEW_IBM_texture_mirrored_repeat; continue; } #endif -#ifdef GL_EXT_abgr - if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4)) +#ifdef GL_IBM_vertex_array_lists + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18)) { - ret = GLEW_EXT_abgr; + ret = GLEW_IBM_vertex_array_lists; continue; } #endif -#ifdef GL_EXT_bgra - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5)) + { +#ifdef GL_INGR_color_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11)) { - ret = GLEW_EXT_bgra; + ret = GLEW_INGR_color_clamp; continue; } #endif -#ifdef GL_EXT_bindable_uniform - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindable_uniform", 16)) +#ifdef GL_INGR_interlace_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14)) { - ret = GLEW_EXT_bindable_uniform; + ret = GLEW_INGR_interlace_read; continue; } #endif -#ifdef GL_EXT_blend_color - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) + { +#ifdef GL_INTEL_conservative_rasterization + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_rasterization", 26)) { - ret = GLEW_EXT_blend_color; + ret = GLEW_INTEL_conservative_rasterization; continue; } #endif -#ifdef GL_EXT_blend_equation_separate - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23)) +#ifdef GL_INTEL_fragment_shader_ordering + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_ordering", 24)) { - ret = GLEW_EXT_blend_equation_separate; + ret = GLEW_INTEL_fragment_shader_ordering; continue; } #endif -#ifdef GL_EXT_blend_func_separate - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19)) +#ifdef GL_INTEL_framebuffer_CMAA + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_CMAA", 16)) { - ret = GLEW_EXT_blend_func_separate; + ret = GLEW_INTEL_framebuffer_CMAA; continue; } #endif -#ifdef GL_EXT_blend_logic_op - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14)) +#ifdef GL_INTEL_map_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_texture", 11)) { - ret = GLEW_EXT_blend_logic_op; + ret = GLEW_INTEL_map_texture; continue; } #endif -#ifdef GL_EXT_blend_minmax - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12)) +#ifdef GL_INTEL_parallel_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15)) { - ret = GLEW_EXT_blend_minmax; + ret = GLEW_INTEL_parallel_arrays; continue; } #endif -#ifdef GL_EXT_blend_subtract - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14)) +#ifdef GL_INTEL_performance_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_query", 17)) { - ret = GLEW_EXT_blend_subtract; + ret = GLEW_INTEL_performance_query; continue; } #endif -#ifdef GL_EXT_clip_volume_hint - if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16)) +#ifdef GL_INTEL_texture_scissor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15)) { - ret = GLEW_EXT_clip_volume_hint; + ret = GLEW_INTEL_texture_scissor; continue; } #endif -#ifdef GL_EXT_cmyka - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5)) + } + 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_EXT_cmyka; + ret = GLEW_KHR_blend_equation_advanced; continue; } #endif -#ifdef GL_EXT_color_subtable - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14)) +#ifdef GL_KHR_blend_equation_advanced_coherent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) { - ret = GLEW_EXT_color_subtable; + ret = GLEW_KHR_blend_equation_advanced_coherent; continue; } #endif -#ifdef GL_EXT_compiled_vertex_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21)) +#ifdef GL_KHR_context_flush_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) { - ret = GLEW_EXT_compiled_vertex_array; + ret = GLEW_KHR_context_flush_control; continue; } #endif -#ifdef GL_EXT_convolution - if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11)) +#ifdef GL_KHR_debug + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5)) { - ret = GLEW_EXT_convolution; + ret = GLEW_KHR_debug; continue; } #endif -#ifdef GL_EXT_coordinate_frame - if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16)) +#ifdef GL_KHR_no_error + if (_glewStrSame3(&pos, &len, (const GLubyte*)"no_error", 8)) { - ret = GLEW_EXT_coordinate_frame; + ret = GLEW_KHR_no_error; continue; } #endif -#ifdef GL_EXT_copy_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12)) +#ifdef GL_KHR_robust_buffer_access_behavior + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) { - ret = GLEW_EXT_copy_texture; + ret = GLEW_KHR_robust_buffer_access_behavior; continue; } #endif -#ifdef GL_EXT_cull_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) +#ifdef GL_KHR_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) { - ret = GLEW_EXT_cull_vertex; + ret = GLEW_KHR_robustness; continue; } #endif -#ifdef GL_EXT_debug_label - if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_label", 11)) +#ifdef GL_KHR_texture_compression_astc_hdr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_hdr", 28)) { - ret = GLEW_EXT_debug_label; + ret = GLEW_KHR_texture_compression_astc_hdr; continue; } #endif -#ifdef GL_EXT_debug_marker - if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug_marker", 12)) +#ifdef GL_KHR_texture_compression_astc_ldr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_ldr", 28)) { - ret = GLEW_EXT_debug_marker; + ret = GLEW_KHR_texture_compression_astc_ldr; continue; } #endif -#ifdef GL_EXT_depth_bounds_test - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17)) +#ifdef GL_KHR_texture_compression_astc_sliced_3d + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_sliced_3d", 34)) { - ret = GLEW_EXT_depth_bounds_test; + ret = GLEW_KHR_texture_compression_astc_sliced_3d; continue; } #endif -#ifdef GL_EXT_direct_state_access - if (_glewStrSame3(&pos, &len, (const GLubyte*)"direct_state_access", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4)) + { +#ifdef GL_KTX_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) { - ret = GLEW_EXT_direct_state_access; + ret = GLEW_KTX_buffer_region; continue; } #endif -#ifdef GL_EXT_draw_buffers2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers2", 13)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6)) + { +#ifdef GL_MESAX_texture_stack + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13)) { - ret = GLEW_EXT_draw_buffers2; + ret = GLEW_MESAX_texture_stack; continue; } #endif -#ifdef GL_EXT_draw_instanced - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_instanced", 14)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GL_MESA_pack_invert + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11)) { - ret = GLEW_EXT_draw_instanced; + ret = GLEW_MESA_pack_invert; continue; } #endif -#ifdef GL_EXT_draw_range_elements - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19)) +#ifdef GL_MESA_resize_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14)) { - ret = GLEW_EXT_draw_range_elements; + ret = GLEW_MESA_resize_buffers; continue; } #endif -#ifdef GL_EXT_fog_coord - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9)) +#ifdef GL_MESA_shader_integer_functions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_integer_functions", 24)) { - ret = GLEW_EXT_fog_coord; + ret = GLEW_MESA_shader_integer_functions; continue; } #endif -#ifdef GL_EXT_fragment_lighting - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17)) +#ifdef GL_MESA_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) { - ret = GLEW_EXT_fragment_lighting; + ret = GLEW_MESA_window_pos; continue; } #endif -#ifdef GL_EXT_framebuffer_blit - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) +#ifdef GL_MESA_ycbcr_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13)) { - ret = GLEW_EXT_framebuffer_blit; + ret = GLEW_MESA_ycbcr_texture; continue; } #endif -#ifdef GL_EXT_framebuffer_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NVX_", 4)) + { +#ifdef GL_NVX_blend_equation_advanced_multi_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_multi_draw_buffers", 42)) { - ret = GLEW_EXT_framebuffer_multisample; + ret = GLEW_NVX_blend_equation_advanced_multi_draw_buffers; continue; } #endif -#ifdef GL_EXT_framebuffer_multisample_blit_scaled - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_blit_scaled", 35)) +#ifdef GL_NVX_conditional_render + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) { - ret = GLEW_EXT_framebuffer_multisample_blit_scaled; + ret = GLEW_NVX_conditional_render; continue; } #endif -#ifdef GL_EXT_framebuffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) +#ifdef GL_NVX_gpu_memory_info + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_memory_info", 15)) { - ret = GLEW_EXT_framebuffer_object; + ret = GLEW_NVX_gpu_memory_info; continue; } #endif -#ifdef GL_EXT_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#ifdef GL_NVX_linked_gpu_multicast + if (_glewStrSame3(&pos, &len, (const GLubyte*)"linked_gpu_multicast", 20)) { - ret = GLEW_EXT_framebuffer_sRGB; + ret = GLEW_NVX_linked_gpu_multicast; continue; } #endif -#ifdef GL_EXT_geometry_shader4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) + } + 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_EXT_geometry_shader4; + ret = GLEW_NV_bindless_multi_draw_indirect; continue; } #endif -#ifdef GL_EXT_gpu_program_parameters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_parameters", 22)) +#ifdef GL_NV_bindless_multi_draw_indirect_count + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect_count", 34)) { - ret = GLEW_EXT_gpu_program_parameters; + ret = GLEW_NV_bindless_multi_draw_indirect_count; continue; } #endif -#ifdef GL_EXT_gpu_shader4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader4", 11)) +#ifdef GL_NV_bindless_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) { - ret = GLEW_EXT_gpu_shader4; + ret = GLEW_NV_bindless_texture; continue; } #endif -#ifdef GL_EXT_histogram - if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9)) +#ifdef GL_NV_blend_equation_advanced + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23)) { - ret = GLEW_EXT_histogram; + ret = GLEW_NV_blend_equation_advanced; continue; } #endif -#ifdef GL_EXT_index_array_formats - if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19)) +#ifdef GL_NV_blend_equation_advanced_coherent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) { - ret = GLEW_EXT_index_array_formats; + ret = GLEW_NV_blend_equation_advanced_coherent; continue; } #endif -#ifdef GL_EXT_index_func - if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10)) +#ifdef GL_NV_blend_square + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12)) { - ret = GLEW_EXT_index_func; + ret = GLEW_NV_blend_square; continue; } #endif -#ifdef GL_EXT_index_material - if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14)) +#ifdef GL_NV_clip_space_w_scaling + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_space_w_scaling", 20)) { - ret = GLEW_EXT_index_material; + ret = GLEW_NV_clip_space_w_scaling; continue; } #endif -#ifdef GL_EXT_index_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13)) +#ifdef GL_NV_command_list + if (_glewStrSame3(&pos, &len, (const GLubyte*)"command_list", 12)) { - ret = GLEW_EXT_index_texture; + ret = GLEW_NV_command_list; continue; } #endif -#ifdef GL_EXT_light_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13)) +#ifdef GL_NV_compute_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_program5", 16)) { - ret = GLEW_EXT_light_texture; + ret = GLEW_NV_compute_program5; continue; } #endif -#ifdef GL_EXT_misc_attribute - if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14)) +#ifdef GL_NV_conditional_render + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) { - ret = GLEW_EXT_misc_attribute; + ret = GLEW_NV_conditional_render; continue; } #endif -#ifdef GL_EXT_multi_draw_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17)) +#ifdef GL_NV_conservative_raster + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster", 19)) { - ret = GLEW_EXT_multi_draw_arrays; + ret = GLEW_NV_conservative_raster; continue; } #endif -#ifdef GL_EXT_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef GL_NV_conservative_raster_dilate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster_dilate", 26)) { - ret = GLEW_EXT_multisample; + ret = GLEW_NV_conservative_raster_dilate; continue; } #endif -#ifdef GL_EXT_packed_depth_stencil - if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) +#ifdef GL_NV_conservative_raster_pre_snap_triangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster_pre_snap_triangles", 38)) { - ret = GLEW_EXT_packed_depth_stencil; + ret = GLEW_NV_conservative_raster_pre_snap_triangles; continue; } #endif -#ifdef GL_EXT_packed_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_float", 12)) +#ifdef GL_NV_copy_depth_to_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19)) { - ret = GLEW_EXT_packed_float; + ret = GLEW_NV_copy_depth_to_color; continue; } #endif -#ifdef GL_EXT_packed_pixels - if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13)) +#ifdef GL_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { - ret = GLEW_EXT_packed_pixels; + ret = GLEW_NV_copy_image; continue; } #endif -#ifdef GL_EXT_paletted_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16)) +#ifdef GL_NV_deep_texture3D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"deep_texture3D", 14)) { - ret = GLEW_EXT_paletted_texture; + ret = GLEW_NV_deep_texture3D; continue; } #endif -#ifdef GL_EXT_pixel_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) +#ifdef GL_NV_depth_buffer_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) { - ret = GLEW_EXT_pixel_buffer_object; + ret = GLEW_NV_depth_buffer_float; continue; } #endif -#ifdef GL_EXT_pixel_transform - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15)) +#ifdef GL_NV_depth_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) { - ret = GLEW_EXT_pixel_transform; + ret = GLEW_NV_depth_clamp; continue; } #endif -#ifdef GL_EXT_pixel_transform_color_table - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27)) +#ifdef GL_NV_depth_range_unclamped + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_range_unclamped", 21)) { - ret = GLEW_EXT_pixel_transform_color_table; + ret = GLEW_NV_depth_range_unclamped; continue; } #endif -#ifdef GL_EXT_point_parameters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) +#ifdef GL_NV_draw_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_texture", 12)) { - ret = GLEW_EXT_point_parameters; + ret = GLEW_NV_draw_texture; continue; } #endif -#ifdef GL_EXT_polygon_offset - if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14)) +#ifdef GL_NV_draw_vulkan_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_vulkan_image", 17)) { - ret = GLEW_EXT_polygon_offset; + ret = GLEW_NV_draw_vulkan_image; continue; } #endif -#ifdef GL_EXT_polygon_offset_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset_clamp", 20)) +#ifdef GL_NV_evaluators + if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10)) { - ret = GLEW_EXT_polygon_offset_clamp; + ret = GLEW_NV_evaluators; continue; } #endif -#ifdef GL_EXT_post_depth_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_depth_coverage", 19)) +#ifdef GL_NV_explicit_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_multisample", 20)) { - ret = GLEW_EXT_post_depth_coverage; + ret = GLEW_NV_explicit_multisample; continue; } #endif -#ifdef GL_EXT_provoking_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"provoking_vertex", 16)) +#ifdef GL_NV_fence + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) { - ret = GLEW_EXT_provoking_vertex; + ret = GLEW_NV_fence; continue; } #endif -#ifdef GL_EXT_raster_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"raster_multisample", 18)) +#ifdef GL_NV_fill_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fill_rectangle", 14)) { - ret = GLEW_EXT_raster_multisample; + ret = GLEW_NV_fill_rectangle; continue; } #endif -#ifdef GL_EXT_rescale_normal - if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14)) +#ifdef GL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { - ret = GLEW_EXT_rescale_normal; + ret = GLEW_NV_float_buffer; continue; } #endif -#ifdef GL_EXT_scene_marker - if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) +#ifdef GL_NV_fog_distance + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12)) { - ret = GLEW_EXT_scene_marker; + ret = GLEW_NV_fog_distance; continue; } #endif -#ifdef GL_EXT_secondary_color - if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15)) +#ifdef GL_NV_fragment_coverage_to_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coverage_to_color", 26)) { - ret = GLEW_EXT_secondary_color; + ret = GLEW_NV_fragment_coverage_to_color; continue; } #endif -#ifdef GL_EXT_separate_shader_objects - if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_shader_objects", 23)) +#ifdef GL_NV_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) { - ret = GLEW_EXT_separate_shader_objects; + ret = GLEW_NV_fragment_program; continue; } #endif -#ifdef GL_EXT_separate_specular_color - if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23)) +#ifdef GL_NV_fragment_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17)) { - ret = GLEW_EXT_separate_specular_color; + ret = GLEW_NV_fragment_program2; continue; } #endif -#ifdef GL_EXT_shader_image_load_formatted - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_formatted", 27)) +#ifdef GL_NV_fragment_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program4", 17)) { - ret = GLEW_EXT_shader_image_load_formatted; + ret = GLEW_NV_fragment_program4; continue; } #endif -#ifdef GL_EXT_shader_image_load_store - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_image_load_store", 23)) +#ifdef GL_NV_fragment_program_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23)) { - ret = GLEW_EXT_shader_image_load_store; + ret = GLEW_NV_fragment_program_option; continue; } #endif -#ifdef GL_EXT_shader_integer_mix - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_integer_mix", 18)) +#ifdef GL_NV_fragment_shader_interlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) { - ret = GLEW_EXT_shader_integer_mix; + ret = GLEW_NV_fragment_shader_interlock; continue; } #endif -#ifdef GL_EXT_shadow_funcs - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12)) +#ifdef GL_NV_framebuffer_mixed_samples + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_mixed_samples", 25)) { - ret = GLEW_EXT_shadow_funcs; + ret = GLEW_NV_framebuffer_mixed_samples; continue; } #endif -#ifdef GL_EXT_shared_texture_palette - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22)) +#ifdef GL_NV_framebuffer_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_coverage", 32)) { - ret = GLEW_EXT_shared_texture_palette; + ret = GLEW_NV_framebuffer_multisample_coverage; continue; } #endif -#ifdef GL_EXT_sparse_texture2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sparse_texture2", 15)) +#ifdef GL_NV_geometry_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_program4", 17)) { - ret = GLEW_EXT_sparse_texture2; + ret = GLEW_NV_geometry_program4; continue; } #endif -#ifdef GL_EXT_stencil_clear_tag - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17)) +#ifdef GL_NV_geometry_shader4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) { - ret = GLEW_EXT_stencil_clear_tag; + ret = GLEW_NV_geometry_shader4; continue; } #endif -#ifdef GL_EXT_stencil_two_side - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16)) +#ifdef GL_NV_geometry_shader_passthrough + if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader_passthrough", 27)) { - ret = GLEW_EXT_stencil_two_side; + ret = GLEW_NV_geometry_shader_passthrough; continue; } #endif -#ifdef GL_EXT_stencil_wrap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12)) +#ifdef GL_NV_gpu_multicast + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_multicast", 13)) { - ret = GLEW_EXT_stencil_wrap; + ret = GLEW_NV_gpu_multicast; continue; } #endif -#ifdef GL_EXT_subtexture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10)) +#ifdef GL_NV_gpu_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program4", 12)) { - ret = GLEW_EXT_subtexture; + ret = GLEW_NV_gpu_program4; continue; } #endif -#ifdef GL_EXT_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7)) +#ifdef GL_NV_gpu_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5", 12)) { - ret = GLEW_EXT_texture; + ret = GLEW_NV_gpu_program5; continue; } #endif -#ifdef GL_EXT_texture3D - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9)) +#ifdef GL_NV_gpu_program5_mem_extended + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5_mem_extended", 25)) { - ret = GLEW_EXT_texture3D; + ret = GLEW_NV_gpu_program5_mem_extended; continue; } #endif -#ifdef GL_EXT_texture_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_array", 13)) +#ifdef GL_NV_gpu_program_fp64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_fp64", 16)) { - ret = GLEW_EXT_texture_array; + ret = GLEW_NV_gpu_program_fp64; continue; } #endif -#ifdef GL_EXT_texture_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_buffer_object", 21)) +#ifdef GL_NV_gpu_shader5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) { - ret = GLEW_EXT_texture_buffer_object; + ret = GLEW_NV_gpu_shader5; continue; } #endif -#ifdef GL_EXT_texture_compression_dxt1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) +#ifdef GL_NV_half_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10)) { - ret = GLEW_EXT_texture_compression_dxt1; + ret = GLEW_NV_half_float; continue; } #endif -#ifdef GL_EXT_texture_compression_latc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_latc", 24)) +#ifdef GL_NV_internalformat_sample_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_sample_query", 27)) { - ret = GLEW_EXT_texture_compression_latc; + ret = GLEW_NV_internalformat_sample_query; continue; } #endif -#ifdef GL_EXT_texture_compression_rgtc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_rgtc", 24)) +#ifdef GL_NV_light_max_exponent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18)) { - ret = GLEW_EXT_texture_compression_rgtc; + ret = GLEW_NV_light_max_exponent; continue; } #endif -#ifdef GL_EXT_texture_compression_s3tc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24)) +#ifdef GL_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { - ret = GLEW_EXT_texture_compression_s3tc; + ret = GLEW_NV_multisample_coverage; continue; } #endif -#ifdef GL_EXT_texture_cube_map - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) +#ifdef GL_NV_multisample_filter_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23)) { - ret = GLEW_EXT_texture_cube_map; + ret = GLEW_NV_multisample_filter_hint; continue; } #endif -#ifdef GL_EXT_texture_edge_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) +#ifdef GL_NV_occlusion_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) { - ret = GLEW_EXT_texture_edge_clamp; + ret = GLEW_NV_occlusion_query; continue; } #endif -#ifdef GL_EXT_texture_env - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11)) +#ifdef GL_NV_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) { - ret = GLEW_EXT_texture_env; + ret = GLEW_NV_packed_depth_stencil; continue; } #endif -#ifdef GL_EXT_texture_env_add - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) +#ifdef GL_NV_parameter_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object", 23)) { - ret = GLEW_EXT_texture_env_add; + ret = GLEW_NV_parameter_buffer_object; continue; } #endif -#ifdef GL_EXT_texture_env_combine - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) +#ifdef GL_NV_parameter_buffer_object2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object2", 24)) { - ret = GLEW_EXT_texture_env_combine; + ret = GLEW_NV_parameter_buffer_object2; continue; } #endif -#ifdef GL_EXT_texture_env_dot3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) +#ifdef GL_NV_path_rendering + if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering", 14)) { - ret = GLEW_EXT_texture_env_dot3; + ret = GLEW_NV_path_rendering; continue; } #endif -#ifdef GL_EXT_texture_filter_anisotropic - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26)) +#ifdef GL_NV_path_rendering_shared_edge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering_shared_edge", 26)) { - ret = GLEW_EXT_texture_filter_anisotropic; + ret = GLEW_NV_path_rendering_shared_edge; continue; } #endif -#ifdef GL_EXT_texture_filter_minmax - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_minmax", 21)) +#ifdef GL_NV_pixel_data_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16)) { - ret = GLEW_EXT_texture_filter_minmax; + ret = GLEW_NV_pixel_data_range; continue; } #endif -#ifdef GL_EXT_texture_integer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_integer", 15)) +#ifdef GL_NV_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) { - ret = GLEW_EXT_texture_integer; + ret = GLEW_NV_point_sprite; continue; } #endif -#ifdef GL_EXT_texture_lod_bias - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) +#ifdef GL_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { - ret = GLEW_EXT_texture_lod_bias; + ret = GLEW_NV_present_video; continue; } #endif -#ifdef GL_EXT_texture_mirror_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20)) +#ifdef GL_NV_primitive_restart + if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17)) { - ret = GLEW_EXT_texture_mirror_clamp; + ret = GLEW_NV_primitive_restart; continue; } #endif -#ifdef GL_EXT_texture_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14)) +#ifdef GL_NV_register_combiners + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18)) { - ret = GLEW_EXT_texture_object; + ret = GLEW_NV_register_combiners; continue; } #endif -#ifdef GL_EXT_texture_perturb_normal - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22)) +#ifdef GL_NV_register_combiners2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19)) { - ret = GLEW_EXT_texture_perturb_normal; + ret = GLEW_NV_register_combiners2; continue; } #endif -#ifdef GL_EXT_texture_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) +#ifdef GL_NV_robustness_video_memory_purge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_video_memory_purge", 29)) { - ret = GLEW_EXT_texture_rectangle; + ret = GLEW_NV_robustness_video_memory_purge; continue; } #endif -#ifdef GL_EXT_texture_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12)) +#ifdef GL_NV_sample_locations + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) { - ret = GLEW_EXT_texture_sRGB; + ret = GLEW_NV_sample_locations; continue; } #endif -#ifdef GL_EXT_texture_sRGB_decode - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB_decode", 19)) +#ifdef GL_NV_sample_mask_override_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_mask_override_coverage", 29)) { - ret = GLEW_EXT_texture_sRGB_decode; + ret = GLEW_NV_sample_mask_override_coverage; continue; } #endif -#ifdef GL_EXT_texture_shared_exponent - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shared_exponent", 23)) +#ifdef GL_NV_shader_atomic_counters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) { - ret = GLEW_EXT_texture_shared_exponent; + ret = GLEW_NV_shader_atomic_counters; continue; } #endif -#ifdef GL_EXT_texture_snorm - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_snorm", 13)) +#ifdef GL_NV_shader_atomic_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float", 19)) { - ret = GLEW_EXT_texture_snorm; + ret = GLEW_NV_shader_atomic_float; continue; } #endif -#ifdef GL_EXT_texture_swizzle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_swizzle", 15)) +#ifdef GL_NV_shader_atomic_float64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float64", 21)) { - ret = GLEW_EXT_texture_swizzle; + ret = GLEW_NV_shader_atomic_float64; continue; } #endif -#ifdef GL_EXT_timer_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"timer_query", 11)) +#ifdef GL_NV_shader_atomic_fp16_vector + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_fp16_vector", 25)) { - ret = GLEW_EXT_timer_query; + ret = GLEW_NV_shader_atomic_fp16_vector; continue; } #endif -#ifdef GL_EXT_transform_feedback - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) +#ifdef GL_NV_shader_atomic_int64 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_int64", 19)) { - ret = GLEW_EXT_transform_feedback; + ret = GLEW_NV_shader_atomic_int64; continue; } #endif -#ifdef GL_EXT_vertex_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12)) +#ifdef GL_NV_shader_buffer_load + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_buffer_load", 18)) { - ret = GLEW_EXT_vertex_array; + ret = GLEW_NV_shader_buffer_load; continue; } #endif -#ifdef GL_EXT_vertex_array_bgra - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_bgra", 17)) +#ifdef GL_NV_shader_storage_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) { - ret = GLEW_EXT_vertex_array_bgra; + ret = GLEW_NV_shader_storage_buffer_object; continue; } #endif -#ifdef GL_EXT_vertex_attrib_64bit - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_64bit", 19)) +#ifdef GL_NV_shader_thread_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_group", 19)) { - ret = GLEW_EXT_vertex_attrib_64bit; + ret = GLEW_NV_shader_thread_group; continue; } #endif -#ifdef GL_EXT_vertex_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) +#ifdef GL_NV_shader_thread_shuffle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_shuffle", 21)) { - ret = GLEW_EXT_vertex_shader; + ret = GLEW_NV_shader_thread_shuffle; continue; } #endif -#ifdef GL_EXT_vertex_weighting - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16)) +#ifdef GL_NV_stereo_view_rendering + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_view_rendering", 21)) { - ret = GLEW_EXT_vertex_weighting; + ret = GLEW_NV_stereo_view_rendering; continue; } #endif -#ifdef GL_EXT_x11_sync_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15)) +#ifdef GL_NV_tessellation_program5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_program5", 21)) { - ret = GLEW_EXT_x11_sync_object; + ret = GLEW_NV_tessellation_program5; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) - { -#ifdef GL_GREMEDY_frame_terminator - if (_glewStrSame3(&pos, &len, (const GLubyte*)"frame_terminator", 16)) +#ifdef GL_NV_texgen_emboss + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13)) { - ret = GLEW_GREMEDY_frame_terminator; + ret = GLEW_NV_texgen_emboss; continue; } #endif -#ifdef GL_GREMEDY_string_marker - if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13)) +#ifdef GL_NV_texgen_reflection + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17)) { - ret = GLEW_GREMEDY_string_marker; + ret = GLEW_NV_texgen_reflection; 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)) +#ifdef GL_NV_texture_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) { - ret = GLEW_HP_convolution_border_modes; + ret = GLEW_NV_texture_barrier; continue; } #endif -#ifdef GL_HP_image_transform - if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15)) +#ifdef GL_NV_texture_compression_vtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23)) { - ret = GLEW_HP_image_transform; + ret = GLEW_NV_texture_compression_vtc; continue; } #endif -#ifdef GL_HP_occlusion_test - if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14)) +#ifdef GL_NV_texture_env_combine4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20)) { - ret = GLEW_HP_occlusion_test; + ret = GLEW_NV_texture_env_combine4; continue; } #endif -#ifdef GL_HP_texture_lighting - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16)) +#ifdef GL_NV_texture_expand_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21)) { - ret = GLEW_HP_texture_lighting; + ret = GLEW_NV_texture_expand_normal; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4)) - { -#ifdef GL_IBM_cull_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) +#ifdef GL_NV_texture_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) { - ret = GLEW_IBM_cull_vertex; + ret = GLEW_NV_texture_multisample; continue; } #endif -#ifdef GL_IBM_multimode_draw_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21)) +#ifdef GL_NV_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { - ret = GLEW_IBM_multimode_draw_arrays; + ret = GLEW_NV_texture_rectangle; continue; } #endif -#ifdef GL_IBM_rasterpos_clip - if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14)) +#ifdef GL_NV_texture_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14)) { - ret = GLEW_IBM_rasterpos_clip; + ret = GLEW_NV_texture_shader; continue; } #endif -#ifdef GL_IBM_static_data - if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11)) +#ifdef GL_NV_texture_shader2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15)) { - ret = GLEW_IBM_static_data; + ret = GLEW_NV_texture_shader2; continue; } #endif -#ifdef GL_IBM_texture_mirrored_repeat - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) +#ifdef GL_NV_texture_shader3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15)) { - ret = GLEW_IBM_texture_mirrored_repeat; + ret = GLEW_NV_texture_shader3; continue; } #endif -#ifdef GL_IBM_vertex_array_lists - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18)) +#ifdef GL_NV_transform_feedback + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) { - ret = GLEW_IBM_vertex_array_lists; + ret = GLEW_NV_transform_feedback; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5)) - { -#ifdef GL_INGR_color_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11)) +#ifdef GL_NV_transform_feedback2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) { - ret = GLEW_INGR_color_clamp; + ret = GLEW_NV_transform_feedback2; continue; } #endif -#ifdef GL_INGR_interlace_read - if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14)) +#ifdef GL_NV_uniform_buffer_unified_memory + if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_unified_memory", 29)) { - ret = GLEW_INGR_interlace_read; + ret = GLEW_NV_uniform_buffer_unified_memory; 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)) +#ifdef GL_NV_vdpau_interop + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vdpau_interop", 13)) { - ret = GLEW_INTEL_fragment_shader_ordering; + ret = GLEW_NV_vdpau_interop; continue; } #endif -#ifdef GL_INTEL_framebuffer_CMAA - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_CMAA", 16)) +#ifdef GL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { - ret = GLEW_INTEL_framebuffer_CMAA; + ret = GLEW_NV_vertex_array_range; continue; } #endif -#ifdef GL_INTEL_map_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_texture", 11)) +#ifdef GL_NV_vertex_array_range2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19)) { - ret = GLEW_INTEL_map_texture; + ret = GLEW_NV_vertex_array_range2; continue; } #endif -#ifdef GL_INTEL_parallel_arrays - if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15)) +#ifdef GL_NV_vertex_attrib_integer_64bit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_integer_64bit", 27)) { - ret = GLEW_INTEL_parallel_arrays; + ret = GLEW_NV_vertex_attrib_integer_64bit; continue; } #endif -#ifdef GL_INTEL_performance_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"performance_query", 17)) +#ifdef GL_NV_vertex_buffer_unified_memory + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_unified_memory", 28)) { - ret = GLEW_INTEL_performance_query; + ret = GLEW_NV_vertex_buffer_unified_memory; continue; } #endif -#ifdef GL_INTEL_texture_scissor - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15)) +#ifdef GL_NV_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) { - ret = GLEW_INTEL_texture_scissor; + ret = GLEW_NV_vertex_program; 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)) +#ifdef GL_NV_vertex_program1_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17)) { - ret = GLEW_KHR_blend_equation_advanced; + ret = GLEW_NV_vertex_program1_1; continue; } #endif -#ifdef GL_KHR_blend_equation_advanced_coherent - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) +#ifdef GL_NV_vertex_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15)) { - ret = GLEW_KHR_blend_equation_advanced_coherent; + ret = GLEW_NV_vertex_program2; continue; } #endif -#ifdef GL_KHR_context_flush_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) +#ifdef GL_NV_vertex_program2_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22)) { - ret = GLEW_KHR_context_flush_control; + ret = GLEW_NV_vertex_program2_option; continue; } #endif -#ifdef GL_KHR_debug - if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5)) +#ifdef GL_NV_vertex_program3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15)) { - ret = GLEW_KHR_debug; + ret = GLEW_NV_vertex_program3; continue; } #endif -#ifdef GL_KHR_no_error - if (_glewStrSame3(&pos, &len, (const GLubyte*)"no_error", 8)) +#ifdef GL_NV_vertex_program4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program4", 15)) { - ret = GLEW_KHR_no_error; + ret = GLEW_NV_vertex_program4; continue; } #endif -#ifdef GL_KHR_robust_buffer_access_behavior - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robust_buffer_access_behavior", 29)) +#ifdef GL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { - ret = GLEW_KHR_robust_buffer_access_behavior; + ret = GLEW_NV_video_capture; continue; } #endif -#ifdef GL_KHR_robustness - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness", 10)) +#ifdef GL_NV_viewport_array2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array2", 15)) { - ret = GLEW_KHR_robustness; + ret = GLEW_NV_viewport_array2; continue; } #endif -#ifdef GL_KHR_texture_compression_astc_hdr - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_hdr", 28)) +#ifdef GL_NV_viewport_swizzle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_swizzle", 16)) { - ret = GLEW_KHR_texture_compression_astc_hdr; + ret = GLEW_NV_viewport_swizzle; continue; } #endif -#ifdef GL_KHR_texture_compression_astc_ldr - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_astc_ldr", 28)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4)) + { +#ifdef GL_OES_byte_coordinates + if (_glewStrSame3(&pos, &len, (const GLubyte*)"byte_coordinates", 16)) { - ret = GLEW_KHR_texture_compression_astc_ldr; + ret = GLEW_OES_byte_coordinates; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4)) - { -#ifdef GL_KTX_buffer_region - if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) +#ifdef GL_OES_compressed_paletted_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_paletted_texture", 27)) { - ret = GLEW_KTX_buffer_region; + ret = GLEW_OES_compressed_paletted_texture; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6)) - { -#ifdef GL_MESAX_texture_stack - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13)) +#ifdef GL_OES_read_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_format", 11)) { - ret = GLEW_MESAX_texture_stack; + ret = GLEW_OES_read_format; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) - { -#ifdef GL_MESA_pack_invert - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11)) +#ifdef GL_OES_single_precision + if (_glewStrSame3(&pos, &len, (const GLubyte*)"single_precision", 16)) { - ret = GLEW_MESA_pack_invert; + ret = GLEW_OES_single_precision; continue; } #endif -#ifdef GL_MESA_resize_buffers - if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef GL_OML_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) { - ret = GLEW_MESA_resize_buffers; + ret = GLEW_OML_interlace; continue; } #endif -#ifdef GL_MESA_window_pos - if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) +#ifdef GL_OML_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) { - ret = GLEW_MESA_window_pos; + ret = GLEW_OML_resample; continue; } #endif -#ifdef GL_MESA_ycbcr_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13)) +#ifdef GL_OML_subsample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9)) { - ret = GLEW_MESA_ycbcr_texture; + ret = GLEW_OML_subsample; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"NVX_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OVR_", 4)) { -#ifdef GL_NVX_conditional_render - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) +#ifdef GL_OVR_multiview + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview", 9)) { - ret = GLEW_NVX_conditional_render; + ret = GLEW_OVR_multiview; continue; } #endif -#ifdef GL_NVX_gpu_memory_info - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_memory_info", 15)) +#ifdef GL_OVR_multiview2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview2", 10)) { - ret = GLEW_NVX_gpu_memory_info; + ret = GLEW_OVR_multiview2; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4)) { -#ifdef GL_NV_bindless_multi_draw_indirect - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect", 28)) +#ifdef GL_PGI_misc_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10)) { - ret = GLEW_NV_bindless_multi_draw_indirect; + ret = GLEW_PGI_misc_hints; continue; } #endif -#ifdef GL_NV_bindless_multi_draw_indirect_count - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_multi_draw_indirect_count", 34)) +#ifdef GL_PGI_vertex_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12)) { - ret = GLEW_NV_bindless_multi_draw_indirect_count; + ret = GLEW_PGI_vertex_hints; continue; } #endif -#ifdef GL_NV_bindless_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"bindless_texture", 16)) + } + 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_NV_bindless_texture; + ret = GLEW_REGAL_ES1_0_compatibility; continue; } #endif -#ifdef GL_NV_blend_equation_advanced - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced", 23)) +#ifdef GL_REGAL_ES1_1_compatibility + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_1_compatibility", 19)) { - ret = GLEW_NV_blend_equation_advanced; + ret = GLEW_REGAL_ES1_1_compatibility; continue; } #endif -#ifdef GL_NV_blend_equation_advanced_coherent - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_advanced_coherent", 32)) +#ifdef GL_REGAL_enable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"enable", 6)) { - ret = GLEW_NV_blend_equation_advanced_coherent; + ret = GLEW_REGAL_enable; continue; } #endif -#ifdef GL_NV_blend_square - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12)) +#ifdef GL_REGAL_error_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"error_string", 12)) { - ret = GLEW_NV_blend_square; + ret = GLEW_REGAL_error_string; continue; } #endif -#ifdef GL_NV_compute_program5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compute_program5", 16)) +#ifdef GL_REGAL_extension_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extension_query", 15)) { - ret = GLEW_NV_compute_program5; + ret = GLEW_REGAL_extension_query; continue; } #endif -#ifdef GL_NV_conditional_render - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conditional_render", 18)) +#ifdef GL_REGAL_log + if (_glewStrSame3(&pos, &len, (const GLubyte*)"log", 3)) { - ret = GLEW_NV_conditional_render; + ret = GLEW_REGAL_log; continue; } #endif -#ifdef GL_NV_conservative_raster - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster", 19)) +#ifdef GL_REGAL_proc_address + if (_glewStrSame3(&pos, &len, (const GLubyte*)"proc_address", 12)) { - ret = GLEW_NV_conservative_raster; + ret = GLEW_REGAL_proc_address; continue; } #endif -#ifdef GL_NV_conservative_raster_dilate - if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_raster_dilate", 26)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5)) + { +#ifdef GL_REND_screen_coordinates + if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18)) { - ret = GLEW_NV_conservative_raster_dilate; + ret = GLEW_REND_screen_coordinates; continue; } #endif -#ifdef GL_NV_copy_depth_to_color - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3)) + { +#ifdef GL_S3_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4)) { - ret = GLEW_NV_copy_depth_to_color; + ret = GLEW_S3_s3tc; continue; } #endif -#ifdef GL_NV_copy_image - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + { +#ifdef GL_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) { - ret = GLEW_NV_copy_image; + ret = GLEW_SGIS_color_range; continue; } #endif -#ifdef GL_NV_deep_texture3D - if (_glewStrSame3(&pos, &len, (const GLubyte*)"deep_texture3D", 14)) +#ifdef GL_SGIS_detail_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14)) { - ret = GLEW_NV_deep_texture3D; + ret = GLEW_SGIS_detail_texture; continue; } #endif -#ifdef GL_NV_depth_buffer_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_buffer_float", 18)) +#ifdef GL_SGIS_fog_function + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12)) { - ret = GLEW_NV_depth_buffer_float; + ret = GLEW_SGIS_fog_function; continue; } #endif -#ifdef GL_NV_depth_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) +#ifdef GL_SGIS_generate_mipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15)) { - ret = GLEW_NV_depth_clamp; + ret = GLEW_SGIS_generate_mipmap; continue; } #endif -#ifdef GL_NV_depth_range_unclamped - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_range_unclamped", 21)) +#ifdef GL_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_NV_depth_range_unclamped; + ret = GLEW_SGIS_multisample; continue; } #endif -#ifdef GL_NV_draw_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_texture", 12)) +#ifdef GL_SGIS_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) { - ret = GLEW_NV_draw_texture; + ret = GLEW_SGIS_pixel_texture; continue; } #endif -#ifdef GL_NV_evaluators - if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10)) +#ifdef GL_SGIS_point_line_texgen + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_line_texgen", 17)) { - ret = GLEW_NV_evaluators; + ret = GLEW_SGIS_point_line_texgen; continue; } #endif -#ifdef GL_NV_explicit_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"explicit_multisample", 20)) +#ifdef GL_SGIS_sharpen_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15)) { - ret = GLEW_NV_explicit_multisample; + ret = GLEW_SGIS_sharpen_texture; continue; } #endif -#ifdef GL_NV_fence - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) +#ifdef GL_SGIS_texture4D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9)) { - ret = GLEW_NV_fence; + ret = GLEW_SGIS_texture4D; continue; } #endif -#ifdef GL_NV_fill_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fill_rectangle", 14)) +#ifdef GL_SGIS_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) { - ret = GLEW_NV_fill_rectangle; + ret = GLEW_SGIS_texture_border_clamp; continue; } #endif -#ifdef GL_NV_float_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) +#ifdef GL_SGIS_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) { - ret = GLEW_NV_float_buffer; + ret = GLEW_SGIS_texture_edge_clamp; continue; } #endif -#ifdef GL_NV_fog_distance - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12)) +#ifdef GL_SGIS_texture_filter4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15)) { - ret = GLEW_NV_fog_distance; + ret = GLEW_SGIS_texture_filter4; continue; } #endif -#ifdef GL_NV_fragment_coverage_to_color - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_coverage_to_color", 26)) +#ifdef GL_SGIS_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11)) { - ret = GLEW_NV_fragment_coverage_to_color; + ret = GLEW_SGIS_texture_lod; continue; } #endif -#ifdef GL_NV_fragment_program - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) +#ifdef GL_SGIS_texture_select + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14)) { - ret = GLEW_NV_fragment_program; + ret = GLEW_SGIS_texture_select; continue; } #endif -#ifdef GL_NV_fragment_program2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GL_SGIX_async + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5)) { - ret = GLEW_NV_fragment_program2; + ret = GLEW_SGIX_async; continue; } #endif -#ifdef GL_NV_fragment_program4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program4", 17)) +#ifdef GL_SGIX_async_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15)) { - ret = GLEW_NV_fragment_program4; + ret = GLEW_SGIX_async_histogram; continue; } #endif -#ifdef GL_NV_fragment_program_option - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23)) +#ifdef GL_SGIX_async_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11)) { - ret = GLEW_NV_fragment_program_option; + ret = GLEW_SGIX_async_pixel; continue; } #endif -#ifdef GL_NV_fragment_shader_interlock - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader_interlock", 25)) +#ifdef GL_SGIX_blend_alpha_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18)) { - ret = GLEW_NV_fragment_shader_interlock; + ret = GLEW_SGIX_blend_alpha_minmax; continue; } #endif -#ifdef GL_NV_framebuffer_mixed_samples - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_mixed_samples", 25)) +#ifdef GL_SGIX_clipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7)) { - ret = GLEW_NV_framebuffer_mixed_samples; + ret = GLEW_SGIX_clipmap; continue; } #endif -#ifdef GL_NV_framebuffer_multisample_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample_coverage", 32)) +#ifdef GL_SGIX_convolution_accuracy + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_accuracy", 20)) { - ret = GLEW_NV_framebuffer_multisample_coverage; + ret = GLEW_SGIX_convolution_accuracy; continue; } #endif -#ifdef GL_NV_geometry_program4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_program4", 17)) +#ifdef GL_SGIX_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) { - ret = GLEW_NV_geometry_program4; + ret = GLEW_SGIX_depth_texture; continue; } #endif -#ifdef GL_NV_geometry_shader4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader4", 16)) +#ifdef GL_SGIX_flush_raster + if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12)) { - ret = GLEW_NV_geometry_shader4; + ret = GLEW_SGIX_flush_raster; continue; } #endif -#ifdef GL_NV_geometry_shader_passthrough - if (_glewStrSame3(&pos, &len, (const GLubyte*)"geometry_shader_passthrough", 27)) +#ifdef GL_SGIX_fog_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10)) { - ret = GLEW_NV_geometry_shader_passthrough; + ret = GLEW_SGIX_fog_offset; continue; } #endif -#ifdef GL_NV_gpu_program4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program4", 12)) +#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_NV_gpu_program4; + ret = GLEW_SGIX_fragment_specular_lighting; continue; } #endif -#ifdef GL_NV_gpu_program5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5", 12)) +#ifdef GL_SGIX_framezoom + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9)) { - ret = GLEW_NV_gpu_program5; + ret = GLEW_SGIX_framezoom; continue; } #endif -#ifdef GL_NV_gpu_program5_mem_extended - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program5_mem_extended", 25)) +#ifdef GL_SGIX_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) { - ret = GLEW_NV_gpu_program5_mem_extended; + ret = GLEW_SGIX_interlace; continue; } #endif -#ifdef GL_NV_gpu_program_fp64 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_program_fp64", 16)) +#ifdef GL_SGIX_ir_instrument1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14)) { - ret = GLEW_NV_gpu_program_fp64; + ret = GLEW_SGIX_ir_instrument1; continue; } #endif -#ifdef GL_NV_gpu_shader5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_shader5", 11)) +#ifdef GL_SGIX_list_priority + if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13)) { - ret = GLEW_NV_gpu_shader5; + ret = GLEW_SGIX_list_priority; continue; } #endif -#ifdef GL_NV_half_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10)) +#ifdef GL_SGIX_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) { - ret = GLEW_NV_half_float; + ret = GLEW_SGIX_pixel_texture; continue; } #endif -#ifdef GL_NV_internalformat_sample_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"internalformat_sample_query", 27)) +#ifdef GL_SGIX_pixel_texture_bits + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18)) { - ret = GLEW_NV_internalformat_sample_query; + ret = GLEW_SGIX_pixel_texture_bits; continue; } #endif -#ifdef GL_NV_light_max_exponent - if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18)) +#ifdef GL_SGIX_reference_plane + if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15)) { - ret = GLEW_NV_light_max_exponent; + ret = GLEW_SGIX_reference_plane; continue; } #endif -#ifdef GL_NV_multisample_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) +#ifdef GL_SGIX_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) { - ret = GLEW_NV_multisample_coverage; + ret = GLEW_SGIX_resample; continue; } #endif -#ifdef GL_NV_multisample_filter_hint - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23)) +#ifdef GL_SGIX_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) { - ret = GLEW_NV_multisample_filter_hint; + ret = GLEW_SGIX_shadow; continue; } #endif -#ifdef GL_NV_occlusion_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) +#ifdef GL_SGIX_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) { - ret = GLEW_NV_occlusion_query; + ret = GLEW_SGIX_shadow_ambient; continue; } #endif -#ifdef GL_NV_packed_depth_stencil - if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) +#ifdef GL_SGIX_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6)) { - ret = GLEW_NV_packed_depth_stencil; + ret = GLEW_SGIX_sprite; continue; } #endif -#ifdef GL_NV_parameter_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object", 23)) +#ifdef GL_SGIX_tag_sample_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17)) { - ret = GLEW_NV_parameter_buffer_object; + ret = GLEW_SGIX_tag_sample_buffer; continue; } #endif -#ifdef GL_NV_parameter_buffer_object2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"parameter_buffer_object2", 24)) +#ifdef GL_SGIX_texture_add_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15)) { - ret = GLEW_NV_parameter_buffer_object2; + ret = GLEW_SGIX_texture_add_env; continue; } #endif -#ifdef GL_NV_path_rendering - if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering", 14)) +#ifdef GL_SGIX_texture_coordinate_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24)) { - ret = GLEW_NV_path_rendering; + ret = GLEW_SGIX_texture_coordinate_clamp; continue; } #endif -#ifdef GL_NV_path_rendering_shared_edge - if (_glewStrSame3(&pos, &len, (const GLubyte*)"path_rendering_shared_edge", 26)) +#ifdef GL_SGIX_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) { - ret = GLEW_NV_path_rendering_shared_edge; + ret = GLEW_SGIX_texture_lod_bias; continue; } #endif -#ifdef GL_NV_pixel_data_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16)) +#ifdef GL_SGIX_texture_multi_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20)) { - ret = GLEW_NV_pixel_data_range; + ret = GLEW_SGIX_texture_multi_buffer; continue; } #endif -#ifdef GL_NV_point_sprite - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) +#ifdef GL_SGIX_texture_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) { - ret = GLEW_NV_point_sprite; + ret = GLEW_SGIX_texture_range; continue; } #endif -#ifdef GL_NV_present_video - if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) +#ifdef GL_SGIX_texture_scale_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18)) { - ret = GLEW_NV_present_video; + ret = GLEW_SGIX_texture_scale_bias; continue; } #endif -#ifdef GL_NV_primitive_restart - if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17)) +#ifdef GL_SGIX_vertex_preclip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14)) { - ret = GLEW_NV_primitive_restart; + ret = GLEW_SGIX_vertex_preclip; continue; } #endif -#ifdef GL_NV_register_combiners - if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18)) +#ifdef GL_SGIX_vertex_preclip_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19)) { - ret = GLEW_NV_register_combiners; + ret = GLEW_SGIX_vertex_preclip_hint; continue; } #endif -#ifdef GL_NV_register_combiners2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19)) +#ifdef GL_SGIX_ycrcb + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5)) { - ret = GLEW_NV_register_combiners2; + ret = GLEW_SGIX_ycrcb; continue; } #endif -#ifdef GL_NV_sample_locations - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_locations", 16)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GL_SGI_color_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12)) { - ret = GLEW_NV_sample_locations; + ret = GLEW_SGI_color_matrix; continue; } #endif -#ifdef GL_NV_sample_mask_override_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_mask_override_coverage", 29)) +#ifdef GL_SGI_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11)) { - ret = GLEW_NV_sample_mask_override_coverage; + ret = GLEW_SGI_color_table; continue; } #endif -#ifdef GL_NV_shader_atomic_counters - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_counters", 22)) +#ifdef GL_SGI_texture_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19)) { - ret = GLEW_NV_shader_atomic_counters; + ret = GLEW_SGI_texture_color_table; continue; } #endif -#ifdef GL_NV_shader_atomic_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_float", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5)) + { +#ifdef GL_SUNX_constant_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13)) { - ret = GLEW_NV_shader_atomic_float; + ret = GLEW_SUNX_constant_data; continue; } #endif -#ifdef GL_NV_shader_atomic_fp16_vector - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_fp16_vector", 25)) + } + 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_NV_shader_atomic_fp16_vector; + ret = GLEW_SUN_convolution_border_modes; continue; } #endif -#ifdef GL_NV_shader_atomic_int64 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_atomic_int64", 19)) +#ifdef GL_SUN_global_alpha + if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12)) { - ret = GLEW_NV_shader_atomic_int64; + ret = GLEW_SUN_global_alpha; continue; } #endif -#ifdef GL_NV_shader_buffer_load - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_buffer_load", 18)) +#ifdef GL_SUN_mesh_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10)) { - ret = GLEW_NV_shader_buffer_load; + ret = GLEW_SUN_mesh_array; continue; } #endif -#ifdef GL_NV_shader_storage_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_storage_buffer_object", 28)) +#ifdef GL_SUN_read_video_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17)) { - ret = GLEW_NV_shader_storage_buffer_object; + ret = GLEW_SUN_read_video_pixels; continue; } #endif -#ifdef GL_NV_shader_thread_group - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_group", 19)) +#ifdef GL_SUN_slice_accum + if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11)) { - ret = GLEW_NV_shader_thread_group; + ret = GLEW_SUN_slice_accum; continue; } #endif -#ifdef GL_NV_shader_thread_shuffle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_thread_shuffle", 21)) +#ifdef GL_SUN_triangle_list + if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13)) { - ret = GLEW_NV_shader_thread_shuffle; + ret = GLEW_SUN_triangle_list; continue; } #endif -#ifdef GL_NV_tessellation_program5 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"tessellation_program5", 21)) +#ifdef GL_SUN_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6)) { - ret = GLEW_NV_tessellation_program5; + ret = GLEW_SUN_vertex; continue; } #endif -#ifdef GL_NV_texgen_emboss - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4)) + { +#ifdef GL_WIN_phong_shading + if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13)) { - ret = GLEW_NV_texgen_emboss; + ret = GLEW_WIN_phong_shading; continue; } #endif -#ifdef GL_NV_texgen_reflection - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17)) +#ifdef GL_WIN_specular_fog + if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12)) { - ret = GLEW_NV_texgen_reflection; + ret = GLEW_WIN_specular_fog; continue; } #endif -#ifdef GL_NV_texture_barrier - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_barrier", 15)) +#ifdef GL_WIN_swap_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9)) { - ret = GLEW_NV_texture_barrier; + ret = GLEW_WIN_swap_hint; continue; } #endif -#ifdef GL_NV_texture_compression_vtc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23)) + } + } + ret = (len == 0); + } + return ret; +} + +#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA) + +GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) +{ + const GLubyte* pos = (const 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 = GLEW_NV_texture_compression_vtc; + ret = WGLEW_3DFX_multisample; continue; } #endif -#ifdef GL_NV_texture_env_combine4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4)) + { +#ifdef WGL_3DL_stereo_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14)) { - ret = GLEW_NV_texture_env_combine4; + ret = WGLEW_3DL_stereo_control; continue; } #endif -#ifdef GL_NV_texture_expand_normal - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) + { +#ifdef WGL_AMD_gpu_association + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) { - ret = GLEW_NV_texture_expand_normal; + ret = WGLEW_AMD_gpu_association; continue; } #endif -#ifdef GL_NV_texture_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef WGL_ARB_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) { - ret = GLEW_NV_texture_multisample; + ret = WGLEW_ARB_buffer_region; continue; } #endif -#ifdef GL_NV_texture_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) +#ifdef WGL_ARB_context_flush_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) { - ret = GLEW_NV_texture_rectangle; + ret = WGLEW_ARB_context_flush_control; continue; } #endif -#ifdef GL_NV_texture_shader - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14)) +#ifdef WGL_ARB_create_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) { - ret = GLEW_NV_texture_shader; + ret = WGLEW_ARB_create_context; continue; } #endif -#ifdef GL_NV_texture_shader2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15)) +#ifdef WGL_ARB_create_context_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) { - ret = GLEW_NV_texture_shader2; + ret = WGLEW_ARB_create_context_profile; continue; } #endif -#ifdef GL_NV_texture_shader3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15)) +#ifdef WGL_ARB_create_context_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) { - ret = GLEW_NV_texture_shader3; + ret = WGLEW_ARB_create_context_robustness; continue; } #endif -#ifdef GL_NV_transform_feedback - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback", 18)) +#ifdef WGL_ARB_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) { - ret = GLEW_NV_transform_feedback; + ret = WGLEW_ARB_extensions_string; continue; } #endif -#ifdef GL_NV_transform_feedback2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_feedback2", 19)) +#ifdef WGL_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_NV_transform_feedback2; + ret = WGLEW_ARB_framebuffer_sRGB; continue; } #endif -#ifdef GL_NV_uniform_buffer_unified_memory - if (_glewStrSame3(&pos, &len, (const GLubyte*)"uniform_buffer_unified_memory", 29)) +#ifdef WGL_ARB_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { - ret = GLEW_NV_uniform_buffer_unified_memory; + ret = WGLEW_ARB_make_current_read; continue; } #endif -#ifdef GL_NV_vdpau_interop - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vdpau_interop", 13)) +#ifdef WGL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_NV_vdpau_interop; + ret = WGLEW_ARB_multisample; continue; } #endif -#ifdef GL_NV_vertex_array_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) +#ifdef WGL_ARB_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { - ret = GLEW_NV_vertex_array_range; + ret = WGLEW_ARB_pbuffer; continue; } #endif -#ifdef GL_NV_vertex_array_range2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19)) +#ifdef WGL_ARB_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) { - ret = GLEW_NV_vertex_array_range2; + ret = WGLEW_ARB_pixel_format; continue; } #endif -#ifdef GL_NV_vertex_attrib_integer_64bit - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_integer_64bit", 27)) +#ifdef WGL_ARB_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) { - ret = GLEW_NV_vertex_attrib_integer_64bit; + ret = WGLEW_ARB_pixel_format_float; continue; } #endif -#ifdef GL_NV_vertex_buffer_unified_memory - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_unified_memory", 28)) +#ifdef WGL_ARB_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) { - ret = GLEW_NV_vertex_buffer_unified_memory; + ret = WGLEW_ARB_render_texture; continue; } #endif -#ifdef GL_NV_vertex_program - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) +#ifdef WGL_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) { - ret = GLEW_NV_vertex_program; + ret = WGLEW_ARB_robustness_application_isolation; continue; } #endif -#ifdef GL_NV_vertex_program1_1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17)) +#ifdef WGL_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) { - ret = GLEW_NV_vertex_program1_1; + ret = WGLEW_ARB_robustness_share_group_isolation; continue; } #endif -#ifdef GL_NV_vertex_program2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15)) + } + 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 = GLEW_NV_vertex_program2; + ret = WGLEW_ATI_pixel_format_float; continue; } #endif -#ifdef GL_NV_vertex_program2_option - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22)) +#ifdef WGL_ATI_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) { - ret = GLEW_NV_vertex_program2_option; + ret = WGLEW_ATI_render_texture_rectangle; continue; } #endif -#ifdef GL_NV_vertex_program3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15)) + } + 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 = GLEW_NV_vertex_program3; + ret = WGLEW_EXT_create_context_es2_profile; continue; } #endif -#ifdef GL_NV_vertex_program4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program4", 15)) +#ifdef WGL_EXT_create_context_es_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) { - ret = GLEW_NV_vertex_program4; + ret = WGLEW_EXT_create_context_es_profile; continue; } #endif -#ifdef GL_NV_video_capture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) +#ifdef WGL_EXT_depth_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11)) { - ret = GLEW_NV_video_capture; + ret = WGLEW_EXT_depth_float; continue; } #endif -#ifdef GL_NV_viewport_array2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"viewport_array2", 15)) +#ifdef WGL_EXT_display_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19)) { - ret = GLEW_NV_viewport_array2; + ret = WGLEW_EXT_display_color_table; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4)) - { -#ifdef GL_OES_byte_coordinates - if (_glewStrSame3(&pos, &len, (const GLubyte*)"byte_coordinates", 16)) +#ifdef WGL_EXT_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) { - ret = GLEW_OES_byte_coordinates; + ret = WGLEW_EXT_extensions_string; continue; } #endif -#ifdef GL_OES_compressed_paletted_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"compressed_paletted_texture", 27)) +#ifdef WGL_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_OES_compressed_paletted_texture; + ret = WGLEW_EXT_framebuffer_sRGB; continue; } #endif -#ifdef GL_OES_read_format - if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_format", 11)) +#ifdef WGL_EXT_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { - ret = GLEW_OES_read_format; + ret = WGLEW_EXT_make_current_read; continue; } #endif -#ifdef GL_OES_single_precision - if (_glewStrSame3(&pos, &len, (const GLubyte*)"single_precision", 16)) +#ifdef WGL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_OES_single_precision; + ret = WGLEW_EXT_multisample; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) - { -#ifdef GL_OML_interlace - if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) +#ifdef WGL_EXT_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { - ret = GLEW_OML_interlace; + ret = WGLEW_EXT_pbuffer; continue; } #endif -#ifdef GL_OML_resample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) +#ifdef WGL_EXT_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) { - ret = GLEW_OML_resample; + ret = WGLEW_EXT_pixel_format; continue; } #endif -#ifdef GL_OML_subsample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9)) +#ifdef WGL_EXT_pixel_format_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_packed_float", 25)) { - ret = GLEW_OML_subsample; + ret = WGLEW_EXT_pixel_format_packed_float; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"OVR_", 4)) - { -#ifdef GL_OVR_multiview - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview", 9)) +#ifdef WGL_EXT_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { - ret = GLEW_OVR_multiview; + ret = WGLEW_EXT_swap_control; continue; } #endif -#ifdef GL_OVR_multiview2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview2", 10)) +#ifdef WGL_EXT_swap_control_tear + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) { - ret = GLEW_OVR_multiview2; + ret = WGLEW_EXT_swap_control_tear; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4)) { -#ifdef GL_PGI_misc_hints - if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10)) +#ifdef WGL_I3D_digital_video_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21)) { - ret = GLEW_PGI_misc_hints; + ret = WGLEW_I3D_digital_video_control; continue; } #endif -#ifdef GL_PGI_vertex_hints - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12)) +#ifdef WGL_I3D_gamma + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5)) { - ret = GLEW_PGI_vertex_hints; + ret = WGLEW_I3D_gamma; 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)) +#ifdef WGL_I3D_genlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7)) { - ret = GLEW_REGAL_ES1_0_compatibility; + ret = WGLEW_I3D_genlock; continue; } #endif -#ifdef GL_REGAL_ES1_1_compatibility - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ES1_1_compatibility", 19)) +#ifdef WGL_I3D_image_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12)) { - ret = GLEW_REGAL_ES1_1_compatibility; + ret = WGLEW_I3D_image_buffer; continue; } #endif -#ifdef GL_REGAL_enable - if (_glewStrSame3(&pos, &len, (const GLubyte*)"enable", 6)) +#ifdef WGL_I3D_swap_frame_lock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15)) { - ret = GLEW_REGAL_enable; + ret = WGLEW_I3D_swap_frame_lock; continue; } #endif -#ifdef GL_REGAL_error_string - if (_glewStrSame3(&pos, &len, (const GLubyte*)"error_string", 12)) +#ifdef WGL_I3D_swap_frame_usage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16)) { - ret = GLEW_REGAL_error_string; + ret = WGLEW_I3D_swap_frame_usage; continue; } #endif -#ifdef GL_REGAL_extension_query - if (_glewStrSame3(&pos, &len, (const GLubyte*)"extension_query", 15)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef WGL_NV_DX_interop + if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10)) { - ret = GLEW_REGAL_extension_query; + ret = WGLEW_NV_DX_interop; continue; } #endif -#ifdef GL_REGAL_log - if (_glewStrSame3(&pos, &len, (const GLubyte*)"log", 3)) +#ifdef WGL_NV_DX_interop2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop2", 11)) { - ret = GLEW_REGAL_log; + ret = WGLEW_NV_DX_interop2; continue; } #endif -#ifdef GL_REGAL_proc_address - if (_glewStrSame3(&pos, &len, (const GLubyte*)"proc_address", 12)) +#ifdef WGL_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { - ret = GLEW_REGAL_proc_address; + ret = WGLEW_NV_copy_image; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5)) - { -#ifdef GL_REND_screen_coordinates - if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18)) +#ifdef WGL_NV_delay_before_swap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) { - ret = GLEW_REND_screen_coordinates; + ret = WGLEW_NV_delay_before_swap; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3)) - { -#ifdef GL_S3_s3tc - if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4)) +#ifdef WGL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { - ret = GLEW_S3_s3tc; + ret = WGLEW_NV_float_buffer; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) - { -#ifdef GL_SGIS_color_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) +#ifdef WGL_NV_gpu_affinity + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_affinity", 12)) { - ret = GLEW_SGIS_color_range; + ret = WGLEW_NV_gpu_affinity; continue; } #endif -#ifdef GL_SGIS_detail_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14)) +#ifdef WGL_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { - ret = GLEW_SGIS_detail_texture; + ret = WGLEW_NV_multisample_coverage; continue; } #endif -#ifdef GL_SGIS_fog_function - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12)) +#ifdef WGL_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { - ret = GLEW_SGIS_fog_function; + ret = WGLEW_NV_present_video; continue; } #endif -#ifdef GL_SGIS_generate_mipmap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15)) +#ifdef WGL_NV_render_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20)) { - ret = GLEW_SGIS_generate_mipmap; + ret = WGLEW_NV_render_depth_texture; continue; } #endif -#ifdef GL_SGIS_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef WGL_NV_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) { - ret = GLEW_SGIS_multisample; + ret = WGLEW_NV_render_texture_rectangle; continue; } #endif -#ifdef GL_SGIS_pixel_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) +#ifdef WGL_NV_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { - ret = GLEW_SGIS_pixel_texture; + ret = WGLEW_NV_swap_group; continue; } #endif -#ifdef GL_SGIS_point_line_texgen - if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_line_texgen", 17)) +#ifdef WGL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { - ret = GLEW_SGIS_point_line_texgen; + ret = WGLEW_NV_vertex_array_range; continue; } #endif -#ifdef GL_SGIS_sharpen_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15)) +#ifdef WGL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { - ret = GLEW_SGIS_sharpen_texture; + ret = WGLEW_NV_video_capture; continue; } #endif -#ifdef GL_SGIS_texture4D - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9)) +#ifdef WGL_NV_video_output + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) { - ret = GLEW_SGIS_texture4D; + ret = WGLEW_NV_video_output; continue; } #endif -#ifdef GL_SGIS_texture_border_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef WGL_OML_sync_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) { - ret = GLEW_SGIS_texture_border_clamp; + ret = WGLEW_OML_sync_control; continue; } #endif -#ifdef GL_SGIS_texture_edge_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) + } + } + ret = (len == 0); + } + return ret; +} + +#elif !defined(GLEW_OSMESA) && !defined(GLEW_EGL) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) + +GLboolean glxewIsSupported (const char* name) +{ + const GLubyte* pos = (const 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 = GLEW_SGIS_texture_edge_clamp; + ret = GLXEW_VERSION_1_2; continue; } #endif -#ifdef GL_SGIS_texture_filter4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15)) +#ifdef GLX_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) { - ret = GLEW_SGIS_texture_filter4; + ret = GLXEW_VERSION_1_3; continue; } #endif -#ifdef GL_SGIS_texture_lod - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11)) +#ifdef GLX_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) { - ret = GLEW_SGIS_texture_lod; + ret = GLXEW_VERSION_1_4; continue; } #endif -#ifdef GL_SGIS_texture_select - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef GLX_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_SGIS_texture_select; + ret = GLXEW_3DFX_multisample; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) { -#ifdef GL_SGIX_async - if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5)) +#ifdef GLX_AMD_gpu_association + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) { - ret = GLEW_SGIX_async; + ret = GLXEW_AMD_gpu_association; continue; } #endif -#ifdef GL_SGIX_async_histogram - if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15)) + } + 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 = GLEW_SGIX_async_histogram; + ret = GLXEW_ARB_context_flush_control; continue; } #endif -#ifdef GL_SGIX_async_pixel - if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11)) +#ifdef GLX_ARB_create_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) { - ret = GLEW_SGIX_async_pixel; + ret = GLXEW_ARB_create_context; continue; } #endif -#ifdef GL_SGIX_blend_alpha_minmax - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18)) +#ifdef GLX_ARB_create_context_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) { - ret = GLEW_SGIX_blend_alpha_minmax; + ret = GLXEW_ARB_create_context_profile; continue; } #endif -#ifdef GL_SGIX_clipmap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7)) +#ifdef GLX_ARB_create_context_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) { - ret = GLEW_SGIX_clipmap; + ret = GLXEW_ARB_create_context_robustness; continue; } #endif -#ifdef GL_SGIX_convolution_accuracy - if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_accuracy", 20)) +#ifdef GLX_ARB_fbconfig_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14)) { - ret = GLEW_SGIX_convolution_accuracy; + ret = GLXEW_ARB_fbconfig_float; continue; } #endif -#ifdef GL_SGIX_depth_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) +#ifdef GLX_ARB_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_SGIX_depth_texture; + ret = GLXEW_ARB_framebuffer_sRGB; continue; } #endif -#ifdef GL_SGIX_flush_raster - if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12)) +#ifdef GLX_ARB_get_proc_address + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16)) { - ret = GLEW_SGIX_flush_raster; + ret = GLXEW_ARB_get_proc_address; continue; } #endif -#ifdef GL_SGIX_fog_offset - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10)) +#ifdef GLX_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = GLEW_SGIX_fog_offset; + ret = GLXEW_ARB_multisample; continue; } #endif -#ifdef GL_SGIX_fog_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_texture", 11)) +#ifdef GLX_ARB_robustness_application_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) { - ret = GLEW_SGIX_fog_texture; + ret = GLXEW_ARB_robustness_application_isolation; continue; } #endif -#ifdef GL_SGIX_fragment_specular_lighting - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_specular_lighting", 26)) +#ifdef GLX_ARB_robustness_share_group_isolation + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) { - ret = GLEW_SGIX_fragment_specular_lighting; + ret = GLXEW_ARB_robustness_share_group_isolation; continue; } #endif -#ifdef GL_SGIX_framezoom - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9)) +#ifdef GLX_ARB_vertex_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) { - ret = GLEW_SGIX_framezoom; + ret = GLXEW_ARB_vertex_buffer_object; continue; } #endif -#ifdef GL_SGIX_interlace - if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) + } + 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 = GLEW_SGIX_interlace; + ret = GLXEW_ATI_pixel_format_float; continue; } #endif -#ifdef GL_SGIX_ir_instrument1 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14)) +#ifdef GLX_ATI_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) { - ret = GLEW_SGIX_ir_instrument1; + ret = GLXEW_ATI_render_texture; continue; } #endif -#ifdef GL_SGIX_list_priority - if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GLX_EXT_buffer_age + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_age", 10)) { - ret = GLEW_SGIX_list_priority; + ret = GLXEW_EXT_buffer_age; continue; } #endif -#ifdef GL_SGIX_pixel_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) +#ifdef GLX_EXT_create_context_es2_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) { - ret = GLEW_SGIX_pixel_texture; + ret = GLXEW_EXT_create_context_es2_profile; continue; } #endif -#ifdef GL_SGIX_pixel_texture_bits - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18)) +#ifdef GLX_EXT_create_context_es_profile + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) { - ret = GLEW_SGIX_pixel_texture_bits; + ret = GLXEW_EXT_create_context_es_profile; continue; } #endif -#ifdef GL_SGIX_reference_plane - if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15)) +#ifdef GLX_EXT_fbconfig_packed_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_packed_float", 21)) { - ret = GLEW_SGIX_reference_plane; + ret = GLXEW_EXT_fbconfig_packed_float; continue; } #endif -#ifdef GL_SGIX_resample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) +#ifdef GLX_EXT_framebuffer_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) { - ret = GLEW_SGIX_resample; + ret = GLXEW_EXT_framebuffer_sRGB; continue; } #endif -#ifdef GL_SGIX_shadow - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) +#ifdef GLX_EXT_import_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14)) { - ret = GLEW_SGIX_shadow; + ret = GLXEW_EXT_import_context; continue; } #endif -#ifdef GL_SGIX_shadow_ambient - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) +#ifdef GLX_EXT_libglvnd + if (_glewStrSame3(&pos, &len, (const GLubyte*)"libglvnd", 8)) { - ret = GLEW_SGIX_shadow_ambient; + ret = GLXEW_EXT_libglvnd; continue; } #endif -#ifdef GL_SGIX_sprite - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6)) +#ifdef GLX_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) { - ret = GLEW_SGIX_sprite; + ret = GLXEW_EXT_scene_marker; continue; } #endif -#ifdef GL_SGIX_tag_sample_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17)) +#ifdef GLX_EXT_stereo_tree + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_tree", 11)) { - ret = GLEW_SGIX_tag_sample_buffer; + ret = GLXEW_EXT_stereo_tree; continue; } #endif -#ifdef GL_SGIX_texture_add_env - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15)) +#ifdef GLX_EXT_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { - ret = GLEW_SGIX_texture_add_env; + ret = GLXEW_EXT_swap_control; continue; } #endif -#ifdef GL_SGIX_texture_coordinate_clamp - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24)) +#ifdef GLX_EXT_swap_control_tear + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) { - ret = GLEW_SGIX_texture_coordinate_clamp; + ret = GLXEW_EXT_swap_control_tear; continue; } #endif -#ifdef GL_SGIX_texture_lod_bias - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) +#ifdef GLX_EXT_texture_from_pixmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19)) { - ret = GLEW_SGIX_texture_lod_bias; + ret = GLXEW_EXT_texture_from_pixmap; continue; } #endif -#ifdef GL_SGIX_texture_multi_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20)) +#ifdef GLX_EXT_visual_info + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11)) { - ret = GLEW_SGIX_texture_multi_buffer; + ret = GLXEW_EXT_visual_info; continue; } #endif -#ifdef GL_SGIX_texture_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) +#ifdef GLX_EXT_visual_rating + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13)) { - ret = GLEW_SGIX_texture_range; + ret = GLXEW_EXT_visual_rating; continue; } #endif -#ifdef GL_SGIX_texture_scale_bias - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) + { +#ifdef GLX_INTEL_swap_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_event", 10)) { - ret = GLEW_SGIX_texture_scale_bias; + ret = GLXEW_INTEL_swap_event; continue; } #endif -#ifdef GL_SGIX_vertex_preclip - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GLX_MESA_agp_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10)) { - ret = GLEW_SGIX_vertex_preclip; + ret = GLXEW_MESA_agp_offset; continue; } #endif -#ifdef GL_SGIX_vertex_preclip_hint - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19)) +#ifdef GLX_MESA_copy_sub_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15)) { - ret = GLEW_SGIX_vertex_preclip_hint; + ret = GLXEW_MESA_copy_sub_buffer; continue; } #endif -#ifdef GL_SGIX_ycrcb - if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5)) +#ifdef GLX_MESA_pixmap_colormap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15)) { - ret = GLEW_SGIX_ycrcb; + ret = GLXEW_MESA_pixmap_colormap; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) - { -#ifdef GL_SGI_color_matrix - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12)) +#ifdef GLX_MESA_query_renderer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_renderer", 14)) { - ret = GLEW_SGI_color_matrix; + ret = GLXEW_MESA_query_renderer; continue; } #endif -#ifdef GL_SGI_color_table - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11)) +#ifdef GLX_MESA_release_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15)) { - ret = GLEW_SGI_color_table; + ret = GLXEW_MESA_release_buffers; continue; } #endif -#ifdef GL_SGI_texture_color_table - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19)) +#ifdef GLX_MESA_set_3dfx_mode + if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13)) { - ret = GLEW_SGI_texture_color_table; + ret = GLXEW_MESA_set_3dfx_mode; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5)) - { -#ifdef GL_SUNX_constant_data - if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13)) +#ifdef GLX_MESA_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { - ret = GLEW_SUNX_constant_data; + ret = GLXEW_MESA_swap_control; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { -#ifdef GL_SUN_convolution_border_modes - if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) +#ifdef GLX_NV_copy_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) { - ret = GLEW_SUN_convolution_border_modes; + ret = GLXEW_NV_copy_buffer; continue; } #endif -#ifdef GL_SUN_global_alpha - if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12)) +#ifdef GLX_NV_copy_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { - ret = GLEW_SUN_global_alpha; + ret = GLXEW_NV_copy_image; continue; } #endif -#ifdef GL_SUN_mesh_array - if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10)) +#ifdef GLX_NV_delay_before_swap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) { - ret = GLEW_SUN_mesh_array; + ret = GLXEW_NV_delay_before_swap; continue; } #endif -#ifdef GL_SUN_read_video_pixels - if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17)) +#ifdef GLX_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) { - ret = GLEW_SUN_read_video_pixels; + ret = GLXEW_NV_float_buffer; continue; } #endif -#ifdef GL_SUN_slice_accum - if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11)) +#ifdef GLX_NV_multisample_coverage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) { - ret = GLEW_SUN_slice_accum; + ret = GLXEW_NV_multisample_coverage; continue; } #endif -#ifdef GL_SUN_triangle_list - if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13)) +#ifdef GLX_NV_present_video + if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) { - ret = GLEW_SUN_triangle_list; + ret = GLXEW_NV_present_video; continue; } #endif -#ifdef GL_SUN_vertex - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6)) +#ifdef GLX_NV_robustness_video_memory_purge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_video_memory_purge", 29)) { - ret = GLEW_SUN_vertex; + ret = GLXEW_NV_robustness_video_memory_purge; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4)) - { -#ifdef GL_WIN_phong_shading - if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13)) +#ifdef GLX_NV_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { - ret = GLEW_WIN_phong_shading; + ret = GLXEW_NV_swap_group; continue; } #endif -#ifdef GL_WIN_specular_fog - if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12)) +#ifdef GLX_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) { - ret = GLEW_WIN_specular_fog; + ret = GLXEW_NV_vertex_array_range; continue; } #endif -#ifdef GL_WIN_swap_hint - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9)) +#ifdef GLX_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) { - ret = GLEW_WIN_swap_hint; + ret = GLXEW_NV_video_capture; 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 -{ - const GLubyte* pos = (const 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)) +#ifdef GLX_NV_video_out + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_out", 9)) { - ret = WGLEW_3DFX_multisample; + ret = GLXEW_NV_video_out; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) { -#ifdef WGL_3DL_stereo_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14)) +#ifdef GLX_OML_swap_method + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11)) { - ret = WGLEW_3DL_stereo_control; + ret = GLXEW_OML_swap_method; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) - { -#ifdef WGL_AMD_gpu_association - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) +#ifdef GLX_OML_sync_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) { - ret = WGLEW_AMD_gpu_association; + ret = GLXEW_OML_sync_control; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) { -#ifdef WGL_ARB_buffer_region - if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) +#ifdef GLX_SGIS_blended_overlay + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15)) { - ret = WGLEW_ARB_buffer_region; + ret = GLXEW_SGIS_blended_overlay; continue; } #endif -#ifdef WGL_ARB_context_flush_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) +#ifdef GLX_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) { - ret = WGLEW_ARB_context_flush_control; + ret = GLXEW_SGIS_color_range; continue; } #endif -#ifdef WGL_ARB_create_context - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) +#ifdef GLX_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) { - ret = WGLEW_ARB_create_context; + ret = GLXEW_SGIS_multisample; continue; } -#endif -#ifdef WGL_ARB_create_context_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) +#endif +#ifdef GLX_SGIS_shared_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18)) { - ret = WGLEW_ARB_create_context_profile; + ret = GLXEW_SGIS_shared_multisample; continue; } #endif -#ifdef WGL_ARB_create_context_robustness - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GLX_SGIX_fbconfig + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8)) { - ret = WGLEW_ARB_create_context_robustness; + ret = GLXEW_SGIX_fbconfig; continue; } #endif -#ifdef WGL_ARB_extensions_string - if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) +#ifdef GLX_SGIX_hyperpipe + if (_glewStrSame3(&pos, &len, (const GLubyte*)"hyperpipe", 9)) { - ret = WGLEW_ARB_extensions_string; + ret = GLXEW_SGIX_hyperpipe; continue; } #endif -#ifdef WGL_ARB_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#ifdef GLX_SGIX_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) { - ret = WGLEW_ARB_framebuffer_sRGB; + ret = GLXEW_SGIX_pbuffer; continue; } #endif -#ifdef WGL_ARB_make_current_read - if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) +#ifdef GLX_SGIX_swap_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12)) { - ret = WGLEW_ARB_make_current_read; + ret = GLXEW_SGIX_swap_barrier; continue; } #endif -#ifdef WGL_ARB_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef GLX_SGIX_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) { - ret = WGLEW_ARB_multisample; + ret = GLXEW_SGIX_swap_group; continue; } #endif -#ifdef WGL_ARB_pbuffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) +#ifdef GLX_SGIX_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) { - ret = WGLEW_ARB_pbuffer; + ret = GLXEW_SGIX_video_resize; continue; } #endif -#ifdef WGL_ARB_pixel_format - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) +#ifdef GLX_SGIX_visual_select_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19)) { - ret = WGLEW_ARB_pixel_format; + ret = GLXEW_SGIX_visual_select_group; continue; } #endif -#ifdef WGL_ARB_pixel_format_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GLX_SGI_cushion + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7)) { - ret = WGLEW_ARB_pixel_format_float; + ret = GLXEW_SGI_cushion; continue; } #endif -#ifdef WGL_ARB_render_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) +#ifdef GLX_SGI_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) { - ret = WGLEW_ARB_render_texture; + ret = GLXEW_SGI_make_current_read; continue; } #endif -#ifdef WGL_ARB_robustness_application_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) +#ifdef GLX_SGI_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) { - ret = WGLEW_ARB_robustness_application_isolation; + ret = GLXEW_SGI_swap_control; continue; } #endif -#ifdef WGL_ARB_robustness_share_group_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) +#ifdef GLX_SGI_video_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10)) { - ret = WGLEW_ARB_robustness_share_group_isolation; + ret = GLXEW_SGI_video_sync; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) { -#ifdef WGL_ATI_pixel_format_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) +#ifdef GLX_SUN_get_transparent_index + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21)) { - ret = WGLEW_ATI_pixel_format_float; + ret = GLXEW_SUN_get_transparent_index; continue; } #endif -#ifdef WGL_ATI_render_texture_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) +#ifdef GLX_SUN_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) { - ret = WGLEW_ATI_render_texture_rectangle; + ret = GLXEW_SUN_video_resize; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + } + ret = (len == 0); + } + return ret; +} + +#elif defined(GLEW_EGL) + +GLboolean eglewIsSupported (const char* name) +{ + const GLubyte* pos = (const GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if(_glewStrSame1(&pos, &len, (const GLubyte*)"EGL_", 4)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) { -#ifdef WGL_EXT_create_context_es2_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) +#ifdef EGL_VERSION_1_0 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_0", 3)) { - ret = WGLEW_EXT_create_context_es2_profile; + ret = EGLEW_VERSION_1_0; continue; } #endif -#ifdef WGL_EXT_create_context_es_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) +#ifdef EGL_VERSION_1_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_1", 3)) { - ret = WGLEW_EXT_create_context_es_profile; + ret = EGLEW_VERSION_1_1; continue; } #endif -#ifdef WGL_EXT_depth_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11)) +#ifdef EGL_VERSION_1_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) { - ret = WGLEW_EXT_depth_float; + ret = EGLEW_VERSION_1_2; continue; } #endif -#ifdef WGL_EXT_display_color_table - if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19)) +#ifdef EGL_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) { - ret = WGLEW_EXT_display_color_table; + ret = EGLEW_VERSION_1_3; continue; } #endif -#ifdef WGL_EXT_extensions_string - if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) +#ifdef EGL_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) { - ret = WGLEW_EXT_extensions_string; + ret = EGLEW_VERSION_1_4; continue; } #endif -#ifdef WGL_EXT_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#ifdef EGL_VERSION_1_5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3)) { - ret = WGLEW_EXT_framebuffer_sRGB; + ret = EGLEW_VERSION_1_5; continue; } #endif -#ifdef WGL_EXT_make_current_read - if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ANDROID_", 8)) + { +#ifdef EGL_ANDROID_blob_cache + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blob_cache", 10)) { - ret = WGLEW_EXT_make_current_read; + ret = EGLEW_ANDROID_blob_cache; continue; } #endif -#ifdef WGL_EXT_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef EGL_ANDROID_create_native_client_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_native_client_buffer", 27)) { - ret = WGLEW_EXT_multisample; + ret = EGLEW_ANDROID_create_native_client_buffer; continue; } #endif -#ifdef WGL_EXT_pbuffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) +#ifdef EGL_ANDROID_framebuffer_target + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_target", 18)) { - ret = WGLEW_EXT_pbuffer; + ret = EGLEW_ANDROID_framebuffer_target; continue; } #endif -#ifdef WGL_EXT_pixel_format - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) +#ifdef EGL_ANDROID_front_buffer_auto_refresh + if (_glewStrSame3(&pos, &len, (const GLubyte*)"front_buffer_auto_refresh", 25)) { - ret = WGLEW_EXT_pixel_format; + ret = EGLEW_ANDROID_front_buffer_auto_refresh; continue; } #endif -#ifdef WGL_EXT_pixel_format_packed_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_packed_float", 25)) +#ifdef EGL_ANDROID_image_native_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_native_buffer", 19)) { - ret = WGLEW_EXT_pixel_format_packed_float; + ret = EGLEW_ANDROID_image_native_buffer; continue; } #endif -#ifdef WGL_EXT_swap_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) +#ifdef EGL_ANDROID_native_fence_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"native_fence_sync", 17)) { - ret = WGLEW_EXT_swap_control; + ret = EGLEW_ANDROID_native_fence_sync; continue; } #endif -#ifdef WGL_EXT_swap_control_tear - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) +#ifdef EGL_ANDROID_presentation_time + if (_glewStrSame3(&pos, &len, (const GLubyte*)"presentation_time", 17)) { - ret = WGLEW_EXT_swap_control_tear; + ret = EGLEW_ANDROID_presentation_time; + continue; + } +#endif +#ifdef EGL_ANDROID_recordable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"recordable", 10)) + { + ret = EGLEW_ANDROID_recordable; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ANGLE_", 6)) { -#ifdef WGL_I3D_digital_video_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21)) +#ifdef EGL_ANGLE_d3d_share_handle_client_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"d3d_share_handle_client_buffer", 30)) { - ret = WGLEW_I3D_digital_video_control; + ret = EGLEW_ANGLE_d3d_share_handle_client_buffer; continue; } #endif -#ifdef WGL_I3D_gamma - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5)) +#ifdef EGL_ANGLE_device_d3d + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_d3d", 10)) { - ret = WGLEW_I3D_gamma; + ret = EGLEW_ANGLE_device_d3d; continue; } #endif -#ifdef WGL_I3D_genlock - if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7)) +#ifdef EGL_ANGLE_query_surface_pointer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_surface_pointer", 21)) { - ret = WGLEW_I3D_genlock; + ret = EGLEW_ANGLE_query_surface_pointer; continue; } #endif -#ifdef WGL_I3D_image_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12)) +#ifdef EGL_ANGLE_surface_d3d_texture_2d_share_handle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"surface_d3d_texture_2d_share_handle", 35)) { - ret = WGLEW_I3D_image_buffer; + ret = EGLEW_ANGLE_surface_d3d_texture_2d_share_handle; continue; } #endif -#ifdef WGL_I3D_swap_frame_lock - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15)) +#ifdef EGL_ANGLE_window_fixed_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_fixed_size", 17)) { - ret = WGLEW_I3D_swap_frame_lock; + ret = EGLEW_ANGLE_window_fixed_size; continue; } #endif -#ifdef WGL_I3D_swap_frame_usage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARM_", 4)) + { +#ifdef EGL_ARM_pixmap_multisample_discard + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_multisample_discard", 26)) { - ret = WGLEW_I3D_swap_frame_usage; + ret = EGLEW_ARM_pixmap_multisample_discard; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) { -#ifdef WGL_NV_DX_interop - if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10)) +#ifdef EGL_EXT_buffer_age + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_age", 10)) { - ret = WGLEW_NV_DX_interop; + ret = EGLEW_EXT_buffer_age; continue; } #endif -#ifdef WGL_NV_DX_interop2 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop2", 11)) +#ifdef EGL_EXT_client_extensions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_extensions", 17)) { - ret = WGLEW_NV_DX_interop2; + ret = EGLEW_EXT_client_extensions; continue; } #endif -#ifdef WGL_NV_copy_image - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) +#ifdef EGL_EXT_create_context_robustness + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) { - ret = WGLEW_NV_copy_image; + ret = EGLEW_EXT_create_context_robustness; continue; } #endif -#ifdef WGL_NV_delay_before_swap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) +#ifdef EGL_EXT_device_base + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_base", 11)) { - ret = WGLEW_NV_delay_before_swap; + ret = EGLEW_EXT_device_base; continue; } #endif -#ifdef WGL_NV_float_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) +#ifdef EGL_EXT_device_drm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_drm", 10)) { - ret = WGLEW_NV_float_buffer; + ret = EGLEW_EXT_device_drm; continue; } #endif -#ifdef WGL_NV_gpu_affinity - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_affinity", 12)) +#ifdef EGL_EXT_device_enumeration + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_enumeration", 18)) { - ret = WGLEW_NV_gpu_affinity; + ret = EGLEW_EXT_device_enumeration; continue; } #endif -#ifdef WGL_NV_multisample_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) +#ifdef EGL_EXT_device_openwf + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_openwf", 13)) { - ret = WGLEW_NV_multisample_coverage; + ret = EGLEW_EXT_device_openwf; continue; } #endif -#ifdef WGL_NV_present_video - if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) +#ifdef EGL_EXT_device_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_query", 12)) { - ret = WGLEW_NV_present_video; + ret = EGLEW_EXT_device_query; continue; } #endif -#ifdef WGL_NV_render_depth_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20)) +#ifdef EGL_EXT_image_dma_buf_import + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_dma_buf_import", 20)) { - ret = WGLEW_NV_render_depth_texture; + ret = EGLEW_EXT_image_dma_buf_import; continue; } #endif -#ifdef WGL_NV_render_texture_rectangle - if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) +#ifdef EGL_EXT_multiview_window + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multiview_window", 16)) { - ret = WGLEW_NV_render_texture_rectangle; + ret = EGLEW_EXT_multiview_window; continue; } #endif -#ifdef WGL_NV_swap_group - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) +#ifdef EGL_EXT_output_base + if (_glewStrSame3(&pos, &len, (const GLubyte*)"output_base", 11)) { - ret = WGLEW_NV_swap_group; + ret = EGLEW_EXT_output_base; continue; } #endif -#ifdef WGL_NV_vertex_array_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) +#ifdef EGL_EXT_output_drm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"output_drm", 10)) { - ret = WGLEW_NV_vertex_array_range; + ret = EGLEW_EXT_output_drm; continue; } #endif -#ifdef WGL_NV_video_capture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) +#ifdef EGL_EXT_output_openwf + if (_glewStrSame3(&pos, &len, (const GLubyte*)"output_openwf", 13)) { - ret = WGLEW_NV_video_capture; + ret = EGLEW_EXT_output_openwf; continue; } #endif -#ifdef WGL_NV_video_output - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) +#ifdef EGL_EXT_platform_base + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_base", 13)) { - ret = WGLEW_NV_video_output; + ret = EGLEW_EXT_platform_base; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) - { -#ifdef WGL_OML_sync_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) +#ifdef EGL_EXT_platform_device + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_device", 15)) { - ret = WGLEW_OML_sync_control; + ret = EGLEW_EXT_platform_device; 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 -{ - const GLubyte* pos = (const 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)) +#ifdef EGL_EXT_platform_wayland + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_wayland", 16)) + { + ret = EGLEW_EXT_platform_wayland; + continue; + } +#endif +#ifdef EGL_EXT_platform_x11 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_x11", 12)) { - ret = GLXEW_VERSION_1_2; + ret = EGLEW_EXT_platform_x11; continue; } #endif -#ifdef GLX_VERSION_1_3 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) +#ifdef EGL_EXT_protected_content + if (_glewStrSame3(&pos, &len, (const GLubyte*)"protected_content", 17)) { - ret = GLXEW_VERSION_1_3; + ret = EGLEW_EXT_protected_content; continue; } #endif -#ifdef GLX_VERSION_1_4 - if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) +#ifdef EGL_EXT_protected_surface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"protected_surface", 17)) { - ret = GLXEW_VERSION_1_4; + ret = EGLEW_EXT_protected_surface; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) - { -#ifdef GLX_3DFX_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef EGL_EXT_stream_consumer_egloutput + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_consumer_egloutput", 25)) { - ret = GLXEW_3DFX_multisample; + ret = EGLEW_EXT_stream_consumer_egloutput; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) - { -#ifdef GLX_AMD_gpu_association - if (_glewStrSame3(&pos, &len, (const GLubyte*)"gpu_association", 15)) +#ifdef EGL_EXT_swap_buffers_with_damage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_buffers_with_damage", 24)) { - ret = GLXEW_AMD_gpu_association; + ret = EGLEW_EXT_swap_buffers_with_damage; + continue; + } +#endif +#ifdef EGL_EXT_yuv_surface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"yuv_surface", 11)) + { + ret = EGLEW_EXT_yuv_surface; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"HI_", 3)) { -#ifdef GLX_ARB_context_flush_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_flush_control", 21)) +#ifdef EGL_HI_clientpixmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clientpixmap", 12)) { - ret = GLXEW_ARB_context_flush_control; + ret = EGLEW_HI_clientpixmap; continue; } #endif -#ifdef GLX_ARB_create_context - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) +#ifdef EGL_HI_colorformats + if (_glewStrSame3(&pos, &len, (const GLubyte*)"colorformats", 12)) { - ret = GLXEW_ARB_create_context; + ret = EGLEW_HI_colorformats; continue; } #endif -#ifdef GLX_ARB_create_context_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_profile", 22)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"IMG_", 4)) + { +#ifdef EGL_IMG_context_priority + if (_glewStrSame3(&pos, &len, (const GLubyte*)"context_priority", 16)) { - ret = GLXEW_ARB_create_context_profile; + ret = EGLEW_IMG_context_priority; continue; } #endif -#ifdef GLX_ARB_create_context_robustness - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_robustness", 25)) +#ifdef EGL_IMG_image_plane_attribs + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_plane_attribs", 19)) { - ret = GLXEW_ARB_create_context_robustness; + ret = EGLEW_IMG_image_plane_attribs; continue; } #endif -#ifdef GLX_ARB_fbconfig_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"KHR_", 4)) + { +#ifdef EGL_KHR_cl_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event", 8)) { - ret = GLXEW_ARB_fbconfig_float; + ret = EGLEW_KHR_cl_event; continue; } #endif -#ifdef GLX_ARB_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#ifdef EGL_KHR_cl_event2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cl_event2", 9)) { - ret = GLXEW_ARB_framebuffer_sRGB; + ret = EGLEW_KHR_cl_event2; continue; } #endif -#ifdef GLX_ARB_get_proc_address - if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16)) +#ifdef EGL_KHR_client_get_all_proc_addresses + if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_get_all_proc_addresses", 29)) { - ret = GLXEW_ARB_get_proc_address; + ret = EGLEW_KHR_client_get_all_proc_addresses; continue; } #endif -#ifdef GLX_ARB_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef EGL_KHR_config_attribs + if (_glewStrSame3(&pos, &len, (const GLubyte*)"config_attribs", 14)) { - ret = GLXEW_ARB_multisample; + ret = EGLEW_KHR_config_attribs; continue; } #endif -#ifdef GLX_ARB_robustness_application_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_application_isolation", 32)) +#ifdef EGL_KHR_create_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context", 14)) { - ret = GLXEW_ARB_robustness_application_isolation; + ret = EGLEW_KHR_create_context; continue; } #endif -#ifdef GLX_ARB_robustness_share_group_isolation - if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_share_group_isolation", 32)) +#ifdef EGL_KHR_create_context_no_error + if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_no_error", 23)) { - ret = GLXEW_ARB_robustness_share_group_isolation; + ret = EGLEW_KHR_create_context_no_error; continue; } #endif -#ifdef GLX_ARB_vertex_buffer_object - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) +#ifdef EGL_KHR_debug + if (_glewStrSame3(&pos, &len, (const GLubyte*)"debug", 5)) { - ret = GLXEW_ARB_vertex_buffer_object; + ret = EGLEW_KHR_debug; 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)) +#ifdef EGL_KHR_fence_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence_sync", 10)) { - ret = GLXEW_ATI_pixel_format_float; + ret = EGLEW_KHR_fence_sync; continue; } #endif -#ifdef GLX_ATI_render_texture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) +#ifdef EGL_KHR_get_all_proc_addresses + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_all_proc_addresses", 22)) { - ret = GLXEW_ATI_render_texture; + ret = EGLEW_KHR_get_all_proc_addresses; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) - { -#ifdef GLX_EXT_buffer_age - if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_age", 10)) +#ifdef EGL_KHR_gl_colorspace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_colorspace", 13)) { - ret = GLXEW_EXT_buffer_age; + ret = EGLEW_KHR_gl_colorspace; continue; } #endif -#ifdef GLX_EXT_create_context_es2_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es2_profile", 26)) +#ifdef EGL_KHR_gl_renderbuffer_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_renderbuffer_image", 21)) { - ret = GLXEW_EXT_create_context_es2_profile; + ret = EGLEW_KHR_gl_renderbuffer_image; continue; } #endif -#ifdef GLX_EXT_create_context_es_profile - if (_glewStrSame3(&pos, &len, (const GLubyte*)"create_context_es_profile", 25)) +#ifdef EGL_KHR_gl_texture_2D_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_texture_2D_image", 19)) { - ret = GLXEW_EXT_create_context_es_profile; + ret = EGLEW_KHR_gl_texture_2D_image; continue; } #endif -#ifdef GLX_EXT_fbconfig_packed_float - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_packed_float", 21)) +#ifdef EGL_KHR_gl_texture_3D_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_texture_3D_image", 19)) { - ret = GLXEW_EXT_fbconfig_packed_float; + ret = EGLEW_KHR_gl_texture_3D_image; continue; } #endif -#ifdef GLX_EXT_framebuffer_sRGB - if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_sRGB", 16)) +#ifdef EGL_KHR_gl_texture_cubemap_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gl_texture_cubemap_image", 24)) { - ret = GLXEW_EXT_framebuffer_sRGB; + ret = EGLEW_KHR_gl_texture_cubemap_image; continue; } #endif -#ifdef GLX_EXT_import_context - if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14)) +#ifdef EGL_KHR_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image", 5)) { - ret = GLXEW_EXT_import_context; + ret = EGLEW_KHR_image; continue; } #endif -#ifdef GLX_EXT_scene_marker - if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) +#ifdef EGL_KHR_image_base + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_base", 10)) { - ret = GLXEW_EXT_scene_marker; + ret = EGLEW_KHR_image_base; continue; } #endif -#ifdef GLX_EXT_stereo_tree - if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_tree", 11)) +#ifdef EGL_KHR_image_pixmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_pixmap", 12)) { - ret = GLXEW_EXT_stereo_tree; + ret = EGLEW_KHR_image_pixmap; continue; } #endif -#ifdef GLX_EXT_swap_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) +#ifdef EGL_KHR_lock_surface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"lock_surface", 12)) { - ret = GLXEW_EXT_swap_control; + ret = EGLEW_KHR_lock_surface; continue; } #endif -#ifdef GLX_EXT_swap_control_tear - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control_tear", 17)) +#ifdef EGL_KHR_lock_surface2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"lock_surface2", 13)) { - ret = GLXEW_EXT_swap_control_tear; + ret = EGLEW_KHR_lock_surface2; continue; } #endif -#ifdef GLX_EXT_texture_from_pixmap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19)) +#ifdef EGL_KHR_lock_surface3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"lock_surface3", 13)) { - ret = GLXEW_EXT_texture_from_pixmap; + ret = EGLEW_KHR_lock_surface3; continue; } #endif -#ifdef GLX_EXT_visual_info - if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11)) +#ifdef EGL_KHR_mutable_render_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"mutable_render_buffer", 21)) { - ret = GLXEW_EXT_visual_info; + ret = EGLEW_KHR_mutable_render_buffer; continue; } #endif -#ifdef GLX_EXT_visual_rating - if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13)) +#ifdef EGL_KHR_partial_update + if (_glewStrSame3(&pos, &len, (const GLubyte*)"partial_update", 14)) { - ret = GLXEW_EXT_visual_rating; + ret = EGLEW_KHR_partial_update; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) - { -#ifdef GLX_INTEL_swap_event - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_event", 10)) +#ifdef EGL_KHR_platform_android + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_android", 16)) { - ret = GLXEW_INTEL_swap_event; + ret = EGLEW_KHR_platform_android; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) - { -#ifdef GLX_MESA_agp_offset - if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10)) +#ifdef EGL_KHR_platform_gbm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_gbm", 12)) { - ret = GLXEW_MESA_agp_offset; + ret = EGLEW_KHR_platform_gbm; continue; } #endif -#ifdef GLX_MESA_copy_sub_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15)) +#ifdef EGL_KHR_platform_wayland + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_wayland", 16)) { - ret = GLXEW_MESA_copy_sub_buffer; + ret = EGLEW_KHR_platform_wayland; continue; } #endif -#ifdef GLX_MESA_pixmap_colormap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15)) +#ifdef EGL_KHR_platform_x11 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_x11", 12)) { - ret = GLXEW_MESA_pixmap_colormap; + ret = EGLEW_KHR_platform_x11; continue; } #endif -#ifdef GLX_MESA_query_renderer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"query_renderer", 14)) +#ifdef EGL_KHR_reusable_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"reusable_sync", 13)) { - ret = GLXEW_MESA_query_renderer; + ret = EGLEW_KHR_reusable_sync; continue; } #endif -#ifdef GLX_MESA_release_buffers - if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15)) +#ifdef EGL_KHR_stream + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream", 6)) { - ret = GLXEW_MESA_release_buffers; + ret = EGLEW_KHR_stream; continue; } #endif -#ifdef GLX_MESA_set_3dfx_mode - if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13)) +#ifdef EGL_KHR_stream_consumer_gltexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_consumer_gltexture", 25)) { - ret = GLXEW_MESA_set_3dfx_mode; + ret = EGLEW_KHR_stream_consumer_gltexture; continue; } #endif -#ifdef GLX_MESA_swap_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) +#ifdef EGL_KHR_stream_cross_process_fd + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_cross_process_fd", 23)) { - ret = GLXEW_MESA_swap_control; + ret = EGLEW_KHR_stream_cross_process_fd; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) - { -#ifdef GLX_NV_copy_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_buffer", 11)) +#ifdef EGL_KHR_stream_fifo + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_fifo", 11)) { - ret = GLXEW_NV_copy_buffer; + ret = EGLEW_KHR_stream_fifo; continue; } #endif -#ifdef GLX_NV_copy_image - if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) +#ifdef EGL_KHR_stream_producer_aldatalocator + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_producer_aldatalocator", 29)) { - ret = GLXEW_NV_copy_image; + ret = EGLEW_KHR_stream_producer_aldatalocator; continue; } #endif -#ifdef GLX_NV_delay_before_swap - if (_glewStrSame3(&pos, &len, (const GLubyte*)"delay_before_swap", 17)) +#ifdef EGL_KHR_stream_producer_eglsurface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_producer_eglsurface", 26)) { - ret = GLXEW_NV_delay_before_swap; + ret = EGLEW_KHR_stream_producer_eglsurface; continue; } #endif -#ifdef GLX_NV_float_buffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) +#ifdef EGL_KHR_surfaceless_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"surfaceless_context", 19)) { - ret = GLXEW_NV_float_buffer; + ret = EGLEW_KHR_surfaceless_context; continue; } #endif -#ifdef GLX_NV_multisample_coverage - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_coverage", 20)) +#ifdef EGL_KHR_swap_buffers_with_damage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_buffers_with_damage", 24)) { - ret = GLXEW_NV_multisample_coverage; + ret = EGLEW_KHR_swap_buffers_with_damage; continue; } #endif -#ifdef GLX_NV_present_video - if (_glewStrSame3(&pos, &len, (const GLubyte*)"present_video", 13)) +#ifdef EGL_KHR_vg_parent_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vg_parent_image", 15)) { - ret = GLXEW_NV_present_video; + ret = EGLEW_KHR_vg_parent_image; continue; } #endif -#ifdef GLX_NV_swap_group - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) +#ifdef EGL_KHR_wait_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"wait_sync", 9)) { - ret = GLXEW_NV_swap_group; + ret = EGLEW_KHR_wait_sync; continue; } #endif -#ifdef GLX_NV_vertex_array_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef EGL_MESA_drm_image + if (_glewStrSame3(&pos, &len, (const GLubyte*)"drm_image", 9)) { - ret = GLXEW_NV_vertex_array_range; + ret = EGLEW_MESA_drm_image; continue; } #endif -#ifdef GLX_NV_video_capture - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) +#ifdef EGL_MESA_image_dma_buf_export + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_dma_buf_export", 20)) { - ret = GLXEW_NV_video_capture; + ret = EGLEW_MESA_image_dma_buf_export; continue; } #endif -#ifdef GLX_NV_video_out - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_out", 9)) +#ifdef EGL_MESA_platform_gbm + if (_glewStrSame3(&pos, &len, (const GLubyte*)"platform_gbm", 12)) { - ret = GLXEW_NV_video_out; + ret = EGLEW_MESA_platform_gbm; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NOK_", 4)) { -#ifdef GLX_OML_swap_method - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11)) +#ifdef EGL_NOK_swap_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_region", 11)) { - ret = GLXEW_OML_swap_method; + ret = EGLEW_NOK_swap_region; continue; } #endif -#ifdef GLX_OML_sync_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) +#ifdef EGL_NOK_swap_region2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_region2", 12)) { - ret = GLXEW_OML_sync_control; + ret = EGLEW_NOK_swap_region2; + continue; + } +#endif +#ifdef EGL_NOK_texture_from_pixmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_from_pixmap", 19)) + { + ret = EGLEW_NOK_texture_from_pixmap; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { -#ifdef GLX_SGIS_blended_overlay - if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15)) +#ifdef EGL_NV_3dvision_surface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"3dvision_surface", 16)) { - ret = GLXEW_SGIS_blended_overlay; + ret = EGLEW_NV_3dvision_surface; continue; } #endif -#ifdef GLX_SGIS_color_range - if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) +#ifdef EGL_NV_coverage_sample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"coverage_sample", 15)) { - ret = GLXEW_SGIS_color_range; + ret = EGLEW_NV_coverage_sample; continue; } #endif -#ifdef GLX_SGIS_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) +#ifdef EGL_NV_coverage_sample_resolve + if (_glewStrSame3(&pos, &len, (const GLubyte*)"coverage_sample_resolve", 23)) { - ret = GLXEW_SGIS_multisample; + ret = EGLEW_NV_coverage_sample_resolve; continue; } #endif -#ifdef GLX_SGIS_shared_multisample - if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18)) +#ifdef EGL_NV_cuda_event + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cuda_event", 10)) { - ret = GLXEW_SGIS_shared_multisample; + ret = EGLEW_NV_cuda_event; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) - { -#ifdef GLX_SGIX_fbconfig - if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8)) +#ifdef EGL_NV_depth_nonlinear + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_nonlinear", 15)) { - ret = GLXEW_SGIX_fbconfig; + ret = EGLEW_NV_depth_nonlinear; continue; } #endif -#ifdef GLX_SGIX_hyperpipe - if (_glewStrSame3(&pos, &len, (const GLubyte*)"hyperpipe", 9)) +#ifdef EGL_NV_device_cuda + if (_glewStrSame3(&pos, &len, (const GLubyte*)"device_cuda", 11)) { - ret = GLXEW_SGIX_hyperpipe; + ret = EGLEW_NV_device_cuda; continue; } #endif -#ifdef GLX_SGIX_pbuffer - if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) +#ifdef EGL_NV_native_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"native_query", 12)) { - ret = GLXEW_SGIX_pbuffer; + ret = EGLEW_NV_native_query; continue; } #endif -#ifdef GLX_SGIX_swap_barrier - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12)) +#ifdef EGL_NV_post_convert_rounding + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_convert_rounding", 21)) { - ret = GLXEW_SGIX_swap_barrier; + ret = EGLEW_NV_post_convert_rounding; continue; } #endif -#ifdef GLX_SGIX_swap_group - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) +#ifdef EGL_NV_post_sub_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"post_sub_buffer", 15)) { - ret = GLXEW_SGIX_swap_group; + ret = EGLEW_NV_post_sub_buffer; continue; } #endif -#ifdef GLX_SGIX_video_resize - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) +#ifdef EGL_NV_robustness_video_memory_purge + if (_glewStrSame3(&pos, &len, (const GLubyte*)"robustness_video_memory_purge", 29)) { - ret = GLXEW_SGIX_video_resize; + ret = EGLEW_NV_robustness_video_memory_purge; continue; } #endif -#ifdef GLX_SGIX_visual_select_group - if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19)) +#ifdef EGL_NV_stream_consumer_gltexture_yuv + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_consumer_gltexture_yuv", 29)) { - ret = GLXEW_SGIX_visual_select_group; + ret = EGLEW_NV_stream_consumer_gltexture_yuv; continue; } #endif - } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) - { -#ifdef GLX_SGI_cushion - if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7)) +#ifdef EGL_NV_stream_metadata + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_metadata", 15)) { - ret = GLXEW_SGI_cushion; + ret = EGLEW_NV_stream_metadata; continue; } #endif -#ifdef GLX_SGI_make_current_read - if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) +#ifdef EGL_NV_stream_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stream_sync", 11)) { - ret = GLXEW_SGI_make_current_read; + ret = EGLEW_NV_stream_sync; continue; } #endif -#ifdef GLX_SGI_swap_control - if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) +#ifdef EGL_NV_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync", 4)) { - ret = GLXEW_SGI_swap_control; + ret = EGLEW_NV_sync; continue; } #endif -#ifdef GLX_SGI_video_sync - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10)) +#ifdef EGL_NV_system_time + if (_glewStrSame3(&pos, &len, (const GLubyte*)"system_time", 11)) { - ret = GLXEW_SGI_video_sync; + ret = EGLEW_NV_system_time; continue; } #endif } - if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + if (_glewStrSame2(&pos, &len, (const GLubyte*)"TIZEN_", 6)) { -#ifdef GLX_SUN_get_transparent_index - if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21)) +#ifdef EGL_TIZEN_image_native_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_native_buffer", 19)) { - ret = GLXEW_SUN_get_transparent_index; + ret = EGLEW_TIZEN_image_native_buffer; continue; } #endif -#ifdef GLX_SUN_video_resize - if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) +#ifdef EGL_TIZEN_image_native_surface + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_native_surface", 20)) { - ret = GLXEW_SUN_video_resize; + ret = EGLEW_TIZEN_image_native_surface; continue; } #endif diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 10a8912561..1f23387516 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -274,17 +274,7 @@ void RasterizerCanvasGLES3::_draw_polygon(int p_vertex_count, const int* p_indic } if (p_indices) { -#ifdef GLEW_ENABLED glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices ); -#else - static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!! - ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices); - static uint16_t _draw_poly_indices[_max_draw_poly_indices]; - for (int i=0; iframe.canvas_draw_commands++; } @@ -471,14 +443,14 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item,Item *curr Vector2(line->to.x,line->to.y) }; -#ifdef GLEW_ENABLED +#ifdef GLES_OVER_GL if (line->antialiased) glEnable(GL_LINE_SMOOTH); #endif - glLineWidth(line->width); + //glLineWidth(line->width); _draw_gui_primitive(2,verts,NULL,NULL); -#ifdef GLEW_ENABLED +#ifdef GLES_OVER_GL if (line->antialiased) glDisable(GL_LINE_SMOOTH); #endif @@ -1395,7 +1367,7 @@ void RasterizerCanvasGLES3::reset_canvas() { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } //glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - glLineWidth(1.0); + //glLineWidth(1.0); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); for(int i=0;iis_stdout_verbose()) { @@ -91,9 +124,17 @@ void RasterizerGLES3::initialize() { } #endif - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); +#ifdef GLAD_ENABLED + + if(!gladLoadGL()) { + ERR_PRINT("Error initializing GLAD"); + } + + glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glDebugMessageCallbackARB(_gl_debug_print, NULL); - glEnable(GL_DEBUG_OUTPUT); + glEnable(_EXT_DEBUG_OUTPUT); + +#endif /* glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 54dc3b914b..f42eea45d4 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -934,7 +934,7 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m } if (state.current_line_width!=p_material->line_width) { - glLineWidth(p_material->line_width); + //glLineWidth(MAX(p_material->line_width,1.0)); state.current_line_width=p_material->line_width; } @@ -1109,17 +1109,17 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { int stride = (multi_mesh->xform_floats+multi_mesh->color_floats)*4; glEnableVertexAttribArray(8); glVertexAttribPointer(8,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+0); - glVertexAttribDivisorARB(8,1); + glVertexAttribDivisor(8,1); glEnableVertexAttribArray(9); glVertexAttribPointer(9,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+4*4); - glVertexAttribDivisorARB(9,1); + glVertexAttribDivisor(9,1); int color_ofs; if (multi_mesh->transform_format==VS::MULTIMESH_TRANSFORM_3D) { glEnableVertexAttribArray(10); glVertexAttribPointer(10,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+8*4); - glVertexAttribDivisorARB(10,1); + glVertexAttribDivisor(10,1); color_ofs=12*4; } else { glDisableVertexAttribArray(10); @@ -1136,13 +1136,13 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { case VS::MULTIMESH_COLOR_8BIT: { glEnableVertexAttribArray(11); glVertexAttribPointer(11,4,GL_UNSIGNED_BYTE,GL_TRUE,stride,((uint8_t*)NULL)+color_ofs); - glVertexAttribDivisorARB(11,1); + glVertexAttribDivisor(11,1); } break; case VS::MULTIMESH_COLOR_FLOAT: { glEnableVertexAttribArray(11); glVertexAttribPointer(11,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)NULL)+color_ofs); - glVertexAttribDivisorARB(11,1); + glVertexAttribDivisor(11,1); } break; } @@ -1191,11 +1191,11 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (s->index_array_len>0) { - glDrawElementsInstancedARB(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0,amount); + glDrawElementsInstanced(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0,amount); } else { - glDrawArraysInstancedARB(gl_primitive[s->primitive],0,s->array_len,amount); + glDrawArraysInstanced(gl_primitive[s->primitive],0,s->array_len,amount); } @@ -3648,10 +3648,9 @@ void RasterizerSceneGLES3::initialize() { } -#ifdef GLEW_ENABLED +#ifdef GLES_OVER_GL //"desktop" opengl needs this. - glEnable(GL_POINT_SPRITE); - glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + glEnable(GL_PROGRAM_POINT_SIZE); #endif } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index e5a0cded8e..60cbbc9023 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -62,7 +62,21 @@ #define _GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define _GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF - +#define _EXT_COMPRESSED_R11_EAC 0x9270 +#define _EXT_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define _EXT_COMPRESSED_RG11_EAC 0x9272 +#define _EXT_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define _EXT_COMPRESSED_RGB8_ETC2 0x9274 +#define _EXT_COMPRESSED_SRGB8_ETC2 0x9275 +#define _EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define _EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define _EXT_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define _EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 + +#define _EXT_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define _EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define _EXT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define _EXT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,GLenum& r_gl_internal_format,GLenum &r_gl_type,bool &r_compressed,bool &srgb) { @@ -77,17 +91,16 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima switch(p_format) { case Image::FORMAT_L8: { - r_gl_internal_format=GL_LUMINANCE; - r_gl_format=GL_LUMINANCE; + r_gl_internal_format=GL_R8; + r_gl_format=GL_RED; r_gl_type=GL_UNSIGNED_BYTE; } break; case Image::FORMAT_LA8: { - r_gl_internal_format=GL_LUMINANCE_ALPHA; - r_gl_format=GL_LUMINANCE_ALPHA; + r_gl_internal_format=GL_RG8; + r_gl_format=GL_RG; r_gl_type=GL_UNSIGNED_BYTE; - } break; case Image::FORMAT_R8: { @@ -120,8 +133,9 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima } break; case Image::FORMAT_RGB565: { - - r_gl_internal_format=GL_RGB565; +#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-) + r_gl_internal_format=GL_RGB5; + //r_gl_internal_format=GL_RGB565; r_gl_format=GL_RGB; r_gl_type=GL_UNSIGNED_SHORT_5_6_5; @@ -287,7 +301,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.bptc_supported) { - r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:GL_COMPRESSED_RGBA_BPTC_UNORM; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:_EXT_COMPRESSED_RGBA_BPTC_UNORM; r_gl_format=GL_RGBA; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -303,7 +317,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.bptc_supported) { - r_gl_internal_format=GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT; + r_gl_internal_format=_EXT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT; r_gl_format=GL_RGB; r_gl_type=GL_FLOAT; r_compressed=true; @@ -316,7 +330,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.bptc_supported) { - r_gl_internal_format=GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT; + r_gl_internal_format=_EXT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT; r_gl_format=GL_RGB; r_gl_type=GL_FLOAT; r_compressed=true; @@ -413,7 +427,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=GL_COMPRESSED_R11_EAC; + r_gl_internal_format=_EXT_COMPRESSED_R11_EAC; r_gl_format=GL_RED; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -427,7 +441,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=GL_COMPRESSED_SIGNED_R11_EAC; + r_gl_internal_format=_EXT_COMPRESSED_SIGNED_R11_EAC; r_gl_format=GL_RED; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -441,7 +455,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=GL_COMPRESSED_RG11_EAC; + r_gl_internal_format=_EXT_COMPRESSED_RG11_EAC; r_gl_format=GL_RG; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -454,7 +468,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima case Image::FORMAT_ETC2_RG11S: { if (config.etc2_supported) { - r_gl_internal_format=GL_COMPRESSED_SIGNED_RG11_EAC; + r_gl_internal_format=_EXT_COMPRESSED_SIGNED_RG11_EAC; r_gl_format=GL_RG; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -467,7 +481,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_ETC2:GL_COMPRESSED_RGB8_ETC2; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB8_ETC2:_EXT_COMPRESSED_RGB8_ETC2; r_gl_format=GL_RGB; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -483,7 +497,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:GL_COMPRESSED_RGBA8_ETC2_EAC; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:_EXT_COMPRESSED_RGBA8_ETC2_EAC; r_gl_format=GL_RGBA; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -499,7 +513,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.etc2_supported) { - r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:_EXT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; r_gl_format=GL_RGBA; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -709,6 +723,32 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image glTexParameterf( texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); } + //set swizle for older format compatibility + switch(texture->format) { + + case Image::FORMAT_L8: { + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_R,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_G,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_B,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_A,GL_ONE); + + } break; + case Image::FORMAT_LA8: { + + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_R,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_G,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_B,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_A,GL_GREEN); + } break; + default: { + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_R,GL_RED); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_G,GL_GREEN); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_B,GL_BLUE); + glTexParameteri(texture->target,GL_TEXTURE_SWIZZLE_A,GL_ALPHA); + + } break; + + } if (config.use_anisotropic_filter) { if (texture->flags&VS::TEXTURE_FLAG_ANISOTROPIC_FILTER) { @@ -782,7 +822,7 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c ERR_FAIL_COND_V(texture->data_size==0,Image()); ERR_FAIL_COND_V(texture->render_target,Image()); -#ifdef GLEW_ENABLED +#ifdef GLES_OVER_GL DVector data; @@ -5068,9 +5108,14 @@ void RasterizerStorageGLES3::initialize() { /// { - Vector ext= String((const char*)glGetString( GL_EXTENSIONS )).split(" ",false); - for(int i=0;i strings; -#ifdef GLEW_ENABLED +#ifdef GLES_OVER_GL //strings.push_back("#version 330\n"); strings.push_back("#version 300 es\n"); #else @@ -709,6 +709,8 @@ void ShaderGLES3::setup(const char** p_conditional_defines, int p_conditional_co } } + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&max_image_units); + } void ShaderGLES3::finish() { @@ -804,7 +806,7 @@ ShaderGLES3::ShaderGLES3() { last_custom_code=1; uniforms_dirty = true; base_material_tex_index=0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&max_image_units); + } diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index ccf7a801ef..789f346608 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -76,6 +76,13 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) { }*/ +static bool ctxErrorOccurred = false; +static int ctxErrorHandler( Display *dpy, XErrorEvent *ev ) +{ + ctxErrorOccurred = true; + return 0; +} + Error ContextGL_X11::initialize() { @@ -133,21 +140,31 @@ Error ContextGL_X11::initialize() { //}; + int (*oldHandler)(Display*, XErrorEvent*) = + XSetErrorHandler(&ctxErrorHandler); + + if (!opengl_3_context) { //oldstyle context: p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE); } else { static int context_attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 0, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, + GLX_CONTEXT_MINOR_VERSION_ARB, 3, + GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB|GLX_CONTEXT_DEBUG_BIT_ARB, None }; p->glx_context = glXCreateContextAttribsARB(x11_display, fbc[0], NULL, true, context_attribs); - ERR_FAIL_COND_V(!p->glx_context,ERR_UNCONFIGURED); + ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!"); + ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context,ERR_UNCONFIGURED); } + XSync( x11_display, False ); + XSetErrorHandler( oldHandler ); + + print_line("ALL IS GOOD"); + glXMakeCurrent(x11_display, x11_window, p->glx_context); /* diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d2d6e88c4b..581a930143 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -204,7 +204,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) - context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) ); + context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, true ) ); context_gl->initialize(); RasterizerGLES3::register_config(); diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h index 1873e712ec..4d31f87820 100644 --- a/platform/x11/platform_config.h +++ b/platform/x11/platform_config.h @@ -35,6 +35,7 @@ #endif #define GLES2_INCLUDE_H "gl_context/GL/glew.h" -#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +//#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/glad/glad.h" -- cgit v1.2.3 From b72ca046051018628a31bc458dd730384ebddbe8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 22 Nov 2016 20:53:37 -0300 Subject: Changed to proper GLSL version --- drivers/gles3/shader_gles3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 0a25f6c3b3..e906f9a790 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -221,8 +221,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { Vector strings; #ifdef GLES_OVER_GL - //strings.push_back("#version 330\n"); - strings.push_back("#version 300 es\n"); + strings.push_back("#version 330\n"); + //strings.push_back("#version 300 es\n"); #else strings.push_back("#version 300 es\n"); //ATI requieres this before anything #endif -- cgit v1.2.3 From 7cf8d75cf8c49d02a72eac1d5342808526fa54ef Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 23 Nov 2016 07:04:55 -0300 Subject: WIP immediates and proper buffers swapping --- drivers/gles3/rasterizer_gles3.cpp | 3 +- drivers/gles3/rasterizer_storage_gles3.cpp | 134 +++++++++++++++++++++++++++-- drivers/gles3/rasterizer_storage_gles3.h | 36 +++++++- drivers/gles3/shader_gles3.cpp | 3 +- servers/visual/rasterizer.h | 3 +- servers/visual/visual_server_raster.h | 1 - servers/visual/visual_server_scene.cpp | 25 ++++-- servers/visual_server.cpp | 4 + servers/visual_server.h | 2 +- 9 files changed, 185 insertions(+), 26 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index ebcedd5f05..9046028705 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -276,8 +276,7 @@ void RasterizerGLES3::end_frame(){ canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1)); #endif - if (ContextGL::get_singleton()) - ContextGL::get_singleton()->swap_buffers(); + OS::get_singleton()->swap_buffers(); } void RasterizerGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 60cbbc9023..a618953b86 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -3675,57 +3675,157 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { /* IMMEDIATE API */ -RID RasterizerStorageGLES3::immediate_create(){ - return RID(); +RID RasterizerStorageGLES3::immediate_create() { + + Immediate *im = memnew( Immediate ); + return immediate_owner.make_rid(im); + } -void RasterizerStorageGLES3::immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture){ + +void RasterizerStorageGLES3::immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture){ + + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(im->building); + + Immediate::Chunk ic; + ic.texture=p_texture; + ic.primitive=p_rimitive; + im->chunks.push_back(ic); + im->mask=0; + im->building=true; } void RasterizerStorageGLES3::immediate_vertex(RID p_immediate,const Vector3& p_vertex){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); -} -void RasterizerStorageGLES3::immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex){ + Immediate::Chunk *c = &im->chunks.back()->get(); + + + if (c->vertices.empty() && im->chunks.size()==1) { + im->aabb.pos=p_vertex; + im->aabb.size=Vector3(); + } else { + im->aabb.expand_to(p_vertex); + } + + if (im->mask&VS::ARRAY_FORMAT_NORMAL) + c->normals.push_back(chunk_normal); + if (im->mask&VS::ARRAY_FORMAT_TANGENT) + c->tangents.push_back(chunk_tangent); + if (im->mask&VS::ARRAY_FORMAT_COLOR) + c->colors.push_back(chunk_color); + if (im->mask&VS::ARRAY_FORMAT_TEX_UV) + c->uvs.push_back(chunk_uv); + if (im->mask&VS::ARRAY_FORMAT_TEX_UV2) + c->uvs2.push_back(chunk_uv2); + im->mask|=VS::ARRAY_FORMAT_VERTEX; + c->vertices.push_back(p_vertex); } + + void RasterizerStorageGLES3::immediate_normal(RID p_immediate,const Vector3& p_normal){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->mask|=VS::ARRAY_FORMAT_NORMAL; + chunk_normal=p_normal; } void RasterizerStorageGLES3::immediate_tangent(RID p_immediate,const Plane& p_tangent){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->mask|=VS::ARRAY_FORMAT_TANGENT; + chunk_tangent=p_tangent; } void RasterizerStorageGLES3::immediate_color(RID p_immediate,const Color& p_color){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->mask|=VS::ARRAY_FORMAT_COLOR; + chunk_color=p_color; } void RasterizerStorageGLES3::immediate_uv(RID p_immediate,const Vector2& tex_uv){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->mask|=VS::ARRAY_FORMAT_TEX_UV; + chunk_uv=tex_uv; } void RasterizerStorageGLES3::immediate_uv2(RID p_immediate,const Vector2& tex_uv){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->mask|=VS::ARRAY_FORMAT_TEX_UV2; + chunk_uv2=tex_uv; } + void RasterizerStorageGLES3::immediate_end(RID p_immediate){ + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(!im->building); + + im->building=false; + + im->instance_change_notify(); } -void RasterizerStorageGLES3::immediate_clear(RID p_immediate){ +void RasterizerStorageGLES3::immediate_clear(RID p_immediate) { + + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + ERR_FAIL_COND(im->building); + im->chunks.clear(); + im->instance_change_notify(); } -void RasterizerStorageGLES3::immediate_set_material(RID p_immediate,RID p_material){ +AABB RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const { + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND_V(!im,AABB()); + return im->aabb; } -RID RasterizerStorageGLES3::immediate_get_material(RID p_immediate) const{ - return RID(); +void RasterizerStorageGLES3::immediate_set_material(RID p_immediate,RID p_material) { + + Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND(!im); + im->material=p_material; + im->instance_material_change_notify(); + +} + +RID RasterizerStorageGLES3::immediate_get_material(RID p_immediate) const { + + const Immediate *im = immediate_owner.get(p_immediate); + ERR_FAIL_COND_V(!im,RID()); + return im->material; + } /* SKELETON API */ @@ -4417,6 +4517,10 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: inst = multimesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_IMMEDIATE: { + inst = immediate_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_REFLECTION_PROBE: { inst = reflection_probe_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -4452,6 +4556,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce inst = multimesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_IMMEDIATE: { + inst = immediate_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; case VS::INSTANCE_REFLECTION_PROBE: { inst = reflection_probe_owner.getornull(p_base); ERR_FAIL_COND(!inst); @@ -4949,6 +5057,9 @@ VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { if (multimesh_owner.owns(p_rid)) { return VS::INSTANCE_MULTIMESH; } + if (immediate_owner.owns(p_rid)) { + return VS::INSTANCE_IMMEDIATE; + } if (light_owner.owns(p_rid)) { return VS::INSTANCE_LIGHT; } @@ -5057,7 +5168,12 @@ bool RasterizerStorageGLES3::free(RID p_rid){ multimesh_owner.free(p_rid); memdelete(multimesh); + } else if (immediate_owner.owns(p_rid)) { + + Immediate *immediate = immediate_owner.get(p_rid); + immediate_owner.free(p_rid); + memdelete(immediate); } else if (light_owner.owns(p_rid)) { // delete the texture diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index c6712bd8ea..623962bf61 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -651,10 +651,41 @@ public: /* IMMEDIATE API */ + struct Immediate : public Geometry { + + struct Chunk { + + RID texture; + VS::PrimitiveType primitive; + Vector vertices; + Vector normals; + Vector tangents; + Vector colors; + Vector uvs; + Vector uvs2; + }; + + List chunks; + bool building; + int mask; + AABB aabb; + + Immediate() { type=GEOMETRY_IMMEDIATE; building=false;} + + }; + + Vector3 chunk_vertex; + Vector3 chunk_normal; + Plane chunk_tangent; + Color chunk_color; + Vector2 chunk_uv; + Vector2 chunk_uv2; + + mutable RID_Owner immediate_owner; + virtual RID immediate_create(); virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID()); - virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); - virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex); + virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex); virtual void immediate_normal(RID p_immediate,const Vector3& p_normal); virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent); virtual void immediate_color(RID p_immediate,const Color& p_color); @@ -664,6 +695,7 @@ public: virtual void immediate_clear(RID p_immediate); virtual void immediate_set_material(RID p_immediate,RID p_material); virtual RID immediate_get_material(RID p_immediate) const; + virtual AABB immediate_get_aabb(RID p_immediate) const; /* SKELETON API */ diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index e906f9a790..78f35c493a 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -222,9 +222,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { Vector strings; #ifdef GLES_OVER_GL strings.push_back("#version 330\n"); - //strings.push_back("#version 300 es\n"); #else - strings.push_back("#version 300 es\n"); //ATI requieres this before anything + strings.push_back("#version 300 es\n"); #endif diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 08d1995725..5f536b8fd4 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -285,7 +285,6 @@ public: virtual RID immediate_create()=0; virtual void immediate_begin(RID p_immediate,VS::PrimitiveType p_rimitive,RID p_texture=RID())=0; virtual void immediate_vertex(RID p_immediate,const Vector3& p_vertex)=0; - virtual void immediate_vertex_2d(RID p_immediate,const Vector3& p_vertex)=0; virtual void immediate_normal(RID p_immediate,const Vector3& p_normal)=0; virtual void immediate_tangent(RID p_immediate,const Plane& p_tangent)=0; virtual void immediate_color(RID p_immediate,const Color& p_color)=0; @@ -295,6 +294,8 @@ public: virtual void immediate_clear(RID p_immediate)=0; virtual void immediate_set_material(RID p_immediate,RID p_material)=0; virtual RID immediate_get_material(RID p_immediate) const=0; + virtual AABB immediate_get_aabb(RID p_immediate) const=0; + /* SKELETON API */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 675e2d4aef..c3afadb393 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -731,7 +731,6 @@ public: BIND0R(RID,immediate_create) BIND3(immediate_begin,RID,PrimitiveType,RID) BIND2(immediate_vertex,RID,const Vector3&) - BIND2(immediate_vertex_2d,RID,const Vector3&) BIND2(immediate_normal,RID,const Vector3&) BIND2(immediate_tangent,RID,const Plane&) BIND2(immediate_color,RID,const Color&) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index f25e5bc943..2439eacd75 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -557,12 +557,9 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ instance->base_data=light; } break; - case VS::INSTANCE_MESH: { - - InstanceGeometryData *geom = memnew( InstanceGeometryData ); - instance->base_data=geom; - } break; - case VS::INSTANCE_MULTIMESH: { + case VS::INSTANCE_MESH: + case VS::INSTANCE_MULTIMESH: + case VS::INSTANCE_IMMEDIATE: { InstanceGeometryData *geom = memnew( InstanceGeometryData ); instance->base_data=geom; @@ -1147,13 +1144,14 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { new_aabb = VSG::storage->multimesh_get_aabb(p_instance->base); } break; -#if 0 case VisualServer::INSTANCE_IMMEDIATE: { - new_aabb = rasterizer->immediate_get_aabb(p_instance->base); + new_aabb = VSG::storage->immediate_get_aabb(p_instance->base); } break; +#if 0 + case VisualServer::INSTANCE_PARTICLES: { new_aabb = rasterizer->particles_get_aabb(p_instance->base); @@ -2309,6 +2307,17 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { can_cast_shadows=false; } } + } else if (p_instance->base_type==VS::INSTANCE_IMMEDIATE) { + + RID mat = VSG::storage->immediate_get_material(p_instance->base); + + if (!mat.is_valid() || VSG::storage->material_casts_shadows(mat)) { + can_cast_shadows=true; + } else { + can_cast_shadows=false; + } + + } diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 30d6b76b8e..27b08c4c50 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1648,6 +1648,10 @@ void VisualServer::mesh_add_surface_from_planes( RID p_mesh, const DVector Date: Wed, 23 Nov 2016 08:00:15 -0300 Subject: implemented immediates --- drivers/gles3/rasterizer_scene_gles3.cpp | 196 +++++++++++++++++++++++++++---- drivers/gles3/rasterizer_scene_gles3.h | 4 + 2 files changed, 177 insertions(+), 23 deletions(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index f42eea45d4..7a0e21b620 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1027,59 +1027,75 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m RID* textures = p_material->textures.ptr(); ShaderLanguage::ShaderNode::Uniform::Hint* texture_hints = p_material->shader->texture_hints.ptr(); + state.current_main_tex=0; + for(int i=0;itexture_owner.getornull( textures[i] ); + if (!t) { //check hints + target=GL_TEXTURE_2D; + switch(texture_hints[i]) { case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO: case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { - glBindTexture(GL_TEXTURE_2D,storage->resources.black_tex); + tex=storage->resources.black_tex; } break; case ShaderLanguage::ShaderNode::Uniform::HINT_ANISO: { - glBindTexture(GL_TEXTURE_2D,storage->resources.aniso_tex); + tex=storage->resources.aniso_tex; } break; case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { - glBindTexture(GL_TEXTURE_2D,storage->resources.normal_tex); + tex=storage->resources.normal_tex; } break; default: { - glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex); + tex=storage->resources.white_tex; } break; } - continue; - } - if (storage->config.srgb_decode_supported) { - //if SRGB decode extension is present, simply switch the texture to whathever is needed - bool must_srgb=false; + } else { - if (t->srgb && (texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO || texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO)) { - must_srgb=true; - } + if (storage->config.srgb_decode_supported) { + //if SRGB decode extension is present, simply switch the texture to whathever is needed + bool must_srgb=false; + + if (t->srgb && (texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO || texture_hints[i]==ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO)) { + must_srgb=true; + } - if (t->using_srgb!=must_srgb) { - if (must_srgb) { - glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); + if (t->using_srgb!=must_srgb) { + if (must_srgb) { + glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); #ifdef TOOLS_ENABLED - if (!(t->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { - t->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; - //notify that texture must be set to linear beforehand, so it works in other platforms when exported - } + if (!(t->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { + t->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; + //notify that texture must be set to linear beforehand, so it works in other platforms when exported + } #endif - } else { - glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + } else { + glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_SKIP_DECODE_EXT); + } + t->using_srgb=must_srgb; } - t->using_srgb=must_srgb; } + + target=t->target; + tex = t->tex_id; + } + glBindTexture(target,tex); - glBindTexture(t->target,t->tex_id); + if (i==0) { + state.current_main_tex=tex; + } } @@ -1200,6 +1216,125 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } } break; + case VS::INSTANCE_IMMEDIATE: { + + bool restore_tex=false; + const RasterizerStorageGLES3::Immediate *im = static_cast( e->geometry ); + + if (im->building) { + return; + } + + glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer); + glBindVertexArray(state.immediate_array); + + + for(const List< RasterizerStorageGLES3::Immediate::Chunk>::Element *E=im->chunks.front();E;E=E->next()) { + + const RasterizerStorageGLES3::Immediate::Chunk &c=E->get(); + if (c.vertices.empty()) { + continue; + } + + int vertices = c.vertices.size(); + uint32_t buf_ofs=0; + + if (c.texture.is_valid() && storage->texture_owner.owns(c.texture)) { + + const RasterizerStorageGLES3::Texture *t = storage->texture_owner.get(c.texture); + glActiveTexture(GL_TEXTURE0); + glBindTexture(t->target,t->tex_id); + restore_tex=true; + + + } else if (restore_tex) { + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,state.current_main_tex); + restore_tex=false; + } + + + + if (!c.normals.empty()) { + + glEnableVertexAttribArray(VS::ARRAY_NORMAL); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Vector3)*vertices,c.normals.ptr()); + glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, false,sizeof(Vector3)*vertices,((uint8_t*)NULL)+buf_ofs); + buf_ofs+=sizeof(Vector3)*vertices; + + } else { + + glDisableVertexAttribArray(VS::ARRAY_NORMAL); + } + + if (!c.tangents.empty()) { + + glEnableVertexAttribArray(VS::ARRAY_TANGENT); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Plane)*vertices,c.tangents.ptr()); + glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, false,sizeof(Plane)*vertices,((uint8_t*)NULL)+buf_ofs); + buf_ofs+=sizeof(Plane)*vertices; + + } else { + + glDisableVertexAttribArray(VS::ARRAY_TANGENT); + } + + if (!c.colors.empty()) { + + glEnableVertexAttribArray(VS::ARRAY_COLOR); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Color)*vertices,c.colors.ptr()); + glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, false,sizeof(Color),((uint8_t*)NULL)+buf_ofs); + buf_ofs+=sizeof(Color)*vertices; + + } else { + + glDisableVertexAttribArray(VS::ARRAY_COLOR); + glVertexAttrib4f(VS::ARRAY_COLOR,1,1,1,1); + } + + + if (!c.uvs.empty()) { + + glEnableVertexAttribArray(VS::ARRAY_TEX_UV); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Vector2)*vertices,c.uvs.ptr()); + glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, false,sizeof(Vector2),((uint8_t*)NULL)+buf_ofs); + buf_ofs+=sizeof(Vector2)*vertices; + + } else { + + glDisableVertexAttribArray(VS::ARRAY_TEX_UV); + } + + if (!c.uvs2.empty()) { + + glEnableVertexAttribArray(VS::ARRAY_TEX_UV2); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Vector2)*vertices,c.uvs2.ptr()); + glVertexAttribPointer(VS::ARRAY_TEX_UV2, 2, GL_FLOAT, false,sizeof(Vector2),((uint8_t*)NULL)+buf_ofs); + buf_ofs+=sizeof(Vector2)*vertices; + + } else { + + glDisableVertexAttribArray(VS::ARRAY_TEX_UV2); + } + + + glEnableVertexAttribArray(VS::ARRAY_VERTEX); + glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(Vector3)*vertices,c.vertices.ptr()); + glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false,sizeof(Vector3),((uint8_t*)NULL)+buf_ofs); + glDrawArrays(gl_primitive[c.primitive],0,c.vertices.size()); + + + } + + + if (restore_tex) { + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,state.current_main_tex); + restore_tex=false; + } + } break; } @@ -3647,6 +3782,21 @@ void RasterizerSceneGLES3::initialize() { } } + { + + + uint32_t immediate_buffer_size=GLOBAL_DEF("rendering/gles3/immediate_buffer_size_kb",2048); + + glGenBuffers(1, &state.immediate_buffer); + glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer); + glBufferData(GL_ARRAY_BUFFER, immediate_buffer_size*1024, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); + + glGenVertexArrays(1,&state.immediate_array); + + + + } #ifdef GLES_OVER_GL //"desktop" opengl needs this. diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 31253e56b6..929b01e373 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -41,6 +41,7 @@ public: int current_blend_mode; float current_line_width; int current_depth_draw; + GLuint current_main_tex; SceneShaderGLES3 scene_shader; CubeToDpShaderGLES3 cube_to_dp_shader; @@ -90,6 +91,9 @@ public: GLuint omni_array_ubo; GLuint reflection_array_ubo; + GLuint immediate_buffer; + GLuint immediate_array; + uint32_t ubo_light_size; uint8_t *spot_array_tmp; uint8_t *omni_array_tmp; -- cgit v1.2.3 From a732708b9dad4ebc118a0ce854f950c6becb984c Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 24 Nov 2016 20:46:55 -0300 Subject: Blend shapes using transform feedback (GPU) --- drivers/gles3/rasterizer_scene_gles3.cpp | 11 +- drivers/gles3/rasterizer_storage_gles3.cpp | 401 +++++++++++++++++----- drivers/gles3/rasterizer_storage_gles3.h | 72 ++-- drivers/gles3/shader_gles3.cpp | 23 +- drivers/gles3/shader_gles3.h | 10 +- drivers/gles3/shaders/SCsub | 1 + drivers/gles3/shaders/blend_shape.glsl | 197 +++++++++++ methods.py | 39 ++- scene/resources/mesh.cpp | 6 +- scene/resources/mesh.h | 18 +- scene/resources/surface_tool.cpp | 38 +- servers/visual/rasterizer.h | 3 +- servers/visual/visual_server_scene.cpp | 27 +- servers/visual_server.cpp | 12 +- tools/editor/io_plugins/editor_import_collada.cpp | 28 +- tools/editor/plugins/script_editor_plugin.cpp | 2 + 16 files changed, 726 insertions(+), 162 deletions(-) create mode 100644 drivers/gles3/shaders/blend_shape.glsl diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 7a0e21b620..9de441c2bb 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1111,7 +1111,16 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { case VS::INSTANCE_MESH: { RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); - glBindVertexArray(s->array_id); // everything is so easy nowadays + + if (s->morph_targets.size() && e->instance->morph_values.size()) { + //blend shapes, use transform feedback + storage->mesh_render_blend_shapes(s,e->instance->morph_values.ptr()); + //rebind shader + state.scene_shader.bind(); + } else { + + glBindVertexArray(s->array_id); // everything is so easy nowadays + } } break; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a618953b86..559f733e4d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2274,8 +2274,8 @@ void RasterizerStorageGLES3::_update_material(Material* material) { material->can_cast_shadow_cache=can_cast_shadow; material->is_animated_cache=is_animated; - for(Map::Element *E=material->instantiable_owners.front();E;E=E->next()) { - E->key()->instance_material_change_notify(); + for(Map::Element *E=material->geometry_owners.front();E;E=E->next()) { + E->key()->material_changed_notify(); } for(Map::Element *E=material->instance_owners.front();E;E=E->next()) { @@ -2379,32 +2379,32 @@ void RasterizerStorageGLES3::_update_material(Material* material) { } -void RasterizerStorageGLES3::_material_add_instantiable(RID p_material,Instantiable *p_instantiable) { +void RasterizerStorageGLES3::_material_add_geometry(RID p_material,Geometry *p_geometry) { Material * material = material_owner.getornull(p_material); ERR_FAIL_COND(!material); - Map::Element *I = material->instantiable_owners.find(p_instantiable); + Map::Element *I = material->geometry_owners.find(p_geometry); if (I) { I->get()++; } else { - material->instantiable_owners[p_instantiable]=1; + material->geometry_owners[p_geometry]=1; } } -void RasterizerStorageGLES3::_material_remove_instantiable(RID p_material,Instantiable *p_instantiable) { +void RasterizerStorageGLES3::_material_remove_geometry(RID p_material,Geometry *p_geometry) { Material * material = material_owner.getornull(p_material); ERR_FAIL_COND(!material); - Map::Element *I = material->instantiable_owners.find(p_instantiable); + Map::Element *I = material->geometry_owners.find(p_geometry); ERR_FAIL_COND(!I); I->get()--; if (I->get()==0) { - material->instantiable_owners.erase(I); + material->geometry_owners.erase(I); } } @@ -2446,18 +2446,15 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P bool has_morph = p_blend_shapes.size(); - Surface::Attrib attribs[VS::ARRAY_MAX],morph_attribs[VS::ARRAY_MAX]; + Surface::Attrib attribs[VS::ARRAY_MAX]; int stride=0; - int morph_stride=0; for(int i=0;iattribs[i]=attribs[i]; - surface->morph_attribs[i]=morph_attribs[i]; } { @@ -2763,12 +2701,11 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P glGenVertexArrays(1,&surface->array_id); glBindVertexArray(surface->array_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - } else { + } else if (i==1) { //for instancing draw (can be changed and no one cares) glGenVertexArrays(1,&surface->instancing_array_id); glBindVertexArray(surface->instancing_array_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - } @@ -2816,17 +2753,17 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P glBindVertexArray(mt.array_id); glBindBuffer(GL_ARRAY_BUFFER,mt.vertex_id); - for(int i=0;isurfaces[p_surface]->material.is_valid()) { - _material_remove_instantiable(mesh->surfaces[p_surface]->material,mesh); + _material_remove_geometry(mesh->surfaces[p_surface]->material,mesh->surfaces[p_surface]); } mesh->surfaces[p_surface]->material=p_material; if (mesh->surfaces[p_surface]->material.is_valid()) { - _material_add_instantiable(mesh->surfaces[p_surface]->material,mesh); + _material_add_geometry(mesh->surfaces[p_surface]->material,mesh->surfaces[p_surface]); } mesh->instance_material_change_notify(); @@ -3067,7 +3004,7 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ Surface *surface = mesh->surfaces[p_surface]; if (surface->material.is_valid()) { - _material_remove_instantiable(surface->material,mesh); + _material_remove_geometry(surface->material,mesh->surfaces[p_surface]); } glDeleteBuffers(1,&surface->vertex_id); @@ -3241,6 +3178,227 @@ void RasterizerStorageGLES3::mesh_clear(RID p_mesh){ } } +void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, float *p_weights) { + + glBindVertexArray(s->array_id); + + BlendShapeShaderGLES3::Conditionals cond[VS::ARRAY_MAX-1]={ + BlendShapeShaderGLES3::ENABLE_NORMAL, //will be ignored + BlendShapeShaderGLES3::ENABLE_NORMAL, + BlendShapeShaderGLES3::ENABLE_TANGENT, + BlendShapeShaderGLES3::ENABLE_COLOR, + BlendShapeShaderGLES3::ENABLE_UV, + BlendShapeShaderGLES3::ENABLE_UV2, + BlendShapeShaderGLES3::ENABLE_SKELETON, + BlendShapeShaderGLES3::ENABLE_SKELETON, + }; + + int stride=0; + + if (s->format&VS::ARRAY_FLAG_USE_2D_VERTICES) { + stride=2*4; + } else { + stride=3*4; + } + + static const int sizes[VS::ARRAY_MAX-1]={ + 3*4, + 3*4, + 4*4, + 4*4, + 2*4, + 2*4, + 4*4, + 4*4 + }; + + for(int i=1;iformat&(1<format&(1<morph_targets.size(); + + if (s->mesh->morph_target_mode==VS::MORPH_MODE_NORMALIZED) { + + for(int i=0;iformat&VS::ARRAY_FLAG_USE_2D_VERTICES); //use 2D vertices if needed + + shaders.blend_shapes.bind(); + + shaders.blend_shapes.set_uniform(BlendShapeShaderGLES3::BLEND_AMOUNT,base_weight); + glEnable(GL_RASTERIZER_DISCARD); + + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, resources.transform_feedback_buffers[0]); + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS,0,s->array_len); + glEndTransformFeedback(); + + + shaders.blend_shapes.set_conditional(BlendShapeShaderGLES3::ENABLE_BLEND,true); //first pass does not blend + shaders.blend_shapes.bind(); + + for(int ti=0;timorph_targets[ti].array_id); + glBindBuffer(GL_ARRAY_BUFFER, resources.transform_feedback_buffers[0]); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, resources.transform_feedback_buffers[1]); + + shaders.blend_shapes.set_uniform(BlendShapeShaderGLES3::BLEND_AMOUNT,weight); + + int ofs=0; + for(int i=0;iformat&(1<format&VS::ARRAY_FLAG_USE_2D_VERTICES) { + glVertexAttribPointer(i+8,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + } else { + glVertexAttribPointer(i+8,3,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=3*4; + } + } break; + case VS::ARRAY_NORMAL: { + glVertexAttribPointer(i+8,3,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=3*4; + } break; + case VS::ARRAY_TANGENT: { + glVertexAttribPointer(i+8,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_COLOR: { + glVertexAttribPointer(i+8,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_TEX_UV: { + glVertexAttribPointer(i+8,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + + } break; + case VS::ARRAY_TEX_UV2: { + glVertexAttribPointer(i+8,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + + } break; + case VS::ARRAY_BONES: { + glVertexAttribIPointer(i+8,4,GL_UNSIGNED_INT,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_WEIGHTS: { + glVertexAttribPointer(i+8,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + } + + } else { + glDisableVertexAttribArray(i+8); + } + } + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS,0,s->array_len); + glEndTransformFeedback(); + + + SWAP(resources.transform_feedback_buffers[0],resources.transform_feedback_buffers[1]); + + } + + glDisable(GL_RASTERIZER_DISCARD); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0); + + + glBindVertexArray(resources.transform_feedback_array); + glBindBuffer(GL_ARRAY_BUFFER, resources.transform_feedback_buffers[0]); + + int ofs=0; + for(int i=0;iformat&(1<format&VS::ARRAY_FLAG_USE_2D_VERTICES) { + glVertexAttribPointer(i,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + } else { + glVertexAttribPointer(i,3,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=3*4; + } + } break; + case VS::ARRAY_NORMAL: { + glVertexAttribPointer(i,3,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=3*4; + } break; + case VS::ARRAY_TANGENT: { + glVertexAttribPointer(i,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_COLOR: { + glVertexAttribPointer(i,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_TEX_UV: { + glVertexAttribPointer(i,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + + } break; + case VS::ARRAY_TEX_UV2: { + glVertexAttribPointer(i,2,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=2*4; + + } break; + case VS::ARRAY_BONES: { + glVertexAttribIPointer(i,4,GL_UNSIGNED_INT,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + case VS::ARRAY_WEIGHTS: { + glVertexAttribPointer(i,4,GL_FLOAT,GL_FALSE,stride,((uint8_t*)0)+ofs); + ofs+=4*4; + + } break; + } + + } else { + glDisableVertexAttribArray(i); + } + } + + if (s->index_array_len) { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,s->index_id); + } + +} + /* MULTIMESH API */ @@ -3896,7 +4054,6 @@ void RasterizerStorageGLES3::skeleton_allocate(RID p_skeleton,int p_bones,bool p skeleton_update_list.add(&skeleton->update_list); } - skeleton->instance_change_notify(); } @@ -4017,7 +4174,10 @@ void RasterizerStorageGLES3::update_dirty_skeletons() { glBufferSubData(GL_UNIFORM_BUFFER,0,skeleton->bones.size()*sizeof(float),skeleton->bones.ptr()); glBindBuffer(GL_UNIFORM_BUFFER, 0); } - skeleton->instance_change_notify(); + + for (Set::Element *E=skeleton->instances.front();E;E=E->next()) { + E->get()->base_changed(); + } skeleton_update_list.remove(skeleton_update_list.first()); } @@ -4505,6 +4665,23 @@ void RasterizerStorageGLES3::portal_set_disabled_color(RID p_portal, const Color } +void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance) { + + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + ERR_FAIL_COND(!skeleton); + + skeleton->instances.insert(p_instance); +} + +void RasterizerStorageGLES3::instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance) { + + Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); + ERR_FAIL_COND(!skeleton); + + skeleton->instances.erase(p_instance); +} + + void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance) { Instantiable *inst=NULL; @@ -4530,9 +4707,6 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: ERR_FAIL_COND(!inst); } break; default: { - if (skeleton_owner.owns(p_base)) { - inst=skeleton_owner.getornull(p_base); - } if (!inst) { ERR_FAIL(); } @@ -4550,7 +4724,6 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce case VS::INSTANCE_MESH: { inst = mesh_owner.getornull(p_base); ERR_FAIL_COND(!inst); - } break; case VS::INSTANCE_MULTIMESH: { inst = multimesh_owner.getornull(p_base); @@ -4569,9 +4742,7 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce ERR_FAIL_COND(!inst); } break; default: { - if (skeleton_owner.owns(p_base)) { - inst=skeleton_owner.getornull(p_base); - } + if (!inst) { ERR_FAIL(); } @@ -5134,6 +5305,26 @@ bool RasterizerStorageGLES3::free(RID p_rid){ glDeleteBuffers(1,&material->ubo_id); } + //remove from owners + for (Map::Element *E=material->geometry_owners.front();E;E=E->next()) { + + Geometry *g = E->key(); + g->material=RID(); + } + for (Map::Element *E=material->instance_owners.front();E;E=E->next()) { + RasterizerScene::InstanceBase*ins=E->key(); + if (ins->material_override==p_rid) { + ins->material_override=RID(); + } + + for(int i=0;imaterials.size();i++) { + if (ins->materials[i]==p_rid) { + ins->materials[i]=RID(); + } + } + + } + material_owner.free(p_rid); memdelete(material); @@ -5144,6 +5335,11 @@ bool RasterizerStorageGLES3::free(RID p_rid){ if (skeleton->update_list.in_list()) { skeleton_update_list.remove(&skeleton->update_list); } + + for (Set::Element *E=skeleton->instances.front();E;E=E->next()) { + E->get()->skeleton=RID(); + } + skeleton_allocate(p_rid,0,false); skeleton_owner.free(p_rid); memdelete(skeleton); @@ -5370,6 +5566,23 @@ void RasterizerStorageGLES3::initialize() { glBindBuffer(GL_ARRAY_BUFFER,0); //unbind } + + { + //transform feedback buffers + uint32_t xf_feedback_size = GLOBAL_DEF("rendering/gles3/blend_shape_max_buffer_size_kb",4096); + for(int i=0;i<2;i++) { + + glGenBuffers(1,&resources.transform_feedback_buffers[i]); + glBindBuffer(GL_ARRAY_BUFFER,resources.transform_feedback_buffers[i]); + glBufferData(GL_ARRAY_BUFFER,xf_feedback_size*1024,NULL,GL_STREAM_DRAW); + } + + shaders.blend_shapes.init();; + + glGenVertexArrays(1,&resources.transform_feedback_array); + + } + shaders.cubemap_filter.init(); glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 623962bf61..361e738af5 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -6,6 +6,7 @@ #include "shader_gles3.h" #include "shaders/copy.glsl.h" #include "shaders/canvas.glsl.h" +#include "shaders/blend_shape.glsl.h" #include "shaders/cubemap_filter.glsl.h" #include "self_list.h" #include "shader_compiler_gles3.h" @@ -65,6 +66,8 @@ public: CubemapFilterShaderGLES3 cubemap_filter; + BlendShapeShaderGLES3 blend_shapes; + ShaderCompilerGLES3::IdentifierActions actions_canvas; ShaderCompilerGLES3::IdentifierActions actions_scene; } shaders; @@ -79,6 +82,9 @@ public: GLuint quadie; GLuint quadie_array; + GLuint transform_feedback_buffers[2]; + GLuint transform_feedback_array; + } resources; struct Info { @@ -133,8 +139,33 @@ public: } }; + struct GeometryOwner : public Instantiable { + + virtual ~GeometryOwner() {} + }; + struct Geometry : Instantiable { + + enum Type { + GEOMETRY_INVALID, + GEOMETRY_SURFACE, + GEOMETRY_IMMEDIATE, + GEOMETRY_MULTISURFACE, + }; + + + Type type; + RID material; + uint64_t last_pass; + uint32_t index; + virtual void material_changed_notify() {} + Geometry() { + last_pass=0; + index=0; + } + + }; @@ -384,7 +415,7 @@ public: uint32_t index; uint64_t last_pass; - Map instantiable_owners; + Map geometry_owners; Map instance_owners; bool can_cast_shadow_cache; @@ -404,8 +435,8 @@ public: mutable SelfList::List _material_dirty_list; void _material_make_dirty(Material *p_material) const; - void _material_add_instantiable(RID p_material,Instantiable *p_instantiable); - void _material_remove_instantiable(RID p_material, Instantiable *p_instantiable); + void _material_add_geometry(RID p_material,Geometry *p_instantiable); + void _material_remove_geometry(RID p_material, Geometry *p_instantiable); mutable RID_Owner material_owner; @@ -433,31 +464,9 @@ public: /* MESH API */ - struct Geometry : Instantiable { - - enum Type { - GEOMETRY_INVALID, - GEOMETRY_SURFACE, - GEOMETRY_IMMEDIATE, - GEOMETRY_MULTISURFACE, - }; - - Type type; - RID material; - uint64_t last_pass; - uint32_t index; - Geometry() { - last_pass=0; - index=0; - } - }; - struct GeometryOwner : public Instantiable { - - virtual ~GeometryOwner() {} - }; struct Mesh; struct Surface : public Geometry { @@ -475,7 +484,7 @@ public: }; Attrib attribs[VS::ARRAY_MAX]; - Attrib morph_attribs[VS::ARRAY_MAX]; + Mesh *mesh; @@ -512,6 +521,10 @@ public: bool active; + virtual void material_changed_notify() { + mesh->instance_material_change_notify(); + } + Surface() { array_byte_size=0; @@ -590,6 +603,8 @@ public: virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const; virtual void mesh_clear(RID p_mesh); + void mesh_render_blend_shapes(Surface *s, float *p_weights); + /* MULTIMESH API */ struct MultiMesh : public GeometryOwner { @@ -699,12 +714,13 @@ public: /* SKELETON API */ - struct Skeleton : Instantiable { + struct Skeleton : RID_Data { int size; bool use_2d; Vector bones; //4x3 or 4x2 depending on what is needed GLuint ubo; SelfList update_list; + Set instances; //instances using skeleton Skeleton() : update_list(this) { size=0; @@ -843,6 +859,8 @@ public: virtual void portal_set_disable_distance(RID p_portal, float p_distance); virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); + virtual void instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); + virtual void instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); virtual void instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance); virtual void instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 78f35c493a..d29927b137 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -502,6 +502,25 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { glBindAttribLocation(v.id, attribute_pairs[i].index, attribute_pairs[i].name ); } + //if feedback exists, set it up + + if (feedback_count) { + Vector feedback; + for(int i=0;imesh_add_surface_from_arrays(mesh,(VisualServer::PrimitiveType)p_primitive, p_arrays,p_blend_shapes); + VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh,(VisualServer::PrimitiveType)p_primitive, p_arrays,p_blend_shapes,p_flags); surfaces.push_back(s); @@ -1024,7 +1024,7 @@ void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); ObjectTypeDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); - ObjectTypeDB::bind_method(_MD("add_surface_from_arrays","primitive","arrays","blend_shapes"),&Mesh::add_surface_from_arrays,DEFVAL(Array())); + ObjectTypeDB::bind_method(_MD("add_surface_from_arrays","primitive","arrays","blend_shapes","compress_flags"),&Mesh::add_surface_from_arrays,DEFVAL(Array()),DEFVAL(ARRAY_COMPRESS_DEFAULT)); ObjectTypeDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); ObjectTypeDB::bind_method(_MD("surface_remove","surf_idx"),&Mesh::surface_remove); ObjectTypeDB::bind_method(_MD("surface_get_array_len","surf_idx"),&Mesh::surface_get_array_len); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 2b28f1187e..b671d8c3b3 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -77,6 +77,22 @@ public: ARRAY_FORMAT_WEIGHTS=1<& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector()); Array surface_get_arrays(int p_surface) const; diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 6f08d69221..8e6175fa5b 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -355,7 +355,30 @@ Ref SurfaceTool::commit(const Ref& p_existing) { w=DVector::Write(); a[i]=array; } break; - case Mesh::ARRAY_FORMAT_BONES: + case Mesh::ARRAY_FORMAT_BONES: { + + + DVector array; + array.resize(varr_len*4); + DVector::Write w = array.write(); + + int idx=0; + for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { + + const Vertex &v=E->get(); + + ERR_CONTINUE( v.bones.size()!=4 ); + + for(int j=0;j<4;j++) { + w[idx+j]=v.bones[j]; + } + + } + + w=DVector::Write(); + a[i]=array; + + } break; case Mesh::ARRAY_FORMAT_WEIGHTS: { @@ -367,18 +390,11 @@ Ref SurfaceTool::commit(const Ref& p_existing) { for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { const Vertex &v=E->get(); + ERR_CONTINUE( v.weights.size()!=4 ); for(int j=0;j<4;j++) { - switch(i) { - case Mesh::ARRAY_WEIGHTS: { - ERR_CONTINUE( v.weights.size()!=4 ); - w[idx+j]=v.weights[j]; - } break; - case Mesh::ARRAY_BONES: { - ERR_CONTINUE( v.bones.size()!=4 ); - w[idx+j]=v.bones[j]; - } break; - } + + w[idx+j]=v.weights[j]; } } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 5f536b8fd4..21cf391af5 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -380,7 +380,8 @@ public: virtual void portal_set_disable_distance(RID p_portal, float p_distance)=0; virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0; - + virtual void instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance)=0; + virtual void instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance)=0; virtual void instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; virtual void instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 2439eacd75..0f7dabcc12 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -738,13 +738,25 @@ void VisualServerScene::instance_attach_object_instance_ID(RID p_instance,Object } void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + if (instance->update_item.in_list()) { + _update_dirty_instance(instance); + } + + ERR_FAIL_INDEX(p_shape,instance->morph_values.size()); + instance->morph_values[p_shape]=p_weight; } + void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); - _update_dirty_instance(instance); + if (instance->update_item.in_list()) { + _update_dirty_instance(instance); + } ERR_FAIL_INDEX(p_surface,instance->materials.size()); @@ -770,13 +782,13 @@ void VisualServerScene::instance_attach_skeleton(RID p_instance,RID p_skeleton){ return; if (instance->skeleton.is_valid()) { - VSG::storage->instance_remove_dependency(p_skeleton,instance); + VSG::storage->instance_remove_skeleton(p_skeleton,instance); } instance->skeleton=p_skeleton; if (instance->skeleton.is_valid()) { - VSG::storage->instance_add_dependency(p_skeleton,instance); + VSG::storage->instance_add_skeleton(p_skeleton,instance); } _instance_queue_update(instance,true); @@ -2227,6 +2239,7 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { if (p_instance->update_aabb) _update_instance_aabb(p_instance); + if (p_instance->update_materials) { if (p_instance->base_type==VS::INSTANCE_MESH) { @@ -2239,6 +2252,14 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { } } p_instance->materials.resize(new_mat_count); + + int new_morph_count = VSG::storage->mesh_get_morph_target_count(p_instance->base); + if (new_morph_count!=p_instance->morph_values.size()) { + p_instance->morph_values.resize(new_morph_count); + for(int i=0;imorph_values[i]=0; + } + } } if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 27b08c4c50..ac894f1286 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -709,7 +709,7 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } break; case VS::ARRAY_BONES: { - ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); + ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); DVector array = p_arrays[ai]; @@ -912,7 +912,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi bsformat|=(1< noindex; AABB laabb; - Error err = _surface_set_data(p_blend_shapes[i],format&~ARRAY_FORMAT_INDEX,offsets,total_elem_size,vertex_array,array_len,noindex,0,laabb,bone_aabb); + Error err = _surface_set_data(p_blend_shapes[i],format&~ARRAY_FORMAT_INDEX,offsets,total_elem_size,vertex_array_shape,array_len,noindex,0,laabb,bone_aabb); aabb.merge_with(laabb); if (err) { ERR_EXPLAIN("Invalid blend shape array format for surface"); @@ -1194,9 +1194,9 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p case VS::ARRAY_BONES: { if (p_format&ARRAY_FLAG_USE_16_BIT_BONES) { - elem_size=sizeof(uint32_t); - } else { elem_size=sizeof(uint16_t)*4; + } else { + elem_size=sizeof(uint32_t); } } break; @@ -1487,7 +1487,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p DVector::Write w = arr.write(); for(int j=0;j& p_mesh,const Map& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data,Vector > p_morph_meshes=Vector >()); + Error _create_mesh_surfaces(bool p_optimize, Ref& p_mesh, const Map& p_material_map, const Collada::MeshData &meshdata, const Transform& p_local_xform, const Vector &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector > p_morph_meshes=Vector >(), bool p_for_morph=false); Error load(const String& p_path, int p_flags, bool p_force_make_tangents=false); void _fix_param_animation_tracks(); void create_animation(int p_clip,bool p_make_tracks_in_all_bones); @@ -597,7 +597,7 @@ static void _generate_tangents_and_binormals(const DVector& p_indices,const } } -Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,const Map& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector > p_morph_meshes) { +Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,const Map& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector > p_morph_meshes,bool p_for_morph) { bool local_xform_mirror=p_local_xform.basis.determinant() < 0; @@ -1072,7 +1072,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con DVector final_color_array; DVector final_uv_array; DVector final_uv2_array; - DVector final_bone_array; + DVector final_bone_array; DVector final_weight_array; uint32_t final_format=0; @@ -1223,12 +1223,12 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con if (has_weights) { DVector weightarray; - DVector bonearray; + DVector bonearray; weightarray.resize(vertex_array.size()*4); DVector::Write weightarrayw = weightarray.write(); bonearray.resize(vertex_array.size()*4); - DVector::Write bonearrayw = bonearray.write(); + DVector::Write bonearrayw = bonearray.write(); for(int k=0;k& p_mesh,con if (l& p_mesh,con } weightarrayw = DVector::Write(); - bonearrayw = DVector::Write(); + bonearrayw = DVector::Write(); final_weight_array = weightarray; final_bone_array = bonearray; @@ -1461,14 +1461,20 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con // print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count())); Array a = p_morph_meshes[mi]->surface_get_arrays(surface); - a[Mesh::ARRAY_BONES]=Variant(); - a[Mesh::ARRAY_WEIGHTS]=Variant(); + //add valid weight and bone arrays if they exist, TODO check if they are unique to shape (generally not) + + if (final_weight_array.size()) + a[Mesh::ARRAY_WEIGHTS]=final_weight_array; + if (final_bone_array.size()) + a[Mesh::ARRAY_BONES]=final_bone_array; + a[Mesh::ARRAY_INDEX]=Variant(); //a.resize(Mesh::ARRAY_MAX); //no need for index mr.push_back(a); } - p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr); + + p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr,p_for_morph?0:Mesh::ARRAY_COMPRESS_DEFAULT); if (material.is_valid()) { p_mesh->surface_set_material(surface, material); @@ -1692,7 +1698,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { if (collada.state.mesh_data_map.has(meshid)) { Ref mesh=Ref(memnew( Mesh )); const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; - Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL); + Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL,Vector >(),true); ERR_FAIL_COND_V(err,err); morphs.push_back(mesh); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 3cd6d8336a..d650725e2e 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1840,6 +1840,8 @@ void ScriptEditor::get_window_layout(Ref p_layout) { void ScriptEditor::_help_class_open(const String& p_class) { + if (p_class=="") + return; for(int i=0;iget_child_count();i++) { -- cgit v1.2.3 From 3f40701002254aeb20e20acbad0cd28a9b7476e3 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 24 Nov 2016 23:30:54 -0300 Subject: fixed bug removing dependencies --- drivers/gles3/rasterizer_storage_gles3.cpp | 15 ++++++++++++++- drivers/gles3/rasterizer_storage_gles3.h | 14 +++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 559f733e4d..e9d9136a0b 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5272,6 +5272,7 @@ bool RasterizerStorageGLES3::free(RID p_rid){ // delete the texture Shader *shader = shader_owner.get(p_rid); + if (shader->shader) shader->shader->free_custom_shader(shader->custom_code_id); @@ -5348,7 +5349,7 @@ bool RasterizerStorageGLES3::free(RID p_rid){ // delete the texture Mesh *mesh = mesh_owner.get(p_rid); - + mesh->instance_remove_deps(); mesh_clear(p_rid); mesh_owner.free(p_rid); @@ -5358,6 +5359,7 @@ bool RasterizerStorageGLES3::free(RID p_rid){ // delete the texture MultiMesh *multimesh = multimesh_owner.get(p_rid); + multimesh->instance_remove_deps(); multimesh_allocate(p_rid,0,VS::MULTIMESH_TRANSFORM_2D,VS::MULTIMESH_COLOR_NONE); //frees multimesh update_dirty_multimeshes(); @@ -5367,6 +5369,7 @@ bool RasterizerStorageGLES3::free(RID p_rid){ } else if (immediate_owner.owns(p_rid)) { Immediate *immediate = immediate_owner.get(p_rid); + immediate->instance_remove_deps(); immediate_owner.free(p_rid); memdelete(immediate); @@ -5374,10 +5377,20 @@ bool RasterizerStorageGLES3::free(RID p_rid){ // delete the texture Light *light = light_owner.get(p_rid); + light->instance_remove_deps(); light_owner.free(p_rid); memdelete(light); + } else if (reflection_probe_owner.owns(p_rid)) { + + // delete the texture + ReflectionProbe *reflection_probe = reflection_probe_owner.get(p_rid); + reflection_probe->instance_remove_deps(); + + reflection_probe_owner.free(p_rid); + memdelete(reflection_probe); + } else if (canvas_occluder_owner.owns(p_rid)) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 361e738af5..62199b10ff 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -130,12 +130,20 @@ public: } } + _FORCE_INLINE_ void instance_remove_deps() { + SelfList *instances = instance_list.first(); + while(instances) { + + SelfList *next = instances->next(); + instances->self()->base_removed(); + instances=next; + } + } + + Instantiable() { } virtual ~Instantiable() { - while(instance_list.first()) { - instance_list.first()->self()->base_removed(); - } } }; -- cgit v1.2.3 From a47c78aed113a9b4c009c5a2ef29c690192c7eef Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 29 Nov 2016 19:55:12 -0300 Subject: Screen space reflection effect --- drivers/gles2/shaders/copy.glsl | 10 + drivers/gles3/rasterizer_canvas_gles3.cpp | 2 +- drivers/gles3/rasterizer_gles3.cpp | 6 +- drivers/gles3/rasterizer_scene_gles3.cpp | 172 +++++++++- drivers/gles3/rasterizer_scene_gles3.h | 27 ++ drivers/gles3/rasterizer_storage_gles3.cpp | 169 ++++++---- drivers/gles3/rasterizer_storage_gles3.h | 37 ++- drivers/gles3/shader_gles3.cpp | 4 +- drivers/gles3/shaders/SCsub | 3 + drivers/gles3/shaders/copy.glsl | 19 ++ drivers/gles3/shaders/resolve.glsl | 45 +++ drivers/gles3/shaders/resolve.glsl.h | 166 ++++++++++ drivers/gles3/shaders/scene.glsl | 6 +- drivers/gles3/shaders/screen_space.glsl.h | 183 +++++++++++ drivers/gles3/shaders/screen_space_reflection.glsl | 350 +++++++++++++++++++++ scene/resources/environment.cpp | 120 +++++++ scene/resources/environment.h | 29 ++ servers/visual/rasterizer.h | 2 + servers/visual/visual_server_raster.h | 1 + servers/visual_server.h | 2 +- tools/collada/collada.cpp | 12 +- 21 files changed, 1284 insertions(+), 81 deletions(-) create mode 100644 drivers/gles3/shaders/resolve.glsl create mode 100644 drivers/gles3/shaders/resolve.glsl.h create mode 100644 drivers/gles3/shaders/screen_space.glsl.h create mode 100644 drivers/gles3/shaders/screen_space_reflection.glsl diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index ae7185a1d6..cb42970921 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -71,6 +71,11 @@ uniform sampler2D source; #endif varying vec2 uv2_interp; + +#ifdef USE_DEPTH +uniform highp sampler2D source_depth; //texunit:1 +#endif + #ifdef USE_GLOW uniform sampler2D glow_source; @@ -547,5 +552,10 @@ void main() { gl_FragColor = color; + +#ifdef USE_DEPTH + gl_FragDepth = texture(source_depth,uv_interp).r; +#endif + } diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 1f23387516..3c6094a41d 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1349,7 +1349,7 @@ void RasterizerCanvasGLES3::reset_canvas() { if (storage->frame.current_rt) { - glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); glColorMask(1,1,1,1); //don't touch alpha } diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 9046028705..3924ffb75f 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -178,7 +178,7 @@ void RasterizerGLES3::set_current_render_target(RID p_render_target){ if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) { //handle pending clear request, if the framebuffer was not cleared - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); print_line("unbind clear of: "+storage->frame.clear_request_color); glClearColor( storage->frame.clear_request_color.r, @@ -213,7 +213,7 @@ void RasterizerGLES3::restore_render_target() { ERR_FAIL_COND(storage->frame.current_rt==NULL); RasterizerStorageGLES3::RenderTarget * rt = storage->frame.current_rt; - glBindFramebuffer(GL_FRAMEBUFFER,rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,rt->fbo); glViewport(0,0,rt->width,rt->height); } @@ -238,7 +238,7 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target,const Rec glDisable(GL_BLEND); glBindFramebuffer(GL_FRAMEBUFFER,storage->config.system_fbo); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,rt->front.color); + glBindTexture(GL_TEXTURE_2D,rt->color); canvas->draw_generic_textured_rect(p_screen_rect,Rect2(0,0,1,-1)); glBindTexture(GL_TEXTURE_2D,0); canvas->canvas_end(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 9de441c2bb..16784246f6 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -857,6 +857,21 @@ void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_b } +void RasterizerSceneGLES3::environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness) { + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->ssr_enabled=p_enable; + env->ssr_max_steps=p_max_steps; + env->ssr_accel=p_accel; + env->ssr_fade=p_fade; + env->ssr_depth_tolerance=p_depth_tolerance; + env->ssr_smooth=p_smooth; + env->ssr_roughness=p_roughness; + +} + void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, bool p_enable, float p_exposure, float p_white, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale, VS::EnvironmentToneMapper p_tone_mapper){ } @@ -2538,7 +2553,7 @@ void RasterizerSceneGLES3::_copy_screen() { void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) { //copy to front buffer - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); glDepthMask(GL_FALSE); glDisable(GL_DEPTH_TEST); @@ -2575,7 +2590,7 @@ void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) { void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) { //copy to front buffer - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->front.fbo); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); glDepthMask(GL_FALSE); glDisable(GL_DEPTH_TEST); @@ -2660,6 +2675,127 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_ } +void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_cam_projection) { + + + glDepthMask(GL_FALSE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + + if (env->ssr_enabled) { + //blur diffuse into effect mipmaps using separatable convolution + //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); + for(int i=0;iframe.current_rt->effects.mip_maps[1].sizes.size();i++) { + + + int vp_w = storage->frame.current_rt->effects.mip_maps[1].sizes[i].width; + int vp_h = storage->frame.current_rt->effects.mip_maps[1].sizes[i].height; + glViewport(0,0,vp_w,vp_h); + //horizontal pass + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i)); + glActiveTexture(GL_TEXTURE0); + if (i==0) { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + } else { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); //previous level, since mipmaps[0] starts one level bigger + } + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[i].fbo); + _copy_screen(); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL,false); + + //vertical pass + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_VERTICAL,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i)); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[i+1].fbo); //next level, since mipmaps[0] starts one level bigger + _copy_screen(); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_VERTICAL,false); + } + + + //perform SSR + + state.ssr_shader.set_conditional(ScreenSpaceReflectionShaderGLES3::SMOOTH_ACCEL,env->ssr_accel>0 && env->ssr_smooth); + state.ssr_shader.set_conditional(ScreenSpaceReflectionShaderGLES3::REFLECT_ROUGHNESS,env->ssr_accel>0 && env->ssr_roughness); + + state.ssr_shader.bind(); + + int ssr_w = storage->frame.current_rt->effects.mip_maps[1].sizes[0].width; + int ssr_h = storage->frame.current_rt->effects.mip_maps[1].sizes[0].height; + + + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::PIXEL_SIZE,Vector2(1.0/(ssr_w*0.5),1.0/(ssr_h*0.5))); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::PROJECTION,p_cam_projection); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::INVERSE_PROJECTION,p_cam_projection.inverse()); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::VIEWPORT_SIZE,Size2(ssr_w,ssr_h)); + //state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::FRAME_INDEX,int(render_pass)); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::FILTER_MIPMAP_LEVELS,float(storage->frame.current_rt->effects.mip_maps[0].sizes.size())); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::NUM_STEPS,env->ssr_max_steps); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::ACCELERATION,env->ssr_accel); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::DEPTH_TOLERANCE,env->ssr_depth_tolerance); + state.ssr_shader.set_uniform(ScreenSpaceReflectionShaderGLES3::DISTANCE_FADE,env->ssr_fade); + + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_sr); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); + glActiveTexture(GL_TEXTURE3); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[0].fbo); + glViewport(0,0,ssr_w,ssr_h); + + _copy_screen(); + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + + } + + + state.resolve_shader.set_conditional(ResolveShaderGLES3::USE_SSR,env->ssr_enabled); + state.resolve_shader.bind(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.specular); + if (env->ssr_enabled) { + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color); + } + + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); + //glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + _copy_screen(); + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(0)); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); + + _copy_screen(); + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY,false); + + +} + + void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){ //first of all, make a new render pass @@ -2700,7 +2836,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C render_list.clear(); - bool use_mrt=false; + bool use_mrt=true; _fill_render_list(p_cull_result,p_cull_count,false); @@ -2712,10 +2848,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - + //rendering to a probe cubemap side ReflectionProbeInstance *probe = reflection_probe_instance_owner.getornull(p_reflection_probe); GLuint current_fbo; + if (probe) { ReflectionAtlas *ref_atlas = reflection_atlas_owner.getptr(probe->atlas); @@ -2739,6 +2876,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glViewport(0,0,reflection_cubemaps[cubemap_index].size,reflection_cubemaps[cubemap_index].size); glBindFramebuffer(GL_FRAMEBUFFER,current_fbo); + } else { glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); @@ -2750,6 +2888,13 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,true); + + Vector draw_buffers; + draw_buffers.push_back(GL_COLOR_ATTACHMENT0); + draw_buffers.push_back(GL_COLOR_ATTACHMENT1); + draw_buffers.push_back(GL_COLOR_ATTACHMENT2); + glDrawBuffers(draw_buffers.size(),draw_buffers.ptr()); + Color black(0,0,0,0); glClearBufferfv(GL_COLOR,1,black.components); // specular glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough @@ -2760,6 +2905,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + } } @@ -2841,6 +2987,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + if (use_mrt) { + GLenum gldb = GL_COLOR_ATTACHMENT0; + glDrawBuffers(1,&gldb); + } + if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { if (use_mrt) { @@ -2859,16 +3010,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C // state.scene_shader.set_conditional( SceneShaderGLES3::USE_FOG,false); + + if (use_mrt) { + _render_mrts(env,p_cam_projection); + } + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glEnable(GL_BLEND); glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - if (use_mrt) { - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); - } - render_list.sort_by_depth(true); if (state.directional_light_count==0) { @@ -3812,6 +3964,10 @@ void RasterizerSceneGLES3::initialize() { glEnable(GL_PROGRAM_POINT_SIZE); #endif + + state.resolve_shader.init(); + state.ssr_shader.init(); + state.effect_blur_shader.init(); } void RasterizerSceneGLES3::iteration() { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 929b01e373..0b934085ed 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -4,6 +4,9 @@ #include "rasterizer_storage_gles3.h" #include "drivers/gles3/shaders/scene.glsl.h" #include "drivers/gles3/shaders/cube_to_dp.glsl.h" +#include "drivers/gles3/shaders/resolve.glsl.h" +#include "drivers/gles3/shaders/screen_space_reflection.glsl.h" +#include "drivers/gles3/shaders/effect_blur.glsl.h" class RasterizerSceneGLES3 : public RasterizerScene { public: @@ -45,6 +48,9 @@ public: SceneShaderGLES3 scene_shader; CubeToDpShaderGLES3 cube_to_dp_shader; + ResolveShaderGLES3 resolve_shader; + ScreenSpaceReflectionShaderGLES3 ssr_shader; + EffectBlurShaderGLES3 effect_blur_shader; struct SceneDataUBO { @@ -289,6 +295,15 @@ public: int canvas_max_layer; + bool ssr_enabled; + int ssr_max_steps; + float ssr_accel; + float ssr_fade; + float ssr_depth_tolerance; + bool ssr_smooth; + bool ssr_roughness; + + Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; @@ -298,6 +313,15 @@ public: ambient_energy=1.0; ambient_skybox_contribution=0.0; canvas_max_layer=0; + + ssr_enabled=false; + ssr_max_steps=64; + ssr_accel=0.04; + ssr_fade=2.0; + ssr_depth_tolerance=0.2; + ssr_smooth=true; + ssr_roughness=true; + } }; @@ -316,6 +340,8 @@ public: virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); + virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness); + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper); virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp); @@ -551,6 +577,7 @@ public: void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow); + void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection); virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass); virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count); virtual bool free(RID p_rid); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index e9d9136a0b..01668e728c 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4760,16 +4760,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { - if (rt->front.fbo) { - glDeleteFramebuffers(1,&rt->front.fbo); - glDeleteTextures(1,&rt->front.color); - rt->front.fbo=0; - } - - if (rt->back.fbo) { - glDeleteFramebuffers(1,&rt->back.fbo); - glDeleteTextures(1,&rt->back.color); - rt->back.fbo=0; + if (rt->fbo) { + glDeleteFramebuffers(1,&rt->fbo); + glDeleteTextures(1,&rt->color); + rt->fbo=0; } if (rt->buffers.fbo) { @@ -4783,7 +4777,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { } if (rt->depth) { - glDeleteRenderbuffers(1,&rt->depth); + glDeleteTextures(1,&rt->depth); rt->depth=0; } @@ -4793,6 +4787,22 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { tex->width=0; tex->height=0; + for(int i=0;i<2;i++) { + for(int j=0;jeffects.mip_maps[i].sizes.size();j++) { + glDeleteFramebuffers(1,&rt->effects.mip_maps[i].sizes[j].fbo); + } + + glDeleteTextures(1,&rt->effects.mip_maps[i].color); + rt->effects.mip_maps[i].sizes.clear(); + rt->effects.mip_maps[i].levels=0; + } +/* + if (rt->effects.screen_space_depth) { + glDeleteTextures(1,&rt->effects.screen_space_depth); + rt->effects.screen_space_depth=0; + + } +*/ } void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ @@ -4833,21 +4843,24 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ glActiveTexture(GL_TEXTURE0); - glGenFramebuffers(1, &rt->front.fbo); - glBindFramebuffer(GL_FRAMEBUFFER, rt->front.fbo); - - - glGenRenderbuffers(1, &rt->depth); - glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); + glGenFramebuffers(1, &rt->fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo); - glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8, rt->width, rt->height); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); - glBindRenderbuffer(GL_RENDERBUFFER, 0 ); + glGenTextures(1, &rt->depth); + glBindTexture(GL_TEXTURE_2D, rt->depth); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, rt->width, rt->height, 0, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, rt->depth, 0); - glGenTextures(1, &rt->front.color); - glBindTexture(GL_TEXTURE_2D, rt->front.color); + glGenTextures(1, &rt->color); + glBindTexture(GL_TEXTURE_2D, rt->color); glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); @@ -4855,7 +4868,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->front.color, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); @@ -4867,7 +4880,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ tex->gl_format_cache=color_format; tex->gl_type_cache=color_type; tex->gl_internal_format_cache=color_internal_format; - tex->tex_id=rt->front.color; + tex->tex_id=rt->color; tex->width=rt->width; tex->alloc_width=rt->width; tex->height=rt->height; @@ -4881,32 +4894,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ /* BACK FBO */ - if (!rt->flags[RENDER_TARGET_NO_SAMPLING]) { - - glGenFramebuffers(1, &rt->back.fbo); - glBindFramebuffer(GL_FRAMEBUFFER, rt->back.fbo); - glBindRenderbuffer(GL_RENDERBUFFER, rt->depth ); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); - - glGenTextures(1, &rt->back.color); - glBindTexture(GL_TEXTURE_2D, rt->back.color); - glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->back.color, 0); - - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); - - if (status != GL_FRAMEBUFFER_COMPLETE) { - _render_target_clear(rt); - ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); - } - } - if (config.render_arch==RENDER_ARCH_DESKTOP && !rt->flags[RENDER_TARGET_NO_3D]) { @@ -4915,11 +4902,12 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ glGenFramebuffers(1, &rt->buffers.fbo); glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, rt->depth, 0); glGenTextures(1, &rt->buffers.diffuse); glBindTexture(GL_TEXTURE_2D, rt->buffers.diffuse); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, rt->width, rt->height, 0, GL_RGBA, GL_HALF_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -4958,7 +4946,9 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ glGenFramebuffers(1, &rt->buffers.alpha_fbo); glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.alpha_fbo); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, rt->depth, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0); status = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -4969,9 +4959,80 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); } - } + for(int i=0;i<2;i++) { + + ERR_FAIL_COND( rt->effects.mip_maps[i].sizes.size() ); + int w=rt->width; + int h=rt->height; + + + if (i>0) { + w>>=1; + h>>=1; + } + + + glGenTextures(1, &rt->effects.mip_maps[i].color); + glBindTexture(GL_TEXTURE_2D, rt->effects.mip_maps[i].color); + int level=0; + + while(true) { + + RenderTarget::Effects::MipMaps::Size mm; + + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, NULL); + mm.width=w; + mm.height=h; + rt->effects.mip_maps[i].sizes.push_back(mm); + + w>>=1; + h>>=1; + + if (w<32 || h<32) + break; //going less than 32 is pointless + + level++; + + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level); + + + for(int j=0;jeffects.mip_maps[i].sizes.size();j++) { + + RenderTarget::Effects::MipMaps::Size &mm=rt->effects.mip_maps[i].sizes[j]; + + glGenFramebuffers(1, &mm.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, mm.fbo); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,rt->effects.mip_maps[i].color ,j); + + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + + + float zero[4]={1,0,1,0}; + glClearBufferfv(GL_COLOR,0,zero); + + + } + + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); + rt->effects.mip_maps[i].levels=level; + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } + + } } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 62199b10ff..1eba8b42c9 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -877,11 +877,8 @@ public: struct RenderTarget : public RID_Data { - struct Color { - GLuint fbo; - GLuint color; - } front,back; - + GLuint fbo; + GLuint color; GLuint depth; struct Buffers { @@ -890,8 +887,35 @@ public: GLuint specular; GLuint diffuse; GLuint normal_sr; + GLuint temporal; } buffers; + struct Effects { + + struct MipMaps { + + struct Size { + GLuint fbo; + int width; + int height; + }; + + Vector sizes; + GLuint color; + int levels; + + MipMaps() { color=0; levels=0;} + }; + + MipMaps mip_maps[2]; //first mipmap chain starts from full-screen + //GLuint depth2; //depth for the second mipmap chain, in case of desiring upsampling + + Effects() { + + } + + } effects; + int width,height; bool flags[RENDER_TARGET_FLAG_MAX]; @@ -905,8 +929,7 @@ public: width=0; height=0; depth=0; - front.fbo=0; - back.fbo=0; + fbo=0; buffers.fbo=0; buffers.alpha_fbo=0; used_in_frame=false; diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index d29927b137..778d3b23ec 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -393,8 +393,8 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { strings.resize(strings_base_size); //fragment precision is medium - strings.push_back("precision mediump float;\n"); - strings.push_back("precision mediump int;\n"); + strings.push_back("precision highp float;\n"); + strings.push_back("precision highp int;\n"); #if 0 if (cc) { diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index a9808dcbcf..66a19eefd1 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -2,10 +2,13 @@ Import('env') if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('copy.glsl'); + env.GLES3_GLSL('resolve.glsl'); env.GLES3_GLSL('canvas.glsl'); env.GLES3_GLSL('canvas_shadow.glsl'); env.GLES3_GLSL('scene.glsl'); env.GLES3_GLSL('cubemap_filter.glsl'); env.GLES3_GLSL('cube_to_dp.glsl'); env.GLES3_GLSL('blend_shape.glsl'); + env.GLES3_GLSL('screen_space_reflection.glsl'); + env.GLES3_GLSL('effect_blur.glsl'); diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index 79982ecf25..a87d62f2d7 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -50,6 +50,7 @@ float sRGB_gamma_correct(float c){ uniform float stuff; +uniform vec2 pixel_size; in vec2 uv2_interp; @@ -81,6 +82,24 @@ void main() { color.a=1.0; #endif + +#ifdef GAUSSIAN_HORIZONTAL + color*=0.38774; + color+=texture( source, uv_interp+vec2( 1.0, 0.0)*pixel_size )*0.24477; + color+=texture( source, uv_interp+vec2( 2.0, 0.0)*pixel_size )*0.06136; + color+=texture( source, uv_interp+vec2(-1.0, 0.0)*pixel_size )*0.24477; + color+=texture( source, uv_interp+vec2(-2.0, 0.0)*pixel_size )*0.06136; +#endif + +#ifdef GAUSSIAN_VERTICAL + color*=0.38774; + color+=texture( source, uv_interp+vec2( 0.0, 1.0)*pixel_size )*0.24477; + color+=texture( source, uv_interp+vec2( 0.0, 2.0)*pixel_size )*0.06136; + color+=texture( source, uv_interp+vec2( 0.0,-1.0)*pixel_size )*0.24477; + color+=texture( source, uv_interp+vec2( 0.0,-2.0)*pixel_size )*0.06136; +#endif + + frag_color = color; } diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl new file mode 100644 index 0000000000..4ca6297303 --- /dev/null +++ b/drivers/gles3/shaders/resolve.glsl @@ -0,0 +1,45 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; + + +void main() { + + uv_interp = uv_in; + gl_Position = vertex_attrib; +} + +[fragment] + + +in vec2 uv_interp; +uniform sampler2D source_diffuse; //texunit:0 +uniform sampler2D source_specular; //texunit:1 + + +uniform sampler2D source_ssr_ssao; //texunit:2 + +uniform float stuff; + +in vec2 uv2_interp; + +layout(location = 0) out vec4 frag_color; + +void main() { + + vec4 diffuse = texture( source_diffuse, uv_interp ); + vec4 specular = texture( source_specular, uv_interp ); + +#ifdef USE_SSR + + vec4 ssr = textureLod(source_ssr_ssao,uv_interp,0.0); + specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a); +#endif + + frag_color = vec4(diffuse.rgb,1.0)+vec4(specular.rgb,1.0); +} + diff --git a/drivers/gles3/shaders/resolve.glsl.h b/drivers/gles3/shaders/resolve.glsl.h new file mode 100644 index 0000000000..72baf50716 --- /dev/null +++ b/drivers/gles3/shaders/resolve.glsl.h @@ -0,0 +1,166 @@ +/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */ +#ifndef RESOLVE_GLSL_HGLES3_120 +#define RESOLVE_GLSL_HGLES3_120 + + +#include "drivers/gles3/shader_gles3.h" + + +class ResolveShaderGLES3 : public ShaderGLES3 { + + virtual String get_shader_name() const { return "ResolveShaderGLES3"; } +public: + + enum Conditionals { + USE_SSR, + }; + + enum Uniforms { + STUFF, + }; + + _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); } + + _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); } + + #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this ); + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU + + const Transform &tr = p_transform; + + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.basis.elements[0][0], + tr.basis.elements[1][0], + tr.basis.elements[2][0], + 0, + tr.basis.elements[0][1], + tr.basis.elements[1][1], + tr.basis.elements[2][1], + 0, + tr.basis.elements[0][2], + tr.basis.elements[1][2], + tr.basis.elements[2][2], + 0, + tr.origin.x, + tr.origin.y, + tr.origin.z, + 1 + }; + + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + + + } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU + + const Matrix32 &tr = p_transform; + + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.elements[0][0], + tr.elements[0][1], + 0, + 0, + tr.elements[1][0], + tr.elements[1][1], + 0, + 0, + 0, + 0, + 1, + 0, + tr.elements[2][0], + tr.elements[2][1], + 0, + 1 + }; + + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + + + } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU + + GLfloat matrix[16]; + + for (int i=0;i<4;i++) { + for (int j=0;j<4;j++) { + + matrix[i*4+j]=p_matrix.matrix[i][j]; + } + } + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + }; + +#undef _FU + + + virtual void init() { + + static const Enum *_enums=NULL; + static const EnumValue *_enum_values=NULL; + static const char* _conditional_strings[]={ + "#define USE_SSR\n", + }; + + static const char* _uniform_strings[]={ + "stuff", + }; + + static AttributePair *_attribute_pairs=NULL; + static const Feedback* _feedbacks=NULL; + static TexUnitPair _texunit_pairs[]={ + {"source_diffuse",0}, + {"source_specular",1}, + {"source_ssr_ssao",2}, + }; + + static UBOPair *_ubo_pairs=NULL; + static const char _vertex_code[]={ +10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,125,10,10, 0}; + + static const int _vertex_code_start=1; + static const char _fragment_code[]={ +10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,59,32,47,47,116,101,120,117,110,105,116,58,49,10,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,59,32,47,47,116,101,120,117,110,105,116,58,50,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,115,116,117,102,102,59,10,10,105,110,32,118,101,99,50,32,117,118,50,95,105,110,116,101,114,112,59,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,115,112,101,99,117,108,97,114,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,10,35,105,102,100,101,102,32,85,83,69,95,83,83,82,10,10,9,118,101,99,52,32,115,115,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,44,117,118,95,105,110,116,101,114,112,44,48,46,48,41,59,10,9,115,112,101,99,117,108,97,114,46,114,103,98,32,61,32,109,105,120,40,115,112,101,99,117,108,97,114,46,114,103,98,44,115,115,114,46,114,103,98,42,115,112,101,99,117,108,97,114,46,97,44,115,115,114,46,97,41,59,10,35,101,110,100,105,102,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,46,114,103,98,44,49,46,48,41,43,118,101,99,52,40,115,112,101,99,117,108,97,114,46,114,103,98,44,49,46,48,41,59,10,125,10,10, 0}; + + static const int _fragment_code_start=16; + setup(_conditional_strings,1,_uniform_strings,1,_attribute_pairs,0, _texunit_pairs,3,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start); + }; + +}; + +#endif + diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index c198534728..192042192e 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1189,8 +1189,10 @@ LIGHT_SHADER_CODE #endif //ENABLE_AO diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale); - specular_buffer=vec4(specular_light,0.0); - normal_mr_buffer=vec4(normal.x,normal.y,max(specular.r,max(specular.g,specular.b)),roughness); + specular_buffer=vec4(specular_light,max(specular.r,max(specular.g,specular.b))); + + + normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness); #else diff --git a/drivers/gles3/shaders/screen_space.glsl.h b/drivers/gles3/shaders/screen_space.glsl.h new file mode 100644 index 0000000000..f39d04429d --- /dev/null +++ b/drivers/gles3/shaders/screen_space.glsl.h @@ -0,0 +1,183 @@ +/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */ +#ifndef SCREEN_SPACE_GLSL_HGLES3_120 +#define SCREEN_SPACE_GLSL_HGLES3_120 + + +#include "drivers/gles3/shader_gles3.h" + + +class ScreenSpaceShaderGLES3 : public ShaderGLES3 { + + virtual String get_shader_name() const { return "ScreenSpaceShaderGLES3"; } +public: + + enum Conditionals { + BLEND_ACCEL, + REFLECT_ROUGHNESS, + }; + + enum Uniforms { + CAMERA_Z_NEAR, + CAMERA_Z_FAR, + VIEWPORT_SIZE, + PIXEL_SIZE, + FILTER_MIPMAP_LEVELS, + INVERSE_PROJECTION, + PROJECTION, + FRAME_INDEX, + }; + + _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); } + + _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); } + + #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this ); + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU + + const Transform &tr = p_transform; + + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.basis.elements[0][0], + tr.basis.elements[1][0], + tr.basis.elements[2][0], + 0, + tr.basis.elements[0][1], + tr.basis.elements[1][1], + tr.basis.elements[2][1], + 0, + tr.basis.elements[0][2], + tr.basis.elements[1][2], + tr.basis.elements[2][2], + 0, + tr.origin.x, + tr.origin.y, + tr.origin.z, + 1 + }; + + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + + + } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU + + const Matrix32 &tr = p_transform; + + GLfloat matrix[16]={ /* build a 16x16 matrix */ + tr.elements[0][0], + tr.elements[0][1], + 0, + 0, + tr.elements[1][0], + tr.elements[1][1], + 0, + 0, + 0, + 0, + 1, + 0, + tr.elements[2][0], + tr.elements[2][1], + 0, + 1 + }; + + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + + + } + + _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU + + GLfloat matrix[16]; + + for (int i=0;i<4;i++) { + for (int j=0;j<4;j++) { + + matrix[i*4+j]=p_matrix.matrix[i][j]; + } + } + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); + }; + +#undef _FU + + + virtual void init() { + + static const Enum *_enums=NULL; + static const EnumValue *_enum_values=NULL; + static const char* _conditional_strings[]={ + "#define BLEND_ACCEL\n", + "#define REFLECT_ROUGHNESS\n", + }; + + static const char* _uniform_strings[]={ + "camera_z_near", + "camera_z_far", + "viewport_size", + "pixel_size", + "filter_mipmap_levels", + "inverse_projection", + "projection", + "frame_index", + }; + + static AttributePair *_attribute_pairs=NULL; + static const Feedback* _feedbacks=NULL; + static TexUnitPair _texunit_pairs[]={ + {"source_diffuse",0}, + {"source_normal_roughness",1}, + {"source_depth",2}, + {"source_diffuse_mipmaps",3}, + }; + + static UBOPair *_ubo_pairs=NULL; + static const char _vertex_code[]={ +10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,111,117,116,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,9,112,111,115,95,105,110,116,101,114,112,46,120,121,61,103,108,95,80,111,115,105,116,105,111,110,46,120,121,59,10,125,10,10, 0}; + + static const int _vertex_code_start=1; + static const char _fragment_code[]={ +10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,105,110,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,59,32,47,47,116,101,120,117,110,105,116,58,49,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,101,112,116,104,59,32,47,47,116,101,120,117,110,105,116,58,50,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,59,32,47,47,116,101,120,117,110,105,116,58,51,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,110,101,97,114,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,10,117,110,105,102,111,114,109,32,118,101,99,50,32,118,105,101,119,112,111,114,116,95,115,105,122,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,112,105,120,101,108,95,115,105,122,101,59,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,59,10,10,117,110,105,102,111,114,109,32,109,97,116,52,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,59,10,117,110,105,102,111,114,109,32,109,97,116,52,32,112,114,111,106,101,99,116,105,111,110,59,10,10,117,110,105,102,111,114,109,32,105,110,116,32,102,114,97,109,101,95,105,110,100,101,120,59,10,10,118,101,99,50,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,99,51,32,118,105,101,119,95,112,111,115,44,111,117,116,32,102,108,111,97,116,32,119,41,32,123,10,32,32,32,32,118,101,99,52,32,112,114,111,106,101,99,116,101,100,32,61,32,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,118,105,101,119,95,112,111,115,44,32,49,46,48,41,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,122,32,47,61,32,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,32,61,32,112,114,111,106,101,99,116,101,100,46,120,121,32,42,32,48,46,53,32,43,32,48,46,53,59,10,32,32,32,32,119,61,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,114,101,116,117,114,110,32,112,114,111,106,101,99,116,101,100,46,120,121,59,10,125,10,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,35,100,101,102,105,110,101,32,78,85,77,95,82,65,89,68,73,82,95,82,69,84,82,73,69,83,32,51,10,10,47,47,102,114,111,109,32,104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,116,111,98,115,112,114,44,32,105,102,32,105,116,32,119,111,114,107,115,32,102,111,114,32,121,111,117,44,32,100,117,100,101,46,46,10,118,101,99,51,32,114,97,110,100,95,114,103,98,40,118,101,99,50,32,99,111,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,97,98,115,40,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,44,32,118,101,99,50,40,51,52,46,52,56,51,53,44,32,56,57,46,54,51,55,50,41,41,41,32,42,10,9,118,101,99,51,40,50,57,49,53,54,46,52,55,54,53,44,32,51,56,50,55,51,46,53,54,51,57,51,44,32,52,55,56,52,51,46,55,53,52,54,56,41,41,41,32,42,32,50,32,45,32,49,59,10,125,10,10,35,100,101,102,105,110,101,32,77,95,80,73,32,51,46,49,52,49,53,57,50,54,53,51,53,57,10,10,118,101,99,51,32,105,109,112,111,114,116,97,110,99,101,95,115,97,109,112,108,101,95,103,103,120,40,118,101,99,50,32,120,105,44,32,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,41,10,123,10,32,32,32,32,102,108,111,97,116,32,114,95,115,113,117,97,114,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,114,111,117,103,104,110,101,115,115,59,10,32,32,32,32,102,108,111,97,116,32,112,104,105,32,61,32,50,32,42,32,77,95,80,73,32,42,32,120,105,46,120,59,10,32,32,32,32,102,108,111,97,116,32,99,111,115,95,116,104,101,116,97,32,61,32,115,113,114,116,40,40,49,32,45,32,120,105,46,121,41,32,47,32,40,49,32,43,32,40,114,95,115,113,117,97,114,101,32,42,32,114,95,115,113,117,97,114,101,32,45,32,49,41,32,42,32,120,105,46,121,41,41,59,10,32,32,32,32,102,108,111,97,116,32,115,105,110,95,116,104,101,116,97,32,61,32,115,113,114,116,40,49,32,45,32,99,111,115,95,116,104,101,116,97,32,42,32,99,111,115,95,116,104,101,116,97,41,59,10,10,32,32,32,32,114,101,116,117,114,110,32,118,101,99,51,40,115,105,110,95,116,104,101,116,97,32,42,32,99,111,115,40,112,104,105,41,44,32,115,105,110,95,116,104,101,116,97,32,42,32,115,105,110,40,112,104,105,41,44,32,99,111,115,95,116,104,101,116,97,41,59,10,125,10,10,118,111,105,100,32,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,118,101,99,51,32,110,111,114,109,97,108,44,32,111,117,116,32,118,101,99,51,32,116,97,110,103,101,110,116,44,32,111,117,116,32,118,101,99,51,32,98,105,116,97,110,103,101,110,116,41,32,123,10,32,32,32,32,118,101,99,51,32,118,48,32,61,32,97,98,115,40,110,111,114,109,97,108,46,122,41,32,60,32,48,46,57,57,57,32,63,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,49,46,48,41,32,58,32,118,101,99,51,40,48,46,48,44,32,49,46,48,44,32,48,46,48,41,59,10,32,32,32,32,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,118,48,44,32,110,111,114,109,97,108,41,41,59,10,32,32,32,32,98,105,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,116,97,110,103,101,110,116,44,32,110,111,114,109,97,108,41,41,59,10,125,10,10,98,111,111,108,32,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,102,108,111,97,116,32,122,44,32,102,108,111,97,116,32,122,95,97,44,32,102,108,111,97,116,32,122,95,98,44,32,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,103,116,104,44,32,111,117,116,32,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,41,32,123,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,99,111,114,114,101,99,116,44,32,98,117,116,32,108,111,111,107,115,32,119,101,105,114,100,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,110,111,116,32,102,105,108,108,101,100,10,32,32,32,32,47,47,32,114,101,116,117,114,110,32,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,62,61,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,48,46,48,48,48,49,53,32,38,38,32,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,59,10,10,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,34,105,110,99,111,114,114,101,99,116,34,44,32,98,117,116,32,108,111,111,107,115,32,98,101,116,116,101,114,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,103,101,116,116,105,110,103,32,102,105,108,108,101,100,32,116,104,101,110,10,32,32,32,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,61,48,46,48,48,48,49,59,10,32,32,32,32,99,111,110,115,116,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,32,61,32,48,46,48,48,48,48,48,49,59,10,32,32,32,32,105,102,32,40,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,41,32,123,10,10,32,32,32,32,32,105,102,32,40,116,114,117,101,41,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,40,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,41,32,62,61,10,9,9,9,32,32,32,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,59,10,32,32,32,32,32,125,32,101,108,115,101,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,116,114,117,101,59,10,32,32,32,32,32,32,125,10,10,9,114,101,116,117,114,110,32,116,114,117,101,59,10,32,32,32,32,125,10,10,32,32,32,32,114,101,116,117,114,110,32,102,97,108,115,101,59,10,125,10,10,98,111,111,108,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,118,101,99,50,32,116,99,111,111,114,100,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,116,99,111,111,114,100,46,120,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,120,32,62,32,49,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,62,32,49,46,48,59,10,125,10,10,102,108,111,97,116,32,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,118,101,99,50,32,97,44,32,118,101,99,50,32,98,41,32,123,32,97,32,45,61,32,98,59,32,114,101,116,117,114,110,32,100,111,116,40,97,44,32,97,41,59,32,125,10,10,118,101,99,51,32,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,102,108,111,97,116,32,122,110,44,32,102,108,111,97,116,32,122,102,41,32,123,10,32,114,101,116,117,114,110,32,118,101,99,51,40,122,110,32,32,42,32,122,102,44,32,122,110,32,45,32,122,102,44,32,122,102,41,59,10,10,125,10,10,10,102,108,111,97,116,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,102,108,111,97,116,32,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,44,32,118,101,99,51,32,99,41,32,123,10,32,32,32,32,32,32,114,101,116,117,114,110,32,99,91,48,93,32,47,32,40,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,32,42,32,99,91,49,93,32,43,32,99,91,50,93,41,59,10,125,10,10,10,98,111,111,108,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,10,32,32,32,40,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,115,79,114,105,103,105,110,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,99,115,68,105,114,101,99,116,105,111,110,44,10,32,32,32,32,109,97,116,52,120,52,32,32,32,32,32,32,32,32,32,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,44,10,32,32,32,32,115,97,109,112,108,101,114,50,68,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,44,10,32,32,32,32,118,101,99,50,32,32,32,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,83,105,122,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,99,115,90,84,104,105,99,107,110,101,115,115,44,10,32,32,32,32,99,111,110,115,116,32,105,110,32,98,111,111,108,32,32,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,108,105,112,73,110,102,111,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,110,101,97,114,80,108,97,110,101,90,44,10,32,32,32,32,102,108,111,97,116,9,9,9,115,116,114,105,100,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,109,97,120,83,116,101,112,115,44,10,32,32,32,32,105,110,32,102,108,111,97,116,32,32,32,32,32,32,32,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,44,10,32,32,32,32,111,117,116,32,118,101,99,50,32,32,32,32,32,32,104,105,116,80,105,120,101,108,44,10,32,32,32,32,111,117,116,32,105,110,116,32,32,32,32,32,32,32,32,32,119,104,105,99,104,44,10,9,111,117,116,32,118,101,99,51,9,9,99,115,72,105,116,80,111,105,110,116,41,32,123,10,10,9,47,47,32,67,108,105,112,32,114,97,121,32,116,111,32,97,32,110,101,97,114,32,112,108,97,110,101,32,105,110,32,51,68,32,40,100,111,101,115,110,39,116,32,104,97,118,101,32,116,111,32,98,101,32,42,116,104,101,42,32,110,101,97,114,32,112,108,97,110,101,44,32,97,108,116,104,111,117,103,104,32,116,104,97,116,32,119,111,117,108,100,32,98,101,32,97,32,103,111,111,100,32,105,100,101,97,41,10,9,102,108,111,97,116,32,114,97,121,76,101,110,103,116,104,32,61,32,40,40,99,115,79,114,105,103,105,110,46,122,32,43,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,42,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,41,32,62,32,110,101,97,114,80,108,97,110,101,90,41,32,63,10,9,9,9,9,40,110,101,97,114,80,108,97,110,101,90,32,45,32,99,115,79,114,105,103,105,110,46,122,41,32,47,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,58,10,9,9,9,9,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,59,10,9,118,101,99,51,32,99,115,69,110,100,80,111,105,110,116,32,61,32,99,115,68,105,114,101,99,116,105,111,110,32,42,32,114,97,121,76,101,110,103,116,104,32,43,32,99,115,79,114,105,103,105,110,59,10,10,9,47,47,32,80,114,111,106,101,99,116,32,105,110,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,52,32,72,48,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,79,114,105,103,105,110,44,32,49,46,48,41,59,10,9,118,101,99,52,32,72,49,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,69,110,100,80,111,105,110,116,44,32,49,46,48,41,59,10,10,9,47,47,32,84,104,101,114,101,32,97,114,101,32,97,32,108,111,116,32,111,102,32,100,105,118,105,115,105,111,110,115,32,98,121,32,119,32,116,104,97,116,32,99,97,110,32,98,101,32,116,117,114,110,101,100,32,105,110,116,111,32,109,117,108,116,105,112,108,105,99,97,116,105,111,110,115,10,9,47,47,32,97,116,32,115,111,109,101,32,109,105,110,111,114,32,112,114,101,99,105,115,105,111,110,32,108,111,115,115,46,46,46,97,110,100,32,119,101,32,110,101,101,100,32,116,111,32,105,110,116,101,114,112,111,108,97,116,101,32,116,104,101,115,101,32,49,47,119,32,118,97,108,117,101,115,10,9,47,47,32,97,110,121,119,97,121,46,10,9,47,47,10,9,47,47,32,66,101,99,97,117,115,101,32,116,104,101,32,99,97,108,108,101,114,32,119,97,115,32,114,101,113,117,105,114,101,100,32,116,111,32,99,108,105,112,32,116,111,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,44,10,9,47,47,32,116,104,105,115,32,104,111,109,111,103,101,110,101,111,117,115,32,100,105,118,105,115,105,111,110,32,40,112,114,111,106,101,99,116,105,110,103,32,102,114,111,109,32,52,68,32,116,111,32,50,68,41,32,105,115,32,103,117,97,114,97,110,116,101,101,100,10,9,47,47,32,116,111,32,115,117,99,99,101,101,100,46,10,9,102,108,111,97,116,32,107,48,32,61,32,49,46,48,32,47,32,72,48,46,119,59,10,9,102,108,111,97,116,32,107,49,32,61,32,49,46,48,32,47,32,72,49,46,119,59,10,10,9,47,47,32,83,119,105,116,99,104,32,116,104,101,32,111,114,105,103,105,110,97,108,32,112,111,105,110,116,115,32,116,111,32,118,97,108,117,101,115,32,116,104,97,116,32,105,110,116,101,114,112,111,108,97,116,101,32,108,105,110,101,97,114,108,121,32,105,110,32,50,68,10,9,118,101,99,51,32,81,48,32,61,32,99,115,79,114,105,103,105,110,32,42,32,107,48,59,10,9,118,101,99,51,32,81,49,32,61,32,99,115,69,110,100,80,111,105,110,116,32,42,32,107,49,59,10,10,9,47,47,32,83,99,114,101,101,110,45,115,112,97,99,101,32,101,110,100,112,111,105,110,116,115,10,9,118,101,99,50,32,80,48,32,61,32,72,48,46,120,121,32,42,32,107,48,59,10,9,118,101,99,50,32,80,49,32,61,32,72,49,46,120,121,32,42,32,107,49,59,10,10,9,47,47,32,91,79,112,116,105,111,110,97,108,32,99,108,105,112,112,105,110,103,32,116,111,32,102,114,117,115,116,117,109,32,115,105,100,101,115,32,104,101,114,101,93,10,10,9,47,47,32,73,110,105,116,105,97,108,105,122,101,32,116,111,32,111,102,102,32,115,99,114,101,101,110,10,9,104,105,116,80,105,120,101,108,32,61,32,118,101,99,50,40,45,49,46,48,44,32,45,49,46,48,41,59,10,9,119,104,105,99,104,32,61,32,48,59,32,47,47,32,79,110,108,121,32,111,110,101,32,108,97,121,101,114,10,10,9,47,47,32,73,102,32,116,104,101,32,108,105,110,101,32,105,115,32,100,101,103,101,110,101,114,97,116,101,44,32,109,97,107,101,32,105,116,32,99,111,118,101,114,32,97,116,32,108,101,97,115,116,32,111,110,101,32,112,105,120,101,108,10,9,47,47,32,116,111,32,97,118,111,105,100,32,104,97,110,100,108,105,110,103,32,122,101,114,111,45,112,105,120,101,108,32,101,120,116,101,110,116,32,97,115,32,97,32,115,112,101,99,105,97,108,32,99,97,115,101,32,108,97,116,101,114,10,9,80,49,32,43,61,32,118,101,99,50,40,40,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,80,48,44,32,80,49,41,32,60,32,48,46,48,48,48,49,41,32,63,32,48,46,48,49,32,58,32,48,46,48,41,59,10,10,9,118,101,99,50,32,100,101,108,116,97,32,61,32,80,49,32,45,32,80,48,59,10,10,9,47,47,32,80,101,114,109,117,116,101,32,115,111,32,116,104,97,116,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,105,115,32,105,110,32,120,32,116,111,32,114,101,100,117,99,101,10,9,47,47,32,108,97,114,103,101,32,98,114,97,110,99,104,101,115,32,108,97,116,101,114,10,9,98,111,111,108,32,112,101,114,109,117,116,101,32,61,32,102,97,108,115,101,59,10,9,105,102,32,40,97,98,115,40,100,101,108,116,97,46,120,41,32,60,32,97,98,115,40,100,101,108,116,97,46,121,41,41,32,123,10,9,9,47,47,32,77,111,114,101,45,118,101,114,116,105,99,97,108,32,108,105,110,101,46,32,67,114,101,97,116,101,32,97,32,112,101,114,109,117,116,97,116,105,111,110,32,116,104,97,116,32,115,119,97,112,115,32,120,32,97,110,100,32,121,32,105,110,32,116,104,101,32,111,117,116,112,117,116,10,9,9,112,101,114,109,117,116,101,32,61,32,116,114,117,101,59,10,10,9,9,47,47,32,68,105,114,101,99,116,108,121,32,115,119,105,122,122,108,101,32,116,104,101,32,105,110,112,117,116,115,10,9,9,100,101,108,116,97,32,61,32,100,101,108,116,97,46,121,120,59,10,9,9,80,49,32,61,32,80,49,46,121,120,59,10,9,9,80,48,32,61,32,80,48,46,121,120,59,10,9,125,10,10,9,47,47,32,70,114,111,109,32,110,111,119,32,111,110,44,32,34,120,34,32,105,115,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,100,105,114,101,99,116,105,111,110,32,97,110,100,32,34,121,34,32,105,115,32,116,104,101,32,115,101,99,111,110,100,97,114,121,32,111,110,101,10,10,9,102,108,111,97,116,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,61,32,115,105,103,110,40,100,101,108,116,97,46,120,41,59,10,9,102,108,111,97,116,32,105,110,118,100,120,32,61,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,47,32,100,101,108,116,97,46,120,59,10,9,118,101,99,50,32,100,80,32,61,32,118,101,99,50,40,115,116,101,112,68,105,114,101,99,116,105,111,110,44,32,105,110,118,100,120,32,42,32,100,101,108,116,97,46,121,41,59,10,10,9,47,47,32,84,114,97,99,107,32,116,104,101,32,100,101,114,105,118,97,116,105,118,101,115,32,111,102,32,81,32,97,110,100,32,107,10,9,118,101,99,51,32,100,81,32,61,32,40,81,49,32,45,32,81,48,41,32,42,32,105,110,118,100,120,59,10,9,102,108,111,97,116,32,32,32,100,107,32,61,32,40,107,49,32,45,32,107,48,41,32,42,32,105,110,118,100,120,59,10,10,9,47,47,32,83,99,97,108,101,32,100,101,114,105,118,97,116,105,118,101,115,32,98,121,32,116,104,101,32,100,101,115,105,114,101,100,32,112,105,120,101,108,32,115,116,114,105,100,101,10,9,100,80,32,42,61,32,115,116,114,105,100,101,59,32,100,81,32,42,61,32,115,116,114,105,100,101,59,32,100,107,32,42,61,32,115,116,114,105,100,101,59,10,10,9,47,47,32,79,102,102,115,101,116,32,116,104,101,32,115,116,97,114,116,105,110,103,32,118,97,108,117,101,115,32,98,121,32,116,104,101,32,106,105,116,116,101,114,32,102,114,97,99,116,105,111,110,10,9,80,48,32,43,61,32,100,80,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,81,48,32,43,61,32,100,81,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,107,48,32,43,61,32,100,107,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,10,10,9,47,47,32,83,108,105,100,101,32,80,32,102,114,111,109,32,80,48,32,116,111,32,80,49,44,32,40,110,111,119,45,104,111,109,111,103,101,110,101,111,117,115,41,32,81,32,102,114,111,109,32,81,48,32,116,111,32,81,49,44,32,97,110,100,32,107,32,102,114,111,109,32,107,48,32,116,111,32,107,49,10,9,118,101,99,51,32,81,32,61,32,81,48,59,10,9,102,108,111,97,116,32,32,107,32,61,32,107,48,59,10,10,9,47,47,32,87,101,32,116,114,97,99,107,32,116,104,101,32,114,97,121,32,100,101,112,116,104,32,97,116,32,43,47,45,32,49,47,50,32,112,105,120,101,108,32,116,111,32,116,114,101,97,116,32,112,105,120,101,108,115,32,97,115,32,99,108,105,112,45,115,112,97,99,101,32,115,111,108,105,100,10,9,47,47,32,118,111,120,101,108,115,46,32,66,101,99,97,117,115,101,32,116,104,101,32,100,101,112,116,104,32,97,116,32,45,49,47,50,32,102,111,114,32,97,32,103,105,118,101,110,32,112,105,120,101,108,32,119,105,108,108,32,98,101,32,116,104,101,32,115,97,109,101,32,97,115,32,97,116,10,9,47,47,32,43,49,47,50,32,102,111,114,32,116,104,101,32,112,114,101,118,105,111,117,115,32,105,116,101,114,97,116,105,111,110,44,32,119,101,32,97,99,116,117,97,108,108,121,32,111,110,108,121,32,104,97,118,101,32,116,111,32,99,111,109,112,117,116,101,32,111,110,101,32,118,97,108,117,101,10,9,47,47,32,112,101,114,32,105,116,101,114,97,116,105,111,110,46,10,9,102,108,111,97,116,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,99,115,79,114,105,103,105,110,46,122,59,10,9,102,108,111,97,116,32,115,116,101,112,67,111,117,110,116,32,61,32,48,46,48,59,10,9,102,108,111,97,116,32,114,97,121,90,77,97,120,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,44,32,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,9,102,108,111,97,116,32,115,99,101,110,101,90,77,97,120,32,61,32,114,97,121,90,77,97,120,32,43,32,49,101,52,59,10,10,9,47,47,32,80,49,46,120,32,105,115,32,110,101,118,101,114,32,109,111,100,105,102,105,101,100,32,97,102,116,101,114,32,116,104,105,115,32,112,111,105,110,116,44,32,115,111,32,112,114,101,45,115,99,97,108,101,32,105,116,32,98,121,10,9,47,47,32,116,104,101,32,115,116,101,112,32,100,105,114,101,99,116,105,111,110,32,102,111,114,32,97,32,115,105,103,110,101,100,32,99,111,109,112,97,114,105,115,111,110,10,9,102,108,111,97,116,32,101,110,100,32,61,32,80,49,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,59,10,10,9,47,47,32,87,101,32,111,110,108,121,32,97,100,118,97,110,99,101,32,116,104,101,32,122,32,102,105,101,108,100,32,111,102,32,81,32,105,110,32,116,104,101,32,105,110,110,101,114,32,108,111,111,112,44,32,115,105,110,99,101,10,9,47,47,32,81,46,120,121,32,105,115,32,110,101,118,101,114,32,117,115,101,100,32,117,110,116,105,108,32,97,102,116,101,114,32,116,104,101,32,108,111,111,112,32,116,101,114,109,105,110,97,116,101,115,46,10,10,10,9,102,111,114,32,40,118,101,99,50,32,80,32,61,32,80,48,59,10,9,32,32,32,32,32,40,40,80,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,41,32,60,61,32,101,110,100,41,32,38,38,10,9,32,32,32,32,32,40,115,116,101,112,67,111,117,110,116,32,60,32,109,97,120,83,116,101,112,115,41,32,38,38,10,9,32,32,32,32,32,40,40,114,97,121,90,77,97,120,32,60,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,124,124,10,9,32,32,32,32,32,32,40,114,97,121,90,77,105,110,32,62,32,115,99,101,110,101,90,77,97,120,41,41,32,38,38,10,9,32,32,32,32,32,40,115,99,101,110,101,90,77,97,120,32,33,61,32,48,46,48,41,59,10,9,32,32,32,32,32,80,32,43,61,32,100,80,44,32,81,46,122,32,43,61,32,100,81,46,122,44,32,107,32,43,61,32,100,107,44,32,115,116,101,112,67,111,117,110,116,32,43,61,32,49,46,48,41,32,123,10,10,9,9,104,105,116,80,105,120,101,108,32,61,32,112,101,114,109,117,116,101,32,63,32,80,46,121,120,32,58,32,80,59,10,10,9,9,47,47,32,84,104,101,32,100,101,112,116,104,32,114,97,110,103,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,99,111,118,101,114,115,32,119,105,116,104,105,110,32,116,104,105,115,32,108,111,111,112,10,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,32,65,115,115,117,109,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,105,115,32,109,111,118,105,110,103,32,105,110,32,105,110,99,114,101,97,115,105,110,103,32,122,10,9,9,47,47,32,97,110,100,32,115,119,97,112,32,105,102,32,98,97,99,107,119,97,114,100,115,46,32,32,66,101,99,97,117,115,101,32,111,110,101,32,101,110,100,32,111,102,32,116,104,101,32,105,110,116,101,114,118,97,108,32,105,115,10,9,9,47,47,32,115,104,97,114,101,100,32,98,101,116,119,101,101,110,32,97,100,106,97,99,101,110,116,32,105,116,101,114,97,116,105,111,110,115,44,32,119,101,32,116,114,97,99,107,32,116,104,101,32,112,114,101,118,105,111,117,115,10,9,9,47,47,32,118,97,108,117,101,32,97,110,100,32,116,104,101,110,32,115,119,97,112,32,97,115,32,110,101,101,100,101,100,32,116,111,32,101,110,115,117,114,101,32,99,111,114,114,101,99,116,32,111,114,100,101,114,105,110,103,10,9,9,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,10,9,9,47,47,32,67,111,109,112,117,116,101,32,116,104,101,32,118,97,108,117,101,32,97,116,32,49,47,50,32,112,105,120,101,108,32,105,110,116,111,32,116,104,101,32,102,117,116,117,114,101,10,9,9,114,97,121,90,77,97,120,32,61,32,40,100,81,46,122,32,42,32,48,46,53,32,43,32,81,46,122,41,32,47,32,40,100,107,32,42,32,48,46,53,32,43,32,107,41,59,10,9,9,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,114,97,121,90,77,97,120,59,10,9,9,105,102,32,40,114,97,121,90,77,105,110,32,62,32,114,97,121,90,77,97,120,41,32,123,10,9,9,9,102,108,111,97,116,32,97,117,120,32,61,32,114,97,121,90,77,105,110,59,10,9,9,9,114,97,121,90,77,105,110,61,114,97,121,90,77,97,120,59,10,9,9,9,114,97,121,90,77,97,120,61,97,117,120,59,10,10,9,9,125,10,10,10,9,9,47,47,32,67,97,109,101,114,97,45,115,112,97,99,101,32,122,32,111,102,32,116,104,101,32,98,97,99,107,103,114,111,117,110,100,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,116,101,120,101,108,70,101,116,99,104,40,99,115,90,66,117,102,102,101,114,44,32,105,118,101,99,50,40,104,105,116,80,105,120,101,108,41,44,32,48,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,10,9,9,47,47,32,84,104,105,115,32,99,111,109,112,105,108,101,115,32,97,119,97,121,32,119,104,101,110,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,32,61,32,102,97,108,115,101,10,9,9,47,42,105,102,32,40,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,41,32,123,10,9,9,9,115,99,101,110,101,90,77,97,120,32,61,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,115,99,101,110,101,90,77,97,120,44,32,99,108,105,112,73,110,102,111,41,59,10,9,9,125,42,47,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,115,99,101,110,101,90,77,97,120,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,45,115,99,101,110,101,90,77,97,120,59,10,10,10,10,9,125,32,47,47,32,112,105,120,101,108,32,111,110,32,114,97,121,10,10,10,10,9,81,46,120,121,32,43,61,32,100,81,46,120,121,32,42,32,115,116,101,112,67,111,117,110,116,59,10,9,99,115,72,105,116,80,111,105,110,116,32,61,32,81,32,42,32,40,49,46,48,32,47,32,107,41,59,10,10,9,47,47,32,77,97,116,99,104,101,115,32,116,104,101,32,110,101,119,32,108,111,111,112,32,99,111,110,100,105,116,105,111,110,58,10,9,114,101,116,117,114,110,32,40,114,97,121,90,77,97,120,32,62,61,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,38,38,32,40,114,97,121,90,77,105,110,32,60,61,32,115,99,101,110,101,90,77,97,120,41,59,10,125,10,10,118,111,105,100,32,115,119,97,112,102,40,105,110,111,117,116,32,102,108,111,97,116,32,97,44,105,110,111,117,116,32,102,108,111,97,116,32,98,41,32,123,10,9,102,108,111,97,116,32,97,117,120,61,97,59,10,9,97,61,98,59,10,9,98,61,97,117,120,59,10,125,10,102,108,111,97,116,32,114,97,110,100,40,118,101,99,50,32,99,111,41,123,10,32,32,32,32,114,101,116,117,114,110,32,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,32,44,118,101,99,50,40,49,50,46,57,56,57,56,44,55,56,46,50,51,51,41,41,41,32,42,32,52,51,55,53,56,46,53,52,53,51,41,59,10,125,10,10,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,84,111,67,111,110,101,65,110,103,108,101,40,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,41,32,123,10,9,102,108,111,97,116,32,101,120,112,111,110,101,110,116,32,61,32,49,46,48,102,32,47,32,40,115,112,101,99,117,108,97,114,80,111,119,101,114,32,43,32,49,46,48,102,41,59,10,9,114,101,116,117,114,110,32,97,99,111,115,40,112,111,119,40,48,46,50,52,52,102,44,32,101,120,112,111,110,101,110,116,41,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,79,112,112,111,115,105,116,101,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,99,111,110,101,84,104,101,116,97,41,10,123,10,9,47,47,32,115,105,109,112,108,101,32,116,114,105,103,32,97,110,100,32,97,108,103,101,98,114,97,32,45,32,115,111,104,44,32,99,97,104,44,32,116,111,97,32,45,32,116,97,110,40,116,104,101,116,97,41,32,61,32,111,112,112,47,97,100,106,44,32,111,112,112,32,61,32,116,97,110,40,116,104,101,116,97,41,32,42,32,97,100,106,44,32,116,104,101,110,32,109,117,108,116,105,112,108,121,32,42,32,50,46,48,102,32,102,111,114,32,105,115,111,115,99,101,108,101,115,32,116,114,105,97,110,103,108,101,32,98,97,115,101,10,9,114,101,116,117,114,110,32,50,46,48,102,32,42,32,116,97,110,40,99,111,110,101,84,104,101,116,97,41,32,42,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,73,110,82,97,100,105,117,115,40,102,108,111,97,116,32,97,44,32,102,108,111,97,116,32,104,41,10,123,10,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,114,101,116,117,114,110,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,78,101,120,116,65,100,106,97,99,101,110,116,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,105,110,99,105,114,99,108,101,82,97,100,105,117,115,41,10,123,10,9,47,47,32,115,117,98,116,114,97,99,116,32,116,104,101,32,100,105,97,109,101,116,101,114,32,111,102,32,116,104,101,32,105,110,99,105,114,99,108,101,32,116,111,32,103,101,116,32,116,104,101,32,97,100,106,97,99,101,110,116,32,115,105,100,101,32,111,102,32,116,104,101,32,110,101,120,116,32,108,101,118,101,108,32,111,110,32,116,104,101,32,99,111,110,101,10,9,114,101,116,117,114,110,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,32,45,32,40,105,110,99,105,114,99,108,101,82,97,100,105,117,115,32,42,32,50,46,48,102,41,59,10,125,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,10,9,102,108,111,97,116,32,110,117,109,95,115,116,101,112,115,61,54,52,59,10,9,102,108,111,97,116,32,105,110,105,116,105,97,108,95,98,105,97,115,61,48,46,49,59,10,9,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,61,48,46,49,59,10,10,9,47,47,47,47,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,44,32,117,118,95,105,110,116,101,114,112,41,59,10,10,9,118,101,99,51,32,110,111,114,109,97,108,59,10,10,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,50,46,48,45,49,46,48,59,10,10,9,105,102,32,40,102,97,108,115,101,41,32,123,10,9,32,32,32,32,102,108,111,97,116,32,115,99,97,108,101,32,61,32,49,46,55,55,55,55,59,10,9,32,32,32,32,118,101,99,51,32,110,110,32,61,10,9,9,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,118,101,99,51,40,50,46,48,42,115,99,97,108,101,44,50,46,48,42,115,99,97,108,101,44,48,46,48,41,32,43,10,9,9,118,101,99,51,40,45,115,99,97,108,101,44,45,115,99,97,108,101,44,49,46,48,41,59,10,9,32,32,32,32,102,108,111,97,116,32,103,32,61,32,50,46,48,32,47,32,100,111,116,40,110,110,46,120,121,122,44,110,110,46,120,121,122,41,59,10,9,32,32,32,32,118,101,99,51,32,110,59,10,9,32,32,32,32,110,46,120,121,32,61,32,103,42,110,110,46,120,121,59,10,9,32,32,32,32,110,46,122,32,61,32,103,45,49,46,48,59,10,9,32,32,32,110,111,114,109,97,108,61,110,59,10,9,125,10,10,9,118,101,99,51,32,116,97,110,103,101,110,116,59,10,9,118,101,99,51,32,98,105,110,111,114,109,97,108,59,10,9,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,110,111,114,109,97,108,44,32,116,97,110,103,101,110,116,44,32,98,105,110,111,114,109,97,108,41,59,10,10,9,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,119,59,10,10,9,102,108,111,97,116,32,100,101,112,116,104,95,116,101,120,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,117,118,95,105,110,116,101,114,112,41,46,114,59,10,10,9,118,101,99,52,32,119,111,114,108,100,95,112,111,115,32,61,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,32,117,118,95,105,110,116,101,114,112,42,50,46,48,45,49,46,48,44,32,100,101,112,116,104,95,116,101,120,42,50,46,48,45,49,46,48,44,32,49,46,48,32,41,59,10,9,118,101,99,51,32,118,101,114,116,101,120,32,61,32,119,111,114,108,100,95,112,111,115,46,120,121,122,47,119,111,114,108,100,95,112,111,115,46,119,59,10,10,9,118,101,99,51,32,118,105,101,119,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,114,101,102,108,101,99,116,40,118,105,101,119,95,100,105,114,44,32,110,111,114,109,97,108,41,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,105,101,119,95,100,105,114,32,45,32,110,111,114,109,97,108,32,42,32,100,111,116,40,110,111,114,109,97,108,44,118,105,101,119,95,100,105,114,41,32,42,32,50,46,48,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,99,51,40,49,44,49,44,45,49,41,41,59,10,10,10,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,10,10,9,47,47,109,97,107,101,32,114,97,121,32,108,101,110,103,116,104,32,97,110,100,32,99,108,105,112,32,105,116,32,97,103,97,105,110,115,116,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,32,40,100,111,110,39,116,32,119,97,110,116,32,116,111,32,116,114,97,99,101,32,98,101,121,111,110,100,32,118,105,115,105,98,108,101,41,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,62,32,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,63,32,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,32,61,32,118,101,114,116,101,120,32,43,32,114,97,121,95,100,105,114,42,114,97,121,95,108,101,110,59,10,10,9,102,108,111,97,116,32,119,95,98,101,103,105,110,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,98,101,103,105,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,44,119,95,98,101,103,105,110,41,59,10,9,102,108,111,97,116,32,119,95,101,110,100,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,101,110,100,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,32,114,97,121,95,101,110,100,44,32,119,95,101,110,100,41,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,101,110,100,45,118,112,95,108,105,110,101,95,98,101,103,105,110,59,10,10,10,9,119,95,98,101,103,105,110,32,61,32,49,46,48,47,119,95,98,101,103,105,110,59,10,9,119,95,101,110,100,32,61,32,49,46,48,47,119,95,101,110,100,59,10,10,10,9,102,108,111,97,116,32,122,95,98,101,103,105,110,32,61,32,118,101,114,116,101,120,46,122,42,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,101,110,100,32,61,32,114,97,121,95,101,110,100,46,122,42,119,95,101,110,100,59,10,10,9,118,101,99,50,32,108,105,110,101,95,98,101,103,105,110,32,61,32,118,112,95,108,105,110,101,95,98,101,103,105,110,47,112,105,120,101,108,95,115,105,122,101,59,10,9,118,101,99,50,32,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,100,105,114,47,112,105,120,101,108,95,115,105,122,101,59,10,9,102,108,111,97,116,32,122,95,100,105,114,32,61,32,122,95,101,110,100,32,45,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,95,100,105,114,32,61,32,119,95,101,110,100,32,45,32,119,95,98,101,103,105,110,59,10,10,10,9,47,47,32,99,108,105,112,32,116,104,101,32,108,105,110,101,32,116,111,32,116,104,101,32,118,105,101,119,112,111,114,116,32,101,100,103,101,115,10,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,108,105,110,101,95,99,108,105,112,32,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,32,42,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,9,108,105,110,101,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,122,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,119,95,100,105,114,32,42,61,108,105,110,101,95,99,108,105,112,59,10,10,10,9,118,101,99,50,32,108,105,110,101,95,97,100,118,97,110,99,101,32,61,32,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,59,32,47,47,100,111,119,110,32,116,111,32,112,105,120,101,108,10,9,102,108,111,97,116,32,115,116,101,112,95,115,105,122,101,32,61,32,108,101,110,103,116,104,40,108,105,110,101,95,97,100,118,97,110,99,101,41,47,108,101,110,103,116,104,40,108,105,110,101,95,100,105,114,41,59,10,9,102,108,111,97,116,32,122,95,97,100,118,97,110,99,101,32,61,32,122,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,102,108,111,97,116,32,119,95,97,100,118,97,110,99,101,32,61,32,119,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,119,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,10,9,102,108,111,97,116,32,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,32,61,32,49,46,48,47,109,97,120,40,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,120,41,44,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,121,41,41,59,32,47,47,109,97,107,101,32,105,116,32,103,111,32,102,97,115,116,101,114,32,116,104,101,32,99,108,111,115,101,114,32,116,111,32,52,53,100,10,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,122,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,9,119,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,10,9,118,101,99,50,32,112,111,115,32,61,32,108,105,110,101,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,32,61,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,32,61,32,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,102,114,111,109,61,122,47,119,59,10,9,102,108,111,97,116,32,122,95,116,111,61,122,95,102,114,111,109,59,10,9,102,108,111,97,116,32,100,101,112,116,104,59,10,9,118,101,99,50,32,112,114,101,118,95,112,111,115,61,112,111,115,59,10,10,9,98,111,111,108,32,102,111,117,110,100,61,102,97,108,115,101,59,10,10,9,102,108,111,97,116,32,97,99,99,101,108,61,49,46,48,52,59,47,47,43,114,97,110,100,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,42,48,46,48,48,48,49,59,10,9,102,108,111,97,116,32,115,116,101,112,115,95,116,97,107,101,110,61,48,59,10,10,9,102,111,114,40,102,108,111,97,116,32,105,61,48,59,105,60,110,117,109,95,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,112,111,115,43,61,108,105,110,101,95,97,100,118,97,110,99,101,59,10,9,9,122,43,61,122,95,97,100,118,97,110,99,101,59,10,9,9,119,43,61,119,95,97,100,118,97,110,99,101,59,10,10,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,122,95,102,114,111,109,32,61,32,122,95,116,111,59,10,9,9,122,95,116,111,32,61,32,122,47,119,59,10,10,9,9,105,102,32,40,100,101,112,116,104,62,122,95,116,111,41,32,123,10,10,9,9,9,105,102,32,40,100,101,112,116,104,60,61,109,97,120,40,122,95,116,111,44,122,95,102,114,111,109,41,43,48,46,56,41,32,123,10,9,9,9,9,102,111,117,110,100,61,116,114,117,101,59,10,9,9,9,125,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,10,9,9,115,116,101,112,115,95,116,97,107,101,110,43,61,49,46,48,59,10,9,9,112,114,101,118,95,112,111,115,61,112,111,115,59,10,9,9,122,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,119,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,125,10,10,9,105,102,32,40,102,111,117,110,100,41,32,123,10,10,10,9,9,118,101,99,50,32,102,105,110,97,108,95,112,111,115,59,10,9,9,102,108,111,97,116,32,103,114,97,100,59,10,35,100,101,102,105,110,101,32,66,76,69,78,68,95,65,67,67,69,76,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,10,9,9,118,101,99,50,32,98,108,101,110,100,95,100,105,114,32,61,32,112,111,115,32,45,32,112,114,101,118,95,112,111,115,59,10,9,9,102,108,111,97,116,32,115,116,101,112,115,32,61,32,109,105,110,40,56,46,48,44,108,101,110,103,116,104,40,98,108,101,110,100,95,100,105,114,41,41,59,10,9,9,105,102,32,40,115,116,101,112,115,62,50,46,48,41,32,123,10,9,9,9,118,101,99,50,32,98,108,101,110,100,95,115,116,101,112,32,61,32,98,108,101,110,100,95,100,105,114,47,115,116,101,112,115,59,10,9,9,9,102,108,111,97,116,32,98,108,101,110,100,95,122,32,61,32,40,122,95,116,111,45,122,95,102,114,111,109,41,47,115,116,101,112,115,59,10,9,9,9,118,101,99,50,32,110,101,119,95,112,111,115,59,10,9,9,9,102,108,111,97,116,32,115,117,98,103,114,97,100,61,48,46,48,59,10,9,9,9,102,111,114,40,102,108,111,97,116,32,105,61,48,46,48,59,105,60,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,9,9,110,101,119,95,112,111,115,32,61,32,40,112,114,101,118,95,112,111,115,43,98,108,101,110,100,95,115,116,101,112,42,105,41,59,10,9,9,9,9,102,108,111,97,116,32,122,32,61,32,122,95,102,114,111,109,43,98,108,101,110,100,95,122,42,105,59,10,10,9,9,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,110,101,119,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,9,9,115,117,98,103,114,97,100,61,105,47,115,116,101,112,115,59,10,9,9,9,9,105,102,32,40,100,101,112,116,104,62,122,41,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,125,10,10,9,9,9,102,105,110,97,108,95,112,111,115,32,61,32,110,101,119,95,112,111,115,59,10,9,9,9,103,114,97,100,61,40,115,116,101,112,115,95,116,97,107,101,110,43,115,117,98,103,114,97,100,41,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,118,101,99,51,40,103,114,97,100,41,44,49,46,48,41,59,10,9,9,125,32,101,108,115,101,32,123,10,35,101,110,100,105,102,10,9,9,9,103,114,97,100,61,115,116,101,112,115,95,116,97,107,101,110,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,102,105,110,97,108,95,112,111,115,61,112,111,115,59,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,9,9,125,10,10,35,101,110,100,105,102,10,10,35,100,101,102,105,110,101,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,35,105,102,100,101,102,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,10,10,9,9,118,101,99,52,32,102,105,110,97,108,95,99,111,108,111,114,59,10,10,9,9,105,102,32,40,114,111,117,103,104,110,101,115,115,32,62,32,48,46,48,48,49,41,32,123,10,9,9,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,9,9,9,47,47,117,115,101,32,97,32,98,108,117,114,114,101,100,32,118,101,114,115,105,111,110,32,40,105,110,32,99,111,110,115,101,99,117,116,105,118,101,32,109,105,112,109,97,112,115,41,32,111,102,32,116,104,101,32,115,99,114,101,101,110,32,116,111,32,115,105,109,117,108,97,116,101,32,114,111,117,103,104,110,101,115,115,10,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,32,61,32,49,46,48,45,114,111,117,103,104,110,101,115,115,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,97,110,103,108,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,77,95,80,73,32,42,32,48,46,53,59,10,9,9,9,118,101,99,50,32,99,111,110,101,95,100,105,114,32,61,32,102,105,110,97,108,95,112,111,115,32,45,32,108,105,110,101,95,98,101,103,105,110,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,108,101,110,32,61,32,108,101,110,103,116,104,40,99,111,110,101,95,100,105,114,41,59,10,9,9,9,99,111,110,101,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,99,111,110,101,95,100,105,114,41,59,32,47,47,119,105,108,108,32,98,101,32,117,115,101,100,32,110,111,114,109,97,108,105,122,101,100,32,102,114,111,109,32,110,111,119,32,111,110,10,9,9,9,102,108,111,97,116,32,109,97,120,95,109,105,112,109,97,112,32,61,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,32,45,49,59,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,95,109,117,108,116,61,103,108,111,115,115,59,10,10,9,9,9,102,108,111,97,116,32,114,101,109,95,97,108,112,104,97,61,49,46,48,59,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,41,59,10,10,9,9,9,102,111,114,40,105,110,116,32,105,61,48,59,105,60,55,59,105,43,43,41,32,123,10,10,9,9,9,9,102,108,111,97,116,32,111,112,95,108,101,110,32,61,32,50,46,48,32,42,32,116,97,110,40,99,111,110,101,95,97,110,103,108,101,41,32,42,32,99,111,110,101,95,108,101,110,59,32,47,47,111,112,111,115,105,116,101,32,115,105,100,101,32,111,102,32,105,115,111,32,116,114,105,97,110,103,108,101,10,9,9,9,9,102,108,111,97,116,32,114,97,100,105,117,115,59,10,9,9,9,9,123,10,9,9,9,9,9,47,47,102,105,116,32,116,111,32,115,112,104,101,114,101,32,105,110,115,105,100,101,32,99,111,110,101,32,40,115,112,104,101,114,101,32,101,110,100,115,32,97,116,32,101,110,100,32,111,102,32,99,111,110,101,41,44,32,115,111,109,101,116,104,105,110,103,32,108,105,107,101,32,116,104,105,115,58,10,9,9,9,9,9,47,47,32,95,95,95,10,9,9,9,9,9,47,47,32,92,79,47,10,9,9,9,9,9,47,47,32,32,86,10,9,9,9,9,9,47,47,10,9,9,9,9,9,47,47,32,97,115,32,105,116,32,97,118,111,105,100,115,32,98,108,101,101,100,105,110,103,32,102,114,111,109,32,98,101,121,111,110,100,32,116,104,101,32,114,101,102,108,101,99,116,105,111,110,32,97,115,32,109,117,99,104,32,97,115,32,112,111,115,115,105,98,108,101,46,32,65,115,32,97,32,112,108,117,115,10,9,9,9,9,9,47,47,32,105,116,32,97,108,115,111,32,109,97,107,101,115,32,116,104,101,32,114,111,117,103,104,32,114,101,102,108,101,99,116,105,111,110,32,109,111,114,101,32,101,108,111,110,103,97,116,101,100,46,10,9,9,9,9,9,102,108,111,97,116,32,97,32,61,32,111,112,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,104,32,61,32,99,111,110,101,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,9,9,9,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,9,9,9,9,114,97,100,105,117,115,32,61,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,9,9,9,9,125,10,10,9,9,9,9,47,47,102,105,110,100,32,116,104,101,32,112,108,97,99,101,32,119,104,101,114,101,32,115,99,114,101,101,110,32,109,117,115,116,32,98,101,32,115,97,109,112,108,101,100,10,9,9,9,9,118,101,99,50,32,115,97,109,112,108,101,95,112,111,115,32,61,32,40,32,108,105,110,101,95,98,101,103,105,110,32,43,32,99,111,110,101,95,100,105,114,32,42,32,40,99,111,110,101,95,108,101,110,32,45,32,114,97,100,105,117,115,41,32,41,32,42,32,112,105,120,101,108,95,115,105,122,101,59,10,9,9,9,9,47,47,114,97,100,105,117,115,32,105,115,32,105,110,32,112,105,120,101,108,115,44,32,115,111,32,105,116,39,115,32,110,97,116,117,114,97,108,32,116,104,97,116,32,108,111,103,50,40,114,97,100,105,117,115,41,32,109,97,112,115,32,116,111,32,116,104,101,32,114,105,103,104,116,32,109,105,112,109,97,112,32,102,111,114,32,116,104,101,32,97,109,111,117,110,116,32,111,102,32,112,105,120,101,108,115,10,9,9,9,9,102,108,111,97,116,32,109,105,112,109,97,112,32,61,32,99,108,97,109,112,40,32,108,111,103,50,40,32,114,97,100,105,117,115,32,41,44,32,48,46,48,44,32,109,97,120,95,109,105,112,109,97,112,32,41,59,10,10,9,9,9,9,47,47,109,105,112,109,97,112,32,61,32,109,97,120,40,109,105,112,109,97,112,45,49,46,48,44,48,46,48,41,59,10,9,9,9,9,47,47,100,111,32,115,97,109,112,108,105,110,103,10,10,9,9,9,9,118,101,99,52,32,115,97,109,112,108,101,95,99,111,108,111,114,59,10,9,9,9,9,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,44,115,97,109,112,108,101,95,112,111,115,44,109,97,120,40,49,46,48,44,109,105,112,109,97,112,41,41,59,10,9,9,9,9,9,105,102,32,40,109,105,112,109,97,112,60,49,46,48,41,32,123,32,47,47,119,101,32,117,115,101,32,97,110,111,116,104,101,114,32,105,109,97,103,101,32,97,115,32,98,97,115,101,32,116,111,32,97,118,111,105,100,32,99,111,112,121,105,110,103,32,97,108,108,32,116,104,101,32,115,99,114,101,101,110,32,117,110,110,101,99,101,115,97,114,105,108,121,10,9,9,9,9,9,9,118,101,99,52,32,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,115,97,109,112,108,101,95,112,111,115,44,48,46,48,41,59,10,9,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,109,105,120,40,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,44,115,97,109,112,108,101,95,99,111,108,111,114,44,109,105,112,109,97,112,41,59,10,9,9,9,9,9,125,10,9,9,9,9,125,10,10,9,9,9,9,47,47,109,117,108,116,105,112,108,121,32,98,121,32,103,108,111,115,115,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,42,61,103,108,111,115,115,95,109,117,108,116,59,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,97,61,103,108,111,115,115,95,109,117,108,116,59,10,10,9,9,9,9,114,101,109,95,97,108,112,104,97,32,45,61,32,115,97,109,112,108,101,95,99,111,108,111,114,46,97,59,10,9,9,9,9,105,102,40,114,101,109,95,97,108,112,104,97,32,60,32,48,46,48,41,32,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,32,42,61,32,40,49,46,48,32,45,32,97,98,115,40,114,101,109,95,97,108,112,104,97,41,41,59,10,9,9,9,9,125,10,10,9,9,9,9,102,105,110,97,108,95,99,111,108,111,114,43,61,115,97,109,112,108,101,95,99,111,108,111,114,59,10,10,9,9,9,9,105,102,32,40,102,105,110,97,108,95,99,111,108,111,114,46,97,62,61,48,46,57,53,41,32,123,10,9,9,9,9,9,47,47,32,84,104,105,115,32,99,111,100,101,32,111,102,32,97,99,99,117,109,117,108,97,116,105,110,103,32,103,108,111,115,115,32,97,110,100,32,97,98,111,114,116,105,110,103,32,111,110,32,110,101,97,114,32,111,110,101,10,9,9,9,9,9,47,47,32,109,97,107,101,115,32,115,101,110,115,101,32,119,104,101,110,32,121,111,117,32,116,104,105,110,107,32,111,102,32,99,111,110,101,32,116,114,97,99,105,110,103,46,10,9,9,9,9,9,47,47,32,84,104,105,110,107,32,111,102,32,105,116,32,97,115,32,105,102,32,114,111,117,103,104,110,101,115,115,32,119,97,115,32,48,44,32,116,104,101,110,32,119,101,32,99,111,117,108,100,32,97,98,111,114,116,32,111,110,32,116,104,101,32,102,105,114,115,116,10,9,9,9,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,70,111,114,32,108,101,115,115,101,114,32,114,111,117,103,104,110,101,115,115,32,118,97,108,117,101,115,44,32,119,101,32,110,101,101,100,32,109,111,114,101,32,105,116,101,114,97,116,105,111,110,115,44,32,98,117,116,10,9,9,9,9,9,47,47,32,101,97,99,104,32,110,101,101,100,115,32,116,111,32,104,97,118,101,32,108,101,115,115,32,105,110,102,108,117,101,110,99,101,32,103,105,118,101,110,32,116,104,101,32,115,112,104,101,114,101,32,105,115,32,115,109,97,108,108,101,114,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,111,110,101,95,108,101,110,45,61,114,97,100,105,117,115,42,50,46,48,59,32,47,47,103,111,32,116,111,32,110,101,120,116,32,40,115,109,97,108,108,101,114,41,32,99,105,114,99,108,101,46,10,10,9,9,9,9,103,108,111,115,115,95,109,117,108,116,42,61,103,108,111,115,115,59,10,10,10,9,9,9,125,10,9,9,125,32,101,108,115,101,32,123,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,9,9,125,10,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,102,105,110,97,108,95,99,111,108,111,114,46,114,103,98,44,109,97,120,40,48,46,48,44,49,46,48,45,103,114,97,100,41,41,59,10,10,35,101,108,115,101,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,48,46,48,41,46,114,103,98,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,35,101,110,100,105,102,10,10,10,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,49,46,48,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,10,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,32,42,32,48,46,53,32,43,32,48,46,53,44,48,46,48,44,49,46,48,41,59,10,10,47,42,10,9,118,101,99,50,32,104,105,116,95,112,105,120,101,108,59,10,9,118,101,99,51,32,104,105,116,95,112,111,105,110,116,59,10,9,105,110,116,32,119,104,105,99,104,59,10,9,109,97,116,52,32,98,105,97,115,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,48,46,53,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,53,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,53,44,48,46,53,44,48,46,48,44,49,46,48,41,41,59,10,9,109,97,116,52,32,112,105,120,101,108,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,118,105,101,119,112,111,114,116,95,115,105,122,101,46,120,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,118,105,101,119,112,111,114,116,95,115,105,122,101,46,121,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,48,46,48,44,49,46,48,41,41,59,10,10,10,10,10,9,109,97,116,52,32,100,116,32,61,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,59,10,9,118,101,99,52,32,118,112,32,61,32,100,116,32,42,32,118,101,99,52,40,118,101,114,116,101,120,44,49,46,48,41,59,10,9,118,112,46,120,121,122,47,61,118,112,46,119,59,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,116,101,120,101,108,70,101,116,99,104,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,105,118,101,99,50,40,118,112,46,120,121,41,44,48,32,41,59,10,9,114,101,116,117,114,110,59,10,42,47,10,47,42,9,98,111,111,108,32,104,105,116,32,61,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,40,118,101,114,116,101,120,44,114,97,121,95,100,105,114,44,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,44,115,111,117,114,99,101,95,100,101,112,116,104,44,118,105,101,119,112,111,114,116,95,115,105,122,101,44,48,46,48,49,44,116,114,117,101,44,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,45,99,97,109,101,114,97,95,122,95,102,97,114,41,44,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,49,46,50,44,48,46,48,44,54,52,46,48,44,99,97,109,101,114,97,95,122,95,102,97,114,44,104,105,116,95,112,105,120,101,108,44,119,104,105,99,104,44,104,105,116,95,112,111,105,110,116,41,59,10,10,10,10,9,105,102,32,40,104,105,116,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,101,108,70,101,116,99,104,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,118,101,99,50,40,104,105,116,95,112,105,120,101,108,41,44,48,41,46,114,103,98,44,49,46,48,41,59,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,49,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,42,47,10,10,10,9,47,42,10,9,102,108,111,97,116,32,112,105,120,101,108,100,105,115,116,32,61,32,108,101,110,103,116,104,40,118,101,114,116,101,120,41,59,10,10,10,9,47,47,32,83,107,105,112,32,115,107,121,98,111,120,32,97,110,100,32,100,105,115,116,97,110,116,32,112,105,120,101,108,115,10,9,105,102,32,40,112,105,120,101,108,100,105,115,116,32,62,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,118,101,114,116,101,120,43,61,110,111,114,109,97,108,42,48,46,49,59,10,10,9,47,47,32,82,97,121,32,110,111,116,32,105,110,32,118,105,101,119,10,9,105,102,32,40,100,111,116,40,114,97,121,95,100,105,114,44,32,118,105,101,119,95,100,105,114,41,32,60,32,49,101,45,53,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,44,49,46,48,44,48,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,10,9,102,108,111,97,116,32,109,97,120,95,114,97,121,95,108,101,110,32,61,32,49,46,48,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,10,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,109,97,120,95,114,97,121,95,108,101,110,41,32,62,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,32,63,32,40,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,109,97,120,95,114,97,121,95,108,101,110,59,10,10,10,9,47,47,32,67,111,110,118,101,114,116,32,115,116,97,114,116,32,97,110,100,32,101,110,100,32,112,111,115,32,102,114,111,109,32,118,105,101,119,32,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,51,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,32,43,32,114,97,121,95,108,101,110,32,42,32,114,97,121,95,100,105,114,41,59,10,10,9,118,101,99,51,32,114,97,121,95,112,111,115,32,61,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,61,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,116,104,101,32,114,97,121,32,100,111,101,115,32,110,111,116,32,108,101,97,118,101,32,116,104,101,32,115,99,114,101,101,110,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,10,9,118,101,99,51,32,114,97,121,95,115,116,101,112,32,61,32,40,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,41,32,47,32,110,117,109,95,115,116,101,112,115,59,10,10,9,102,108,111,97,116,32,100,105,115,116,97,110,99,101,95,115,99,97,108,101,32,61,32,49,46,48,32,43,32,48,46,48,48,48,48,49,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,9,102,108,111,97,116,32,106,105,116,116,101,114,32,61,32,48,46,48,59,47,47,97,98,115,40,114,97,110,100,40,105,118,101,99,50,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,32,37,32,56,32,43,32,40,77,97,105,110,83,99,101,110,101,68,97,116,97,46,102,114,97,109,101,95,105,110,100,101,120,32,37,32,71,69,84,95,83,69,84,84,73,78,71,40,115,115,114,44,32,104,105,115,116,111,114,121,95,108,101,110,103,116,104,41,41,32,42,32,48,46,49,41,41,59,10,10,9,47,47,32,82,111,117,103,104,32,115,111,117,114,102,97,99,101,115,32,110,101,101,100,32,109,111,114,101,32,106,105,116,116,101,114,10,9,106,105,116,116,101,114,32,42,61,32,109,97,120,40,48,46,53,44,32,114,111,117,103,104,110,101,115,115,41,59,10,10,9,114,97,121,95,112,111,115,32,43,61,32,106,105,116,116,101,114,32,42,32,114,97,121,95,115,116,101,112,59,10,10,10,9,105,110,116,32,105,32,61,32,48,59,10,9,102,108,111,97,116,32,105,110,116,101,114,115,101,99,116,105,111,110,95,119,101,105,103,104,116,32,61,32,48,46,48,59,10,9,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,9,118,101,99,50,32,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,118,101,99,50,40,45,49,46,48,41,59,10,10,9,102,111,114,32,40,105,32,61,32,49,59,32,105,32,60,32,110,117,109,95,115,116,101,112,115,59,32,43,43,105,41,32,123,10,9,9,114,97,121,95,112,111,115,32,43,61,32,114,97,121,95,115,116,101,112,59,10,10,9,9,47,47,32,67,117,114,114,101,110,116,32,99,111,111,114,100,105,110,97,116,101,32,105,115,32,105,110,32,116,104,101,32,109,105,100,32,111,102,32,116,119,111,32,115,97,109,112,108,101,115,44,32,110,111,116,32,97,116,32,116,104,101,32,101,110,100,44,32,115,111,10,9,9,47,47,32,115,117,98,115,116,114,97,99,116,32,104,97,108,102,32,111,102,32,97,32,115,116,101,112,10,9,9,118,101,99,50,32,99,117,114,114,95,99,111,111,114,100,32,61,32,114,97,121,95,112,111,115,46,120,121,32,45,32,48,46,53,32,42,32,114,97,121,95,115,116,101,112,46,120,121,59,10,10,10,9,9,47,47,32,73,110,99,114,101,97,115,101,32,114,97,121,32,98,105,97,115,32,97,115,32,119,101,32,97,100,118,97,110,99,101,32,116,104,101,32,114,97,121,10,9,9,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,32,61,32,105,110,105,116,105,97,108,95,98,105,97,115,32,42,32,49,48,46,48,32,43,10,9,9,9,9,49,48,48,46,48,32,42,32,100,111,116,40,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,44,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,41,59,10,10,9,9,116,114,97,99,101,95,108,101,110,32,42,61,32,49,46,48,32,43,32,49,46,48,32,42,32,114,111,117,103,104,110,101,115,115,59,10,10,9,9,47,47,32,67,104,101,99,107,32,102,111,114,32,105,110,116,101,114,115,101,99,116,105,111,110,10,10,9,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,99,117,114,114,95,99,111,111,114,100,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,61,100,101,112,116,104,59,10,9,9,47,47,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,47,47,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,45,108,105,110,101,97,114,95,100,101,112,116,104,59,10,10,10,9,9,105,102,32,40,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,108,105,110,101,97,114,95,100,101,112,116,104,44,32,114,97,121,95,112,111,115,46,122,44,10,9,9,9,9,9,32,114,97,121,95,112,111,115,46,122,32,45,32,114,97,121,95,115,116,101,112,46,122,44,32,116,114,97,99,101,95,108,101,110,44,32,104,105,116,95,102,97,99,116,111,114,41,41,32,123,10,9,9,9,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,99,117,114,114,95,99,111,111,114,100,59,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,9,125,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,119,101,32,104,105,116,32,101,120,97,99,116,108,121,32,111,110,101,32,112,105,120,101,108,10,9,47,47,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,116,114,117,110,99,97,116,101,95,99,111,111,114,100,105,110,97,116,101,40,105,110,116,101,114,115,101,99,116,105,111,110,41,59,10,10,9,47,47,32,67,104,101,99,107,32,105,102,32,119,101,32,104,105,116,32,115,111,109,101,116,104,105,110,103,10,9,105,102,32,40,109,105,110,40,105,110,116,101,114,115,101,99,116,105,111,110,46,120,44,32,105,110,116,101,114,115,101,99,116,105,111,110,46,121,41,32,60,61,32,48,46,48,32,124,124,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,105,110,116,101,114,115,101,99,116,105,111,110,41,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,49,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,105,102,32,40,33,104,105,116,95,102,97,99,116,111,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,49,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,110,116,101,114,115,101,99,116,105,111,110,41,46,114,103,98,44,49,46,48,41,59,10,42,47,10,10,125,10,10, 0}; + + static const int _fragment_code_start=17; + setup(_conditional_strings,2,_uniform_strings,8,_attribute_pairs,0, _texunit_pairs,4,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start); + }; + +}; + +#endif + diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl new file mode 100644 index 0000000000..5b24013c07 --- /dev/null +++ b/drivers/gles3/shaders/screen_space_reflection.glsl @@ -0,0 +1,350 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; +out vec2 pos_interp; + +void main() { + + uv_interp = uv_in; + gl_Position = vertex_attrib; + pos_interp.xy=gl_Position.xy; +} + +[fragment] + + +in vec2 uv_interp; +in vec2 pos_interp; + +uniform sampler2D source_diffuse; //texunit:0 +uniform sampler2D source_normal_roughness; //texunit:1 +uniform sampler2D source_depth; //texunit:2 +uniform sampler2D source_diffuse_mipmaps; //texunit:3 + +uniform float camera_z_near; +uniform float camera_z_far; + +uniform vec2 viewport_size; +uniform vec2 pixel_size; + +uniform float filter_mipmap_levels; + +uniform mat4 inverse_projection; +uniform mat4 projection; + +uniform int num_steps; +uniform float depth_tolerance; +uniform float distance_fade; +uniform float acceleration; + +layout(location = 0) out vec4 frag_color; + + +vec2 view_to_screen(vec3 view_pos,out float w) { + vec4 projected = projection * vec4(view_pos, 1.0); + projected.xyz /= projected.w; + projected.xy = projected.xy * 0.5 + 0.5; + w=projected.w; + return projected.xy; +} + + + +#define M_PI 3.14159265359 + + +void main() { + + + //// + + vec4 diffuse = texture( source_diffuse, uv_interp ); + vec4 normal_roughness = texture( source_normal_roughness, uv_interp); + + vec3 normal; + + normal = normal_roughness.xyz*2.0-1.0; + + float roughness = normal_roughness.w; + + float depth_tex = texture(source_depth,uv_interp).r; + + vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 ); + vec3 vertex = world_pos.xyz/world_pos.w; + + vec3 view_dir = normalize(vertex); + vec3 ray_dir = normalize(reflect(view_dir, normal)); + + if (dot(ray_dir,normal)<0.001) { + frag_color=vec4(0.0); + return; + } + //ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0); + + //ray_dir = normalize(vec3(1,1,-1)); + + + //////////////// + + + //make ray length and clip it against the near plane (don't want to trace beyond visible) + float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far; + vec3 ray_end = vertex + ray_dir*ray_len; + + float w_begin; + vec2 vp_line_begin = view_to_screen(vertex,w_begin); + float w_end; + vec2 vp_line_end = view_to_screen( ray_end, w_end); + vec2 vp_line_dir = vp_line_end-vp_line_begin; + + //we need to interpolate w along the ray, to generate perspective correct reflections + + w_begin = 1.0/w_begin; + w_end = 1.0/w_end; + + + float z_begin = vertex.z*w_begin; + float z_end = ray_end.z*w_end; + + vec2 line_begin = vp_line_begin/pixel_size; + vec2 line_dir = vp_line_dir/pixel_size; + float z_dir = z_end - z_begin; + float w_dir = w_end - w_begin; + + + // clip the line to the viewport edges + + float scale_max_x = min(1, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x)); + float scale_max_y = min(1, 0.99 * (1.0 - vp_line_begin.y) / max(1e-5, vp_line_dir.y)); + float scale_min_x = min(1, 0.99 * vp_line_begin.x / max(1e-5, -vp_line_dir.x)); + float scale_min_y = min(1, 0.99 * vp_line_begin.y / max(1e-5, -vp_line_dir.y)); + float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y); + line_dir *= line_clip; + z_dir *= line_clip; + w_dir *=line_clip; + + //clip z and w advance to line advance + vec2 line_advance = normalize(line_dir); //down to pixel + float step_size = length(line_advance)/length(line_dir); + float z_advance = z_dir*step_size; // adapt z advance to line advance + float w_advance = w_dir*step_size; // adapt w advance to line advance + + //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice) + float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y)); + line_advance*=advance_angle_adj; // adapt z advance to line advance + z_advance*=advance_angle_adj; + w_advance*=advance_angle_adj; + + vec2 pos = line_begin; + float z = z_begin; + float w = w_begin; + float z_from=z/w; + float z_to=z_from; + float depth; + vec2 prev_pos=pos; + + bool found=false; + + //if acceleration > 0, distance between pixels gets larger each step. This allows covering a larger area + float accel=1.0+acceleration; + float steps_taken=0; + + for(float i=0;iz_to) { + //if depth was surpassed + if (depth<=max(z_to,z_from)+depth_tolerance) { + //check the depth tolerance + found=true; + } + break; + } + + steps_taken+=1.0; + prev_pos=pos; + z_advance*=accel; + w_advance*=accel; + line_advance*=accel; + } + + + + + if (found) { + + float margin_blend=1.0; + + + vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin + if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) { + //clip outside screen + margin + frag_color=vec4(0.0); + return; + } + + { + //blend fading out towards external margin + vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0))); + margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y)); + //margin_blend=1.0; + + } + + vec2 final_pos; + float grad; + +#ifdef SMOOTH_ACCEL + //if the distance between point and prev point is >1, then take some samples in the middle for smoothing out the image + vec2 blend_dir = pos - prev_pos; + float steps = min(8.0,length(blend_dir)); + if (steps>2.0) { + vec2 blend_step = blend_dir/steps; + float blend_z = (z_to-z_from)/steps; + vec2 new_pos; + float subgrad=0.0; + for(float i=0.0;iz) + break; + } + + final_pos = new_pos; + grad=(steps_taken+subgrad)/num_steps; + + } else { +#endif + grad=steps_taken/num_steps; + final_pos=pos; +#ifdef SMOOTH_ACCEL + } + +#endif + + + +#ifdef REFLECT_ROUGHNESS + + + vec4 final_color; + //if roughness is enabled, do screen space cone tracing + if (roughness > 0.001) { + /////////////////////////////////////////////////////////////////////////////////////// + //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness + + float gloss = 1.0-roughness; + float cone_angle = roughness * M_PI * 0.5; + vec2 cone_dir = final_pos - line_begin; + float cone_len = length(cone_dir); + cone_dir = normalize(cone_dir); //will be used normalized from now on + float max_mipmap = filter_mipmap_levels -1; + float gloss_mult=gloss; + + float rem_alpha=1.0; + final_color = vec4(0.0); + + for(int i=0;i<7;i++) { + + float op_len = 2.0 * tan(cone_angle) * cone_len; //oposite side of iso triangle + float radius; + { + //fit to sphere inside cone (sphere ends at end of cone), something like this: + // ___ + // \O/ + // V + // + // as it avoids bleeding from beyond the reflection as much as possible. As a plus + // it also makes the rough reflection more elongated. + float a = op_len; + float h = cone_len; + float a2 = a * a; + float fh2 = 4.0f * h * h; + radius = (a * (sqrt(a2 + fh2) - a)) / (4.0f * h); + } + + //find the place where screen must be sampled + vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size; + //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels + float mipmap = clamp( log2( radius ), 0.0, max_mipmap ); + + //mipmap = max(mipmap-1.0,0.0); + //do sampling + + vec4 sample_color; + { + sample_color = textureLod(source_diffuse_mipmaps,sample_pos,max(1.0,mipmap)); + if (mipmap<1.0) { //we use another image as base to avoid copying all the screen unnecesarily + vec4 base_sample_color = textureLod(source_diffuse,sample_pos,0.0); + sample_color = mix(base_sample_color,sample_color,mipmap); + } + } + + //multiply by gloss + sample_color.rgb*=gloss_mult; + sample_color.a=gloss_mult; + + rem_alpha -= sample_color.a; + if(rem_alpha < 0.0) { + sample_color.rgb *= (1.0 - abs(rem_alpha)); + } + + final_color+=sample_color; + + if (final_color.a>=0.95) { + // This code of accumulating gloss and aborting on near one + // makes sense when you think of cone tracing. + // Think of it as if roughness was 0, then we could abort on the first + // iteration. For lesser roughness values, we need more iterations, but + // each needs to have less influence given the sphere is smaller + break; + } + + cone_len-=radius*2.0; //go to next (smaller) circle. + + gloss_mult*=gloss; + + + } + } else { + final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0); + } + + frag_color = vec4(final_color.rgb,pow(clamp(1.0-grad,0.0,1.0),distance_fade)*margin_blend); + +#else + frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,pow(clamp(1.0-grad,0.0,1.0),distance_fade)*margin_blend); +#endif + + + + } else { + frag_color = vec4(0.0,0.0,0.0,0.0); + } + + + +} + diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index d35200d98c..578a8ae50a 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -300,6 +300,84 @@ void Environment::_validate_property(PropertyInfo& property) const { } +void Environment::set_ssr_enabled(bool p_enable) { + + ssr_enabled=p_enable; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); +} + +bool Environment::is_ssr_enabled() const{ + + return ssr_enabled; +} + +void Environment::set_ssr_max_steps(int p_steps){ + + ssr_max_steps=p_steps; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +int Environment::get_ssr_max_steps() const { + + return ssr_max_steps; +} + +void Environment::set_ssr_accel(float p_accel) { + + ssr_accel=p_accel; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +float Environment::get_ssr_accel() const { + + return ssr_accel; +} + +void Environment::set_ssr_fade(float p_fade) { + + ssr_fade=p_fade; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +float Environment::get_ssr_fade() const { + + return ssr_fade; +} + +void Environment::set_ssr_depth_tolerance(float p_depth_tolerance) { + + ssr_depth_tolerance=p_depth_tolerance; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +float Environment::get_ssr_depth_tolerance() const { + + return ssr_depth_tolerance; +} + +void Environment::set_ssr_smooth(bool p_enable) { + + ssr_smooth=p_enable; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +bool Environment::is_ssr_smooth() const { + + return ssr_smooth; +} + +void Environment::set_ssr_rough(bool p_enable) { + + ssr_roughness=p_enable; + VS::get_singleton()->environment_set_ssr(environment,ssr_enabled,ssr_max_steps,ssr_accel,ssr_fade,ssr_depth_tolerance,ssr_smooth,ssr_roughness); + +} +bool Environment::is_ssr_rough() const { + + return ssr_roughness; +} + + void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_background","mode"),&Environment::set_background); @@ -334,6 +412,37 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_ambient_light_energy"),_SCS("get_ambient_light_energy") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_light/skybox_contribution",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_ambient_light_skybox_contribution"),_SCS("get_ambient_light_skybox_contribution") ); + + ObjectTypeDB::bind_method(_MD("set_ssr_enabled","enabled"),&Environment::set_ssr_enabled); + ObjectTypeDB::bind_method(_MD("is_ssr_enabled"),&Environment::is_ssr_enabled); + + ObjectTypeDB::bind_method(_MD("set_ssr_max_steps","max_steps"),&Environment::set_ssr_max_steps); + ObjectTypeDB::bind_method(_MD("get_ssr_max_steps"),&Environment::get_ssr_max_steps); + + ObjectTypeDB::bind_method(_MD("set_ssr_accel","accel"),&Environment::set_ssr_accel); + ObjectTypeDB::bind_method(_MD("get_ssr_accel"),&Environment::get_ssr_accel); + + ObjectTypeDB::bind_method(_MD("set_ssr_fade","fade"),&Environment::set_ssr_fade); + ObjectTypeDB::bind_method(_MD("get_ssr_fade"),&Environment::get_ssr_fade); + + ObjectTypeDB::bind_method(_MD("set_ssr_depth_tolerance","depth_tolerance"),&Environment::set_ssr_depth_tolerance); + ObjectTypeDB::bind_method(_MD("get_ssr_depth_tolerance"),&Environment::get_ssr_depth_tolerance); + + ObjectTypeDB::bind_method(_MD("set_ssr_smooth","smooth"),&Environment::set_ssr_smooth); + ObjectTypeDB::bind_method(_MD("is_ssr_smooth"),&Environment::is_ssr_smooth); + + ObjectTypeDB::bind_method(_MD("set_ssr_rough","rough"),&Environment::set_ssr_rough); + ObjectTypeDB::bind_method(_MD("is_ssr_rough"),&Environment::is_ssr_rough); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/enable"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"ss_reflections/max_steps",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_ssr_max_steps"),_SCS("get_ssr_max_steps") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/accel",PROPERTY_HINT_RANGE,"0,4,0.01"),_SCS("set_ssr_accel"),_SCS("get_ssr_accel") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/fade",PROPERTY_HINT_EXP_EASING),_SCS("set_ssr_fade"),_SCS("get_ssr_fade") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/depth_tolerance",PROPERTY_HINT_RANGE,"0.1,128,0.1"),_SCS("set_ssr_depth_tolerance"),_SCS("get_ssr_depth_tolerance") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/accel_smooth"),_SCS("set_ssr_smooth"),_SCS("is_ssr_smooth") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/roughness"),_SCS("set_ssr_rough"),_SCS("is_ssr_rough") ); + + ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); ObjectTypeDB::bind_method(_MD("get_tonemapper"),&Environment::get_tonemapper); @@ -358,6 +467,9 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_scale","exposure_scale"),&Environment::set_tonemap_auto_exposure_scale); ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_scale"),&Environment::get_tonemap_auto_exposure_scale); + + + ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Log,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); @@ -441,6 +553,14 @@ Environment::Environment() { environment = VS::get_singleton()->environment_create(); + ssr_enabled=false; + ssr_max_steps=64; + ssr_accel=0.04; + ssr_fade=2.0; + ssr_depth_tolerance=0.2; + ssr_smooth=true; + ssr_roughness=true; + } Environment::~Environment() { diff --git a/scene/resources/environment.h b/scene/resources/environment.h index ca55b51b20..f4610ada47 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -94,6 +94,14 @@ private: float adjustment_brightness; Ref adjustment_color_correction; + bool ssr_enabled; + int ssr_max_steps; + float ssr_accel; + float ssr_fade; + float ssr_depth_tolerance; + bool ssr_smooth; + bool ssr_roughness; + protected: static void _bind_methods(); @@ -162,6 +170,27 @@ public: void set_adjustment_color_correction(const Ref& p_ramp); Ref get_adjustment_color_correction() const; + void set_ssr_enabled(bool p_enable); + bool is_ssr_enabled() const; + + void set_ssr_max_steps(int p_steps); + int get_ssr_max_steps() const; + + void set_ssr_accel(float p_accel); + float get_ssr_accel() const; + + void set_ssr_fade(float p_fade); + float get_ssr_fade() const; + + void set_ssr_depth_tolerance(float p_depth_tolerance); + float get_ssr_depth_tolerance() const; + + void set_ssr_smooth(bool p_enable); + bool is_ssr_smooth() const; + + void set_ssr_rough(bool p_enable); + bool is_ssr_rough() const; + virtual RID get_rid() const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 21cf391af5..0d36706468 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -64,6 +64,8 @@ public: virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; + virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; + virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0; virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index c3afadb393..e7594278f2 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -875,6 +875,7 @@ public: BIND2(environment_set_bg_energy,RID,float ) BIND2(environment_set_canvas_max_layer,RID,int ) BIND4(environment_set_ambient_light,RID,const Color& ,float,float ) + BIND8(environment_set_ssr,RID,bool,int,float,float,float,bool,bool ) BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) diff --git a/servers/visual_server.h b/servers/visual_server.h index 0fd0733727..4c9e04a782 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -555,7 +555,7 @@ public: virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,EnvironmentToneMapper p_tone_mapper)=0; virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; - + virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; /* SCENARIO API */ diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 268d42a613..431c2b1874 100644 --- a/tools/collada/collada.cpp +++ b/tools/collada/collada.cpp @@ -463,7 +463,7 @@ Transform Collada::_read_transform(XMLParser& parser) { if (parser.is_empty()) return Transform(); - Vector array; + Vector array; while(parser.read()==OK) { // TODO: check for comments inside the element // and ignore them. @@ -471,7 +471,7 @@ Transform Collada::_read_transform(XMLParser& parser) { if (parser.get_node_type() == XMLParser::NODE_TEXT) { // parse float data String str = parser.get_node_data(); - array=str.split_floats(" ",false); + array=str.split_spaces(); } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END) @@ -479,7 +479,13 @@ Transform Collada::_read_transform(XMLParser& parser) { } ERR_FAIL_COND_V(array.size()!=16,Transform()); - return _read_transform_from_array(array); + Vector farr; + farr.resize(16); + for(int i=0;i<16;i++) { + farr[i]=array[i].to_double(); + } + + return _read_transform_from_array(farr); } String Collada::_read_empty_draw_type(XMLParser& parser) { -- cgit v1.2.3 From 9fa6967c248c44257ab2982c58106ce9daa26e15 Mon Sep 17 00:00:00 2001 From: Michele Valente Date: Fri, 25 Nov 2016 15:22:36 +0100 Subject: adds gles3 auto generated shader header files Just added the gles3 shader header files entry to ".gitignore" so we avoid to accidentally commit also those generated files. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 60d7dd4640..abbda17ee2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ platform/osx/logo.h platform/windows/logo.h platform/x11/logo.h drivers/gles2/shaders/*.h +drivers/gles3/shaders/*.h modules/register_module_types.cpp core/version.h core/method_bind.inc -- cgit v1.2.3 From 1652f876fd33972b0151c10beff66590fb413ec7 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 29 Nov 2016 21:08:02 -0300 Subject: Add missing glsl file and remove generated .h files --- drivers/gles3/shaders/effect_blur.glsl | 57 ++++++++++ drivers/gles3/shaders/resolve.glsl.h | 166 --------------------------- drivers/gles3/shaders/screen_space.glsl.h | 183 ------------------------------ drivers/gles3/shadow_atlas_gles3.cpp | 2 - drivers/gles3/shadow_atlas_gles3.h | 8 -- 5 files changed, 57 insertions(+), 359 deletions(-) create mode 100644 drivers/gles3/shaders/effect_blur.glsl delete mode 100644 drivers/gles3/shaders/resolve.glsl.h delete mode 100644 drivers/gles3/shaders/screen_space.glsl.h delete mode 100644 drivers/gles3/shadow_atlas_gles3.cpp delete mode 100644 drivers/gles3/shadow_atlas_gles3.h diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl new file mode 100644 index 0000000000..fc6de7f654 --- /dev/null +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -0,0 +1,57 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; + + +void main() { + + uv_interp = uv_in; + gl_Position = vertex_attrib; +} + +[fragment] + + +in vec2 uv_interp; +uniform sampler2D source_color; //texunit:0 + +uniform float lod; +uniform vec2 pixel_size; + + +layout(location = 0) out vec4 frag_color; + +void main() { + + + +#ifdef GAUSSIAN_HORIZONTAL + vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774; + color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pixel_size,lod )*0.24477; + color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pixel_size,lod )*0.06136; + color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pixel_size,lod )*0.24477; + color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pixel_size,lod )*0.06136; + frag_color = color; +#endif + +#ifdef GAUSSIAN_VERTICAL + vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774; + color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477; + color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136; + color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477; + color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136; + frag_color = color; +#endif + +#ifdef SIMPLE_COPY + vec4 color =textureLod( source_color, uv_interp,0.0); + frag_color = color; +#endif + + +} + diff --git a/drivers/gles3/shaders/resolve.glsl.h b/drivers/gles3/shaders/resolve.glsl.h deleted file mode 100644 index 72baf50716..0000000000 --- a/drivers/gles3/shaders/resolve.glsl.h +++ /dev/null @@ -1,166 +0,0 @@ -/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */ -#ifndef RESOLVE_GLSL_HGLES3_120 -#define RESOLVE_GLSL_HGLES3_120 - - -#include "drivers/gles3/shader_gles3.h" - - -class ResolveShaderGLES3 : public ShaderGLES3 { - - virtual String get_shader_name() const { return "ResolveShaderGLES3"; } -public: - - enum Conditionals { - USE_SSR, - }; - - enum Uniforms { - STUFF, - }; - - _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); } - - _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); } - - #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this ); - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU - - const Transform &tr = p_transform; - - GLfloat matrix[16]={ /* build a 16x16 matrix */ - tr.basis.elements[0][0], - tr.basis.elements[1][0], - tr.basis.elements[2][0], - 0, - tr.basis.elements[0][1], - tr.basis.elements[1][1], - tr.basis.elements[2][1], - 0, - tr.basis.elements[0][2], - tr.basis.elements[1][2], - tr.basis.elements[2][2], - 0, - tr.origin.x, - tr.origin.y, - tr.origin.z, - 1 - }; - - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - - - } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU - - const Matrix32 &tr = p_transform; - - GLfloat matrix[16]={ /* build a 16x16 matrix */ - tr.elements[0][0], - tr.elements[0][1], - 0, - 0, - tr.elements[1][0], - tr.elements[1][1], - 0, - 0, - 0, - 0, - 1, - 0, - tr.elements[2][0], - tr.elements[2][1], - 0, - 1 - }; - - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - - - } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU - - GLfloat matrix[16]; - - for (int i=0;i<4;i++) { - for (int j=0;j<4;j++) { - - matrix[i*4+j]=p_matrix.matrix[i][j]; - } - } - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - }; - -#undef _FU - - - virtual void init() { - - static const Enum *_enums=NULL; - static const EnumValue *_enum_values=NULL; - static const char* _conditional_strings[]={ - "#define USE_SSR\n", - }; - - static const char* _uniform_strings[]={ - "stuff", - }; - - static AttributePair *_attribute_pairs=NULL; - static const Feedback* _feedbacks=NULL; - static TexUnitPair _texunit_pairs[]={ - {"source_diffuse",0}, - {"source_specular",1}, - {"source_ssr_ssao",2}, - }; - - static UBOPair *_ubo_pairs=NULL; - static const char _vertex_code[]={ -10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,125,10,10, 0}; - - static const int _vertex_code_start=1; - static const char _fragment_code[]={ -10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,59,32,47,47,116,101,120,117,110,105,116,58,49,10,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,59,32,47,47,116,101,120,117,110,105,116,58,50,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,115,116,117,102,102,59,10,10,105,110,32,118,101,99,50,32,117,118,50,95,105,110,116,101,114,112,59,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,115,112,101,99,117,108,97,114,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,115,112,101,99,117,108,97,114,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,10,35,105,102,100,101,102,32,85,83,69,95,83,83,82,10,10,9,118,101,99,52,32,115,115,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,115,115,114,95,115,115,97,111,44,117,118,95,105,110,116,101,114,112,44,48,46,48,41,59,10,9,115,112,101,99,117,108,97,114,46,114,103,98,32,61,32,109,105,120,40,115,112,101,99,117,108,97,114,46,114,103,98,44,115,115,114,46,114,103,98,42,115,112,101,99,117,108,97,114,46,97,44,115,115,114,46,97,41,59,10,35,101,110,100,105,102,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,100,105,102,102,117,115,101,46,114,103,98,44,49,46,48,41,43,118,101,99,52,40,115,112,101,99,117,108,97,114,46,114,103,98,44,49,46,48,41,59,10,125,10,10, 0}; - - static const int _fragment_code_start=16; - setup(_conditional_strings,1,_uniform_strings,1,_attribute_pairs,0, _texunit_pairs,3,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start); - }; - -}; - -#endif - diff --git a/drivers/gles3/shaders/screen_space.glsl.h b/drivers/gles3/shaders/screen_space.glsl.h deleted file mode 100644 index f39d04429d..0000000000 --- a/drivers/gles3/shaders/screen_space.glsl.h +++ /dev/null @@ -1,183 +0,0 @@ -/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */ -#ifndef SCREEN_SPACE_GLSL_HGLES3_120 -#define SCREEN_SPACE_GLSL_HGLES3_120 - - -#include "drivers/gles3/shader_gles3.h" - - -class ScreenSpaceShaderGLES3 : public ShaderGLES3 { - - virtual String get_shader_name() const { return "ScreenSpaceShaderGLES3"; } -public: - - enum Conditionals { - BLEND_ACCEL, - REFLECT_ROUGHNESS, - }; - - enum Uniforms { - CAMERA_Z_NEAR, - CAMERA_Z_FAR, - VIEWPORT_SIZE, - PIXEL_SIZE, - FILTER_MIPMAP_LEVELS, - INVERSE_PROJECTION, - PROJECTION, - FRAME_INDEX, - }; - - _FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); } - - _FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); } - - #define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this ); - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU - - const Transform &tr = p_transform; - - GLfloat matrix[16]={ /* build a 16x16 matrix */ - tr.basis.elements[0][0], - tr.basis.elements[1][0], - tr.basis.elements[2][0], - 0, - tr.basis.elements[0][1], - tr.basis.elements[1][1], - tr.basis.elements[2][1], - 0, - tr.basis.elements[0][2], - tr.basis.elements[1][2], - tr.basis.elements[2][2], - 0, - tr.origin.x, - tr.origin.y, - tr.origin.z, - 1 - }; - - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - - - } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU - - const Matrix32 &tr = p_transform; - - GLfloat matrix[16]={ /* build a 16x16 matrix */ - tr.elements[0][0], - tr.elements[0][1], - 0, - 0, - tr.elements[1][0], - tr.elements[1][1], - 0, - 0, - 0, - 0, - 1, - 0, - tr.elements[2][0], - tr.elements[2][1], - 0, - 1 - }; - - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - - - } - - _FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU - - GLfloat matrix[16]; - - for (int i=0;i<4;i++) { - for (int j=0;j<4;j++) { - - matrix[i*4+j]=p_matrix.matrix[i][j]; - } - } - - glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - }; - -#undef _FU - - - virtual void init() { - - static const Enum *_enums=NULL; - static const EnumValue *_enum_values=NULL; - static const char* _conditional_strings[]={ - "#define BLEND_ACCEL\n", - "#define REFLECT_ROUGHNESS\n", - }; - - static const char* _uniform_strings[]={ - "camera_z_near", - "camera_z_far", - "viewport_size", - "pixel_size", - "filter_mipmap_levels", - "inverse_projection", - "projection", - "frame_index", - }; - - static AttributePair *_attribute_pairs=NULL; - static const Feedback* _feedbacks=NULL; - static TexUnitPair _texunit_pairs[]={ - {"source_diffuse",0}, - {"source_normal_roughness",1}, - {"source_depth",2}, - {"source_diffuse_mipmaps",3}, - }; - - static UBOPair *_ubo_pairs=NULL; - static const char _vertex_code[]={ -10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,48,41,32,105,110,32,104,105,103,104,112,32,118,101,99,52,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,61,52,41,32,105,110,32,118,101,99,50,32,117,118,95,105,110,59,10,10,111,117,116,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,111,117,116,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,9,117,118,95,105,110,116,101,114,112,32,61,32,117,118,95,105,110,59,10,9,103,108,95,80,111,115,105,116,105,111,110,32,61,32,118,101,114,116,101,120,95,97,116,116,114,105,98,59,10,9,112,111,115,95,105,110,116,101,114,112,46,120,121,61,103,108,95,80,111,115,105,116,105,111,110,46,120,121,59,10,125,10,10, 0}; - - static const int _vertex_code_start=1; - static const char _fragment_code[]={ -10,10,105,110,32,118,101,99,50,32,117,118,95,105,110,116,101,114,112,59,10,105,110,32,118,101,99,50,32,112,111,115,95,105,110,116,101,114,112,59,10,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,59,32,47,47,116,101,120,117,110,105,116,58,48,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,59,32,47,47,116,101,120,117,110,105,116,58,49,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,101,112,116,104,59,32,47,47,116,101,120,117,110,105,116,58,50,10,117,110,105,102,111,114,109,32,115,97,109,112,108,101,114,50,68,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,59,32,47,47,116,101,120,117,110,105,116,58,51,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,110,101,97,114,59,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,10,117,110,105,102,111,114,109,32,118,101,99,50,32,118,105,101,119,112,111,114,116,95,115,105,122,101,59,10,117,110,105,102,111,114,109,32,118,101,99,50,32,112,105,120,101,108,95,115,105,122,101,59,10,10,117,110,105,102,111,114,109,32,102,108,111,97,116,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,59,10,10,117,110,105,102,111,114,109,32,109,97,116,52,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,59,10,117,110,105,102,111,114,109,32,109,97,116,52,32,112,114,111,106,101,99,116,105,111,110,59,10,10,117,110,105,102,111,114,109,32,105,110,116,32,102,114,97,109,101,95,105,110,100,101,120,59,10,10,118,101,99,50,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,99,51,32,118,105,101,119,95,112,111,115,44,111,117,116,32,102,108,111,97,116,32,119,41,32,123,10,32,32,32,32,118,101,99,52,32,112,114,111,106,101,99,116,101,100,32,61,32,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,118,105,101,119,95,112,111,115,44,32,49,46,48,41,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,122,32,47,61,32,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,112,114,111,106,101,99,116,101,100,46,120,121,32,61,32,112,114,111,106,101,99,116,101,100,46,120,121,32,42,32,48,46,53,32,43,32,48,46,53,59,10,32,32,32,32,119,61,112,114,111,106,101,99,116,101,100,46,119,59,10,32,32,32,32,114,101,116,117,114,110,32,112,114,111,106,101,99,116,101,100,46,120,121,59,10,125,10,10,10,108,97,121,111,117,116,40,108,111,99,97,116,105,111,110,32,61,32,48,41,32,111,117,116,32,118,101,99,52,32,102,114,97,103,95,99,111,108,111,114,59,10,10,35,100,101,102,105,110,101,32,78,85,77,95,82,65,89,68,73,82,95,82,69,84,82,73,69,83,32,51,10,10,47,47,102,114,111,109,32,104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,116,111,98,115,112,114,44,32,105,102,32,105,116,32,119,111,114,107,115,32,102,111,114,32,121,111,117,44,32,100,117,100,101,46,46,10,118,101,99,51,32,114,97,110,100,95,114,103,98,40,118,101,99,50,32,99,111,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,97,98,115,40,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,44,32,118,101,99,50,40,51,52,46,52,56,51,53,44,32,56,57,46,54,51,55,50,41,41,41,32,42,10,9,118,101,99,51,40,50,57,49,53,54,46,52,55,54,53,44,32,51,56,50,55,51,46,53,54,51,57,51,44,32,52,55,56,52,51,46,55,53,52,54,56,41,41,41,32,42,32,50,32,45,32,49,59,10,125,10,10,35,100,101,102,105,110,101,32,77,95,80,73,32,51,46,49,52,49,53,57,50,54,53,51,53,57,10,10,118,101,99,51,32,105,109,112,111,114,116,97,110,99,101,95,115,97,109,112,108,101,95,103,103,120,40,118,101,99,50,32,120,105,44,32,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,41,10,123,10,32,32,32,32,102,108,111,97,116,32,114,95,115,113,117,97,114,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,114,111,117,103,104,110,101,115,115,59,10,32,32,32,32,102,108,111,97,116,32,112,104,105,32,61,32,50,32,42,32,77,95,80,73,32,42,32,120,105,46,120,59,10,32,32,32,32,102,108,111,97,116,32,99,111,115,95,116,104,101,116,97,32,61,32,115,113,114,116,40,40,49,32,45,32,120,105,46,121,41,32,47,32,40,49,32,43,32,40,114,95,115,113,117,97,114,101,32,42,32,114,95,115,113,117,97,114,101,32,45,32,49,41,32,42,32,120,105,46,121,41,41,59,10,32,32,32,32,102,108,111,97,116,32,115,105,110,95,116,104,101,116,97,32,61,32,115,113,114,116,40,49,32,45,32,99,111,115,95,116,104,101,116,97,32,42,32,99,111,115,95,116,104,101,116,97,41,59,10,10,32,32,32,32,114,101,116,117,114,110,32,118,101,99,51,40,115,105,110,95,116,104,101,116,97,32,42,32,99,111,115,40,112,104,105,41,44,32,115,105,110,95,116,104,101,116,97,32,42,32,115,105,110,40,112,104,105,41,44,32,99,111,115,95,116,104,101,116,97,41,59,10,125,10,10,118,111,105,100,32,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,118,101,99,51,32,110,111,114,109,97,108,44,32,111,117,116,32,118,101,99,51,32,116,97,110,103,101,110,116,44,32,111,117,116,32,118,101,99,51,32,98,105,116,97,110,103,101,110,116,41,32,123,10,32,32,32,32,118,101,99,51,32,118,48,32,61,32,97,98,115,40,110,111,114,109,97,108,46,122,41,32,60,32,48,46,57,57,57,32,63,32,118,101,99,51,40,48,46,48,44,32,48,46,48,44,32,49,46,48,41,32,58,32,118,101,99,51,40,48,46,48,44,32,49,46,48,44,32,48,46,48,41,59,10,32,32,32,32,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,118,48,44,32,110,111,114,109,97,108,41,41,59,10,32,32,32,32,98,105,116,97,110,103,101,110,116,32,61,32,110,111,114,109,97,108,105,122,101,40,99,114,111,115,115,40,116,97,110,103,101,110,116,44,32,110,111,114,109,97,108,41,41,59,10,125,10,10,98,111,111,108,32,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,102,108,111,97,116,32,122,44,32,102,108,111,97,116,32,122,95,97,44,32,102,108,111,97,116,32,122,95,98,44,32,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,103,116,104,44,32,111,117,116,32,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,41,32,123,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,99,111,114,114,101,99,116,44,32,98,117,116,32,108,111,111,107,115,32,119,101,105,114,100,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,110,111,116,32,102,105,108,108,101,100,10,32,32,32,32,47,47,32,114,101,116,117,114,110,32,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,62,61,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,48,46,48,48,48,49,53,32,38,38,32,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,59,10,10,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,32,32,32,32,47,47,32,84,104,105,115,32,116,114,97,99,101,115,32,34,105,110,99,111,114,114,101,99,116,34,44,32,98,117,116,32,108,111,111,107,115,32,98,101,116,116,101,114,32,98,101,99,97,117,115,101,32,103,97,112,115,32,97,114,101,32,103,101,116,116,105,110,103,32,102,105,108,108,101,100,32,116,104,101,110,10,32,32,32,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,61,48,46,48,48,48,49,59,10,32,32,32,32,99,111,110,115,116,32,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,32,61,32,48,46,48,48,48,48,48,49,59,10,32,32,32,32,105,102,32,40,122,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,32,60,61,32,109,97,120,40,122,95,97,44,32,122,95,98,41,41,32,123,10,10,32,32,32,32,32,105,102,32,40,116,114,117,101,41,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,40,122,32,43,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,119,115,32,42,32,116,114,97,99,101,95,108,101,110,103,116,104,41,32,62,61,10,9,9,9,32,32,32,32,109,105,110,40,122,95,97,44,32,122,95,98,41,32,45,32,104,105,116,95,116,111,108,101,114,97,110,99,101,95,98,97,99,107,102,97,99,101,59,10,32,32,32,32,32,125,32,101,108,115,101,32,123,10,9,32,32,32,32,104,105,116,95,102,97,99,116,111,114,32,61,32,116,114,117,101,59,10,32,32,32,32,32,32,125,10,10,9,114,101,116,117,114,110,32,116,114,117,101,59,10,32,32,32,32,125,10,10,32,32,32,32,114,101,116,117,114,110,32,102,97,108,115,101,59,10,125,10,10,98,111,111,108,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,118,101,99,50,32,116,99,111,111,114,100,41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,116,99,111,111,114,100,46,120,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,60,32,48,46,48,32,124,124,32,116,99,111,111,114,100,46,120,32,62,32,49,46,48,32,124,124,32,116,99,111,111,114,100,46,121,32,62,32,49,46,48,59,10,125,10,10,102,108,111,97,116,32,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,118,101,99,50,32,97,44,32,118,101,99,50,32,98,41,32,123,32,97,32,45,61,32,98,59,32,114,101,116,117,114,110,32,100,111,116,40,97,44,32,97,41,59,32,125,10,10,118,101,99,51,32,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,102,108,111,97,116,32,122,110,44,32,102,108,111,97,116,32,122,102,41,32,123,10,32,114,101,116,117,114,110,32,118,101,99,51,40,122,110,32,32,42,32,122,102,44,32,122,110,32,45,32,122,102,44,32,122,102,41,59,10,10,125,10,10,10,102,108,111,97,116,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,102,108,111,97,116,32,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,44,32,118,101,99,51,32,99,41,32,123,10,32,32,32,32,32,32,114,101,116,117,114,110,32,99,91,48,93,32,47,32,40,100,101,112,116,104,66,117,102,102,101,114,86,97,108,117,101,32,42,32,99,91,49,93,32,43,32,99,91,50,93,41,59,10,125,10,10,10,98,111,111,108,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,10,32,32,32,40,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,115,79,114,105,103,105,110,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,99,115,68,105,114,101,99,116,105,111,110,44,10,32,32,32,32,109,97,116,52,120,52,32,32,32,32,32,32,32,32,32,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,44,10,32,32,32,32,115,97,109,112,108,101,114,50,68,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,44,10,32,32,32,32,118,101,99,50,32,32,32,32,32,32,32,32,32,32,99,115,90,66,117,102,102,101,114,83,105,122,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,99,115,90,84,104,105,99,107,110,101,115,115,44,10,32,32,32,32,99,111,110,115,116,32,105,110,32,98,111,111,108,32,32,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,44,10,32,32,32,32,118,101,99,51,32,32,32,32,32,32,32,32,32,32,99,108,105,112,73,110,102,111,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,110,101,97,114,80,108,97,110,101,90,44,10,32,32,32,32,102,108,111,97,116,9,9,9,115,116,114,105,100,101,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,44,10,32,32,32,32,102,108,111,97,116,32,32,32,32,32,32,32,32,32,32,32,109,97,120,83,116,101,112,115,44,10,32,32,32,32,105,110,32,102,108,111,97,116,32,32,32,32,32,32,32,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,44,10,32,32,32,32,111,117,116,32,118,101,99,50,32,32,32,32,32,32,104,105,116,80,105,120,101,108,44,10,32,32,32,32,111,117,116,32,105,110,116,32,32,32,32,32,32,32,32,32,119,104,105,99,104,44,10,9,111,117,116,32,118,101,99,51,9,9,99,115,72,105,116,80,111,105,110,116,41,32,123,10,10,9,47,47,32,67,108,105,112,32,114,97,121,32,116,111,32,97,32,110,101,97,114,32,112,108,97,110,101,32,105,110,32,51,68,32,40,100,111,101,115,110,39,116,32,104,97,118,101,32,116,111,32,98,101,32,42,116,104,101,42,32,110,101,97,114,32,112,108,97,110,101,44,32,97,108,116,104,111,117,103,104,32,116,104,97,116,32,119,111,117,108,100,32,98,101,32,97,32,103,111,111,100,32,105,100,101,97,41,10,9,102,108,111,97,116,32,114,97,121,76,101,110,103,116,104,32,61,32,40,40,99,115,79,114,105,103,105,110,46,122,32,43,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,42,32,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,41,32,62,32,110,101,97,114,80,108,97,110,101,90,41,32,63,10,9,9,9,9,40,110,101,97,114,80,108,97,110,101,90,32,45,32,99,115,79,114,105,103,105,110,46,122,41,32,47,32,99,115,68,105,114,101,99,116,105,111,110,46,122,32,58,10,9,9,9,9,109,97,120,82,97,121,84,114,97,99,101,68,105,115,116,97,110,99,101,59,10,9,118,101,99,51,32,99,115,69,110,100,80,111,105,110,116,32,61,32,99,115,68,105,114,101,99,116,105,111,110,32,42,32,114,97,121,76,101,110,103,116,104,32,43,32,99,115,79,114,105,103,105,110,59,10,10,9,47,47,32,80,114,111,106,101,99,116,32,105,110,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,52,32,72,48,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,79,114,105,103,105,110,44,32,49,46,48,41,59,10,9,118,101,99,52,32,72,49,32,61,32,112,114,111,106,101,99,116,84,111,80,105,120,101,108,77,97,116,114,105,120,32,42,32,118,101,99,52,40,99,115,69,110,100,80,111,105,110,116,44,32,49,46,48,41,59,10,10,9,47,47,32,84,104,101,114,101,32,97,114,101,32,97,32,108,111,116,32,111,102,32,100,105,118,105,115,105,111,110,115,32,98,121,32,119,32,116,104,97,116,32,99,97,110,32,98,101,32,116,117,114,110,101,100,32,105,110,116,111,32,109,117,108,116,105,112,108,105,99,97,116,105,111,110,115,10,9,47,47,32,97,116,32,115,111,109,101,32,109,105,110,111,114,32,112,114,101,99,105,115,105,111,110,32,108,111,115,115,46,46,46,97,110,100,32,119,101,32,110,101,101,100,32,116,111,32,105,110,116,101,114,112,111,108,97,116,101,32,116,104,101,115,101,32,49,47,119,32,118,97,108,117,101,115,10,9,47,47,32,97,110,121,119,97,121,46,10,9,47,47,10,9,47,47,32,66,101,99,97,117,115,101,32,116,104,101,32,99,97,108,108,101,114,32,119,97,115,32,114,101,113,117,105,114,101,100,32,116,111,32,99,108,105,112,32,116,111,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,44,10,9,47,47,32,116,104,105,115,32,104,111,109,111,103,101,110,101,111,117,115,32,100,105,118,105,115,105,111,110,32,40,112,114,111,106,101,99,116,105,110,103,32,102,114,111,109,32,52,68,32,116,111,32,50,68,41,32,105,115,32,103,117,97,114,97,110,116,101,101,100,10,9,47,47,32,116,111,32,115,117,99,99,101,101,100,46,10,9,102,108,111,97,116,32,107,48,32,61,32,49,46,48,32,47,32,72,48,46,119,59,10,9,102,108,111,97,116,32,107,49,32,61,32,49,46,48,32,47,32,72,49,46,119,59,10,10,9,47,47,32,83,119,105,116,99,104,32,116,104,101,32,111,114,105,103,105,110,97,108,32,112,111,105,110,116,115,32,116,111,32,118,97,108,117,101,115,32,116,104,97,116,32,105,110,116,101,114,112,111,108,97,116,101,32,108,105,110,101,97,114,108,121,32,105,110,32,50,68,10,9,118,101,99,51,32,81,48,32,61,32,99,115,79,114,105,103,105,110,32,42,32,107,48,59,10,9,118,101,99,51,32,81,49,32,61,32,99,115,69,110,100,80,111,105,110,116,32,42,32,107,49,59,10,10,9,47,47,32,83,99,114,101,101,110,45,115,112,97,99,101,32,101,110,100,112,111,105,110,116,115,10,9,118,101,99,50,32,80,48,32,61,32,72,48,46,120,121,32,42,32,107,48,59,10,9,118,101,99,50,32,80,49,32,61,32,72,49,46,120,121,32,42,32,107,49,59,10,10,9,47,47,32,91,79,112,116,105,111,110,97,108,32,99,108,105,112,112,105,110,103,32,116,111,32,102,114,117,115,116,117,109,32,115,105,100,101,115,32,104,101,114,101,93,10,10,9,47,47,32,73,110,105,116,105,97,108,105,122,101,32,116,111,32,111,102,102,32,115,99,114,101,101,110,10,9,104,105,116,80,105,120,101,108,32,61,32,118,101,99,50,40,45,49,46,48,44,32,45,49,46,48,41,59,10,9,119,104,105,99,104,32,61,32,48,59,32,47,47,32,79,110,108,121,32,111,110,101,32,108,97,121,101,114,10,10,9,47,47,32,73,102,32,116,104,101,32,108,105,110,101,32,105,115,32,100,101,103,101,110,101,114,97,116,101,44,32,109,97,107,101,32,105,116,32,99,111,118,101,114,32,97,116,32,108,101,97,115,116,32,111,110,101,32,112,105,120,101,108,10,9,47,47,32,116,111,32,97,118,111,105,100,32,104,97,110,100,108,105,110,103,32,122,101,114,111,45,112,105,120,101,108,32,101,120,116,101,110,116,32,97,115,32,97,32,115,112,101,99,105,97,108,32,99,97,115,101,32,108,97,116,101,114,10,9,80,49,32,43,61,32,118,101,99,50,40,40,100,105,115,116,97,110,99,101,83,113,117,97,114,101,100,40,80,48,44,32,80,49,41,32,60,32,48,46,48,48,48,49,41,32,63,32,48,46,48,49,32,58,32,48,46,48,41,59,10,10,9,118,101,99,50,32,100,101,108,116,97,32,61,32,80,49,32,45,32,80,48,59,10,10,9,47,47,32,80,101,114,109,117,116,101,32,115,111,32,116,104,97,116,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,105,115,32,105,110,32,120,32,116,111,32,114,101,100,117,99,101,10,9,47,47,32,108,97,114,103,101,32,98,114,97,110,99,104,101,115,32,108,97,116,101,114,10,9,98,111,111,108,32,112,101,114,109,117,116,101,32,61,32,102,97,108,115,101,59,10,9,105,102,32,40,97,98,115,40,100,101,108,116,97,46,120,41,32,60,32,97,98,115,40,100,101,108,116,97,46,121,41,41,32,123,10,9,9,47,47,32,77,111,114,101,45,118,101,114,116,105,99,97,108,32,108,105,110,101,46,32,67,114,101,97,116,101,32,97,32,112,101,114,109,117,116,97,116,105,111,110,32,116,104,97,116,32,115,119,97,112,115,32,120,32,97,110,100,32,121,32,105,110,32,116,104,101,32,111,117,116,112,117,116,10,9,9,112,101,114,109,117,116,101,32,61,32,116,114,117,101,59,10,10,9,9,47,47,32,68,105,114,101,99,116,108,121,32,115,119,105,122,122,108,101,32,116,104,101,32,105,110,112,117,116,115,10,9,9,100,101,108,116,97,32,61,32,100,101,108,116,97,46,121,120,59,10,9,9,80,49,32,61,32,80,49,46,121,120,59,10,9,9,80,48,32,61,32,80,48,46,121,120,59,10,9,125,10,10,9,47,47,32,70,114,111,109,32,110,111,119,32,111,110,44,32,34,120,34,32,105,115,32,116,104,101,32,112,114,105,109,97,114,121,32,105,116,101,114,97,116,105,111,110,32,100,105,114,101,99,116,105,111,110,32,97,110,100,32,34,121,34,32,105,115,32,116,104,101,32,115,101,99,111,110,100,97,114,121,32,111,110,101,10,10,9,102,108,111,97,116,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,61,32,115,105,103,110,40,100,101,108,116,97,46,120,41,59,10,9,102,108,111,97,116,32,105,110,118,100,120,32,61,32,115,116,101,112,68,105,114,101,99,116,105,111,110,32,47,32,100,101,108,116,97,46,120,59,10,9,118,101,99,50,32,100,80,32,61,32,118,101,99,50,40,115,116,101,112,68,105,114,101,99,116,105,111,110,44,32,105,110,118,100,120,32,42,32,100,101,108,116,97,46,121,41,59,10,10,9,47,47,32,84,114,97,99,107,32,116,104,101,32,100,101,114,105,118,97,116,105,118,101,115,32,111,102,32,81,32,97,110,100,32,107,10,9,118,101,99,51,32,100,81,32,61,32,40,81,49,32,45,32,81,48,41,32,42,32,105,110,118,100,120,59,10,9,102,108,111,97,116,32,32,32,100,107,32,61,32,40,107,49,32,45,32,107,48,41,32,42,32,105,110,118,100,120,59,10,10,9,47,47,32,83,99,97,108,101,32,100,101,114,105,118,97,116,105,118,101,115,32,98,121,32,116,104,101,32,100,101,115,105,114,101,100,32,112,105,120,101,108,32,115,116,114,105,100,101,10,9,100,80,32,42,61,32,115,116,114,105,100,101,59,32,100,81,32,42,61,32,115,116,114,105,100,101,59,32,100,107,32,42,61,32,115,116,114,105,100,101,59,10,10,9,47,47,32,79,102,102,115,101,116,32,116,104,101,32,115,116,97,114,116,105,110,103,32,118,97,108,117,101,115,32,98,121,32,116,104,101,32,106,105,116,116,101,114,32,102,114,97,99,116,105,111,110,10,9,80,48,32,43,61,32,100,80,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,81,48,32,43,61,32,100,81,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,32,107,48,32,43,61,32,100,107,32,42,32,106,105,116,116,101,114,70,114,97,99,116,105,111,110,59,10,10,9,47,47,32,83,108,105,100,101,32,80,32,102,114,111,109,32,80,48,32,116,111,32,80,49,44,32,40,110,111,119,45,104,111,109,111,103,101,110,101,111,117,115,41,32,81,32,102,114,111,109,32,81,48,32,116,111,32,81,49,44,32,97,110,100,32,107,32,102,114,111,109,32,107,48,32,116,111,32,107,49,10,9,118,101,99,51,32,81,32,61,32,81,48,59,10,9,102,108,111,97,116,32,32,107,32,61,32,107,48,59,10,10,9,47,47,32,87,101,32,116,114,97,99,107,32,116,104,101,32,114,97,121,32,100,101,112,116,104,32,97,116,32,43,47,45,32,49,47,50,32,112,105,120,101,108,32,116,111,32,116,114,101,97,116,32,112,105,120,101,108,115,32,97,115,32,99,108,105,112,45,115,112,97,99,101,32,115,111,108,105,100,10,9,47,47,32,118,111,120,101,108,115,46,32,66,101,99,97,117,115,101,32,116,104,101,32,100,101,112,116,104,32,97,116,32,45,49,47,50,32,102,111,114,32,97,32,103,105,118,101,110,32,112,105,120,101,108,32,119,105,108,108,32,98,101,32,116,104,101,32,115,97,109,101,32,97,115,32,97,116,10,9,47,47,32,43,49,47,50,32,102,111,114,32,116,104,101,32,112,114,101,118,105,111,117,115,32,105,116,101,114,97,116,105,111,110,44,32,119,101,32,97,99,116,117,97,108,108,121,32,111,110,108,121,32,104,97,118,101,32,116,111,32,99,111,109,112,117,116,101,32,111,110,101,32,118,97,108,117,101,10,9,47,47,32,112,101,114,32,105,116,101,114,97,116,105,111,110,46,10,9,102,108,111,97,116,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,99,115,79,114,105,103,105,110,46,122,59,10,9,102,108,111,97,116,32,115,116,101,112,67,111,117,110,116,32,61,32,48,46,48,59,10,9,102,108,111,97,116,32,114,97,121,90,77,97,120,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,44,32,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,9,102,108,111,97,116,32,115,99,101,110,101,90,77,97,120,32,61,32,114,97,121,90,77,97,120,32,43,32,49,101,52,59,10,10,9,47,47,32,80,49,46,120,32,105,115,32,110,101,118,101,114,32,109,111,100,105,102,105,101,100,32,97,102,116,101,114,32,116,104,105,115,32,112,111,105,110,116,44,32,115,111,32,112,114,101,45,115,99,97,108,101,32,105,116,32,98,121,10,9,47,47,32,116,104,101,32,115,116,101,112,32,100,105,114,101,99,116,105,111,110,32,102,111,114,32,97,32,115,105,103,110,101,100,32,99,111,109,112,97,114,105,115,111,110,10,9,102,108,111,97,116,32,101,110,100,32,61,32,80,49,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,59,10,10,9,47,47,32,87,101,32,111,110,108,121,32,97,100,118,97,110,99,101,32,116,104,101,32,122,32,102,105,101,108,100,32,111,102,32,81,32,105,110,32,116,104,101,32,105,110,110,101,114,32,108,111,111,112,44,32,115,105,110,99,101,10,9,47,47,32,81,46,120,121,32,105,115,32,110,101,118,101,114,32,117,115,101,100,32,117,110,116,105,108,32,97,102,116,101,114,32,116,104,101,32,108,111,111,112,32,116,101,114,109,105,110,97,116,101,115,46,10,10,10,9,102,111,114,32,40,118,101,99,50,32,80,32,61,32,80,48,59,10,9,32,32,32,32,32,40,40,80,46,120,32,42,32,115,116,101,112,68,105,114,101,99,116,105,111,110,41,32,60,61,32,101,110,100,41,32,38,38,10,9,32,32,32,32,32,40,115,116,101,112,67,111,117,110,116,32,60,32,109,97,120,83,116,101,112,115,41,32,38,38,10,9,32,32,32,32,32,40,40,114,97,121,90,77,97,120,32,60,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,124,124,10,9,32,32,32,32,32,32,40,114,97,121,90,77,105,110,32,62,32,115,99,101,110,101,90,77,97,120,41,41,32,38,38,10,9,32,32,32,32,32,40,115,99,101,110,101,90,77,97,120,32,33,61,32,48,46,48,41,59,10,9,32,32,32,32,32,80,32,43,61,32,100,80,44,32,81,46,122,32,43,61,32,100,81,46,122,44,32,107,32,43,61,32,100,107,44,32,115,116,101,112,67,111,117,110,116,32,43,61,32,49,46,48,41,32,123,10,10,9,9,104,105,116,80,105,120,101,108,32,61,32,112,101,114,109,117,116,101,32,63,32,80,46,121,120,32,58,32,80,59,10,10,9,9,47,47,32,84,104,101,32,100,101,112,116,104,32,114,97,110,103,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,99,111,118,101,114,115,32,119,105,116,104,105,110,32,116,104,105,115,32,108,111,111,112,10,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,32,65,115,115,117,109,101,32,116,104,97,116,32,116,104,101,32,114,97,121,32,105,115,32,109,111,118,105,110,103,32,105,110,32,105,110,99,114,101,97,115,105,110,103,32,122,10,9,9,47,47,32,97,110,100,32,115,119,97,112,32,105,102,32,98,97,99,107,119,97,114,100,115,46,32,32,66,101,99,97,117,115,101,32,111,110,101,32,101,110,100,32,111,102,32,116,104,101,32,105,110,116,101,114,118,97,108,32,105,115,10,9,9,47,47,32,115,104,97,114,101,100,32,98,101,116,119,101,101,110,32,97,100,106,97,99,101,110,116,32,105,116,101,114,97,116,105,111,110,115,44,32,119,101,32,116,114,97,99,107,32,116,104,101,32,112,114,101,118,105,111,117,115,10,9,9,47,47,32,118,97,108,117,101,32,97,110,100,32,116,104,101,110,32,115,119,97,112,32,97,115,32,110,101,101,100,101,100,32,116,111,32,101,110,115,117,114,101,32,99,111,114,114,101,99,116,32,111,114,100,101,114,105,110,103,10,9,9,114,97,121,90,77,105,110,32,61,32,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,59,10,10,9,9,47,47,32,67,111,109,112,117,116,101,32,116,104,101,32,118,97,108,117,101,32,97,116,32,49,47,50,32,112,105,120,101,108,32,105,110,116,111,32,116,104,101,32,102,117,116,117,114,101,10,9,9,114,97,121,90,77,97,120,32,61,32,40,100,81,46,122,32,42,32,48,46,53,32,43,32,81,46,122,41,32,47,32,40,100,107,32,42,32,48,46,53,32,43,32,107,41,59,10,9,9,112,114,101,118,90,77,97,120,69,115,116,105,109,97,116,101,32,61,32,114,97,121,90,77,97,120,59,10,9,9,105,102,32,40,114,97,121,90,77,105,110,32,62,32,114,97,121,90,77,97,120,41,32,123,10,9,9,9,102,108,111,97,116,32,97,117,120,32,61,32,114,97,121,90,77,105,110,59,10,9,9,9,114,97,121,90,77,105,110,61,114,97,121,90,77,97,120,59,10,9,9,9,114,97,121,90,77,97,120,61,97,117,120,59,10,10,9,9,125,10,10,10,9,9,47,47,32,67,97,109,101,114,97,45,115,112,97,99,101,32,122,32,111,102,32,116,104,101,32,98,97,99,107,103,114,111,117,110,100,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,116,101,120,101,108,70,101,116,99,104,40,99,115,90,66,117,102,102,101,114,44,32,105,118,101,99,50,40,104,105,116,80,105,120,101,108,41,44,32,48,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,10,9,9,47,47,32,84,104,105,115,32,99,111,109,112,105,108,101,115,32,97,119,97,121,32,119,104,101,110,32,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,32,61,32,102,97,108,115,101,10,9,9,47,42,105,102,32,40,99,115,90,66,117,102,102,101,114,73,115,72,121,112,101,114,98,111,108,105,99,41,32,123,10,9,9,9,115,99,101,110,101,90,77,97,120,32,61,32,114,101,99,111,110,115,116,114,117,99,116,67,83,90,40,115,99,101,110,101,90,77,97,120,44,32,99,108,105,112,73,110,102,111,41,59,10,9,9,125,42,47,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,115,99,101,110,101,90,77,97,120,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,115,99,101,110,101,90,77,97,120,32,61,32,45,115,99,101,110,101,90,77,97,120,59,10,10,10,10,9,125,32,47,47,32,112,105,120,101,108,32,111,110,32,114,97,121,10,10,10,10,9,81,46,120,121,32,43,61,32,100,81,46,120,121,32,42,32,115,116,101,112,67,111,117,110,116,59,10,9,99,115,72,105,116,80,111,105,110,116,32,61,32,81,32,42,32,40,49,46,48,32,47,32,107,41,59,10,10,9,47,47,32,77,97,116,99,104,101,115,32,116,104,101,32,110,101,119,32,108,111,111,112,32,99,111,110,100,105,116,105,111,110,58,10,9,114,101,116,117,114,110,32,40,114,97,121,90,77,97,120,32,62,61,32,115,99,101,110,101,90,77,97,120,32,45,32,99,115,90,84,104,105,99,107,110,101,115,115,41,32,38,38,32,40,114,97,121,90,77,105,110,32,60,61,32,115,99,101,110,101,90,77,97,120,41,59,10,125,10,10,118,111,105,100,32,115,119,97,112,102,40,105,110,111,117,116,32,102,108,111,97,116,32,97,44,105,110,111,117,116,32,102,108,111,97,116,32,98,41,32,123,10,9,102,108,111,97,116,32,97,117,120,61,97,59,10,9,97,61,98,59,10,9,98,61,97,117,120,59,10,125,10,102,108,111,97,116,32,114,97,110,100,40,118,101,99,50,32,99,111,41,123,10,32,32,32,32,114,101,116,117,114,110,32,102,114,97,99,116,40,115,105,110,40,100,111,116,40,99,111,46,120,121,32,44,118,101,99,50,40,49,50,46,57,56,57,56,44,55,56,46,50,51,51,41,41,41,32,42,32,52,51,55,53,56,46,53,52,53,51,41,59,10,125,10,10,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,84,111,67,111,110,101,65,110,103,108,101,40,102,108,111,97,116,32,115,112,101,99,117,108,97,114,80,111,119,101,114,41,32,123,10,9,102,108,111,97,116,32,101,120,112,111,110,101,110,116,32,61,32,49,46,48,102,32,47,32,40,115,112,101,99,117,108,97,114,80,111,119,101,114,32,43,32,49,46,48,102,41,59,10,9,114,101,116,117,114,110,32,97,99,111,115,40,112,111,119,40,48,46,50,52,52,102,44,32,101,120,112,111,110,101,110,116,41,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,79,112,112,111,115,105,116,101,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,99,111,110,101,84,104,101,116,97,41,10,123,10,9,47,47,32,115,105,109,112,108,101,32,116,114,105,103,32,97,110,100,32,97,108,103,101,98,114,97,32,45,32,115,111,104,44,32,99,97,104,44,32,116,111,97,32,45,32,116,97,110,40,116,104,101,116,97,41,32,61,32,111,112,112,47,97,100,106,44,32,111,112,112,32,61,32,116,97,110,40,116,104,101,116,97,41,32,42,32,97,100,106,44,32,116,104,101,110,32,109,117,108,116,105,112,108,121,32,42,32,50,46,48,102,32,102,111,114,32,105,115,111,115,99,101,108,101,115,32,116,114,105,97,110,103,108,101,32,98,97,115,101,10,9,114,101,116,117,114,110,32,50,46,48,102,32,42,32,116,97,110,40,99,111,110,101,84,104,101,116,97,41,32,42,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,73,110,82,97,100,105,117,115,40,102,108,111,97,116,32,97,44,32,102,108,111,97,116,32,104,41,10,123,10,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,114,101,116,117,114,110,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,125,10,10,102,108,111,97,116,32,105,115,111,115,99,101,108,101,115,84,114,105,97,110,103,108,101,78,101,120,116,65,100,106,97,99,101,110,116,40,102,108,111,97,116,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,44,32,102,108,111,97,116,32,105,110,99,105,114,99,108,101,82,97,100,105,117,115,41,10,123,10,9,47,47,32,115,117,98,116,114,97,99,116,32,116,104,101,32,100,105,97,109,101,116,101,114,32,111,102,32,116,104,101,32,105,110,99,105,114,99,108,101,32,116,111,32,103,101,116,32,116,104,101,32,97,100,106,97,99,101,110,116,32,115,105,100,101,32,111,102,32,116,104,101,32,110,101,120,116,32,108,101,118,101,108,32,111,110,32,116,104,101,32,99,111,110,101,10,9,114,101,116,117,114,110,32,97,100,106,97,99,101,110,116,76,101,110,103,116,104,32,45,32,40,105,110,99,105,114,99,108,101,82,97,100,105,117,115,32,42,32,50,46,48,102,41,59,10,125,10,10,118,111,105,100,32,109,97,105,110,40,41,32,123,10,10,10,9,102,108,111,97,116,32,110,117,109,95,115,116,101,112,115,61,54,52,59,10,9,102,108,111,97,116,32,105,110,105,116,105,97,108,95,98,105,97,115,61,48,46,49,59,10,9,102,108,111,97,116,32,104,105,116,95,116,111,108,101,114,97,110,99,101,61,48,46,49,59,10,10,9,47,47,47,47,10,10,9,118,101,99,52,32,100,105,102,102,117,115,101,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,117,118,95,105,110,116,101,114,112,32,41,59,10,9,118,101,99,52,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,32,61,32,116,101,120,116,117,114,101,40,32,115,111,117,114,99,101,95,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,44,32,117,118,95,105,110,116,101,114,112,41,59,10,10,9,118,101,99,51,32,110,111,114,109,97,108,59,10,10,9,110,111,114,109,97,108,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,50,46,48,45,49,46,48,59,10,10,9,105,102,32,40,102,97,108,115,101,41,32,123,10,9,32,32,32,32,102,108,111,97,116,32,115,99,97,108,101,32,61,32,49,46,55,55,55,55,59,10,9,32,32,32,32,118,101,99,51,32,110,110,32,61,10,9,9,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,120,121,122,42,118,101,99,51,40,50,46,48,42,115,99,97,108,101,44,50,46,48,42,115,99,97,108,101,44,48,46,48,41,32,43,10,9,9,118,101,99,51,40,45,115,99,97,108,101,44,45,115,99,97,108,101,44,49,46,48,41,59,10,9,32,32,32,32,102,108,111,97,116,32,103,32,61,32,50,46,48,32,47,32,100,111,116,40,110,110,46,120,121,122,44,110,110,46,120,121,122,41,59,10,9,32,32,32,32,118,101,99,51,32,110,59,10,9,32,32,32,32,110,46,120,121,32,61,32,103,42,110,110,46,120,121,59,10,9,32,32,32,32,110,46,122,32,61,32,103,45,49,46,48,59,10,9,32,32,32,110,111,114,109,97,108,61,110,59,10,9,125,10,10,9,118,101,99,51,32,116,97,110,103,101,110,116,59,10,9,118,101,99,51,32,98,105,110,111,114,109,97,108,59,10,9,102,105,110,100,95,97,114,98,105,116,114,97,114,121,95,116,97,110,103,101,110,116,40,110,111,114,109,97,108,44,32,116,97,110,103,101,110,116,44,32,98,105,110,111,114,109,97,108,41,59,10,10,9,102,108,111,97,116,32,114,111,117,103,104,110,101,115,115,32,61,32,110,111,114,109,97,108,95,114,111,117,103,104,110,101,115,115,46,119,59,10,10,9,102,108,111,97,116,32,100,101,112,116,104,95,116,101,120,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,117,118,95,105,110,116,101,114,112,41,46,114,59,10,10,9,118,101,99,52,32,119,111,114,108,100,95,112,111,115,32,61,32,105,110,118,101,114,115,101,95,112,114,111,106,101,99,116,105,111,110,32,42,32,118,101,99,52,40,32,117,118,95,105,110,116,101,114,112,42,50,46,48,45,49,46,48,44,32,100,101,112,116,104,95,116,101,120,42,50,46,48,45,49,46,48,44,32,49,46,48,32,41,59,10,9,118,101,99,51,32,118,101,114,116,101,120,32,61,32,119,111,114,108,100,95,112,111,115,46,120,121,122,47,119,111,114,108,100,95,112,111,115,46,119,59,10,10,9,118,101,99,51,32,118,105,101,119,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,114,101,102,108,101,99,116,40,118,105,101,119,95,100,105,114,44,32,110,111,114,109,97,108,41,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,105,101,119,95,100,105,114,32,45,32,110,111,114,109,97,108,32,42,32,100,111,116,40,110,111,114,109,97,108,44,118,105,101,119,95,100,105,114,41,32,42,32,50,46,48,41,59,10,10,9,47,47,114,97,121,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,118,101,99,51,40,49,44,49,44,45,49,41,41,59,10,10,10,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,10,10,9,47,47,109,97,107,101,32,114,97,121,32,108,101,110,103,116,104,32,97,110,100,32,99,108,105,112,32,105,116,32,97,103,97,105,110,115,116,32,116,104,101,32,110,101,97,114,32,112,108,97,110,101,32,40,100,111,110,39,116,32,119,97,110,116,32,116,111,32,116,114,97,99,101,32,98,101,121,111,110,100,32,118,105,115,105,98,108,101,41,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,62,32,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,63,32,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,99,97,109,101,114,97,95,122,95,102,97,114,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,32,61,32,118,101,114,116,101,120,32,43,32,114,97,121,95,100,105,114,42,114,97,121,95,108,101,110,59,10,10,9,102,108,111,97,116,32,119,95,98,101,103,105,110,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,98,101,103,105,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,44,119,95,98,101,103,105,110,41,59,10,9,102,108,111,97,116,32,119,95,101,110,100,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,101,110,100,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,32,114,97,121,95,101,110,100,44,32,119,95,101,110,100,41,59,10,9,118,101,99,50,32,118,112,95,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,101,110,100,45,118,112,95,108,105,110,101,95,98,101,103,105,110,59,10,10,10,9,119,95,98,101,103,105,110,32,61,32,49,46,48,47,119,95,98,101,103,105,110,59,10,9,119,95,101,110,100,32,61,32,49,46,48,47,119,95,101,110,100,59,10,10,10,9,102,108,111,97,116,32,122,95,98,101,103,105,110,32,61,32,118,101,114,116,101,120,46,122,42,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,101,110,100,32,61,32,114,97,121,95,101,110,100,46,122,42,119,95,101,110,100,59,10,10,9,118,101,99,50,32,108,105,110,101,95,98,101,103,105,110,32,61,32,118,112,95,108,105,110,101,95,98,101,103,105,110,47,112,105,120,101,108,95,115,105,122,101,59,10,9,118,101,99,50,32,108,105,110,101,95,100,105,114,32,61,32,118,112,95,108,105,110,101,95,100,105,114,47,112,105,120,101,108,95,115,105,122,101,59,10,9,102,108,111,97,116,32,122,95,100,105,114,32,61,32,122,95,101,110,100,32,45,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,95,100,105,114,32,61,32,119,95,101,110,100,32,45,32,119,95,98,101,103,105,110,59,10,10,10,9,47,47,32,99,108,105,112,32,116,104,101,32,108,105,110,101,32,116,111,32,116,104,101,32,118,105,101,119,112,111,114,116,32,101,100,103,101,115,10,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,118,112,95,108,105,110,101,95,98,101,103,105,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,118,112,95,108,105,110,101,95,100,105,114,46,121,41,41,59,10,9,102,108,111,97,116,32,108,105,110,101,95,99,108,105,112,32,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,32,42,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,9,108,105,110,101,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,122,95,100,105,114,32,42,61,32,108,105,110,101,95,99,108,105,112,59,10,9,119,95,100,105,114,32,42,61,108,105,110,101,95,99,108,105,112,59,10,10,10,9,118,101,99,50,32,108,105,110,101,95,97,100,118,97,110,99,101,32,61,32,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,59,32,47,47,100,111,119,110,32,116,111,32,112,105,120,101,108,10,9,102,108,111,97,116,32,115,116,101,112,95,115,105,122,101,32,61,32,108,101,110,103,116,104,40,108,105,110,101,95,97,100,118,97,110,99,101,41,47,108,101,110,103,116,104,40,108,105,110,101,95,100,105,114,41,59,10,9,102,108,111,97,116,32,122,95,97,100,118,97,110,99,101,32,61,32,122,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,102,108,111,97,116,32,119,95,97,100,118,97,110,99,101,32,61,32,119,95,100,105,114,42,115,116,101,112,95,115,105,122,101,59,32,47,47,32,97,100,97,112,116,32,119,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,10,9,102,108,111,97,116,32,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,32,61,32,49,46,48,47,109,97,120,40,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,120,41,44,97,98,115,40,108,105,110,101,95,97,100,118,97,110,99,101,46,121,41,41,59,32,47,47,109,97,107,101,32,105,116,32,103,111,32,102,97,115,116,101,114,32,116,104,101,32,99,108,111,115,101,114,32,116,111,32,52,53,100,10,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,32,47,47,32,97,100,97,112,116,32,122,32,97,100,118,97,110,99,101,32,116,111,32,108,105,110,101,32,97,100,118,97,110,99,101,10,9,122,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,9,119,95,97,100,118,97,110,99,101,42,61,97,100,118,97,110,99,101,95,97,110,103,108,101,95,97,100,106,59,10,10,9,118,101,99,50,32,112,111,115,32,61,32,108,105,110,101,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,32,61,32,122,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,119,32,61,32,119,95,98,101,103,105,110,59,10,9,102,108,111,97,116,32,122,95,102,114,111,109,61,122,47,119,59,10,9,102,108,111,97,116,32,122,95,116,111,61,122,95,102,114,111,109,59,10,9,102,108,111,97,116,32,100,101,112,116,104,59,10,9,118,101,99,50,32,112,114,101,118,95,112,111,115,61,112,111,115,59,10,10,9,98,111,111,108,32,102,111,117,110,100,61,102,97,108,115,101,59,10,10,9,102,108,111,97,116,32,97,99,99,101,108,61,49,46,48,52,59,47,47,43,114,97,110,100,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,42,48,46,48,48,48,49,59,10,9,102,108,111,97,116,32,115,116,101,112,115,95,116,97,107,101,110,61,48,59,10,10,9,102,111,114,40,102,108,111,97,116,32,105,61,48,59,105,60,110,117,109,95,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,112,111,115,43,61,108,105,110,101,95,97,100,118,97,110,99,101,59,10,9,9,122,43,61,122,95,97,100,118,97,110,99,101,59,10,9,9,119,43,61,119,95,97,100,118,97,110,99,101,59,10,10,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,122,95,102,114,111,109,32,61,32,122,95,116,111,59,10,9,9,122,95,116,111,32,61,32,122,47,119,59,10,10,9,9,105,102,32,40,100,101,112,116,104,62,122,95,116,111,41,32,123,10,10,9,9,9,105,102,32,40,100,101,112,116,104,60,61,109,97,120,40,122,95,116,111,44,122,95,102,114,111,109,41,43,48,46,56,41,32,123,10,9,9,9,9,102,111,117,110,100,61,116,114,117,101,59,10,9,9,9,125,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,10,9,9,115,116,101,112,115,95,116,97,107,101,110,43,61,49,46,48,59,10,9,9,112,114,101,118,95,112,111,115,61,112,111,115,59,10,9,9,122,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,119,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,9,108,105,110,101,95,97,100,118,97,110,99,101,42,61,97,99,99,101,108,59,10,9,125,10,10,9,105,102,32,40,102,111,117,110,100,41,32,123,10,10,10,9,9,118,101,99,50,32,102,105,110,97,108,95,112,111,115,59,10,9,9,102,108,111,97,116,32,103,114,97,100,59,10,35,100,101,102,105,110,101,32,66,76,69,78,68,95,65,67,67,69,76,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,10,9,9,118,101,99,50,32,98,108,101,110,100,95,100,105,114,32,61,32,112,111,115,32,45,32,112,114,101,118,95,112,111,115,59,10,9,9,102,108,111,97,116,32,115,116,101,112,115,32,61,32,109,105,110,40,56,46,48,44,108,101,110,103,116,104,40,98,108,101,110,100,95,100,105,114,41,41,59,10,9,9,105,102,32,40,115,116,101,112,115,62,50,46,48,41,32,123,10,9,9,9,118,101,99,50,32,98,108,101,110,100,95,115,116,101,112,32,61,32,98,108,101,110,100,95,100,105,114,47,115,116,101,112,115,59,10,9,9,9,102,108,111,97,116,32,98,108,101,110,100,95,122,32,61,32,40,122,95,116,111,45,122,95,102,114,111,109,41,47,115,116,101,112,115,59,10,9,9,9,118,101,99,50,32,110,101,119,95,112,111,115,59,10,9,9,9,102,108,111,97,116,32,115,117,98,103,114,97,100,61,48,46,48,59,10,9,9,9,102,111,114,40,102,108,111,97,116,32,105,61,48,46,48,59,105,60,115,116,101,112,115,59,105,43,43,41,32,123,10,10,9,9,9,9,110,101,119,95,112,111,115,32,61,32,40,112,114,101,118,95,112,111,115,43,98,108,101,110,100,95,115,116,101,112,42,105,41,59,10,9,9,9,9,102,108,111,97,116,32,122,32,61,32,122,95,102,114,111,109,43,98,108,101,110,100,95,122,42,105,59,10,10,9,9,9,9,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,32,110,101,119,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,9,9,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,9,9,100,101,112,116,104,61,45,100,101,112,116,104,59,10,10,9,9,9,9,115,117,98,103,114,97,100,61,105,47,115,116,101,112,115,59,10,9,9,9,9,105,102,32,40,100,101,112,116,104,62,122,41,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,125,10,10,9,9,9,102,105,110,97,108,95,112,111,115,32,61,32,110,101,119,95,112,111,115,59,10,9,9,9,103,114,97,100,61,40,115,116,101,112,115,95,116,97,107,101,110,43,115,117,98,103,114,97,100,41,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,118,101,99,51,40,103,114,97,100,41,44,49,46,48,41,59,10,9,9,125,32,101,108,115,101,32,123,10,35,101,110,100,105,102,10,9,9,9,103,114,97,100,61,115,116,101,112,115,95,116,97,107,101,110,47,110,117,109,95,115,116,101,112,115,59,10,9,9,9,102,105,110,97,108,95,112,111,115,61,112,111,115,59,10,35,105,102,100,101,102,32,66,76,69,78,68,95,65,67,67,69,76,10,9,9,125,10,10,35,101,110,100,105,102,10,10,35,100,101,102,105,110,101,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,35,105,102,100,101,102,32,82,69,70,76,69,67,84,95,82,79,85,71,72,78,69,83,83,10,10,10,9,9,118,101,99,52,32,102,105,110,97,108,95,99,111,108,111,114,59,10,10,9,9,105,102,32,40,114,111,117,103,104,110,101,115,115,32,62,32,48,46,48,48,49,41,32,123,10,9,9,9,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,10,9,9,9,47,47,117,115,101,32,97,32,98,108,117,114,114,101,100,32,118,101,114,115,105,111,110,32,40,105,110,32,99,111,110,115,101,99,117,116,105,118,101,32,109,105,112,109,97,112,115,41,32,111,102,32,116,104,101,32,115,99,114,101,101,110,32,116,111,32,115,105,109,117,108,97,116,101,32,114,111,117,103,104,110,101,115,115,10,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,32,61,32,49,46,48,45,114,111,117,103,104,110,101,115,115,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,97,110,103,108,101,32,61,32,114,111,117,103,104,110,101,115,115,32,42,32,77,95,80,73,32,42,32,48,46,53,59,10,9,9,9,118,101,99,50,32,99,111,110,101,95,100,105,114,32,61,32,102,105,110,97,108,95,112,111,115,32,45,32,108,105,110,101,95,98,101,103,105,110,59,10,9,9,9,102,108,111,97,116,32,99,111,110,101,95,108,101,110,32,61,32,108,101,110,103,116,104,40,99,111,110,101,95,100,105,114,41,59,10,9,9,9,99,111,110,101,95,100,105,114,32,61,32,110,111,114,109,97,108,105,122,101,40,99,111,110,101,95,100,105,114,41,59,32,47,47,119,105,108,108,32,98,101,32,117,115,101,100,32,110,111,114,109,97,108,105,122,101,100,32,102,114,111,109,32,110,111,119,32,111,110,10,9,9,9,102,108,111,97,116,32,109,97,120,95,109,105,112,109,97,112,32,61,32,102,105,108,116,101,114,95,109,105,112,109,97,112,95,108,101,118,101,108,115,32,45,49,59,10,9,9,9,102,108,111,97,116,32,103,108,111,115,115,95,109,117,108,116,61,103,108,111,115,115,59,10,10,9,9,9,102,108,111,97,116,32,114,101,109,95,97,108,112,104,97,61,49,46,48,59,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,41,59,10,10,9,9,9,102,111,114,40,105,110,116,32,105,61,48,59,105,60,55,59,105,43,43,41,32,123,10,10,9,9,9,9,102,108,111,97,116,32,111,112,95,108,101,110,32,61,32,50,46,48,32,42,32,116,97,110,40,99,111,110,101,95,97,110,103,108,101,41,32,42,32,99,111,110,101,95,108,101,110,59,32,47,47,111,112,111,115,105,116,101,32,115,105,100,101,32,111,102,32,105,115,111,32,116,114,105,97,110,103,108,101,10,9,9,9,9,102,108,111,97,116,32,114,97,100,105,117,115,59,10,9,9,9,9,123,10,9,9,9,9,9,47,47,102,105,116,32,116,111,32,115,112,104,101,114,101,32,105,110,115,105,100,101,32,99,111,110,101,32,40,115,112,104,101,114,101,32,101,110,100,115,32,97,116,32,101,110,100,32,111,102,32,99,111,110,101,41,44,32,115,111,109,101,116,104,105,110,103,32,108,105,107,101,32,116,104,105,115,58,10,9,9,9,9,9,47,47,32,95,95,95,10,9,9,9,9,9,47,47,32,92,79,47,10,9,9,9,9,9,47,47,32,32,86,10,9,9,9,9,9,47,47,10,9,9,9,9,9,47,47,32,97,115,32,105,116,32,97,118,111,105,100,115,32,98,108,101,101,100,105,110,103,32,102,114,111,109,32,98,101,121,111,110,100,32,116,104,101,32,114,101,102,108,101,99,116,105,111,110,32,97,115,32,109,117,99,104,32,97,115,32,112,111,115,115,105,98,108,101,46,32,65,115,32,97,32,112,108,117,115,10,9,9,9,9,9,47,47,32,105,116,32,97,108,115,111,32,109,97,107,101,115,32,116,104,101,32,114,111,117,103,104,32,114,101,102,108,101,99,116,105,111,110,32,109,111,114,101,32,101,108,111,110,103,97,116,101,100,46,10,9,9,9,9,9,102,108,111,97,116,32,97,32,61,32,111,112,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,104,32,61,32,99,111,110,101,95,108,101,110,59,10,9,9,9,9,9,102,108,111,97,116,32,97,50,32,61,32,97,32,42,32,97,59,10,9,9,9,9,9,102,108,111,97,116,32,102,104,50,32,61,32,52,46,48,102,32,42,32,104,32,42,32,104,59,10,9,9,9,9,9,114,97,100,105,117,115,32,61,32,40,97,32,42,32,40,115,113,114,116,40,97,50,32,43,32,102,104,50,41,32,45,32,97,41,41,32,47,32,40,52,46,48,102,32,42,32,104,41,59,10,9,9,9,9,125,10,10,9,9,9,9,47,47,102,105,110,100,32,116,104,101,32,112,108,97,99,101,32,119,104,101,114,101,32,115,99,114,101,101,110,32,109,117,115,116,32,98,101,32,115,97,109,112,108,101,100,10,9,9,9,9,118,101,99,50,32,115,97,109,112,108,101,95,112,111,115,32,61,32,40,32,108,105,110,101,95,98,101,103,105,110,32,43,32,99,111,110,101,95,100,105,114,32,42,32,40,99,111,110,101,95,108,101,110,32,45,32,114,97,100,105,117,115,41,32,41,32,42,32,112,105,120,101,108,95,115,105,122,101,59,10,9,9,9,9,47,47,114,97,100,105,117,115,32,105,115,32,105,110,32,112,105,120,101,108,115,44,32,115,111,32,105,116,39,115,32,110,97,116,117,114,97,108,32,116,104,97,116,32,108,111,103,50,40,114,97,100,105,117,115,41,32,109,97,112,115,32,116,111,32,116,104,101,32,114,105,103,104,116,32,109,105,112,109,97,112,32,102,111,114,32,116,104,101,32,97,109,111,117,110,116,32,111,102,32,112,105,120,101,108,115,10,9,9,9,9,102,108,111,97,116,32,109,105,112,109,97,112,32,61,32,99,108,97,109,112,40,32,108,111,103,50,40,32,114,97,100,105,117,115,32,41,44,32,48,46,48,44,32,109,97,120,95,109,105,112,109,97,112,32,41,59,10,10,9,9,9,9,47,47,109,105,112,109,97,112,32,61,32,109,97,120,40,109,105,112,109,97,112,45,49,46,48,44,48,46,48,41,59,10,9,9,9,9,47,47,100,111,32,115,97,109,112,108,105,110,103,10,10,9,9,9,9,118,101,99,52,32,115,97,109,112,108,101,95,99,111,108,111,114,59,10,9,9,9,9,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,95,109,105,112,109,97,112,115,44,115,97,109,112,108,101,95,112,111,115,44,109,97,120,40,49,46,48,44,109,105,112,109,97,112,41,41,59,10,9,9,9,9,9,105,102,32,40,109,105,112,109,97,112,60,49,46,48,41,32,123,32,47,47,119,101,32,117,115,101,32,97,110,111,116,104,101,114,32,105,109,97,103,101,32,97,115,32,98,97,115,101,32,116,111,32,97,118,111,105,100,32,99,111,112,121,105,110,103,32,97,108,108,32,116,104,101,32,115,99,114,101,101,110,32,117,110,110,101,99,101,115,97,114,105,108,121,10,9,9,9,9,9,9,118,101,99,52,32,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,115,97,109,112,108,101,95,112,111,115,44,48,46,48,41,59,10,9,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,32,61,32,109,105,120,40,98,97,115,101,95,115,97,109,112,108,101,95,99,111,108,111,114,44,115,97,109,112,108,101,95,99,111,108,111,114,44,109,105,112,109,97,112,41,59,10,9,9,9,9,9,125,10,9,9,9,9,125,10,10,9,9,9,9,47,47,109,117,108,116,105,112,108,121,32,98,121,32,103,108,111,115,115,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,42,61,103,108,111,115,115,95,109,117,108,116,59,10,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,97,61,103,108,111,115,115,95,109,117,108,116,59,10,10,9,9,9,9,114,101,109,95,97,108,112,104,97,32,45,61,32,115,97,109,112,108,101,95,99,111,108,111,114,46,97,59,10,9,9,9,9,105,102,40,114,101,109,95,97,108,112,104,97,32,60,32,48,46,48,41,32,123,10,9,9,9,9,9,115,97,109,112,108,101,95,99,111,108,111,114,46,114,103,98,32,42,61,32,40,49,46,48,32,45,32,97,98,115,40,114,101,109,95,97,108,112,104,97,41,41,59,10,9,9,9,9,125,10,10,9,9,9,9,102,105,110,97,108,95,99,111,108,111,114,43,61,115,97,109,112,108,101,95,99,111,108,111,114,59,10,10,9,9,9,9,105,102,32,40,102,105,110,97,108,95,99,111,108,111,114,46,97,62,61,48,46,57,53,41,32,123,10,9,9,9,9,9,47,47,32,84,104,105,115,32,99,111,100,101,32,111,102,32,97,99,99,117,109,117,108,97,116,105,110,103,32,103,108,111,115,115,32,97,110,100,32,97,98,111,114,116,105,110,103,32,111,110,32,110,101,97,114,32,111,110,101,10,9,9,9,9,9,47,47,32,109,97,107,101,115,32,115,101,110,115,101,32,119,104,101,110,32,121,111,117,32,116,104,105,110,107,32,111,102,32,99,111,110,101,32,116,114,97,99,105,110,103,46,10,9,9,9,9,9,47,47,32,84,104,105,110,107,32,111,102,32,105,116,32,97,115,32,105,102,32,114,111,117,103,104,110,101,115,115,32,119,97,115,32,48,44,32,116,104,101,110,32,119,101,32,99,111,117,108,100,32,97,98,111,114,116,32,111,110,32,116,104,101,32,102,105,114,115,116,10,9,9,9,9,9,47,47,32,105,116,101,114,97,116,105,111,110,46,32,70,111,114,32,108,101,115,115,101,114,32,114,111,117,103,104,110,101,115,115,32,118,97,108,117,101,115,44,32,119,101,32,110,101,101,100,32,109,111,114,101,32,105,116,101,114,97,116,105,111,110,115,44,32,98,117,116,10,9,9,9,9,9,47,47,32,101,97,99,104,32,110,101,101,100,115,32,116,111,32,104,97,118,101,32,108,101,115,115,32,105,110,102,108,117,101,110,99,101,32,103,105,118,101,110,32,116,104,101,32,115,112,104,101,114,101,32,105,115,32,115,109,97,108,108,101,114,10,9,9,9,9,9,98,114,101,97,107,59,10,9,9,9,9,125,10,10,9,9,9,9,99,111,110,101,95,108,101,110,45,61,114,97,100,105,117,115,42,50,46,48,59,32,47,47,103,111,32,116,111,32,110,101,120,116,32,40,115,109,97,108,108,101,114,41,32,99,105,114,99,108,101,46,10,10,9,9,9,9,103,108,111,115,115,95,109,117,108,116,42,61,103,108,111,115,115,59,10,10,10,9,9,9,125,10,9,9,125,32,101,108,115,101,32,123,10,9,9,9,102,105,110,97,108,95,99,111,108,111,114,32,61,32,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,9,9,125,10,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,102,105,110,97,108,95,99,111,108,111,114,46,114,103,98,44,109,97,120,40,48,46,48,44,49,46,48,45,103,114,97,100,41,41,59,10,10,35,101,108,115,101,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,76,111,100,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,102,105,110,97,108,95,112,111,115,42,112,105,120,101,108,95,115,105,122,101,44,48,46,48,41,46,114,103,98,44,99,108,97,109,112,40,49,46,48,45,103,114,97,100,44,48,46,48,44,49,46,48,41,41,59,10,35,101,110,100,105,102,10,10,10,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,49,46,48,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,10,9,47,47,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,110,111,114,109,97,108,105,122,101,40,108,105,110,101,95,100,105,114,41,32,42,32,48,46,53,32,43,32,48,46,53,44,48,46,48,44,49,46,48,41,59,10,10,47,42,10,9,118,101,99,50,32,104,105,116,95,112,105,120,101,108,59,10,9,118,101,99,51,32,104,105,116,95,112,111,105,110,116,59,10,9,105,110,116,32,119,104,105,99,104,59,10,9,109,97,116,52,32,98,105,97,115,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,48,46,53,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,53,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,53,44,48,46,53,44,48,46,48,44,49,46,48,41,41,59,10,9,109,97,116,52,32,112,105,120,101,108,95,109,97,116,32,61,32,109,97,116,52,40,118,101,99,52,40,118,105,101,119,112,111,114,116,95,115,105,122,101,46,120,44,48,46,48,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,118,105,101,119,112,111,114,116,95,115,105,122,101,46,121,44,48,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,48,46,48,41,44,118,101,99,52,40,48,46,48,44,48,46,48,44,48,46,48,44,49,46,48,41,41,59,10,10,10,10,10,9,109,97,116,52,32,100,116,32,61,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,59,10,9,118,101,99,52,32,118,112,32,61,32,100,116,32,42,32,118,101,99,52,40,118,101,114,116,101,120,44,49,46,48,41,59,10,9,118,112,46,120,121,122,47,61,118,112,46,119,59,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,116,101,120,101,108,70,101,116,99,104,40,32,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,32,32,105,118,101,99,50,40,118,112,46,120,121,41,44,48,32,41,59,10,9,114,101,116,117,114,110,59,10,42,47,10,47,42,9,98,111,111,108,32,104,105,116,32,61,32,116,114,97,99,101,83,99,114,101,101,110,83,112,97,99,101,82,97,121,49,40,118,101,114,116,101,120,44,114,97,121,95,100,105,114,44,32,112,105,120,101,108,95,109,97,116,32,42,40,32,98,105,97,115,95,109,97,116,32,42,32,112,114,111,106,101,99,116,105,111,110,41,44,115,111,117,114,99,101,95,100,101,112,116,104,44,118,105,101,119,112,111,114,116,95,115,105,122,101,44,48,46,48,49,44,116,114,117,101,44,99,111,109,112,117,116,101,67,108,105,112,73,110,102,111,40,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,45,99,97,109,101,114,97,95,122,95,102,97,114,41,44,45,99,97,109,101,114,97,95,122,95,110,101,97,114,44,49,46,50,44,48,46,48,44,54,52,46,48,44,99,97,109,101,114,97,95,122,95,102,97,114,44,104,105,116,95,112,105,120,101,108,44,119,104,105,99,104,44,104,105,116,95,112,111,105,110,116,41,59,10,10,10,10,9,105,102,32,40,104,105,116,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,101,108,70,101,116,99,104,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,118,101,99,50,40,104,105,116,95,112,105,120,101,108,41,44,48,41,46,114,103,98,44,49,46,48,41,59,10,9,125,32,101,108,115,101,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,49,44,48,46,48,44,48,46,48,44,48,46,48,41,59,10,9,125,10,42,47,10,10,10,9,47,42,10,9,102,108,111,97,116,32,112,105,120,101,108,100,105,115,116,32,61,32,108,101,110,103,116,104,40,118,101,114,116,101,120,41,59,10,10,10,9,47,47,32,83,107,105,112,32,115,107,121,98,111,120,32,97,110,100,32,100,105,115,116,97,110,116,32,112,105,120,101,108,115,10,9,105,102,32,40,112,105,120,101,108,100,105,115,116,32,62,32,99,97,109,101,114,97,95,122,95,102,97,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,118,101,114,116,101,120,43,61,110,111,114,109,97,108,42,48,46,49,59,10,10,9,47,47,32,82,97,121,32,110,111,116,32,105,110,32,118,105,101,119,10,9,105,102,32,40,100,111,116,40,114,97,121,95,100,105,114,44,32,118,105,101,119,95,100,105,114,41,32,60,32,49,101,45,53,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,48,46,48,44,49,46,48,44,48,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,10,9,102,108,111,97,116,32,109,97,120,95,114,97,121,95,108,101,110,32,61,32,49,46,48,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,10,9,102,108,111,97,116,32,114,97,121,95,108,101,110,32,61,32,40,10,40,118,101,114,116,101,120,46,122,32,43,32,114,97,121,95,100,105,114,46,122,32,42,32,109,97,120,95,114,97,121,95,108,101,110,41,32,62,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,32,63,32,40,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,118,101,114,116,101,120,46,122,41,32,47,32,114,97,121,95,100,105,114,46,122,32,58,32,109,97,120,95,114,97,121,95,108,101,110,59,10,10,10,9,47,47,32,67,111,110,118,101,114,116,32,115,116,97,114,116,32,97,110,100,32,101,110,100,32,112,111,115,32,102,114,111,109,32,118,105,101,119,32,116,111,32,115,99,114,101,101,110,32,115,112,97,99,101,10,9,118,101,99,51,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,41,59,10,9,118,101,99,51,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,61,32,118,105,101,119,95,116,111,95,115,99,114,101,101,110,40,118,101,114,116,101,120,32,43,32,114,97,121,95,108,101,110,32,42,32,114,97,121,95,100,105,114,41,59,10,10,9,118,101,99,51,32,114,97,121,95,112,111,115,32,61,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,9,118,101,99,51,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,61,32,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,59,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,116,104,101,32,114,97,121,32,100,111,101,115,32,110,111,116,32,108,101,97,118,101,32,116,104,101,32,115,99,114,101,101,110,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,97,120,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,40,49,46,48,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,41,32,47,32,109,97,120,40,49,101,45,53,44,32,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,120,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,120,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,120,41,41,59,10,9,102,108,111,97,116,32,115,99,97,108,101,95,109,105,110,95,121,32,61,32,109,105,110,40,49,44,32,48,46,57,57,32,42,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,46,121,32,47,32,109,97,120,40,49,101,45,53,44,32,45,114,97,121,95,100,105,114,95,115,99,114,101,101,110,46,121,41,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,97,120,95,120,44,32,115,99,97,108,101,95,109,97,120,95,121,41,59,10,9,114,97,121,95,100,105,114,95,115,99,114,101,101,110,32,42,61,32,109,105,110,40,115,99,97,108,101,95,109,105,110,95,120,44,32,115,99,97,108,101,95,109,105,110,95,121,41,59,10,10,9,118,101,99,51,32,114,97,121,95,115,116,101,112,32,61,32,40,114,97,121,95,101,110,100,95,115,99,114,101,101,110,32,45,32,114,97,121,95,115,116,97,114,116,95,115,99,114,101,101,110,41,32,47,32,110,117,109,95,115,116,101,112,115,59,10,10,9,102,108,111,97,116,32,100,105,115,116,97,110,99,101,95,115,99,97,108,101,32,61,32,49,46,48,32,43,32,48,46,48,48,48,48,49,32,42,32,112,105,120,101,108,100,105,115,116,59,10,10,9,102,108,111,97,116,32,106,105,116,116,101,114,32,61,32,48,46,48,59,47,47,97,98,115,40,114,97,110,100,40,105,118,101,99,50,40,103,108,95,70,114,97,103,67,111,111,114,100,46,120,121,41,32,37,32,56,32,43,32,40,77,97,105,110,83,99,101,110,101,68,97,116,97,46,102,114,97,109,101,95,105,110,100,101,120,32,37,32,71,69,84,95,83,69,84,84,73,78,71,40,115,115,114,44,32,104,105,115,116,111,114,121,95,108,101,110,103,116,104,41,41,32,42,32,48,46,49,41,41,59,10,10,9,47,47,32,82,111,117,103,104,32,115,111,117,114,102,97,99,101,115,32,110,101,101,100,32,109,111,114,101,32,106,105,116,116,101,114,10,9,106,105,116,116,101,114,32,42,61,32,109,97,120,40,48,46,53,44,32,114,111,117,103,104,110,101,115,115,41,59,10,10,9,114,97,121,95,112,111,115,32,43,61,32,106,105,116,116,101,114,32,42,32,114,97,121,95,115,116,101,112,59,10,10,10,9,105,110,116,32,105,32,61,32,48,59,10,9,102,108,111,97,116,32,105,110,116,101,114,115,101,99,116,105,111,110,95,119,101,105,103,104,116,32,61,32,48,46,48,59,10,9,98,111,111,108,32,104,105,116,95,102,97,99,116,111,114,32,61,32,102,97,108,115,101,59,10,10,9,118,101,99,50,32,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,118,101,99,50,40,45,49,46,48,41,59,10,10,9,102,111,114,32,40,105,32,61,32,49,59,32,105,32,60,32,110,117,109,95,115,116,101,112,115,59,32,43,43,105,41,32,123,10,9,9,114,97,121,95,112,111,115,32,43,61,32,114,97,121,95,115,116,101,112,59,10,10,9,9,47,47,32,67,117,114,114,101,110,116,32,99,111,111,114,100,105,110,97,116,101,32,105,115,32,105,110,32,116,104,101,32,109,105,100,32,111,102,32,116,119,111,32,115,97,109,112,108,101,115,44,32,110,111,116,32,97,116,32,116,104,101,32,101,110,100,44,32,115,111,10,9,9,47,47,32,115,117,98,115,116,114,97,99,116,32,104,97,108,102,32,111,102,32,97,32,115,116,101,112,10,9,9,118,101,99,50,32,99,117,114,114,95,99,111,111,114,100,32,61,32,114,97,121,95,112,111,115,46,120,121,32,45,32,48,46,53,32,42,32,114,97,121,95,115,116,101,112,46,120,121,59,10,10,10,9,9,47,47,32,73,110,99,114,101,97,115,101,32,114,97,121,32,98,105,97,115,32,97,115,32,119,101,32,97,100,118,97,110,99,101,32,116,104,101,32,114,97,121,10,9,9,102,108,111,97,116,32,116,114,97,99,101,95,108,101,110,32,61,32,105,110,105,116,105,97,108,95,98,105,97,115,32,42,32,49,48,46,48,32,43,10,9,9,9,9,49,48,48,46,48,32,42,32,100,111,116,40,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,44,99,117,114,114,95,99,111,111,114,100,45,117,118,95,105,110,116,101,114,112,41,59,10,10,9,9,116,114,97,99,101,95,108,101,110,32,42,61,32,49,46,48,32,43,32,49,46,48,32,42,32,114,111,117,103,104,110,101,115,115,59,10,10,9,9,47,47,32,67,104,101,99,107,32,102,111,114,32,105,110,116,101,114,115,101,99,116,105,111,110,10,10,9,9,102,108,111,97,116,32,100,101,112,116,104,32,61,32,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,101,112,116,104,44,99,117,114,114,95,99,111,111,114,100,41,46,114,32,42,32,50,46,48,32,45,32,49,46,48,59,10,9,9,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,61,100,101,112,116,104,59,10,9,9,47,47,102,108,111,97,116,32,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,50,46,48,32,42,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,42,32,99,97,109,101,114,97,95,122,95,102,97,114,32,47,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,43,32,99,97,109,101,114,97,95,122,95,110,101,97,114,32,45,32,100,101,112,116,104,32,42,32,40,99,97,109,101,114,97,95,122,95,102,97,114,32,45,32,99,97,109,101,114,97,95,122,95,110,101,97,114,41,41,59,10,9,9,47,47,108,105,110,101,97,114,95,100,101,112,116,104,32,61,32,45,108,105,110,101,97,114,95,100,101,112,116,104,59,10,10,10,9,9,105,102,32,40,112,111,105,110,116,95,98,101,116,119,101,101,110,95,112,108,97,110,101,115,40,108,105,110,101,97,114,95,100,101,112,116,104,44,32,114,97,121,95,112,111,115,46,122,44,10,9,9,9,9,9,32,114,97,121,95,112,111,115,46,122,32,45,32,114,97,121,95,115,116,101,112,46,122,44,32,116,114,97,99,101,95,108,101,110,44,32,104,105,116,95,102,97,99,116,111,114,41,41,32,123,10,9,9,9,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,99,117,114,114,95,99,111,111,114,100,59,10,9,9,9,98,114,101,97,107,59,10,9,9,125,10,9,125,10,10,9,47,47,32,77,97,107,101,32,115,117,114,101,32,119,101,32,104,105,116,32,101,120,97,99,116,108,121,32,111,110,101,32,112,105,120,101,108,10,9,47,47,105,110,116,101,114,115,101,99,116,105,111,110,32,61,32,116,114,117,110,99,97,116,101,95,99,111,111,114,100,105,110,97,116,101,40,105,110,116,101,114,115,101,99,116,105,111,110,41,59,10,10,9,47,47,32,67,104,101,99,107,32,105,102,32,119,101,32,104,105,116,32,115,111,109,101,116,104,105,110,103,10,9,105,102,32,40,109,105,110,40,105,110,116,101,114,115,101,99,116,105,111,110,46,120,44,32,105,110,116,101,114,115,101,99,116,105,111,110,46,121,41,32,60,61,32,48,46,48,32,124,124,32,111,117,116,95,111,102,95,115,99,114,101,101,110,40,105,110,116,101,114,115,101,99,116,105,111,110,41,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,49,46,48,44,48,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,105,102,32,40,33,104,105,116,95,102,97,99,116,111,114,41,32,123,10,9,9,102,114,97,103,95,99,111,108,111,114,61,118,101,99,52,40,48,46,48,44,49,46,48,44,49,46,48,44,49,46,48,41,59,10,9,9,114,101,116,117,114,110,59,10,9,125,10,10,9,102,114,97,103,95,99,111,108,111,114,32,61,32,118,101,99,52,40,116,101,120,116,117,114,101,40,115,111,117,114,99,101,95,100,105,102,102,117,115,101,44,105,110,116,101,114,115,101,99,116,105,111,110,41,46,114,103,98,44,49,46,48,41,59,10,42,47,10,10,125,10,10, 0}; - - static const int _fragment_code_start=17; - setup(_conditional_strings,2,_uniform_strings,8,_attribute_pairs,0, _texunit_pairs,4,_ubo_pairs,0,_feedbacks,0,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start); - }; - -}; - -#endif - diff --git a/drivers/gles3/shadow_atlas_gles3.cpp b/drivers/gles3/shadow_atlas_gles3.cpp deleted file mode 100644 index 38dee8bcea..0000000000 --- a/drivers/gles3/shadow_atlas_gles3.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "shadow_atlas_gles3.h" - diff --git a/drivers/gles3/shadow_atlas_gles3.h b/drivers/gles3/shadow_atlas_gles3.h deleted file mode 100644 index 46eaf581cb..0000000000 --- a/drivers/gles3/shadow_atlas_gles3.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SHADOW_ATLAS_GLES3_H -#define SHADOW_ATLAS_GLES3_H - -#include "rasterizer_storage_gles3.h" - - - -#endif // SHADOW_ATLAS_GLES3_H -- cgit v1.2.3 From 27a46d78ec43b69a70a1d84c540353e3cb3b04c0 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 2 Dec 2016 22:23:16 -0300 Subject: Subsurface scattering material param is now working! --- drivers/gles3/rasterizer_scene_gles3.cpp | 91 +++++++++-- drivers/gles3/rasterizer_scene_gles3.h | 12 ++ drivers/gles3/rasterizer_storage_gles3.cpp | 21 ++- drivers/gles3/rasterizer_storage_gles3.h | 5 +- drivers/gles3/shader_compiler_gles3.cpp | 11 +- drivers/gles3/shader_compiler_gles3.h | 1 + drivers/gles3/shaders/SCsub | 2 + drivers/gles3/shaders/resolve.glsl | 12 +- drivers/gles3/shaders/scene.glsl | 42 +++++ drivers/gles3/shaders/screen_space_reflection.glsl | 7 +- drivers/gles3/shaders/subsurf_scattering.glsl | 172 +++++++++++++++++++++ scene/3d/light.cpp | 2 +- scene/resources/material.cpp | 37 +++-- scene/resources/material.h | 8 +- servers/visual/shader_types.cpp | 1 + servers/visual/visual_server_scene.cpp | 2 +- servers/visual_server.h | 1 + 17 files changed, 378 insertions(+), 49 deletions(-) create mode 100644 drivers/gles3/shaders/subsurf_scattering.glsl diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 16784246f6..c4c7d4409d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1809,6 +1809,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g mirror=!mirror; } + if (m->shader->spatial.uses_sss) { + state.used_sss=true; + } + if (p_shadow) { if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode!=RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) @@ -1827,6 +1831,7 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g } + RenderList::Element *e = has_alpha ? render_list.add_alpha_element() : render_list.add_element(); if (!e) @@ -2620,6 +2625,7 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase** p_cull_result,int p_ current_geometry_index=0; current_material_index=0; + state.used_sss=false; //fill list @@ -2683,6 +2689,50 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glDisable(GL_CULL_FACE); glDisable(GL_BLEND); + if (state.used_sss) {//sss enabled + //copy diffuse while performing sss + + state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_11_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_LOW); + state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_17_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_MEDIUM); + state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_25_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_HIGH); + state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::ENABLE_FOLLOW_SURFACE,subsurface_scatter_follow_surface); + state.sss_shader.bind(); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::MAX_RADIUS,subsurface_scatter_size); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::FOVY,p_cam_projection.get_fov()); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::DIR,Vector2(1,0)); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.motion_sss); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); //copy to front first + + _copy_screen(); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->color); + state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::DIR,Vector2(0,1)); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level + _copy_screen(); + + } else { + // just copy diffuse + storage->shaders.copy.bind(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level + _copy_screen(); + + } + + + if (env->ssr_enabled) { //blur diffuse into effect mipmaps using separatable convolution //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); @@ -2698,11 +2748,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i)); glActiveTexture(GL_TEXTURE0); - if (i==0) { - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); - } else { - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); //previous level, since mipmaps[0] starts one level bigger - } + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); //previous level, since mipmaps[0] starts one level bigger glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[i].fbo); _copy_screen(); state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GAUSSIAN_HORIZONTAL,false); @@ -2748,7 +2794,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_sr); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_rough); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); @@ -2764,22 +2810,26 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c } + //copy reflection over diffuse, resolving SSR if needed state.resolve_shader.set_conditional(ResolveShaderGLES3::USE_SSR,env->ssr_enabled); state.resolve_shader.bind(); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); - glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.specular); if (env->ssr_enabled) { - glActiveTexture(GL_TEXTURE2); + glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color); } glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); - //glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + glEnable(GL_BLEND); + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_ONE,GL_ONE); //use additive to accumulate one over the other + _copy_screen(); + glDisable(GL_BLEND); //end additive + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SIMPLE_COPY,true); state.effect_blur_shader.bind(); state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(0)); @@ -2839,6 +2889,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C bool use_mrt=true; + _fill_render_list(p_cull_result,p_cull_count,false); // @@ -2893,11 +2944,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C draw_buffers.push_back(GL_COLOR_ATTACHMENT0); draw_buffers.push_back(GL_COLOR_ATTACHMENT1); draw_buffers.push_back(GL_COLOR_ATTACHMENT2); + if (state.used_sss) { + draw_buffers.push_back(GL_COLOR_ATTACHMENT3); + } glDrawBuffers(draw_buffers.size(),draw_buffers.ptr()); Color black(0,0,0,0); glClearBufferfv(GL_COLOR,1,black.components); // specular glClearBufferfv(GL_COLOR,2,black.components); // normal metal rough + if (state.used_sss) { + glClearBufferfv(GL_COLOR,3,black.components); // normal metal rough + } } else { @@ -3968,11 +4025,25 @@ void RasterizerSceneGLES3::initialize() { state.resolve_shader.init(); state.ssr_shader.init(); state.effect_blur_shader.init(); + state.sss_shader.init(); + + + { + GLOBAL_DEF("rendering/gles3/subsurface_scattering/quality",1); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/subsurface_scattering/quality",PropertyInfo(Variant::INT,"rendering/gles3/subsurface_scattering/quality",PROPERTY_HINT_ENUM,"Low,Medium,High")); + GLOBAL_DEF("rendering/gles3/subsurface_scattering/max_size",1.0); + Globals::get_singleton()->set_custom_property_info("rendering/gles3/subsurface_scattering/max_size",PropertyInfo(Variant::INT,"rendering/gles3/subsurface_scattering/max_size",PROPERTY_HINT_RANGE,"0.01,8,0.01")); + GLOBAL_DEF("rendering/gles3/subsurface_scattering/follow_surface",false); + } + } void RasterizerSceneGLES3::iteration() { shadow_filter_mode=ShadowFilterMode(int(Globals::get_singleton()->get("rendering/gles3/shadow_filter_mode"))); + subsurface_scatter_follow_surface=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/follow_surface"); + subsurface_scatter_quality=SubSurfaceScatterQuality(int(Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/quality"))); + subsurface_scatter_size=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/max_size"); } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 0b934085ed..21711292a0 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -7,6 +7,7 @@ #include "drivers/gles3/shaders/resolve.glsl.h" #include "drivers/gles3/shaders/screen_space_reflection.glsl.h" #include "drivers/gles3/shaders/effect_blur.glsl.h" +#include "drivers/gles3/shaders/subsurf_scattering.glsl.h" class RasterizerSceneGLES3 : public RasterizerScene { public: @@ -22,6 +23,15 @@ public: uint64_t shadow_atlas_realloc_tolerance_msec; + enum SubSurfaceScatterQuality { + SSS_QUALITY_LOW, + SSS_QUALITY_MEDIUM, + SSS_QUALITY_HIGH, + }; + + SubSurfaceScatterQuality subsurface_scatter_quality; + float subsurface_scatter_size; + bool subsurface_scatter_follow_surface; uint64_t render_pass; uint64_t scene_pass; @@ -51,6 +61,7 @@ public: ResolveShaderGLES3 resolve_shader; ScreenSpaceReflectionShaderGLES3 ssr_shader; EffectBlurShaderGLES3 effect_blur_shader; + SubsurfScatteringShaderGLES3 sss_shader; struct SceneDataUBO { @@ -118,6 +129,7 @@ public: int reflection_probe_count; bool cull_front; + bool used_sss; } state; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 01668e728c..7b9a3f2af1 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1456,6 +1456,7 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { p_shader->spatial.uses_alpha=false; p_shader->spatial.unshaded=false; p_shader->spatial.ontop=false; + p_shader->spatial.uses_sss=false; shaders.actions_scene.render_mode_values["blend_add"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_ADD); shaders.actions_scene.render_mode_values["blend_mix"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_MIX); @@ -1477,6 +1478,8 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { shaders.actions_scene.usage_flag_pointers["ALPHA"]=&p_shader->spatial.uses_alpha; shaders.actions_scene.usage_flag_pointers["VERTEX"]=&p_shader->spatial.uses_vertex; + shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"]=&p_shader->spatial.uses_sss; + actions=&shaders.actions_scene; actions->uniforms=&p_shader->uniforms; @@ -4771,7 +4774,8 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { glDeleteFramebuffers(1,&rt->buffers.alpha_fbo); glDeleteTextures(1,&rt->buffers.diffuse); glDeleteTextures(1,&rt->buffers.specular); - glDeleteTextures(1,&rt->buffers.normal_sr); + glDeleteTextures(1,&rt->buffers.normal_rough); + glDeleteTextures(1,&rt->buffers.motion_sss); rt->buffers.fbo=0; rt->buffers.alpha_fbo=0; } @@ -4923,14 +4927,23 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->buffers.specular, 0); - glGenTextures(1, &rt->buffers.normal_sr); - glBindTexture(GL_TEXTURE_2D, rt->buffers.normal_sr); + glGenTextures(1, &rt->buffers.normal_rough); + glBindTexture(GL_TEXTURE_2D, rt->buffers.normal_rough); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->buffers.normal_sr, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->buffers.normal_rough, 0); + + glGenTextures(1, &rt->buffers.motion_sss); + glBindTexture(GL_TEXTURE_2D, rt->buffers.motion_sss); + glTexImage2D(GL_TEXTURE_2D, 0, GL_R32UI, rt->width, rt->height, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, rt->buffers.motion_sss, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 1eba8b42c9..e6b89eb66c 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -369,6 +369,7 @@ public: bool ontop; bool uses_vertex; bool uses_discard; + bool uses_sss; } spatial; @@ -886,8 +887,8 @@ public: GLuint alpha_fbo; //single buffer, just diffuse (for alpha pass) GLuint specular; GLuint diffuse; - GLuint normal_sr; - GLuint temporal; + GLuint normal_rough; + GLuint motion_sss; } buffers; struct Effects { diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index c54fc011e9..5c7a72ab17 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -422,9 +422,9 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener used_name_defines.insert(vnode->name); } - if (p_actions.usage_flag_pointers.has(vnode->name) && !used_name_defines.has(vnode->name)) { + if (p_actions.usage_flag_pointers.has(vnode->name) && !used_flag_pointers.has(vnode->name)) { *p_actions.usage_flag_pointers[vnode->name]=true; - used_name_defines.insert(vnode->name); + used_flag_pointers.insert(vnode->name); } if (p_default_actions.renames.has(vnode->name)) @@ -670,6 +670,8 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"]="clearcoat_gloss"; actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"]="anisotropy"; actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"]="anisotropy_flow"; + actions[VS::SHADER_SPATIAL].renames["SSS_SPREAD"]="sss_spread"; + actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"]="sss_strength"; actions[VS::SHADER_SPATIAL].renames["AO"]="ao"; actions[VS::SHADER_SPATIAL].renames["EMISSION"]="emission"; actions[VS::SHADER_SPATIAL].renames["DISCARD"]="_discard"; @@ -692,6 +694,11 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"]="@NORMALMAP"; actions[VS::SHADER_SPATIAL].usage_defines["COLOR"]="#define ENABLE_COLOR_INTERP\n"; + actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"]="#define ENABLE_SSS_MOTION\n"; + + actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"]="sss_strength"; + + actions[VS::SHADER_SPATIAL].render_mode_defines["skip_transform"]="#define SKIP_TRANSFORM_USED\n"; diff --git a/drivers/gles3/shader_compiler_gles3.h b/drivers/gles3/shader_compiler_gles3.h index 3549526808..1beee66ad7 100644 --- a/drivers/gles3/shader_compiler_gles3.h +++ b/drivers/gles3/shader_compiler_gles3.h @@ -58,6 +58,7 @@ private: StringName time_name; Set used_name_defines; + Set used_flag_pointers; Set used_rmode_defines; Set internal_functions; diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index 66a19eefd1..b5797e78b8 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -11,4 +11,6 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('blend_shape.glsl'); env.GLES3_GLSL('screen_space_reflection.glsl'); env.GLES3_GLSL('effect_blur.glsl'); + env.GLES3_GLSL('subsurf_scattering.glsl'); + diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl index 4ca6297303..6acc712299 100644 --- a/drivers/gles3/shaders/resolve.glsl +++ b/drivers/gles3/shaders/resolve.glsl @@ -17,11 +17,8 @@ void main() { in vec2 uv_interp; -uniform sampler2D source_diffuse; //texunit:0 -uniform sampler2D source_specular; //texunit:1 - - -uniform sampler2D source_ssr_ssao; //texunit:2 +uniform sampler2D source_specular; //texunit:0 +uniform sampler2D source_ssr; //texunit:1 uniform float stuff; @@ -31,15 +28,14 @@ layout(location = 0) out vec4 frag_color; void main() { - vec4 diffuse = texture( source_diffuse, uv_interp ); vec4 specular = texture( source_specular, uv_interp ); #ifdef USE_SSR - vec4 ssr = textureLod(source_ssr_ssao,uv_interp,0.0); + vec4 ssr = textureLod(source_ssr,uv_interp,0.0); specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a); #endif - frag_color = vec4(diffuse.rgb,1.0)+vec4(specular.rgb,1.0); + frag_color = vec4(specular.rgb,1.0); } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 192042192e..230544c1c3 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -75,6 +75,7 @@ layout(std140) uniform SceneData { //ubo:0 vec2 directional_shadow_pixel_size; float reflection_multiplier; + float subsurface_scatter_width; }; @@ -385,6 +386,7 @@ layout(std140) uniform SceneData { vec2 directional_shadow_pixel_size; float reflection_multiplier; + float subsurface_scatter_width; }; @@ -479,6 +481,9 @@ uniform int reflection_count; layout(location=0) out vec4 diffuse_buffer; layout(location=1) out vec4 specular_buffer; layout(location=2) out vec4 normal_mr_buffer; +#if defined (ENABLE_SSS_MOTION) +layout(location=3) out uint motion_ssr_buffer; +#endif #else @@ -621,6 +626,35 @@ in highp float dp_clip; #endif +#if 0 +//need to save texture depth for this + +vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) { + + float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width; + float d = scale * distance; + + /** + * Armed with the thickness, we can now calculate the color by means of the + * precalculated transmittance profile. + * (It can be precomputed into a texture, for maximum performance): + */ + float dd = -d * d; + vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) + + vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) + + vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) + + vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) + + vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) + + vec3(0.078, 0.0, 0.0) * exp(dd / 7.41); + + /** + * Using the profile, we finally approximate the transmitted lighting from + * the back of the object: + */ + return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0); +} +#endif + void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 specular, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse_light, inout vec3 specular_light) { vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; @@ -870,6 +904,10 @@ void main() { bool discard_=false; #endif +#if defined (ENABLE_SSS_MOTION) + float sss_strength=0.0; +#endif + { @@ -1194,6 +1232,10 @@ LIGHT_SHADER_CODE normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness); +#if defined (ENABLE_SSS_MOTION) + motion_ssr_buffer = uint(clamp(sqrt(sss_strength)*255.0,0.0,255))<<24; +#endif + #else diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl index 5b24013c07..ec4bdf86c9 100644 --- a/drivers/gles3/shaders/screen_space_reflection.glsl +++ b/drivers/gles3/shaders/screen_space_reflection.glsl @@ -23,7 +23,6 @@ in vec2 pos_interp; uniform sampler2D source_diffuse; //texunit:0 uniform sampler2D source_normal_roughness; //texunit:1 uniform sampler2D source_depth; //texunit:2 -uniform sampler2D source_diffuse_mipmaps; //texunit:3 uniform float camera_z_near; uniform float camera_z_far; @@ -295,11 +294,7 @@ void main() { vec4 sample_color; { - sample_color = textureLod(source_diffuse_mipmaps,sample_pos,max(1.0,mipmap)); - if (mipmap<1.0) { //we use another image as base to avoid copying all the screen unnecesarily - vec4 base_sample_color = textureLod(source_diffuse,sample_pos,0.0); - sample_color = mix(base_sample_color,sample_color,mipmap); - } + sample_color = textureLod(source_diffuse,sample_pos,mipmap); } //multiply by gloss diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl new file mode 100644 index 0000000000..89e618b66c --- /dev/null +++ b/drivers/gles3/shaders/subsurf_scattering.glsl @@ -0,0 +1,172 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; + + +void main() { + + uv_interp = uv_in; + gl_Position = vertex_attrib; +} + +[fragment] + +//#define QUALIFIER uniform // some guy on the interweb says it may be faster with this +#define QUALIFIER const + +#ifdef USE_25_SAMPLES + +const int kernel_size=25; +QUALIFIER vec4 kernel[25] = vec4[] ( + vec4(0.530605, 0.613514, 0.739601, 0.0), + vec4(0.000973794, 1.11862e-005, 9.43437e-007, -3.0), + vec4(0.00333804, 7.85443e-005, 1.2945e-005, -2.52083), + vec4(0.00500364, 0.00020094, 5.28848e-005, -2.08333), + vec4(0.00700976, 0.00049366, 0.000151938, -1.6875), + vec4(0.0094389, 0.00139119, 0.000416598, -1.33333), + vec4(0.0128496, 0.00356329, 0.00132016, -1.02083), + vec4(0.017924, 0.00711691, 0.00347194, -0.75), + vec4(0.0263642, 0.0119715, 0.00684598, -0.520833), + vec4(0.0410172, 0.0199899, 0.0118481, -0.333333), + vec4(0.0493588, 0.0367726, 0.0219485, -0.1875), + vec4(0.0402784, 0.0657244, 0.04631, -0.0833333), + vec4(0.0211412, 0.0459286, 0.0378196, -0.0208333), + vec4(0.0211412, 0.0459286, 0.0378196, 0.0208333), + vec4(0.0402784, 0.0657244, 0.04631, 0.0833333), + vec4(0.0493588, 0.0367726, 0.0219485, 0.1875), + vec4(0.0410172, 0.0199899, 0.0118481, 0.333333), + vec4(0.0263642, 0.0119715, 0.00684598, 0.520833), + vec4(0.017924, 0.00711691, 0.00347194, 0.75), + vec4(0.0128496, 0.00356329, 0.00132016, 1.02083), + vec4(0.0094389, 0.00139119, 0.000416598, 1.33333), + vec4(0.00700976, 0.00049366, 0.000151938, 1.6875), + vec4(0.00500364, 0.00020094, 5.28848e-005, 2.08333), + vec4(0.00333804, 7.85443e-005, 1.2945e-005, 2.52083), + vec4(0.000973794, 1.11862e-005, 9.43437e-007, 3.0) +); + +#endif //USE_25_SAMPLES + +#ifdef USE_17_SAMPLES + +const int kernel_size=17; + +QUALIFIER vec4 kernel[17] = vec4[]( + vec4(0.536343, 0.624624, 0.748867, 0.0), + vec4(0.00317394, 0.000134823, 3.77269e-005, -2.0), + vec4(0.0100386, 0.000914679, 0.000275702, -1.53125), + vec4(0.0144609, 0.00317269, 0.00106399, -1.125), + vec4(0.0216301, 0.00794618, 0.00376991, -0.78125), + vec4(0.0347317, 0.0151085, 0.00871983, -0.5), + vec4(0.0571056, 0.0287432, 0.0172844, -0.28125), + vec4(0.0582416, 0.0659959, 0.0411329, -0.125), + vec4(0.0324462, 0.0656718, 0.0532821, -0.03125), + vec4(0.0324462, 0.0656718, 0.0532821, 0.03125), + vec4(0.0582416, 0.0659959, 0.0411329, 0.125), + vec4(0.0571056, 0.0287432, 0.0172844, 0.28125), + vec4(0.0347317, 0.0151085, 0.00871983, 0.5), + vec4(0.0216301, 0.00794618, 0.00376991, 0.78125), + vec4(0.0144609, 0.00317269, 0.00106399, 1.125), + vec4(0.0100386, 0.000914679, 0.000275702, 1.53125), + vec4(0.00317394, 0.000134823, 3.77269e-005, 2.0) +); + +#endif //USE_17_SAMPLES + + +#ifdef USE_11_SAMPLES + +const int kernel_size=11; + +QUALIFIER vec4 kernel[11] = vec4[]( + vec4(0.560479, 0.669086, 0.784728, 0.0), + vec4(0.00471691, 0.000184771, 5.07566e-005, -2.0), + vec4(0.0192831, 0.00282018, 0.00084214, -1.28), + vec4(0.03639, 0.0130999, 0.00643685, -0.72), + vec4(0.0821904, 0.0358608, 0.0209261, -0.32), + vec4(0.0771802, 0.113491, 0.0793803, -0.08), + vec4(0.0771802, 0.113491, 0.0793803, 0.08), + vec4(0.0821904, 0.0358608, 0.0209261, 0.32), + vec4(0.03639, 0.0130999, 0.00643685, 0.72), + vec4(0.0192831, 0.00282018, 0.00084214, 1.28), + vec4(0.00471691, 0.000184771, 5.07565e-005, 2.0) +); + +#endif //USE_11_SAMPLES + + +uniform float max_radius; +uniform float fovy; +uniform float camera_z_far; +uniform float camera_z_near; +uniform vec2 dir; +in vec2 uv_interp; + +uniform sampler2D source_diffuse; //texunit:0 +uniform highp usampler2D source_motion_ss; //texunit:1 +uniform sampler2D source_depth; //texunit:2 + +layout(location = 0) out vec4 frag_color; + +void main() { + + float strength = float(texture(source_motion_ss,uv_interp).r>>24)*(1.0/255.0); + strength*=strength; //stored as sqrt + + // Fetch color of current pixel: + vec4 base_color = texture(source_diffuse, uv_interp); + + if (strength>0.0) { + + + // Fetch linear depth of current pixel: + float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0; + depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); + depth=-depth; + + + // Calculate the radius scale (1.0 for a unit plane sitting on the + // projection window): + float distance = 1.0 / tan(0.5 * fovy); + float scale = distance / -depth; //remember depth is negative by default in OpenGL + + // Calculate the final step to fetch the surrounding pixels: + vec2 step = max_radius * scale * dir; + step *= strength; // Modulate it using the alpha channel. + step *= 1.0 / 3.0; // Divide by 3 as the kernels range from -3 to 3. + + // Accumulate the center sample: + vec3 color_accum = base_color.rgb; + color_accum *= kernel[0].rgb; + + // Accumulate the other samples: + for (int i = 1; i < kernel_size; i++) { + // Fetch color and depth for current sample: + vec2 offset = uv_interp + kernel[i].a * step; + vec3 color = texture(source_diffuse, offset).rgb; + +#ifdef ENABLE_FOLLOW_SURFACE + // If the difference in depth is huge, we lerp color back to "colorM": + float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0; + depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near)); + depth_cmp=-depth_cmp; + + float s = clamp(300.0f * distance * + max_radius * abs(depth - depth_cmp),0.0,1.0); + color = mix(color, base_color.rgb, s); +#endif + + // Accumulate: + color_accum += kernel[i].rgb * color; + } + + frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO) + } else { + frag_color = base_color; + } +} + diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 49bffd3c21..7177e21e1e 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -218,7 +218,7 @@ void Light::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::INT, "light/cull_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_cull_mask"), _SCS("get_cull_mask")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow/enabled"), _SCS("set_shadow"), _SCS("has_shadow")); ADD_PROPERTY( PropertyInfo( Variant::COLOR, "shadow/color",PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_shadow_color"), _SCS("get_shadow_color")); - ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/bias",PROPERTY_HINT_RANGE,"-16,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow/max_distance",PROPERTY_HINT_RANGE,"0,65536,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_MAX_DISTANCE); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "editor/editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 99b7a130f7..70afd68113 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -72,7 +72,7 @@ void FixedSpatialMaterial::init_shaders() { shader_names->clearcoat_gloss="clearcoat_gloss"; shader_names->anisotropy="anisotropy_ratio"; shader_names->height_scale="height_scale"; - shader_names->subsurface_scattering="subsurface_scattering"; + shader_names->subsurface_scattering_strength="subsurface_scattering_strength"; shader_names->refraction="refraction"; shader_names->refraction_roughness="refraction_roughness"; shader_names->point_size="point_size"; @@ -217,6 +217,14 @@ void FixedSpatialMaterial::_update_shader() { code+="uniform sampler2D texture_detail_mask : hint_white;\n"; } + if (features[FEATURE_SUBSURACE_SCATTERING]) { + + code+="uniform float subsurface_scattering_strength : hint_range(0,1);\n"; + code+="uniform sampler2D texture_subsurface_scattering : hint_white;\n"; + + } + + code+="\n\n"; code+="void vertex() {\n"; @@ -230,7 +238,7 @@ void FixedSpatialMaterial::_update_shader() { code+="\tPOINT_SIZE=point_size;\n"; } code+="\tUV=UV*uv1_scale+uv1_offset;\n"; - if (detail_blend_mode==DETAIL_UV_2) { + if (detail_uv==DETAIL_UV_2) { code+="\tUV2=UV2*uv2_scale+uv2_offset;\n"; } @@ -284,6 +292,12 @@ void FixedSpatialMaterial::_update_shader() { code+="\tAO = texture(texture_ambient_occlusion,UV).r;\n"; } + if (features[FEATURE_SUBSURACE_SCATTERING]) { + + code+="\tfloat sss_tex = texture(texture_subsurface_scattering,UV).r;\n"; + code+="\tSSS_STRENGTH=subsurface_scattering_strength*sss_tex;\n"; + } + if (features[FEATURE_DETAIL]) { String det_uv=detail_uv==DETAIL_UV_1?"UV":"UV2"; code+="\tvec4 detail_tex = texture(texture_detail_albedo,"+det_uv+");\n"; @@ -512,17 +526,18 @@ float FixedSpatialMaterial::get_height_scale() const{ return height_scale; } -void FixedSpatialMaterial::set_subsurface_scattering(float p_subsurface_scattering){ - subsurface_scattering=p_subsurface_scattering; - VS::get_singleton()->material_set_param(_get_material(),shader_names->subsurface_scattering,subsurface_scattering); +void FixedSpatialMaterial::set_subsurface_scattering_strength(float p_subsurface_scattering_strength){ + + subsurface_scattering_strength=p_subsurface_scattering_strength; + VS::get_singleton()->material_set_param(_get_material(),shader_names->subsurface_scattering_strength,subsurface_scattering_strength); } -float FixedSpatialMaterial::get_subsurface_scattering() const{ +float FixedSpatialMaterial::get_subsurface_scattering_strength() const{ - return subsurface_scattering; + return subsurface_scattering_strength; } void FixedSpatialMaterial::set_refraction(float p_refraction){ @@ -806,8 +821,8 @@ void FixedSpatialMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_height_scale","height_scale"),&FixedSpatialMaterial::set_height_scale); ObjectTypeDB::bind_method(_MD("get_height_scale"),&FixedSpatialMaterial::get_height_scale); - ObjectTypeDB::bind_method(_MD("set_subsurface_scattering","subsurface_scattering"),&FixedSpatialMaterial::set_subsurface_scattering); - ObjectTypeDB::bind_method(_MD("get_subsurface_scattering"),&FixedSpatialMaterial::get_subsurface_scattering); + ObjectTypeDB::bind_method(_MD("set_subsurface_scattering_strength","strength"),&FixedSpatialMaterial::set_subsurface_scattering_strength); + ObjectTypeDB::bind_method(_MD("get_subsurface_scattering_strength"),&FixedSpatialMaterial::get_subsurface_scattering_strength); ObjectTypeDB::bind_method(_MD("set_refraction","refraction"),&FixedSpatialMaterial::set_refraction); ObjectTypeDB::bind_method(_MD("get_refraction"),&FixedSpatialMaterial::get_refraction); @@ -912,7 +927,7 @@ void FixedSpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"height/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_HEIGHT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"subsurf_scatter/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_SUBSURACE_SCATTERING); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"subsurf_scatter/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_subsurface_scattering"),_SCS("get_subsurface_scattering")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"subsurf_scatter/strength",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_subsurface_scattering_strength"),_SCS("get_subsurface_scattering_strength")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"subsurf_scatter/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SUBSURFACE_SCATTERING); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"refraction/enabled"),_SCS("set_feature"),_SCS("get_feature"),FEATURE_REFRACTION); @@ -1011,7 +1026,7 @@ FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { set_clearcoat_gloss(0.5); set_anisotropy(0); set_height_scale(1); - set_subsurface_scattering(0); + set_subsurface_scattering_strength(0); set_refraction(0); set_refraction_roughness(0); set_line_width(1); diff --git a/scene/resources/material.h b/scene/resources/material.h index 15c5910a9c..9b80b67691 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -213,7 +213,7 @@ private: StringName clearcoat_gloss; StringName anisotropy; StringName height_scale; - StringName subsurface_scattering; + StringName subsurface_scattering_strength; StringName refraction; StringName refraction_roughness; StringName point_size; @@ -247,7 +247,7 @@ private: float clearcoat_gloss; float anisotropy; float height_scale; - float subsurface_scattering; + float subsurface_scattering_strength; float refraction; float refraction_roughness; float line_width; @@ -318,8 +318,8 @@ public: void set_height_scale(float p_height_scale); float get_height_scale() const; - void set_subsurface_scattering(float p_subsurface_scattering); - float get_subsurface_scattering() const; + void set_subsurface_scattering_strength(float p_strength); + float get_subsurface_scattering_strength() const; void set_refraction(float p_refraction); float get_refraction() const; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index f799329026..4872135e2a 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -66,6 +66,7 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["CLEARCOAT_GLOSS"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ANISOTROPY"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["ANISOTROPY_FLOW"]=ShaderLanguage::TYPE_VEC2; + shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SSS_STRENGTH"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["AO"]=ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["EMISSION"]=ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_SPATIAL].functions["fragment"]["SPECIAL"]=ShaderLanguage::TYPE_FLOAT; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 0f7dabcc12..6f7dac7f4d 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1555,7 +1555,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,const float angle = VSG::storage->light_get_param( p_instance->base, VS::LIGHT_PARAM_SPOT_ANGLE); CameraMatrix cm; - cm.set_perspective( angle, 1.0, 0.01, radius ); + cm.set_perspective( angle*2.0, 1.0, 0.01, radius ); Vector planes = cm.get_projection_planes(p_instance->transform); diff --git a/servers/visual_server.h b/servers/visual_server.h index 4c9e04a782..9b1a9d81ac 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -556,6 +556,7 @@ public: virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; + /* SCENARIO API */ -- cgit v1.2.3 From a299c3ebf1ceb3ce108526b3e134e82e5bf4413b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 4 Dec 2016 12:45:30 -0300 Subject: Support for SSAO --- core/math/camera_matrix.cpp | 9 ++ core/math/camera_matrix.h | 1 + drivers/gles3/rasterizer_scene_gles3.cpp | 185 ++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 28 ++++ drivers/gles3/rasterizer_storage_gles3.cpp | 76 +++++++++ drivers/gles3/rasterizer_storage_gles3.h | 11 ++ drivers/gles3/shaders/SCsub | 3 + drivers/gles3/shaders/effect_blur.glsl | 17 ++ drivers/gles3/shaders/scene.glsl | 4 +- drivers/gles3/shaders/ssao.glsl | 247 +++++++++++++++++++++++++++++ drivers/gles3/shaders/ssao_blur.glsl | 113 +++++++++++++ drivers/gles3/shaders/ssao_minify.glsl | 55 +++++++ scene/resources/environment.cpp | 142 +++++++++++++++++ scene/resources/environment.h | 39 +++++ servers/visual/rasterizer.h | 1 + servers/visual/visual_server_raster.h | 2 + servers/visual_server.h | 1 + 17 files changed, 927 insertions(+), 7 deletions(-) create mode 100644 drivers/gles3/shaders/ssao.glsl create mode 100644 drivers/gles3/shaders/ssao_blur.glsl create mode 100644 drivers/gles3/shaders/ssao_minify.glsl diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 3e3cd1af4f..fc35908fa3 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -534,6 +534,15 @@ float CameraMatrix::get_aspect() const { return w/h; } +int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const { + + + Vector3 result = xform(Vector3(1,0,-1)); + + return int((result.x * 0.5 + 0.5) * p_for_pixel_width); + +} + float CameraMatrix::get_fov() const { const float * matrix = (const float*)this->matrix; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index bf8cf3592e..7fcff63768 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -87,6 +87,7 @@ struct CameraMatrix { void scale_translate_to_fit(const AABB& p_aabb); void make_scale(const Vector3 &p_scale); + int get_pixels_per_meter(int p_for_pixel_width) const; operator Transform() const; CameraMatrix(); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index c4c7d4409d..2488f51e99 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -872,6 +872,25 @@ void RasterizerSceneGLES3::environment_set_ssr(RID p_env,bool p_enable, int p_ma } + +void RasterizerSceneGLES3::environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,const Color &p_color,bool p_blur) { + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->ssao_enabled=p_enable; + env->ssao_radius=p_radius; + env->ssao_intensity=p_intensity; + env->ssao_radius2=p_radius2; + env->ssao_intensity2=p_intensity2; + env->ssao_bias=p_bias; + env->ssao_light_affect=p_light_affect; + env->ssao_color=p_color; + env->ssao_filter=p_blur; + +} + + void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, bool p_enable, float p_exposure, float p_white, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale, VS::EnvironmentToneMapper p_tone_mapper){ } @@ -1460,7 +1479,7 @@ void RasterizerSceneGLES3::_setup_transform(InstanceBase *p_instance,const Trans } } - if (p_instance->billboard) { + if (p_instance->billboard && storage->frame.current_rt) { Vector3 scale = xf.basis.get_scale(); @@ -1473,7 +1492,7 @@ void RasterizerSceneGLES3::_setup_transform(InstanceBase *p_instance,const Trans xf.basis.scale(scale); } - if (p_instance->billboard_y) { + if (p_instance->billboard_y && storage->frame.current_rt) { Vector3 scale = xf.basis.get_scale(); Vector3 look_at = p_view_transform.get_origin(); @@ -2020,6 +2039,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,const CameraMatri state.ubo_data.bg_color[3]=bg_color.a; state.env_radiance_data.ambient_contribution=env->ambient_skybox_contribution; + state.ubo_data.ambient_occlusion_affect_light=env->ssao_light_affect; } else { state.ubo_data.bg_energy=1.0; state.ubo_data.ambient_energy=1.0; @@ -2036,6 +2056,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env,const CameraMatri state.ubo_data.bg_color[3]=linear_ambient_color.a; state.env_radiance_data.ambient_contribution=0; + state.ubo_data.ambient_occlusion_affect_light=0; } @@ -2549,7 +2570,7 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul void RasterizerSceneGLES3::_copy_screen() { - glBindVertexArray(storage->resources.quadie_array); + glBindVertexArray( storage->resources.quadie_array); glDrawArrays(GL_TRIANGLE_FAN,0,4); glBindVertexArray(0); @@ -2689,6 +2710,141 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glDisable(GL_CULL_FACE); glDisable(GL_BLEND); + bool diffuse_copied=false; + + if (env->ssao_enabled) { + //ssao + + //copy from depth, convert to linear + GLint ss[2]; + ss[0]=storage->frame.current_rt->width; + ss[1]=storage->frame.current_rt->height; + + for(int i=0;iframe.current_rt->effects.ssao.depth_mipmap_fbos.size();i++) { + + state.ssao_minify_shader.set_conditional(SsaoMinifyShaderGLES3::MINIFY_START,i==0); + state.ssao_minify_shader.bind(); + state.ssao_minify_shader.set_uniform(SsaoMinifyShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + state.ssao_minify_shader.set_uniform(SsaoMinifyShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.ssao_minify_shader.set_uniform(SsaoMinifyShaderGLES3::SOURCE_MIPMAP,MAX(0,i-1)); + glUniform2iv(state.ssao_minify_shader.get_uniform(SsaoMinifyShaderGLES3::FROM_SIZE),1,ss); + ss[0]>>=1; + ss[1]>>=1; + + glActiveTexture(GL_TEXTURE0); + if (i==0) { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + } else { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.linear_depth); + } + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.ssao.depth_mipmap_fbos[i]); //copy to front first + glViewport(0,0,ss[0],ss[1]); + + _copy_screen(); + + } + ss[0]=storage->frame.current_rt->width; + ss[1]=storage->frame.current_rt->height; + + glViewport(0,0,ss[0],ss[1]); + + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_GREATER); + // do SSAO! + state.ssao_shader.set_conditional(SsaoShaderGLES3::ENABLE_RADIUS2,env->ssao_radius2>0.001); + state.ssao_shader.bind(); + state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + glUniform2iv(state.ssao_shader.get_uniform(SsaoShaderGLES3::SCREEN_SIZE),1,ss); + float radius = env->ssao_radius; + state.ssao_shader.set_uniform(SsaoShaderGLES3::RADIUS,radius); + float intensity = env->ssao_intensity; + state.ssao_shader.set_uniform(SsaoShaderGLES3::INTENSITY_DIV_R6,intensity / pow(radius, 6.0f)); + + if (env->ssao_radius2>0.001) { + + float radius2 = env->ssao_radius2; + state.ssao_shader.set_uniform(SsaoShaderGLES3::RADIUS2,radius2); + float intensity2 = env->ssao_intensity2; + state.ssao_shader.set_uniform(SsaoShaderGLES3::INTENSITY_DIV_R62,intensity2 / pow(radius2, 6.0f)); + + } + + float proj_info[4]={ + -2.0f / (ss[0]*p_cam_projection.matrix[0][0]), + -2.0f / (ss[1]*p_cam_projection.matrix[1][1]), + ( 1.0f - p_cam_projection.matrix[0][2]) / p_cam_projection.matrix[0][0], + ( 1.0f + p_cam_projection.matrix[1][2]) / p_cam_projection.matrix[1][1] + }; + + glUniform4fv(state.ssao_shader.get_uniform(SsaoShaderGLES3::PROJ_INFO),1,proj_info); + float pixels_per_meter = float(p_cam_projection.get_pixels_per_meter(ss[0])); + + state.ssao_shader.set_uniform(SsaoShaderGLES3::PROJ_SCALE,pixels_per_meter); + state.ssao_shader.set_uniform(SsaoShaderGLES3::BIAS,env->ssao_bias); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.linear_depth); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_rough); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.ssao.blur_fbo[0]); //copy to front first + Color white(1,1,1,1); + glClearBufferfv(GL_COLOR,0,white.components); // specular + + _copy_screen(); + + //do the batm, i mean blur + + state.ssao_blur_shader.bind(); + + if (env->ssao_filter) { + for(int i=0;i<2;i++) { + + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + GLint axis[2]={i,1-i}; + glUniform2iv(state.ssao_blur_shader.get_uniform(SsaoBlurShaderGLES3::AXIS),1,axis); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.blur_red[i]); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.ssao.blur_fbo[1-i]); + if (i==0) { + glClearBufferfv(GL_COLOR,0,white.components); // specular + } + _copy_screen(); + + } + } + + glDisable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + + // just copy diffuse while applying SSAO + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SSAO_MERGE,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::SSAO_COLOR,env->ssao_color); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); //previous level, since mipmaps[0] starts one level bigger + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.blur_red[0]); //previous level, since mipmaps[0] starts one level bigger + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level + _copy_screen(); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SSAO_MERGE,false); + + + + + diffuse_copied=true; + } + + if (state.used_sss) {//sss enabled //copy diffuse while performing sss @@ -2704,7 +2860,13 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::DIR,Vector2(1,0)); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + if (diffuse_copied) { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); + } else { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + diffuse_copied=true; + } + glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.motion_sss); glActiveTexture(GL_TEXTURE2); @@ -2721,7 +2883,10 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level _copy_screen(); - } else { + } + + + if (!diffuse_copied) { // just copy diffuse storage->shaders.copy.bind(); glActiveTexture(GL_TEXTURE0); @@ -2826,7 +2991,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE,GL_ONE); //use additive to accumulate one over the other - _copy_screen(); + //_copy_screen(); glDisable(GL_BLEND); //end additive @@ -2878,6 +3043,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } else { state.ubo_data.reflection_multiplier=1.0; } + + state.ubo_data.subsurface_scatter_width=subsurface_scatter_size; + + + _setup_environment(env,p_cam_projection,p_cam_transform); _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_shadow_atlas); @@ -4026,6 +4196,9 @@ void RasterizerSceneGLES3::initialize() { state.ssr_shader.init(); state.effect_blur_shader.init(); state.sss_shader.init(); + state.ssao_minify_shader.init(); + state.ssao_shader.init(); + state.ssao_blur_shader.init(); { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 21711292a0..6b9295deee 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -8,6 +8,9 @@ #include "drivers/gles3/shaders/screen_space_reflection.glsl.h" #include "drivers/gles3/shaders/effect_blur.glsl.h" #include "drivers/gles3/shaders/subsurf_scattering.glsl.h" +#include "drivers/gles3/shaders/ssao_minify.glsl.h" +#include "drivers/gles3/shaders/ssao.glsl.h" +#include "drivers/gles3/shaders/ssao_blur.glsl.h" class RasterizerSceneGLES3 : public RasterizerScene { public: @@ -62,6 +65,9 @@ public: ScreenSpaceReflectionShaderGLES3 ssr_shader; EffectBlurShaderGLES3 effect_blur_shader; SubsurfScatteringShaderGLES3 sss_shader; + SsaoMinifyShaderGLES3 ssao_minify_shader; + SsaoShaderGLES3 ssao_shader; + SsaoBlurShaderGLES3 ssao_blur_shader; struct SceneDataUBO { @@ -81,6 +87,8 @@ public: float shadow_atlas_pixel_size[2]; float shadow_directional_pixel_size[2]; float reflection_multiplier; + float subsurface_scatter_width; + float ambient_occlusion_affect_light; } ubo_data; @@ -316,6 +324,15 @@ public: bool ssr_roughness; + bool ssao_enabled; + float ssao_intensity; + float ssao_radius; + float ssao_intensity2; + float ssao_radius2; + float ssao_bias; + float ssao_light_affect; + Color ssao_color; + bool ssao_filter; Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; @@ -334,6 +351,16 @@ public: ssr_smooth=true; ssr_roughness=true; + ssao_enabled=false; + ssao_intensity=1.0; + ssao_radius=1.0; + ssao_intensity2=1.0; + ssao_radius2=0.0; + ssao_bias=0.01; + ssao_light_affect=0; + ssao_filter=true; + + } }; @@ -353,6 +380,7 @@ public: virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness); + virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_radius2, float p_intensity2, float p_intensity, float p_bias, float p_light_affect,const Color &p_color,bool p_blur); virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper); virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 7b9a3f2af1..f21b7021e9 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4785,6 +4785,20 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->depth=0; } + if (rt->effects.ssao.blur_fbo[0]) { + glDeleteFramebuffers(1,&rt->effects.ssao.blur_fbo[0]); + glDeleteTextures(1,&rt->effects.ssao.blur_red[0]); + glDeleteFramebuffers(1,&rt->effects.ssao.blur_fbo[1]); + glDeleteTextures(1,&rt->effects.ssao.blur_red[1]); + for(int i=0;ieffects.ssao.depth_mipmap_fbos.size();i++) { + glDeleteFramebuffers(1,&rt->effects.ssao.depth_mipmap_fbos[i]); + } + + rt->effects.ssao.depth_mipmap_fbos.clear(); + + glDeleteTextures(1,&rt->effects.ssao.linear_depth); + } + Texture *tex = texture_owner.get(rt->texture); tex->alloc_height=0; tex->alloc_width=0; @@ -5043,6 +5057,67 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + + } + ///////////////// ssao + + //AO strength textures + for(int i=0;i<2;i++) { + + glGenFramebuffers(1, &rt->effects.ssao.blur_fbo[i]); + glBindFramebuffer(GL_FRAMEBUFFER, rt->effects.ssao.blur_fbo[i]); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, rt->depth, 0); + + glGenTextures(1, &rt->effects.ssao.blur_red[i]); + glBindTexture(GL_TEXTURE_2D, rt->effects.ssao.blur_red[i]); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, rt->width, rt->height, 0, GL_RED, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->effects.ssao.blur_red[i], 0); + + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + + } + //5 mip levels for depth texture, but base is read separately + + glGenTextures(1, &rt->effects.ssao.linear_depth); + glBindTexture(GL_TEXTURE_2D, rt->effects.ssao.linear_depth); + + int ssao_w=rt->width/2; + int ssao_h=rt->height/2; + + + for(int i=0;i<4;i++) { //5, but 4 mips, base is read directly to save bw + + glTexImage2D(GL_TEXTURE_2D, i, GL_R16UI, ssao_w, ssao_h, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, NULL); + ssao_w>>=1; + ssao_h>>=1; + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 3); + + for(int i=0;i<4;i++) { //5, but 4 mips, base is read directly to save bw + + GLuint fbo; + glGenFramebuffers(1, &fbo); + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->effects.ssao.linear_depth, i); + rt->effects.ssao.depth_mipmap_fbos.push_back(fbo); } } @@ -5653,6 +5728,7 @@ void RasterizerStorageGLES3::initialize() { glBindBuffer(GL_ARRAY_BUFFER,0); //unbind } + //generic quadie for copying without touching skybox { //transform feedback buffers diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index e6b89eb66c..c2aea391b1 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -911,6 +911,17 @@ public: MipMaps mip_maps[2]; //first mipmap chain starts from full-screen //GLuint depth2; //depth for the second mipmap chain, in case of desiring upsampling + struct SSAO { + GLuint blur_fbo[2]; // blur fbo + GLuint blur_red[2]; // 8 bits red buffer + + GLuint linear_depth; + + Vector depth_mipmap_fbos; //fbos for depth mipmapsla ver + + SSAO() { blur_fbo[0]=0; blur_fbo[1]=0; linear_depth=0; } + } ssao; + Effects() { } diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index b5797e78b8..dd7ec45242 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -12,5 +12,8 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('screen_space_reflection.glsl'); env.GLES3_GLSL('effect_blur.glsl'); env.GLES3_GLSL('subsurf_scattering.glsl'); + env.GLES3_GLSL('ssao.glsl'); + env.GLES3_GLSL('ssao_minify.glsl'); + env.GLES3_GLSL('ssao_blur.glsl'); diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index fc6de7f654..211b60ca2e 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -19,12 +19,22 @@ void main() { in vec2 uv_interp; uniform sampler2D source_color; //texunit:0 +#ifdef SSAO_MERGE +uniform sampler2D source_ssao; //texunit:1 +#endif + uniform float lod; uniform vec2 pixel_size; layout(location = 0) out vec4 frag_color; +#ifdef SSAO_MERGE + +uniform vec4 ssao_color; + +#endif + void main() { @@ -52,6 +62,13 @@ void main() { frag_color = color; #endif +#ifdef SSAO_MERGE + + vec4 color =textureLod( source_color, uv_interp,0.0); + float ssao =textureLod( source_ssao, uv_interp,0.0).r; + frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 ); + +#endif } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 230544c1c3..61e9e37d2b 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -76,6 +76,7 @@ layout(std140) uniform SceneData { //ubo:0 float reflection_multiplier; float subsurface_scatter_width; + float ambient_occlusion_affect_light; }; @@ -387,6 +388,7 @@ layout(std140) uniform SceneData { float reflection_multiplier; float subsurface_scatter_width; + float ambient_occlusion_affect_light; }; @@ -1223,7 +1225,7 @@ LIGHT_SHADER_CODE float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b)); float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b)); float total_ambient = max_ambient+max_diffuse+max_emission; - float ambient_scale = (total_ambient>0.0) ? max_ambient/total_ambient : 0.0; + float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0; #endif //ENABLE_AO diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale); diff --git a/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl new file mode 100644 index 0000000000..75f49ef37a --- /dev/null +++ b/drivers/gles3/shaders/ssao.glsl @@ -0,0 +1,247 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; + +void main() { + + gl_Position = vertex_attrib; + gl_Position.z=1.0; +} + +[fragment] + + +#define NUM_SAMPLES (11) + +// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower +// miplevel to maintain reasonable spatial locality in the cache +// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing. +// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively +#define LOG_MAX_OFFSET (3) + +// This must be less than or equal to the MAX_MIP_LEVEL defined in SSAO.cpp +#define MAX_MIP_LEVEL (4) + +// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent +// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9 +#define NUM_SPIRAL_TURNS (7) + + +uniform sampler2D source_depth; //texunit:0 +uniform usampler2D source_depth_mipmaps; //texunit:1 +uniform sampler2D source_normal; //texunit:2 + +uniform ivec2 screen_size; +uniform float camera_z_far; +uniform float camera_z_near; + +uniform float intensity_div_r6; +uniform float radius; + +#ifdef ENABLE_RADIUS2 +uniform float intensity_div_r62; +uniform float radius2; +#endif + +uniform float bias; +uniform float proj_scale; + +layout(location = 0) out float visibility; + +uniform vec4 proj_info; + +vec3 reconstructCSPosition(vec2 S, float z) { + return vec3((S.xy * proj_info.xy + proj_info.zw) * z, z); +} + +vec3 getPosition(ivec2 ssP) { + vec3 P; + P.z = texelFetch(source_depth, ssP, 0).r; + + P.z = P.z * 2.0 - 1.0; + P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); + P.z = -P.z; + + // Offset to pixel center + P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); + return P; +} + +/** Reconstructs screen-space unit normal from screen-space position */ +vec3 reconstructCSFaceNormal(vec3 C) { + return normalize(cross(dFdy(C), dFdx(C))); +} + + + +/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */ +vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){ + // Radius relative to ssR + float alpha = float(sampleNumber + 0.5) * (1.0 / NUM_SAMPLES); + float angle = alpha * (NUM_SPIRAL_TURNS * 6.28) + spinAngle; + + ssR = alpha; + return vec2(cos(angle), sin(angle)); +} + + +/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */ +vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) { + // Derivation: + // mipLevel = floor(log(ssR / MAX_OFFSET)); + int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL); + + ivec2 ssP = ivec2(ssR * unitOffset) + ssC; + + vec3 P; + + // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map. + // Manually clamp to the texture size because texelFetch bypasses the texture unit + ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1)); + + + if (mipLevel < 1) { + //read from depth buffer + P.z = texelFetch(source_depth, mipP, 0).r; + P.z = P.z * 2.0 - 1.0; + P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near)); + P.z = -P.z; + + } else { + //read from mipmaps + uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r; + P.z = -(float(d)/65535.0)*camera_z_far; + } + + + // Offset to pixel center + P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z); + + return P; +} + + + +/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds + to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius + + Note that units of H() in the HPG12 paper are meters, not + unitless. The whole falloff/sampling function is therefore + unitless. In this implementation, we factor out (9 / radius). + + Four versions of the falloff function are implemented below +*/ +float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) { + // Offset on the unit disk, spun for this pixel + float ssR; + vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR); + ssR *= ssDiskRadius; + + // The occluding point in camera space + vec3 Q = getOffsetPosition(ssC, unitOffset, ssR); + + vec3 v = Q - C; + + float vv = dot(v, v); + float vn = dot(v, n_C); + + const float epsilon = 0.01; + float radius2 = p_radius*p_radius; + + // A: From the HPG12 paper + // Note large epsilon to avoid overdarkening within cracks + //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6; + + // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended] + float f=max(radius2 - vv, 0.0); + return f * f * f * max((vn - bias) / (epsilon + vv), 0.0); + + // C: Medium contrast (which looks better at high radii), no division. Note that the + // contribution still falls off with radius^2, but we've adjusted the rate in a way that is + // more computationally efficient and happens to be aesthetically pleasing. + // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0); + + // D: Low contrast, no division operation + // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0); +} + + + +void main() { + + + // Pixel being shaded + ivec2 ssC = ivec2(gl_FragCoord.xy); + + // World space point being shaded + vec3 C = getPosition(ssC); + +/* if (C.z <= -camera_z_far*0.999) { + // We're on the skybox + visibility=1.0; + return; + }*/ + + //visibility=-C.z/camera_z_far; + //return; + + //vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; + + vec3 n_C = reconstructCSFaceNormal(C); + n_C = -n_C; + + + // Hash function used in the HPG12 AlchemyAO paper + float randomPatternRotationAngle = (3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10; + + // Reconstruct normals from positions. These will lead to 1-pixel black lines + // at depth discontinuities, however the blur will wipe those out so they are not visible + // in the final image. + + // Choose the screen-space sample radius + // proportional to the projected area of the sphere + float ssDiskRadius = -proj_scale * radius / C.z; + + float sum = 0.0; + for (int i = 0; i < NUM_SAMPLES; ++i) { + sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle); + } + + float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / NUM_SAMPLES)); + +#ifdef ENABLE_RADIUS2 + + //go again for radius2 + randomPatternRotationAngle = (5 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 11; + + // Reconstruct normals from positions. These will lead to 1-pixel black lines + // at depth discontinuities, however the blur will wipe those out so they are not visible + // in the final image. + + // Choose the screen-space sample radius + // proportional to the projected area of the sphere + ssDiskRadius = -proj_scale * radius2 / C.z; + + sum = 0.0; + for (int i = 0; i < NUM_SAMPLES; ++i) { + sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle); + } + + A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / NUM_SAMPLES))); +#endif + // Bilateral box-filter over a quad for free, respecting depth edges + // (the difference that this makes is subtle) + if (abs(dFdx(C.z)) < 0.02) { + A -= dFdx(A) * ((ssC.x & 1) - 0.5); + } + if (abs(dFdy(C.z)) < 0.02) { + A -= dFdy(A) * ((ssC.y & 1) - 0.5); + } + + visibility = A; + +} + + + diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl new file mode 100644 index 0000000000..31f3841a2a --- /dev/null +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -0,0 +1,113 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; + + +void main() { + + gl_Position = vertex_attrib; + gl_Position.z=1.0; +} + +[fragment] + + +uniform sampler2D source_ssao; //texunit:0 +uniform sampler2D source_depth; //texunit:1 + + +layout(location = 0) out float visibility; + + +////////////////////////////////////////////////////////////////////////////////////////////// +// Tunable Parameters: + +/** Increase to make depth edges crisper. Decrease to reduce flicker. */ +#define EDGE_SHARPNESS (1.0) + +/** Step in 2-pixel intervals since we already blurred against neighbors in the + first AO pass. This constant can be increased while R decreases to improve + performance at the expense of some dithering artifacts. + + Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was + unobjectionable after shading was applied but eliminated most temporal incoherence + from using small numbers of sample taps. + */ +#define SCALE (3) + +/** Filter radius in pixels. This will be multiplied by SCALE. */ +#define R (4) + + +////////////////////////////////////////////////////////////////////////////////////////////// + + +// Gaussian coefficients +const float gaussian[R + 1] = +// float[](0.356642, 0.239400, 0.072410, 0.009869); +// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0 + float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0 +// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0 + +/** (1, 0) or (0, 1)*/ +uniform ivec2 axis; + +uniform float camera_z_far; +uniform float camera_z_near; + +void main() { + + ivec2 ssC = ivec2(gl_FragCoord.xy); + + float depth = texelFetch(source_depth, ssC, 0).r; + + depth = depth * 2.0 - 1.0; + depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); + + float depth_divide = 1.0 / camera_z_far; + + depth*=depth_divide; + + //if (depth > camera_z_far*0.999) { + // discard;//skybox + //} + + float sum = texelFetch(source_ssao, ssC, 0).r; + + // Base weight for depth falloff. Increase this for more blurriness, + // decrease it for better edge discrimination + float BASE = gaussian[0]; + float totalWeight = BASE; + sum *= totalWeight; + + + for (int r = -R; r <= R; ++r) { + // We already handled the zero case above. This loop should be unrolled and the static branch optimized out, + // so the IF statement has no runtime cost + if (r != 0) { + + ivec2 ppos = ssC + axis * (r * SCALE); + float value = texelFetch(source_ssao, ppos, 0).r; + float temp_depth = texelFetch(source_depth, ssC, 0).r; + + temp_depth = temp_depth * 2.0 - 1.0; + temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near)); + temp_depth *= depth_divide; + + // spatial domain: offset gaussian tap + float weight = 0.3 + gaussian[abs(r)]; + + // range domain (the "bilateral" weight). As depth difference increases, decrease weight. + weight *= max(0.0, 1.0 + - (EDGE_SHARPNESS * 2000.0) * abs(temp_depth - depth) + ); + + sum += value * weight; + totalWeight += weight; + } + } + + const float epsilon = 0.0001; + visibility = sum / (totalWeight + epsilon); +} diff --git a/drivers/gles3/shaders/ssao_minify.glsl b/drivers/gles3/shaders/ssao_minify.glsl new file mode 100644 index 0000000000..df9045c28a --- /dev/null +++ b/drivers/gles3/shaders/ssao_minify.glsl @@ -0,0 +1,55 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; + +void main() { + + gl_Position = vertex_attrib; +} + +[fragment] + + +#ifdef MINIFY_START + +#define SDEPTH_TYPE highp sampler2D +uniform float camera_z_far; +uniform float camera_z_near; + +#else + +#define SDEPTH_TYPE mediump usampler2D + +#endif + +uniform SDEPTH_TYPE source_depth; //texunit:0 + +uniform ivec2 from_size; +uniform int source_mipmap; + +layout(location = 0) out mediump uint depth; + +void main() { + + + ivec2 ssP = ivec2(gl_FragCoord.xy); + + // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling. + // On DX9, the bit-and can be implemented with floating-point modulo + +#ifdef MINIFY_START + float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; + fdepth = fdepth * 2.0 - 1.0; + fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near)); + fdepth /= camera_z_far; + depth = uint(clamp(fdepth*65535,0.0,65535.0)); + +#else + depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r; +#endif + + +} + + diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 578a8ae50a..c945d2a95d 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -377,6 +377,102 @@ bool Environment::is_ssr_rough() const { return ssr_roughness; } +void Environment::set_ssao_enabled(bool p_enable) { + + ssao_enabled=p_enable; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); + +} + +bool Environment::is_ssao_enabled() const{ + + return ssao_enabled; +} + +void Environment::set_ssao_radius(float p_radius){ + + ssao_radius=p_radius; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +float Environment::get_ssao_radius() const{ + + return ssao_radius; +} + + +void Environment::set_ssao_intensity(float p_intensity){ + + ssao_intensity=p_intensity; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} + +float Environment::get_ssao_intensity() const{ + + return ssao_intensity; +} + +void Environment::set_ssao_radius2(float p_radius){ + + ssao_radius2=p_radius; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +float Environment::get_ssao_radius2() const{ + + return ssao_radius2; +} + + +void Environment::set_ssao_intensity2(float p_intensity){ + + ssao_intensity2=p_intensity; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +float Environment::get_ssao_intensity2() const{ + + return ssao_intensity2; +} + +void Environment::set_ssao_bias(float p_bias){ + + ssao_bias=p_bias; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +float Environment::get_ssao_bias() const{ + + return ssao_bias; +} + +void Environment::set_ssao_direct_light_affect(float p_direct_light_affect){ + + ssao_direct_light_affect=p_direct_light_affect; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +float Environment::get_ssao_direct_light_affect() const{ + + return ssao_direct_light_affect; +} + + +void Environment::set_ssao_color(const Color& p_color) { + + ssao_color=p_color; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} + +Color Environment::get_ssao_color() const { + + return ssao_color; +} + +void Environment::set_ssao_blur(bool p_enable) { + + ssao_blur=p_enable; + VS::get_singleton()->environment_set_ssao(environment,ssao_enabled,ssao_radius,ssao_intensity,ssao_radius2,ssao_intensity2,ssao_bias,ssao_direct_light_affect,ssao_color,ssao_blur); +} +bool Environment::is_ssao_blur_enabled() const { + + return ssao_blur; +} void Environment::_bind_methods() { @@ -442,6 +538,43 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/accel_smooth"),_SCS("set_ssr_smooth"),_SCS("is_ssr_smooth") ); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/roughness"),_SCS("set_ssr_rough"),_SCS("is_ssr_rough") ); + ObjectTypeDB::bind_method(_MD("set_ssao_enabled","enabled"),&Environment::set_ssao_enabled); + ObjectTypeDB::bind_method(_MD("is_ssao_enabled"),&Environment::is_ssao_enabled); + + ObjectTypeDB::bind_method(_MD("set_ssao_radius","radius"),&Environment::set_ssao_radius); + ObjectTypeDB::bind_method(_MD("get_ssao_radius"),&Environment::get_ssao_radius); + + ObjectTypeDB::bind_method(_MD("set_ssao_intensity","intensity"),&Environment::set_ssao_intensity); + ObjectTypeDB::bind_method(_MD("get_ssao_intensity"),&Environment::get_ssao_intensity); + + ObjectTypeDB::bind_method(_MD("set_ssao_radius2","radius"),&Environment::set_ssao_radius2); + ObjectTypeDB::bind_method(_MD("get_ssao_radius2"),&Environment::get_ssao_radius2); + + ObjectTypeDB::bind_method(_MD("set_ssao_intensity2","intensity"),&Environment::set_ssao_intensity2); + ObjectTypeDB::bind_method(_MD("get_ssao_intensity2"),&Environment::get_ssao_intensity2); + + ObjectTypeDB::bind_method(_MD("set_ssao_bias","bias"),&Environment::set_ssao_bias); + ObjectTypeDB::bind_method(_MD("get_ssao_bias"),&Environment::get_ssao_bias); + + ObjectTypeDB::bind_method(_MD("set_ssao_direct_light_affect","amount"),&Environment::set_ssao_direct_light_affect); + ObjectTypeDB::bind_method(_MD("get_ssao_direct_light_affect"),&Environment::get_ssao_direct_light_affect); + + ObjectTypeDB::bind_method(_MD("set_ssao_color","color"),&Environment::set_ssao_color); + ObjectTypeDB::bind_method(_MD("get_ssao_color"),&Environment::get_ssao_color); + + ObjectTypeDB::bind_method(_MD("set_ssao_blur","enabled"),&Environment::set_ssao_blur); + ObjectTypeDB::bind_method(_MD("is_ssao_blur_enabled"),&Environment::is_ssao_blur_enabled); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/enable"),_SCS("set_ssao_enabled"),_SCS("is_ssao_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius",PROPERTY_HINT_RANGE,"0.1,16,0.1"),_SCS("set_ssao_radius"),_SCS("get_ssao_radius") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/intensity",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity"),_SCS("get_ssao_intensity") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius2",PROPERTY_HINT_RANGE,"0.0,16,0.1"),_SCS("set_ssao_radius2"),_SCS("get_ssao_radius2") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/intensity2",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity2"),_SCS("get_ssao_intensity2") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/bias",PROPERTY_HINT_RANGE,"0.001,8,0.001"),_SCS("set_ssao_bias"),_SCS("get_ssao_bias") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/light_affect",PROPERTY_HINT_RANGE,"0.00,1,0.01"),_SCS("set_ssao_direct_light_affect"),_SCS("get_ssao_direct_light_affect") ); + ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_occlusion/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_ssao_color"),_SCS("get_ssao_color") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/blur"),_SCS("set_ssao_blur"),_SCS("is_ssao_blur_enabled") ); + ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); ObjectTypeDB::bind_method(_MD("get_tonemapper"),&Environment::get_tonemapper); @@ -561,6 +694,15 @@ Environment::Environment() { ssr_smooth=true; ssr_roughness=true; + ssao_enabled=false; + ssao_radius=1; + ssao_intensity=1; + ssao_radius2=0; + ssao_intensity2=1; + ssao_bias=0.01; + ssao_direct_light_affect=false; + ssao_blur=true; + } Environment::~Environment() { diff --git a/scene/resources/environment.h b/scene/resources/environment.h index f4610ada47..c489ff97fc 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -102,6 +102,17 @@ private: bool ssr_smooth; bool ssr_roughness; + bool ssao_enabled; + float ssao_radius; + float ssao_intensity; + float ssao_radius2; + float ssao_intensity2; + float ssao_bias; + float ssao_direct_light_affect; + Color ssao_color; + bool ssao_blur; + + protected: static void _bind_methods(); @@ -191,6 +202,34 @@ public: void set_ssr_rough(bool p_enable); bool is_ssr_rough() const; + void set_ssao_enabled(bool p_enable); + bool is_ssao_enabled() const; + + void set_ssao_radius(float p_radius); + float get_ssao_radius() const; + + void set_ssao_intensity(float p_intensity); + float get_ssao_intensity() const; + + void set_ssao_radius2(float p_radius); + float get_ssao_radius2() const; + + void set_ssao_intensity2(float p_intensity); + float get_ssao_intensity2() const; + + void set_ssao_bias(float p_bias); + float get_ssao_bias() const; + + void set_ssao_direct_light_affect(float p_direct_light_affect); + float get_ssao_direct_light_affect() const; + + void set_ssao_color(const Color& p_color); + Color get_ssao_color() const; + + void set_ssao_blur(bool p_enable); + bool is_ssao_blur_enabled() const; + + virtual RID get_rid() const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 0d36706468..09d59e3175 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -65,6 +65,7 @@ public: virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; + virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,const Color &p_color,bool p_blur)=0; virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0; virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index e7594278f2..ff1a622107 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -876,6 +876,8 @@ public: BIND2(environment_set_canvas_max_layer,RID,int ) BIND4(environment_set_ambient_light,RID,const Color& ,float,float ) BIND8(environment_set_ssr,RID,bool,int,float,float,float,bool,bool ) + BIND10(environment_set_ssao,RID ,bool , float , float , float,float,float , float ,const Color &,bool ) + BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) diff --git a/servers/visual_server.h b/servers/visual_server.h index 9b1a9d81ac..6c4a080437 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -556,6 +556,7 @@ public: virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; + virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,const Color &p_color,bool p_blur)=0; /* SCENARIO API */ -- cgit v1.2.3 From 9bc506067a0913a2f1f1cef4f99c3a517497d453 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 4 Dec 2016 13:08:38 -0300 Subject: fix small issue with copying reflections --- drivers/gles3/rasterizer_scene_gles3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 2488f51e99..ad88bda719 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2991,7 +2991,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE,GL_ONE); //use additive to accumulate one over the other - //_copy_screen(); + _copy_screen(); glDisable(GL_BLEND); //end additive -- cgit v1.2.3 From 8534ced22d7b889dafb64ab0c40435c5b12b7cbc Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 7 Dec 2016 17:49:52 -0300 Subject: Tonemapping and Auto Exposure support --- drivers/gles3/rasterizer_scene_gles3.cpp | 235 ++++++++++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 29 +++- drivers/gles3/rasterizer_storage_gles3.cpp | 21 +++ drivers/gles3/rasterizer_storage_gles3.h | 15 +- drivers/gles3/shaders/SCsub | 2 + drivers/gles3/shaders/exposure.glsl | 98 ++++++++++++ drivers/gles3/shaders/tonemap.glsl | 97 ++++++++++++ scene/resources/environment.cpp | 41 +++-- scene/resources/environment.h | 9 +- servers/visual/rasterizer.h | 3 +- servers/visual/visual_server_raster.h | 3 +- servers/visual_server.h | 5 +- 12 files changed, 517 insertions(+), 41 deletions(-) create mode 100644 drivers/gles3/shaders/exposure.glsl create mode 100644 drivers/gles3/shaders/tonemap.glsl diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index ad88bda719..4abeef89be 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -890,11 +890,24 @@ void RasterizerSceneGLES3::environment_set_ssao(RID p_env,bool p_enable, float p } +void RasterizerSceneGLES3::environment_set_tonemap(RID p_env,VS::EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale) { -void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, bool p_enable, float p_exposure, float p_white, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale, VS::EnvironmentToneMapper p_tone_mapper){ + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + + env->tone_mapper=p_tone_mapper; + env->tone_mapper_exposure=p_exposure; + env->tone_mapper_exposure_white=p_white; + env->auto_exposure=p_auto_exposure; + env->auto_exposure_speed=p_auto_exp_speed; + env->auto_exposure_min=p_min_luminance; + env->auto_exposure_max=p_max_luminance; + env->auto_exposure_grey=p_auto_exp_scale; } + void RasterizerSceneGLES3::environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp) { @@ -3010,6 +3023,172 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c } +void RasterizerSceneGLES3::_post_process(Environment *env){ + + //copy to front buffer + + glDepthMask(GL_FALSE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDepthFunc(GL_LEQUAL); + glColorMask(1,1,1,1); + + //turn off everything used + + if (!env) { + //no environment, simply return and convert to SRGB + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,true); + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,true); + storage->shaders.copy.bind(); + + _copy_screen(); + + storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,false); + storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,false); //compute luminance + + return; + + } + + + //order of operation + //1) DOF Blur (first blur, then copy to buffer applying the blur) + //2) Motion Blur + //3) Bloom + //4) Tonemap + //5) Adjustments + + GLuint composite_from = storage->frame.current_rt->buffers.diffuse; + + + if ( env->auto_exposure) { + + //compute auto exposure + //first step, copy from image to luminance buffer + state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_BEGIN,true); + state.exposure_shader.bind(); + int ss[2]={ + storage->frame.current_rt->width, + storage->frame.current_rt->height, + }; + int ds[2]={ + exposure_shrink_size, + exposure_shrink_size, + }; + + glUniform2iv(state.exposure_shader.get_uniform(ExposureShaderGLES3::SOURCE_RENDER_SIZE),1,ss); + glUniform2iv(state.exposure_shader.get_uniform(ExposureShaderGLES3::TARGET_SIZE),1,ds); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + + + glBindFramebuffer(GL_FRAMEBUFFER,exposure_shrink[0].fbo); + glViewport(0,0,exposure_shrink_size,exposure_shrink_size); + + _copy_screen(); + + + + + + //second step, shrink to 2x2 pixels + state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_BEGIN,false); + state.exposure_shader.bind(); + //shrink from second to previous to last level + + int s_size=exposure_shrink_size/3; + for(int i=1;iget_ticks_usec(); + uint64_t tick_diff = storage->frame.current_rt->last_exposure_tick==0?0:tick-storage->frame.current_rt->last_exposure_tick; + storage->frame.current_rt->last_exposure_tick=tick; + + if (tick_diff==0 || tick_diff>1000000) { + state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_FORCE_SET,true); + + } + + state.exposure_shader.bind(); + + glBindFramebuffer(GL_FRAMEBUFFER,exposure_shrink[exposure_shrink.size()-1].fbo); + glViewport(0,0,1,1); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,exposure_shrink[exposure_shrink.size()-2].color); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); //read from previous + + + state.exposure_shader.set_uniform(ExposureShaderGLES3::EXPOSURE_ADJUST,env->auto_exposure_speed*(tick_diff/1000000.0)); + state.exposure_shader.set_uniform(ExposureShaderGLES3::MAX_LUMINANCE,env->auto_exposure_max); + state.exposure_shader.set_uniform(ExposureShaderGLES3::MIN_LUMINANCE,env->auto_exposure_min); + + _copy_screen(); + + state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_FORCE_SET,false); + state.exposure_shader.set_conditional(ExposureShaderGLES3::EXPOSURE_END,false); + + //last step, swap with the framebuffer exposure, so the right exposure is kept int he framebuffer + SWAP(exposure_shrink[exposure_shrink.size()-1].fbo,storage->frame.current_rt->exposure.fbo); + SWAP(exposure_shrink[exposure_shrink.size()-1].color,storage->frame.current_rt->exposure.color); + + + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + + } + + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,composite_from); + + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_FILMIC_TONEMAPPER,env->tone_mapper==VS::ENV_TONE_MAPPER_FILMIC); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_ACES_TONEMAPPER,env->tone_mapper==VS::ENV_TONE_MAPPER_ACES); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_REINDHART_TONEMAPPER,env->tone_mapper==VS::ENV_TONE_MAPPER_REINHARDT); + + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE,env->auto_exposure); + + state.tonemap_shader.bind(); + + state.tonemap_shader.set_uniform(TonemapShaderGLES3::EXPOSURE,env->tone_mapper_exposure); + state.tonemap_shader.set_uniform(TonemapShaderGLES3::WHITE,env->tone_mapper_exposure_white); + + + if (env->auto_exposure) { + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); + state.tonemap_shader.set_uniform(TonemapShaderGLES3::AUTO_EXPOSURE_GREY,env->auto_exposure_grey); + + } + + _copy_screen(); + + //turn off everything used + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_FILMIC_TONEMAPPER,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_ACES_TONEMAPPER,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_REINDHART_TONEMAPPER,false); + +} void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){ @@ -3056,8 +3235,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C render_list.clear(); - bool use_mrt=true; - + bool use_mrt=false; _fill_render_list(p_cull_result,p_cull_count,false); @@ -3074,6 +3252,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C GLuint current_fbo; + if (probe) { ReflectionAtlas *ref_atlas = reflection_atlas_owner.getptr(probe->atlas); @@ -3100,6 +3279,8 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } else { + use_mrt = state.used_sss || (env && (env->ssao_enabled || env->ssr_enabled)); //only enable MRT rendering if any of these is enabled + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); if (use_mrt) { @@ -3267,9 +3448,11 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C return; } - _copy_to_front_buffer(env); -/* if (shadow_atlas) { + _post_process(env); + + + if (false && shadow_atlas) { //_copy_texture_to_front_buffer(shadow_atlas->depth); storage->canvas->canvas_begin(); @@ -3279,7 +3462,17 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/2,storage->frame.current_rt->height/2),Rect2(0,0,1,1)); } -*/ + + if (false && storage->frame.current_rt) { + + //_copy_texture_to_front_buffer(shadow_atlas->depth); + storage->canvas->canvas_begin(); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,exposure_shrink[4].color); +// glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); + storage->canvas->draw_generic_textured_rect(Rect2(0,0,storage->frame.current_rt->width/16,storage->frame.current_rt->height/16),Rect2(0,0,1,1)); + + } if (false && reflection_atlas && storage->frame.current_rt) { @@ -4199,6 +4392,8 @@ void RasterizerSceneGLES3::initialize() { state.ssao_minify_shader.init(); state.ssao_shader.init(); state.ssao_blur_shader.init(); + state.exposure_shader.init(); + state.tonemap_shader.init(); { @@ -4209,6 +4404,34 @@ void RasterizerSceneGLES3::initialize() { GLOBAL_DEF("rendering/gles3/subsurface_scattering/follow_surface",false); } + exposure_shrink_size=243; + int max_exposure_shrink_size=exposure_shrink_size; + + while(max_exposure_shrink_size>0) { + + RasterizerStorageGLES3::RenderTarget::Exposure e; + + glGenFramebuffers(1, &e.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, e.fbo); + + glGenTextures(1, &e.color); + glBindTexture(GL_TEXTURE_2D, e.color); + glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, max_exposure_shrink_size, max_exposure_shrink_size, 0, GL_RED, GL_FLOAT, NULL); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, e.color, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + exposure_shrink.push_back(e); + max_exposure_shrink_size/=3; + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); + + + } + } void RasterizerSceneGLES3::iteration() { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 6b9295deee..b0a875aa16 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -11,6 +11,8 @@ #include "drivers/gles3/shaders/ssao_minify.glsl.h" #include "drivers/gles3/shaders/ssao.glsl.h" #include "drivers/gles3/shaders/ssao_blur.glsl.h" +#include "drivers/gles3/shaders/exposure.glsl.h" +#include "drivers/gles3/shaders/tonemap.glsl.h" class RasterizerSceneGLES3 : public RasterizerScene { public: @@ -48,6 +50,9 @@ public: RasterizerStorageGLES3 *storage; + Vector exposure_shrink; + int exposure_shrink_size; + struct State { @@ -68,6 +73,8 @@ public: SsaoMinifyShaderGLES3 ssao_minify_shader; SsaoShaderGLES3 ssao_shader; SsaoBlurShaderGLES3 ssao_blur_shader; + ExposureShaderGLES3 exposure_shader; + TonemapShaderGLES3 tonemap_shader; struct SceneDataUBO { @@ -334,6 +341,15 @@ public: Color ssao_color; bool ssao_filter; + VS::EnvironmentToneMapper tone_mapper; + float tone_mapper_exposure; + float tone_mapper_exposure_white; + bool auto_exposure; + float auto_exposure_speed; + float auto_exposure_min; + float auto_exposure_max; + float auto_exposure_grey; + Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; skybox_scale=1.0; @@ -360,6 +376,14 @@ public: ssao_light_affect=0; ssao_filter=true; + tone_mapper=VS::ENV_TONE_MAPPER_LINEAR; + tone_mapper_exposure=1.0; + tone_mapper_exposure_white=1.0; + auto_exposure=false; + auto_exposure_speed=0.5; + auto_exposure_min=0.05; + auto_exposure_max=8; + auto_exposure_grey=0.4; } }; @@ -382,7 +406,8 @@ public: virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness); virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_radius2, float p_intensity2, float p_intensity, float p_bias, float p_light_affect,const Color &p_color,bool p_blur); - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper); + virtual void environment_set_tonemap(RID p_env,VS::EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale); + virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp); @@ -618,6 +643,8 @@ public: void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow); void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection); + void _post_process(Environment *env); + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass); virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count); virtual bool free(RID p_rid); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index f21b7021e9..ddb60273e4 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4799,6 +4799,10 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { glDeleteTextures(1,&rt->effects.ssao.linear_depth); } + if (rt->exposure.fbo) { + glDeleteFramebuffers(1,&rt->exposure.fbo); + glDeleteTextures(1,&rt->exposure.color); + } Texture *tex = texture_owner.get(rt->texture); tex->alloc_height=0; tex->alloc_width=0; @@ -5120,6 +5124,23 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ rt->effects.ssao.depth_mipmap_fbos.push_back(fbo); } + + //////Exposure + + glGenFramebuffers(1, &rt->exposure.fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->exposure.fbo); + + glGenTextures(1, &rt->exposure.color); + glBindTexture(GL_TEXTURE_2D, rt->exposure.color); + glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, 1, 1, 0, GL_RED, GL_FLOAT, NULL); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->exposure.color, 0); + + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + } } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index c2aea391b1..7802b28158 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -922,12 +922,19 @@ public: SSAO() { blur_fbo[0]=0; blur_fbo[1]=0; linear_depth=0; } } ssao; - Effects() { - - } + Effects() {} } effects; + struct Exposure { + GLuint fbo; + GLuint color; + + Exposure() { fbo=0; } + } exposure; + + uint64_t last_exposure_tick; + int width,height; bool flags[RENDER_TARGET_FLAG_MAX]; @@ -950,6 +957,8 @@ public: flags[RENDER_TARGET_TRANSPARENT]=false; flags[RENDER_TARGET_NO_3D]=false; flags[RENDER_TARGET_NO_SAMPLING]=false; + + last_exposure_tick=0; } }; diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index dd7ec45242..272f9bb5e1 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -15,5 +15,7 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('ssao.glsl'); env.GLES3_GLSL('ssao_minify.glsl'); env.GLES3_GLSL('ssao_blur.glsl'); + env.GLES3_GLSL('exposure.glsl'); + env.GLES3_GLSL('tonemap.glsl'); diff --git a/drivers/gles3/shaders/exposure.glsl b/drivers/gles3/shaders/exposure.glsl new file mode 100644 index 0000000000..001b90a0f1 --- /dev/null +++ b/drivers/gles3/shaders/exposure.glsl @@ -0,0 +1,98 @@ +[vertex] + + +layout(location=0) in highp vec4 vertex_attrib; + + +void main() { + + gl_Position = vertex_attrib; + +} + +[fragment] + + +uniform highp sampler2D source_exposure; //texunit:0 + +#ifdef EXPOSURE_BEGIN + +uniform highp ivec2 source_render_size; +uniform highp ivec2 target_size; + +#endif + +#ifdef EXPOSURE_END + +uniform highp sampler2D prev_exposure; //texunit:1 +uniform highp float exposure_adjust; +uniform highp float min_luminance; +uniform highp float max_luminance; + +#endif + +layout(location = 0) out highp float exposure; + + + +void main() { + + + +#ifdef EXPOSURE_BEGIN + + + ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size; + +#if 1 + //more precise and expensive, but less jittery + ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size; + next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel + highp vec3 source_color=vec3(0.0); + for(int i=src_pos.x;i SRGB conversion + vec3 a = vec3(0.055); + color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); + + + + + frag_color=vec4(color.rgb,1.0); +} + + diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index c945d2a95d..2b691125d0 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -136,7 +136,7 @@ float Environment::get_ambient_light_skybox_contribution() const{ void Environment::set_tonemapper(ToneMapper p_tone_mapper) { tone_mapper=p_tone_mapper; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } Environment::ToneMapper Environment::get_tonemapper() const{ @@ -147,18 +147,18 @@ Environment::ToneMapper Environment::get_tonemapper() const{ void Environment::set_tonemap_exposure(float p_exposure){ tonemap_exposure=p_exposure; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } float Environment::get_tonemap_exposure() const{ - return get_tonemap_auto_exposure(); + return tonemap_exposure; } void Environment::set_tonemap_white(float p_white){ tonemap_white=p_white; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } float Environment::get_tonemap_white() const { @@ -169,7 +169,7 @@ float Environment::get_tonemap_white() const { void Environment::set_tonemap_auto_exposure(bool p_enabled) { tonemap_auto_exposure=p_enabled; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } bool Environment::get_tonemap_auto_exposure() const { @@ -180,7 +180,7 @@ bool Environment::get_tonemap_auto_exposure() const { void Environment::set_tonemap_auto_exposure_max(float p_auto_exposure_max) { tonemap_auto_exposure_max=p_auto_exposure_max; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_max() const { @@ -191,7 +191,7 @@ float Environment::get_tonemap_auto_exposure_max() const { void Environment::set_tonemap_auto_exposure_min(float p_auto_exposure_min) { tonemap_auto_exposure_min=p_auto_exposure_min; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_min() const { @@ -202,7 +202,7 @@ float Environment::get_tonemap_auto_exposure_min() const { void Environment::set_tonemap_auto_exposure_speed(float p_auto_exposure_speed) { tonemap_auto_exposure_speed=p_auto_exposure_speed; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_speed() const { @@ -210,15 +210,15 @@ float Environment::get_tonemap_auto_exposure_speed() const { return tonemap_auto_exposure_speed; } -void Environment::set_tonemap_auto_exposure_scale(float p_auto_exposure_scale) { +void Environment::set_tonemap_auto_exposure_grey(float p_auto_exposure_grey) { - tonemap_auto_exposure_scale=p_auto_exposure_scale; - VS::get_singleton()->environment_set_tonemap(environment,tonemap_auto_exposure,tonemap_exposure,tonemap_white,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_scale,VS::EnvironmentToneMapper(tone_mapper)); + tonemap_auto_exposure_grey=p_auto_exposure_grey; + VS::get_singleton()->environment_set_tonemap(environment,VS::EnvironmentToneMapper(tone_mapper),tonemap_exposure,tonemap_white,tonemap_auto_exposure,tonemap_auto_exposure_min,tonemap_auto_exposure_max,tonemap_auto_exposure_speed,tonemap_auto_exposure_grey); } -float Environment::get_tonemap_auto_exposure_scale() const { +float Environment::get_tonemap_auto_exposure_grey() const { - return tonemap_auto_exposure_scale; + return tonemap_auto_exposure_grey; } void Environment::set_adjustment_enable(bool p_enable) { @@ -597,17 +597,17 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_speed","exposure_speed"),&Environment::set_tonemap_auto_exposure_speed); ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_speed"),&Environment::get_tonemap_auto_exposure_speed); - ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_scale","exposure_scale"),&Environment::set_tonemap_auto_exposure_scale); - ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_scale"),&Environment::get_tonemap_auto_exposure_scale); + ObjectTypeDB::bind_method(_MD("set_tonemap_auto_exposure_grey","exposure_grey"),&Environment::set_tonemap_auto_exposure_grey); + ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_grey"),&Environment::get_tonemap_auto_exposure_grey); - ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Log,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_exposure/enable"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_scale"),_SCS("get_tonemap_auto_exposure_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_grey"),_SCS("get_tonemap_auto_exposure_grey") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/min_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_min"),_SCS("get_tonemap_auto_exposure_min") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/max_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_max"),_SCS("get_tonemap_auto_exposure_max") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/speed",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_speed"),_SCS("get_tonemap_auto_exposure_speed") ); @@ -648,10 +648,9 @@ void Environment::_bind_methods() { BIND_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); BIND_CONSTANT(GLOW_BLEND_MODE_DISABLED); BIND_CONSTANT(TONE_MAPPER_LINEAR); - BIND_CONSTANT(TONE_MAPPER_LOG); BIND_CONSTANT(TONE_MAPPER_REINHARDT); BIND_CONSTANT(TONE_MAPPER_FILMIC); - BIND_CONSTANT(TONE_MAPPER_ACES_FILMIC); + BIND_CONSTANT(TONE_MAPPER_ACES); } @@ -671,9 +670,9 @@ Environment::Environment() { tonemap_white=1.0; tonemap_auto_exposure=false; tonemap_auto_exposure_max=8; - tonemap_auto_exposure_min=0.4; + tonemap_auto_exposure_min=0.05; tonemap_auto_exposure_speed=0.5; - tonemap_auto_exposure_scale=0.4; + tonemap_auto_exposure_grey=0.4; set_tonemapper(tone_mapper); //update diff --git a/scene/resources/environment.h b/scene/resources/environment.h index c489ff97fc..3cf9f550b4 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -58,10 +58,9 @@ public: enum ToneMapper { TONE_MAPPER_LINEAR, - TONE_MAPPER_LOG, TONE_MAPPER_REINHARDT, TONE_MAPPER_FILMIC, - TONE_MAPPER_ACES_FILMIC + TONE_MAPPER_ACES }; @@ -86,7 +85,7 @@ private: float tonemap_auto_exposure_max; float tonemap_auto_exposure_min; float tonemap_auto_exposure_speed; - float tonemap_auto_exposure_scale; + float tonemap_auto_exposure_grey; bool adjustment_enabled; float adjustment_contrast; @@ -163,8 +162,8 @@ public: void set_tonemap_auto_exposure_speed(float p_auto_exposure_speed); float get_tonemap_auto_exposure_speed() const; - void set_tonemap_auto_exposure_scale(float p_auto_exposure_scale); - float get_tonemap_auto_exposure_scale() const; + void set_tonemap_auto_exposure_grey(float p_auto_exposure_grey); + float get_tonemap_auto_exposure_grey() const; void set_adjustment_enable(bool p_enable); bool is_adjustment_enabled() const; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 09d59e3175..4f357afa68 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -67,7 +67,8 @@ public: virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect,const Color &p_color,bool p_blur)=0; - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,VS::EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_tonemap(RID p_env,VS::EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale)=0; + virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; struct InstanceBase : RID_Data { diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index ff1a622107..c7e49ede2c 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -882,7 +882,8 @@ public: BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) - BIND9(environment_set_tonemap,RID,bool ,float ,float ,float ,float ,float,float ,EnvironmentToneMapper ) + BIND9(environment_set_tonemap,RID,EnvironmentToneMapper, float ,float ,bool, float ,float ,float,float ) + BIND6(environment_set_adjustment,RID,bool ,float ,float ,float ,RID ) diff --git a/servers/visual_server.h b/servers/visual_server.h index 6c4a080437..0b3a9771a8 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -546,13 +546,12 @@ public: enum EnvironmentToneMapper { ENV_TONE_MAPPER_LINEAR, - ENV_TONE_MAPPER_LOG, ENV_TONE_MAPPER_REINHARDT, ENV_TONE_MAPPER_FILMIC, - ENV_TONE_MAPPER_ACES_FILMIC + ENV_TONE_MAPPER_ACES }; - virtual void environment_set_tonemap(RID p_env,bool p_enable,float p_exposure,float p_white,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale,EnvironmentToneMapper p_tone_mapper)=0; + virtual void environment_set_tonemap(RID p_env,EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_grey)=0; virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; -- cgit v1.2.3 From 18ebd22000478dffc91255e89b9845f74b05b606 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 8 Dec 2016 09:48:38 -0300 Subject: Multi stage glow with light bleeding from HDR --- drivers/gles3/rasterizer_scene_gles3.cpp | 160 +++++++++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 22 +++- drivers/gles3/rasterizer_storage_gles3.cpp | 4 +- drivers/gles3/shaders/effect_blur.glsl | 67 ++++++++++++ drivers/gles3/shaders/tonemap.glsl | 81 ++++++++++++++ scene/resources/environment.cpp | 165 +++++++++++++++++++++++++++-- scene/resources/environment.h | 49 +++++++-- servers/visual/rasterizer.h | 2 +- servers/visual/visual_server_raster.h | 2 +- servers/visual_server.h | 6 +- 10 files changed, 536 insertions(+), 22 deletions(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 4abeef89be..ec304e7a46 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -850,7 +850,19 @@ void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color& } -void RasterizerSceneGLES3::environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode){ +void RasterizerSceneGLES3::environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale) { + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->glow_enabled=p_enable; + env->glow_levels=p_level_flags; + env->glow_intensity=p_intensity; + env->glow_strength=p_strength; + env->glow_bloom=p_bloom_treshold; + env->glow_blend_mode=p_blend_mode; + env->glow_hdr_bleed_treshold=p_hdr_bleed_treshold; + env->glow_hdr_bleed_scale=p_hdr_bleed_scale; } void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ @@ -3155,6 +3167,95 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ } + int max_glow_level=-1; + int glow_mask=0; + + + if (env->glow_enabled) { + + + for(int i=0;iglow_levels&(1<=storage->frame.current_rt->effects.mip_maps[1].sizes.size()) { + max_glow_level=storage->frame.current_rt->effects.mip_maps[1].sizes.size()-1; + glow_mask|=1<shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); + + for(int i=0;i<(max_glow_level+1);i++) { + + + int vp_w = storage->frame.current_rt->effects.mip_maps[1].sizes[i].width; + int vp_h = storage->frame.current_rt->effects.mip_maps[1].sizes[i].height; + glViewport(0,0,vp_w,vp_h); + //horizontal pass + if (i==0) { + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_FIRST_PASS,true); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_USE_AUTO_EXPOSURE,env->auto_exposure); + } + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_GAUSSIAN_HORIZONTAL,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_STRENGTH,env->glow_strength); + + glActiveTexture(GL_TEXTURE0); + if (i==0) { + glBindTexture(GL_TEXTURE_2D,composite_from); + + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::EXPOSURE,env->tone_mapper_exposure); + if (env->auto_exposure) { + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::AUTO_EXPOSURE_GREY,env->auto_exposure_grey); + } + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->exposure.color); + + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_BLOOM,env->glow_bloom); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_HDR_TRESHOLD,env->glow_hdr_bleed_treshold); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_HDR_SCALE,env->glow_hdr_bleed_scale); + + } else { + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); //previous level, since mipmaps[0] starts one level bigger + } + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[i].fbo); + _copy_screen(); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_GAUSSIAN_HORIZONTAL,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_FIRST_PASS,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_USE_AUTO_EXPOSURE,false); + + //vertical pass + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_GAUSSIAN_VERTICAL,true); + state.effect_blur_shader.bind(); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(i)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::GLOW_STRENGTH,env->glow_strength); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[i+1].fbo); //next level, since mipmaps[0] starts one level bigger + _copy_screen(); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::GLOW_GAUSSIAN_VERTICAL,false); + } + + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + + } + + + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); glActiveTexture(GL_TEXTURE0); @@ -3166,11 +3267,55 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE,env->auto_exposure); + + + if (max_glow_level>=0) { + + + for(int i=0;i<(max_glow_level+1);i++) { + + if (glow_mask&(1<glow_blend_mode==VS::GLOW_BLEND_MODE_SCREEN); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_SOFTLIGHT,env->glow_blend_mode==VS::GLOW_BLEND_MODE_SOFTLIGHT); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_REPLACE,env->glow_blend_mode==VS::GLOW_BLEND_MODE_REPLACE); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); + + } + state.tonemap_shader.bind(); state.tonemap_shader.set_uniform(TonemapShaderGLES3::EXPOSURE,env->tone_mapper_exposure); state.tonemap_shader.set_uniform(TonemapShaderGLES3::WHITE,env->tone_mapper_exposure_white); + if (max_glow_level>=0) { + + state.tonemap_shader.set_uniform(TonemapShaderGLES3::GLOW_INTENSITY,env->glow_intensity); + } if (env->auto_exposure) { @@ -3180,6 +3325,8 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ } + + _copy_screen(); //turn off everything used @@ -3187,7 +3334,16 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_FILMIC_TONEMAPPER,false); state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_ACES_TONEMAPPER,false); state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_REINDHART_TONEMAPPER,false); - + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL1,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL2,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL3,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL4,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL5,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL6,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_LEVEL7,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_REPLACE,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_SCREEN,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_SOFTLIGHT,false); } void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index b0a875aa16..6ca4529ed9 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -341,6 +341,15 @@ public: Color ssao_color; bool ssao_filter; + bool glow_enabled; + int glow_levels; + float glow_intensity; + float glow_strength; + float glow_bloom; + VS::EnvironmentGlowBlendMode glow_blend_mode; + float glow_hdr_bleed_treshold; + float glow_hdr_bleed_scale; + VS::EnvironmentToneMapper tone_mapper; float tone_mapper_exposure; float tone_mapper_exposure_white; @@ -350,6 +359,7 @@ public: float auto_exposure_max; float auto_exposure_grey; + Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; skybox_scale=1.0; @@ -385,6 +395,16 @@ public: auto_exposure_max=8; auto_exposure_grey=0.4; + glow_enabled=false; + glow_levels=(1<<2)|(1<<4); + glow_intensity=0.8; + glow_strength=1.0; + glow_bloom=0.0; + glow_blend_mode=VS::GLOW_BLEND_MODE_SOFTLIGHT; + glow_hdr_bleed_treshold=1.0; + glow_hdr_bleed_scale=2.0; + + } }; @@ -400,7 +420,7 @@ public: virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0); - virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode); + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale); virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ddb60273e4..cfa50f6100 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5020,8 +5020,8 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ w>>=1; h>>=1; - if (w<32 || h<32) - break; //going less than 32 is pointless + if (w<2 || h<2) + break; level++; diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index 211b60ca2e..589af64d44 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -35,6 +35,31 @@ uniform vec4 ssao_color; #endif +#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL) + +uniform float glow_strength; + +#endif + + +#ifdef GLOW_FIRST_PASS + +uniform float exposure; +uniform float white; + +#ifdef GLOW_USE_AUTO_EXPOSURE + +uniform highp sampler2D source_auto_exposure; //texunit:1 +uniform highp float auto_exposure_grey; + +#endif + +uniform float glow_bloom; +uniform float glow_hdr_treshold; +uniform float glow_hdr_scale; + +#endif + void main() { @@ -57,6 +82,48 @@ void main() { frag_color = color; #endif + + +#ifdef GLOW_GAUSSIAN_HORIZONTAL + vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.174938; + color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pixel_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pixel_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pixel_size,lod )*0.106595; + color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pixel_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pixel_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pixel_size,lod )*0.165569; + color*=glow_strength; + frag_color = color; +#endif + +#ifdef GLOW_GAUSSIAN_VERTICAL + vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.174938; + color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2(0.0, 3.0)*pixel_size,lod )*0.106595; + color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2(0.0,-3.0)*pixel_size,lod )*0.165569; + color*=glow_strength; + frag_color = color; +#endif + +#ifdef GLOW_FIRST_PASS + +#ifdef GLOW_USE_AUTO_EXPOSURE + + frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey; +#endif + frag_color*=exposure; + + float luminance = max(frag_color.r,max(frag_color.g,frag_color.b)); + float feedback = max( smoothstep(glow_hdr_treshold,glow_hdr_treshold+glow_hdr_scale,luminance), glow_bloom ); + + frag_color *= feedback; + +#endif + + #ifdef SIMPLE_COPY vec4 color =textureLod( source_color, uv_interp,0.0); frag_color = color; diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl index 566d194a02..8ee51e9d0c 100644 --- a/drivers/gles3/shaders/tonemap.glsl +++ b/drivers/gles3/shaders/tonemap.glsl @@ -2,17 +2,24 @@ layout(location=0) in highp vec4 vertex_attrib; +layout(location=4) in vec2 uv_in; + +out vec2 uv_interp; + void main() { gl_Position = vertex_attrib; + uv_interp = uv_in; } [fragment] +in vec2 uv_interp; + uniform highp sampler2D source; //texunit:0 uniform float exposure; @@ -25,6 +32,12 @@ uniform highp float auto_exposure_grey; #endif +#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7) + +uniform highp sampler2D source_glow; //texunit:2 +uniform highp float glow_intensity; + +#endif layout(location = 0) out vec4 frag_color; @@ -43,6 +56,74 @@ void main() { color*=exposure; +#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7) + vec3 glow = vec3(0.0); + +#ifdef USE_GLOW_LEVEL1 + glow+=textureLod(source_glow,uv_interp,1.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL2 + glow+=textureLod(source_glow,uv_interp,2.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL3 + glow+=textureLod(source_glow,uv_interp,3.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL4 + glow+=textureLod(source_glow,uv_interp,4.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL5 + glow+=textureLod(source_glow,uv_interp,5.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL6 + glow+=textureLod(source_glow,uv_interp,6.0).rgb; +#endif + +#ifdef USE_GLOW_LEVEL7 + glow+=textureLod(source_glow,uv_interp,7.0).rgb; +#endif + + + glow *= glow_intensity; + + + +#ifdef USE_GLOW_REPLACE + + color.rgb = glow; + +#endif + +#ifdef USE_GLOW_SCREEN + + color.rgb = clamp((color.rgb + glow) - (color.rgb * glow), 0.0, 1.0); + +#endif + +#ifdef USE_GLOW_SOFTLIGHT + + { + + glow = (glow * 0.5) + 0.5; + color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r))); + color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g))); + color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b))); + } + +#endif + +#if !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE) + color.rgb+=glow; +#endif + + +#endif + + #ifdef USE_REINDHART_TONEMAPPER { diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 2b691125d0..eb393f2ad1 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -474,6 +474,110 @@ bool Environment::is_ssao_blur_enabled() const { return ssao_blur; } +void Environment::set_glow_enabled(bool p_enabled) { + + glow_enabled=p_enabled; + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); +} + +bool Environment::is_glow_enabled() const{ + + return glow_enabled; +} + +void Environment::set_glow_level(int p_level,bool p_enabled){ + + ERR_FAIL_INDEX(p_level,VS::MAX_GLOW_LEVELS); + + if (p_enabled) + glow_levels|=(1<environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +bool Environment::is_glow_level_enabled(int p_level) const{ + + ERR_FAIL_INDEX_V(p_level,VS::MAX_GLOW_LEVELS,false); + + return glow_levels&(1<environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +float Environment::get_glow_intensity() const{ + + return glow_intensity; +} + +void Environment::set_glow_strength(float p_strength){ + + glow_strength=p_strength; + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +float Environment::get_glow_strength() const{ + + return glow_strength; +} + +void Environment::set_glow_bloom(float p_treshold){ + + glow_bloom=p_treshold; + + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +float Environment::get_glow_bloom() const{ + + return glow_bloom; +} + +void Environment::set_glow_blend_mode(GlowBlendMode p_mode){ + + glow_blend_mode=p_mode; + + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +Environment::GlowBlendMode Environment::get_glow_blend_mode() const{ + + return glow_blend_mode; +} + +void Environment::set_glow_hdr_bleed_treshold(float p_treshold){ + + glow_hdr_bleed_treshold=p_treshold; + + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +float Environment::get_glow_hdr_bleed_treshold() const{ + + return glow_hdr_bleed_treshold; +} + +void Environment::set_glow_hdr_bleed_scale(float p_scale){ + + glow_hdr_bleed_scale=p_scale; + + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + +} +float Environment::get_glow_hdr_bleed_scale() const{ + + return glow_hdr_bleed_scale; +} + + + + void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_background","mode"),&Environment::set_background); @@ -530,7 +634,7 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_ssr_rough","rough"),&Environment::set_ssr_rough); ObjectTypeDB::bind_method(_MD("is_ssr_rough"),&Environment::is_ssr_rough); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/enable"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ss_reflections/enabled"),_SCS("set_ssr_enabled"),_SCS("is_ssr_enabled") ); ADD_PROPERTY(PropertyInfo(Variant::INT,"ss_reflections/max_steps",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_ssr_max_steps"),_SCS("get_ssr_max_steps") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/accel",PROPERTY_HINT_RANGE,"0,4,0.01"),_SCS("set_ssr_accel"),_SCS("get_ssr_accel") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ss_reflections/fade",PROPERTY_HINT_EXP_EASING),_SCS("set_ssr_fade"),_SCS("get_ssr_fade") ); @@ -565,7 +669,7 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_ssao_blur","enabled"),&Environment::set_ssao_blur); ObjectTypeDB::bind_method(_MD("is_ssao_blur_enabled"),&Environment::is_ssao_blur_enabled); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/enable"),_SCS("set_ssao_enabled"),_SCS("is_ssao_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/enabled"),_SCS("set_ssao_enabled"),_SCS("is_ssao_enabled") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius",PROPERTY_HINT_RANGE,"0.1,16,0.1"),_SCS("set_ssao_radius"),_SCS("get_ssao_radius") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/intensity",PROPERTY_HINT_RANGE,"0.0,9,0.1"),_SCS("set_ssao_intensity"),_SCS("get_ssao_intensity") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"ambient_occlusion/radius2",PROPERTY_HINT_RANGE,"0.0,16,0.1"),_SCS("set_ssao_radius2"),_SCS("get_ssao_radius2") ); @@ -576,6 +680,48 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/blur"),_SCS("set_ssao_blur"),_SCS("is_ssao_blur_enabled") ); + ObjectTypeDB::bind_method(_MD("set_glow_enabled","enabled"),&Environment::set_glow_enabled); + ObjectTypeDB::bind_method(_MD("is_glow_enabled"),&Environment::is_glow_enabled); + + ObjectTypeDB::bind_method(_MD("set_glow_level","idx","enabled"),&Environment::set_glow_level); + ObjectTypeDB::bind_method(_MD("is_glow_level_enabled","idx"),&Environment::is_glow_level_enabled); + + ObjectTypeDB::bind_method(_MD("set_glow_intensity","intensity"),&Environment::set_glow_intensity); + ObjectTypeDB::bind_method(_MD("get_glow_intensity"),&Environment::get_glow_intensity); + + ObjectTypeDB::bind_method(_MD("set_glow_strength","strength"),&Environment::set_glow_strength); + ObjectTypeDB::bind_method(_MD("get_glow_strength"),&Environment::get_glow_strength); + + ObjectTypeDB::bind_method(_MD("set_glow_bloom","amount"),&Environment::set_glow_bloom); + ObjectTypeDB::bind_method(_MD("get_glow_bloom"),&Environment::get_glow_bloom); + + ObjectTypeDB::bind_method(_MD("set_glow_blend_mode","mode"),&Environment::set_glow_blend_mode); + ObjectTypeDB::bind_method(_MD("get_glow_blend_mode"),&Environment::get_glow_blend_mode); + + ObjectTypeDB::bind_method(_MD("set_glow_hdr_bleed_treshold","treshold"),&Environment::set_glow_hdr_bleed_treshold); + ObjectTypeDB::bind_method(_MD("get_glow_hdr_bleed_treshold"),&Environment::get_glow_hdr_bleed_treshold); + + ObjectTypeDB::bind_method(_MD("set_glow_hdr_bleed_scale","scale"),&Environment::set_glow_hdr_bleed_scale); + ObjectTypeDB::bind_method(_MD("get_glow_hdr_bleed_scale"),&Environment::get_glow_hdr_bleed_scale); + + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_glow_enabled"),_SCS("is_glow_enabled") ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/1"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),0 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/2"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),1 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/3"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),2 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/4"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),3 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/5"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),4 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/6"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),5 ); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/7"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),6 ); + + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/intensity",PROPERTY_HINT_RANGE,"0.0,8.0,0.01"),_SCS("set_glow_intensity"),_SCS("get_glow_intensity") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/strength",PROPERTY_HINT_RANGE,"0.0,2.0,0.01"),_SCS("set_glow_strength"),_SCS("get_glow_strength") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/bloom",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_glow_bloom"),_SCS("get_glow_bloom") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"glow/blend_mode",PROPERTY_HINT_ENUM,"Additive,Screen,Softlight,Replace"),_SCS("set_glow_blend_mode"),_SCS("get_glow_blend_mode") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_treshold",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_treshold"),_SCS("get_glow_hdr_bleed_treshold") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_scale",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_scale"),_SCS("get_glow_hdr_bleed_scale") ); + + ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); ObjectTypeDB::bind_method(_MD("get_tonemapper"),&Environment::get_tonemapper); @@ -601,12 +747,10 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_tonemap_auto_exposure_grey"),&Environment::get_tonemap_auto_exposure_grey); - - ADD_PROPERTY(PropertyInfo(Variant::INT,"tonemap/mode",PROPERTY_HINT_ENUM,"Linear,Reindhart,Filmic,Aces"),_SCS("set_tonemapper"),_SCS("get_tonemapper") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/exposure",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_exposure"),_SCS("get_tonemap_exposure") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"tonemap/white",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_white"),_SCS("get_tonemap_white") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_exposure/enable"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"auto_exposure/enabled"),_SCS("set_tonemap_auto_exposure"),_SCS("get_tonemap_auto_exposure") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),_SCS("set_tonemap_auto_exposure_grey"),_SCS("get_tonemap_auto_exposure_grey") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/min_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_min"),_SCS("get_tonemap_auto_exposure_min") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"auto_exposure/max_luma",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_tonemap_auto_exposure_max"),_SCS("get_tonemap_auto_exposure_max") ); @@ -646,7 +790,7 @@ void Environment::_bind_methods() { BIND_CONSTANT(GLOW_BLEND_MODE_ADDITIVE); BIND_CONSTANT(GLOW_BLEND_MODE_SCREEN); BIND_CONSTANT(GLOW_BLEND_MODE_SOFTLIGHT); - BIND_CONSTANT(GLOW_BLEND_MODE_DISABLED); + BIND_CONSTANT(GLOW_BLEND_MODE_REPLACE); BIND_CONSTANT(TONE_MAPPER_LINEAR); BIND_CONSTANT(TONE_MAPPER_REINHARDT); BIND_CONSTANT(TONE_MAPPER_FILMIC); @@ -702,6 +846,15 @@ Environment::Environment() { ssao_direct_light_affect=false; ssao_blur=true; + glow_enabled=false; + glow_levels=(1<<2)|(1<<4); + glow_intensity=0.8; + glow_strength=1.0; + glow_bloom=0.0; + glow_blend_mode=GLOW_BLEND_MODE_SOFTLIGHT; + glow_hdr_bleed_treshold=1.0; + glow_hdr_bleed_scale=2.0; + } Environment::~Environment() { diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 3cf9f550b4..50c48165e8 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -49,12 +49,7 @@ public: BG_MAX }; - enum GlowBlendMode { - GLOW_BLEND_MODE_ADDITIVE, - GLOW_BLEND_MODE_SCREEN, - GLOW_BLEND_MODE_SOFTLIGHT, - GLOW_BLEND_MODE_DISABLED, - }; + enum ToneMapper { TONE_MAPPER_LINEAR, @@ -63,6 +58,12 @@ public: TONE_MAPPER_ACES }; + enum GlowBlendMode { + GLOW_BLEND_MODE_ADDITIVE, + GLOW_BLEND_MODE_SCREEN, + GLOW_BLEND_MODE_SOFTLIGHT, + GLOW_BLEND_MODE_REPLACE, + }; private: @@ -111,6 +112,15 @@ private: Color ssao_color; bool ssao_blur; + bool glow_enabled; + int glow_levels; + float glow_intensity; + float glow_strength; + float glow_bloom; + GlowBlendMode glow_blend_mode; + float glow_hdr_bleed_treshold; + float glow_hdr_bleed_scale; + protected: @@ -229,6 +239,31 @@ public: bool is_ssao_blur_enabled() const; + void set_glow_enabled(bool p_enabled); + bool is_glow_enabled() const; + + void set_glow_level(int p_level,bool p_enabled); + bool is_glow_level_enabled(int p_level) const; + + void set_glow_intensity(float p_intensity); + float get_glow_intensity() const; + + void set_glow_strength(float p_strength); + float get_glow_strength() const; + + void set_glow_bloom(float p_treshold); + float get_glow_bloom() const; + + void set_glow_blend_mode(GlowBlendMode p_mode); + GlowBlendMode get_glow_blend_mode() const; + + void set_glow_hdr_bleed_treshold(float p_treshold); + float get_glow_hdr_bleed_treshold() const; + + void set_glow_hdr_bleed_scale(float p_scale); + float get_glow_hdr_bleed_scale() const; + + virtual RID get_rid() const; @@ -240,8 +275,8 @@ public: VARIANT_ENUM_CAST(Environment::BGMode) -VARIANT_ENUM_CAST(Environment::GlowBlendMode) VARIANT_ENUM_CAST(Environment::ToneMapper) +VARIANT_ENUM_CAST(Environment::GlowBlendMode) #endif // ENVIRONMENT_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 4f357afa68..2b1829283f 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -61,7 +61,7 @@ public: virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0)=0; - virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode)=0; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index c7e49ede2c..52c156cd6f 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -879,7 +879,7 @@ public: BIND10(environment_set_ssao,RID ,bool , float , float , float,float,float , float ,const Color &,bool ) - BIND7(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode ) + BIND9(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode,float,float ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) BIND9(environment_set_tonemap,RID,EnvironmentToneMapper, float ,float ,bool, float ,float ,float,float ) diff --git a/servers/visual_server.h b/servers/visual_server.h index 0b3a9771a8..adc9f4960c 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -79,6 +79,8 @@ public: ARRAY_WEIGHTS_SIZE=4, CANVAS_ITEM_Z_MIN=-4096, CANVAS_ITEM_Z_MAX=4096, + MAX_GLOW_LEVELS=7, + @@ -538,9 +540,9 @@ public: GLOW_BLEND_MODE_ADDITIVE, GLOW_BLEND_MODE_SCREEN, GLOW_BLEND_MODE_SOFTLIGHT, - GLOW_BLEND_MODE_DISABLED, + GLOW_BLEND_MODE_REPLACE, }; - virtual void environment_set_glow(RID p_env,bool p_enable,int p_radius,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode)=0; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; -- cgit v1.2.3 From 22a90e8f2acce60f92958788a52b3f0bdb1a0cdf Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 10 Dec 2016 01:13:20 -0300 Subject: DOF blur, near and far fields.. --- core/math/camera_matrix.cpp | 2 +- core/math/camera_matrix.h | 2 +- drivers/gles3/rasterizer_scene_gles3.cpp | 196 +++++++++++++++++++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 31 ++++- drivers/gles3/shaders/effect_blur.glsl | 177 +++++++++++++++++++++++---- drivers/gles3/shaders/tonemap.glsl | 99 ++++++++++++++-- scene/resources/environment.cpp | 198 +++++++++++++++++++++++++++++-- scene/resources/environment.h | 53 ++++++++- servers/visual/rasterizer.h | 4 +- servers/visual/visual_server_raster.h | 5 +- servers/visual_server.h | 11 +- 11 files changed, 731 insertions(+), 47 deletions(-) diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index fc35908fa3..89f3ee1add 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -54,7 +54,7 @@ void CameraMatrix::set_zero() { } -Plane CameraMatrix::xform4(const Plane& p_vec4) { +Plane CameraMatrix::xform4(const Plane& p_vec4) const { Plane ret; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 7fcff63768..c597ec4034 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -80,7 +80,7 @@ struct CameraMatrix { CameraMatrix operator*(const CameraMatrix& p_matrix) const; - Plane xform4(const Plane& p_vec4); + Plane xform4(const Plane& p_vec4) const; _FORCE_INLINE_ Vector3 xform(const Vector3& p_vec3) const; operator String() const; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index ec304e7a46..2c6c9dd9ba 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -850,7 +850,36 @@ void RasterizerSceneGLES3::environment_set_ambient_light(RID p_env, const Color& } -void RasterizerSceneGLES3::environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale) { + + +void RasterizerSceneGLES3::environment_set_dof_blur_far(RID p_env,bool p_enable,float p_distance,float p_transition,float p_amount,VS::EnvironmentDOFBlurQuality p_quality){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->dof_blur_far_enabled=p_enable; + env->dof_blur_far_distance=p_distance; + env->dof_blur_far_transition=p_transition; + env->dof_blur_far_amount=p_amount; + env->dof_blur_far_quality=p_quality; + + +} + +void RasterizerSceneGLES3::environment_set_dof_blur_near(RID p_env,bool p_enable,float p_distance,float p_transition,float p_amount,VS::EnvironmentDOFBlurQuality p_quality){ + + Environment *env=environment_owner.getornull(p_env); + ERR_FAIL_COND(!env); + + env->dof_blur_near_enabled=p_enable; + env->dof_blur_near_distance=p_distance; + env->dof_blur_near_transition=p_transition; + env->dof_blur_near_amount=p_amount; + env->dof_blur_near_quality=p_quality; + + +} +void RasterizerSceneGLES3::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_treshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_treshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) { Environment *env=environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -863,6 +892,7 @@ void RasterizerSceneGLES3::environment_set_glow(RID p_env,bool p_enable,int p_le env->glow_blend_mode=p_blend_mode; env->glow_hdr_bleed_treshold=p_hdr_bleed_treshold; env->glow_hdr_bleed_scale=p_hdr_bleed_scale; + env->glow_bicubic_upscale=p_bicubic_upscale; } void RasterizerSceneGLES3::environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture){ @@ -3035,7 +3065,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c } -void RasterizerSceneGLES3::_post_process(Environment *env){ +void RasterizerSceneGLES3::_post_process(Environment *env,const CameraMatrix &p_cam_projection){ //copy to front buffer @@ -3077,6 +3107,157 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ GLuint composite_from = storage->frame.current_rt->buffers.diffuse; + if (env->dof_blur_far_enabled) { + + //blur diffuse into effect mipmaps using separatable convolution + //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); + + int vp_h = storage->frame.current_rt->height; + int vp_w = storage->frame.current_rt->width; + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_FAR_BLUR,true); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_LOW,env->dof_blur_far_quality==VS::ENV_DOF_BLUR_QUALITY_LOW); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_MEDIUM,env->dof_blur_far_quality==VS::ENV_DOF_BLUR_QUALITY_MEDIUM); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_HIGH,env->dof_blur_far_quality==VS::ENV_DOF_BLUR_QUALITY_HIGH); + + state.effect_blur_shader.bind(); + int qsteps[3]={4,10,20}; + + float radius = (env->dof_blur_far_amount*env->dof_blur_far_amount) / qsteps[env->dof_blur_far_quality]; + + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_BEGIN,env->dof_blur_far_distance); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_END,env->dof_blur_far_distance+env->dof_blur_far_transition); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_DIR,Vector2(1,0)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_RADIUS,radius); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,composite_from); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); //copy to front first + + _copy_screen(); + + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->color); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_DIR,Vector2(0,1)); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level + _copy_screen(); + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_FAR_BLUR,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_FAR_BLUR,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_LOW,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_MEDIUM,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_HIGH,false); + + + composite_from=storage->frame.current_rt->effects.mip_maps[0].color; + + } + + if (env->dof_blur_near_enabled) { + + //blur diffuse into effect mipmaps using separatable convolution + //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); + + int vp_h = storage->frame.current_rt->height; + int vp_w = storage->frame.current_rt->width; + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_BLUR,true); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_FIRST_TAP,true); + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_LOW,env->dof_blur_near_quality==VS::ENV_DOF_BLUR_QUALITY_LOW); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_MEDIUM,env->dof_blur_near_quality==VS::ENV_DOF_BLUR_QUALITY_MEDIUM); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_HIGH,env->dof_blur_near_quality==VS::ENV_DOF_BLUR_QUALITY_HIGH); + + state.effect_blur_shader.bind(); + int qsteps[3]={4,10,20}; + + float radius = (env->dof_blur_near_amount*env->dof_blur_near_amount) / qsteps[env->dof_blur_near_quality]; + + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_BEGIN,env->dof_blur_near_distance); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_END,env->dof_blur_near_distance-env->dof_blur_near_transition); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_DIR,Vector2(1,0)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_RADIUS,radius); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,composite_from); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); //copy to front first + + _copy_screen(); + //manually do the blend if this is the first operation resolving from the diffuse buffer + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_BLUR_MERGE,composite_from == storage->frame.current_rt->buffers.diffuse); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_FIRST_TAP,false); + state.effect_blur_shader.bind(); + + + + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_BEGIN,env->dof_blur_near_distance); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_END,env->dof_blur_near_distance-env->dof_blur_near_transition); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_DIR,Vector2(0,1)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::DOF_RADIUS,radius); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::PIXEL_SIZE,Vector2(1.0/vp_w,1.0/vp_h)); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_NEAR,p_cam_projection.get_z_near()); + state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::CAMERA_Z_FAR,p_cam_projection.get_z_far()); + + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->color); + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level + + if (composite_from != storage->frame.current_rt->buffers.diffuse) { + + glEnable(GL_BLEND); + glBlendEquation(GL_FUNC_ADD); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + } else { + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + + } + + _copy_screen(); + + if (composite_from != storage->frame.current_rt->buffers.diffuse) { + + glDisable(GL_BLEND); + } + + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_BLUR,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_FIRST_TAP,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_NEAR_BLUR_MERGE,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_LOW,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_MEDIUM,false); + state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::DOF_QUALITY_HIGH,false); + + + composite_from=storage->frame.current_rt->effects.mip_maps[0].color; + + } + if ( env->auto_exposure) { //compute auto exposure @@ -3266,6 +3447,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_REINDHART_TONEMAPPER,env->tone_mapper==VS::ENV_TONE_MAPPER_REINHARDT); state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE,env->auto_exposure); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_FILTER_BICUBIC,env->glow_bicubic_upscale); @@ -3315,6 +3497,12 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ if (max_glow_level>=0) { state.tonemap_shader.set_uniform(TonemapShaderGLES3::GLOW_INTENSITY,env->glow_intensity); + int ss[2]={ + storage->frame.current_rt->width, + storage->frame.current_rt->height, + }; + glUniform2iv(state.tonemap_shader.get_uniform(TonemapShaderGLES3::GLOW_TEXTURE_SIZE),1,ss); + } if (env->auto_exposure) { @@ -3344,6 +3532,8 @@ void RasterizerSceneGLES3::_post_process(Environment *env){ state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_REPLACE,false); state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_SCREEN,false); state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_SOFTLIGHT,false); + state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_FILTER_BICUBIC,false); + } void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass){ @@ -3605,7 +3795,7 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } - _post_process(env); + _post_process(env,p_cam_projection); if (false && shadow_atlas) { diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 6ca4529ed9..78e8b3e477 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -349,6 +349,7 @@ public: VS::EnvironmentGlowBlendMode glow_blend_mode; float glow_hdr_bleed_treshold; float glow_hdr_bleed_scale; + bool glow_bicubic_upscale; VS::EnvironmentToneMapper tone_mapper; float tone_mapper_exposure; @@ -359,6 +360,17 @@ public: float auto_exposure_max; float auto_exposure_grey; + bool dof_blur_far_enabled; + float dof_blur_far_distance; + float dof_blur_far_transition; + float dof_blur_far_amount; + VS::EnvironmentDOFBlurQuality dof_blur_far_quality; + + bool dof_blur_near_enabled; + float dof_blur_near_distance; + float dof_blur_near_transition; + float dof_blur_near_amount; + VS::EnvironmentDOFBlurQuality dof_blur_near_quality; Environment() { bg_mode=VS::ENV_BG_CLEAR_COLOR; @@ -403,7 +415,19 @@ public: glow_blend_mode=VS::GLOW_BLEND_MODE_SOFTLIGHT; glow_hdr_bleed_treshold=1.0; glow_hdr_bleed_scale=2.0; + glow_bicubic_upscale=false; + + dof_blur_far_enabled=false; + dof_blur_far_distance=10; + dof_blur_far_transition=5; + dof_blur_far_amount=0.1; + dof_blur_far_quality=VS::ENV_DOF_BLUR_QUALITY_MEDIUM; + dof_blur_near_enabled=false; + dof_blur_near_distance=2; + dof_blur_near_transition=1; + dof_blur_near_amount=0.1; + dof_blur_near_quality=VS::ENV_DOF_BLUR_QUALITY_MEDIUM; } }; @@ -420,12 +444,15 @@ public: virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer); virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0); - virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale); + virtual void environment_set_dof_blur_near(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_dof_blur_far(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale,bool p_bicubic_upscale); virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture); virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness); virtual void environment_set_ssao(RID p_env,bool p_enable, float p_radius, float p_radius2, float p_intensity2, float p_intensity, float p_bias, float p_light_affect,const Color &p_color,bool p_blur); + virtual void environment_set_tonemap(RID p_env,VS::EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale); virtual void environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp); @@ -663,7 +690,7 @@ public: void _fill_render_list(InstanceBase** p_cull_result,int p_cull_count,bool p_shadow); void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection); - void _post_process(Environment *env); + void _post_process(Environment *env, const CameraMatrix &p_cam_projection); virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass); virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count); diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index 589af64d44..89afa12f60 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/shaders/effect_blur.glsl @@ -41,6 +41,40 @@ uniform float glow_strength; #endif +#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR) + +#ifdef DOF_QUALITY_LOW +const int dof_kernel_size=5; +const int dof_kernel_from=2; +const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388); +#endif + +#ifdef DOF_QUALITY_MEDIUM +const int dof_kernel_size=11; +const int dof_kernel_from=5; +const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037); + +#endif + +#ifdef DOF_QUALITY_HIGH +const int dof_kernel_size=21; +const int dof_kernel_from=10; +const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174); +#endif + +uniform sampler2D dof_source_depth; //texunit:1 +uniform float dof_begin; +uniform float dof_end; +uniform vec2 dof_dir; +uniform float dof_radius; + +#ifdef DOF_NEAR_BLUR_MERGE + +uniform sampler2D source_dof_original; //texunit:2 +#endif + +#endif + #ifdef GLOW_FIRST_PASS @@ -60,16 +94,23 @@ uniform float glow_hdr_scale; #endif +uniform float camera_z_far; +uniform float camera_z_near; + void main() { #ifdef GAUSSIAN_HORIZONTAL - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pixel_size,lod )*0.06136; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pixel_size,lod )*0.24477; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pixel_size,lod )*0.06136; + vec2 pix_size = pixel_size; + pix_size*=0.5; //reading from larger buffer, so use more samples + vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607; + color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879; + color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305; + color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303; + color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879; + color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305; + color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303; frag_color = color; #endif @@ -82,32 +123,126 @@ void main() { frag_color = color; #endif - +//glow uses larger sigma for a more rounded blur effect #ifdef GLOW_GAUSSIAN_HORIZONTAL - vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.174938; - color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pixel_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pixel_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pixel_size,lod )*0.106595; - color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pixel_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pixel_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pixel_size,lod )*0.165569; + vec2 pix_size = pixel_size; + pix_size*=0.5; //reading from larger buffer, so use more samples + vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938; + color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595; + color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569; + color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367; + color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595; color*=glow_strength; frag_color = color; #endif #ifdef GLOW_GAUSSIAN_VERTICAL - vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.174938; - color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2(0.0, 3.0)*pixel_size,lod )*0.106595; - color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.165569; - color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.140367; - color+=textureLod( source_color, uv_interp+vec2(0.0,-3.0)*pixel_size,lod )*0.165569; + vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713; + color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062; + color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581; + color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062; + color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581; color*=glow_strength; frag_color = color; #endif +#ifdef DOF_FAR_BLUR + + vec4 color_accum = vec4(0.0); + + float depth = textureLod( dof_source_depth, uv_interp, 0.0).r; + depth = depth * 2.0 - 1.0; + depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); + + float amount = smoothstep(dof_begin,dof_end,depth); + float k_accum=0.0; + + for(int i=0;i0.0) { + color_accum/=k_accum; + } + + frag_color = color_accum;///k_accum; + +#endif + +#ifdef DOF_NEAR_BLUR + + vec4 color_accum = vec4(0.0); + + float max_accum=0; + + for(int i=0;i> p_lod); + vec2 pixel_size =1.0/tex_size; + uv = uv*tex_size + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + + float g0x = g0(fuv.x); + float g1x = g1(fuv.x); + float h0x = h0(fuv.x); + float h1x = h1(fuv.x); + float h0y = h0(fuv.y); + float h1y = h1(fuv.y); + + vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - 0.5) * pixel_size; + vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - 0.5) * pixel_size; + vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * pixel_size; + vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * pixel_size; + + return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) + + g1x * textureLod(tex, p1,lod)) + + g1(fuv.y) * (g0x * textureLod(tex, p2,lod) + + g1x * textureLod(tex, p3,lod)); +} + + + +#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) texture2D_bicubic(m_tex,m_uv,m_lod) + +#else + +#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) textureLod(m_tex,m_uv,float(m_lod)) + +#endif + void main() { @@ -60,31 +144,32 @@ void main() { vec3 glow = vec3(0.0); #ifdef USE_GLOW_LEVEL1 - glow+=textureLod(source_glow,uv_interp,1.0).rgb; + + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,1).rgb; #endif #ifdef USE_GLOW_LEVEL2 - glow+=textureLod(source_glow,uv_interp,2.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,2).rgb; #endif #ifdef USE_GLOW_LEVEL3 - glow+=textureLod(source_glow,uv_interp,3.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,3).rgb; #endif #ifdef USE_GLOW_LEVEL4 - glow+=textureLod(source_glow,uv_interp,4.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,4).rgb; #endif #ifdef USE_GLOW_LEVEL5 - glow+=textureLod(source_glow,uv_interp,5.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,5).rgb; #endif #ifdef USE_GLOW_LEVEL6 - glow+=textureLod(source_glow,uv_interp,6.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,6).rgb; #endif #ifdef USE_GLOW_LEVEL7 - glow+=textureLod(source_glow,uv_interp,7.0).rgb; + glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,7).rgb; #endif diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index eb393f2ad1..71a711dc72 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -477,7 +477,7 @@ bool Environment::is_ssao_blur_enabled() const { void Environment::set_glow_enabled(bool p_enabled) { glow_enabled=p_enabled; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } bool Environment::is_glow_enabled() const{ @@ -494,7 +494,7 @@ void Environment::set_glow_level(int p_level,bool p_enabled){ else glow_levels&=~(1<environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } bool Environment::is_glow_level_enabled(int p_level) const{ @@ -508,7 +508,7 @@ void Environment::set_glow_intensity(float p_intensity){ glow_intensity=p_intensity; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } float Environment::get_glow_intensity() const{ @@ -519,7 +519,7 @@ float Environment::get_glow_intensity() const{ void Environment::set_glow_strength(float p_strength){ glow_strength=p_strength; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } float Environment::get_glow_strength() const{ @@ -531,7 +531,7 @@ void Environment::set_glow_bloom(float p_treshold){ glow_bloom=p_treshold; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } float Environment::get_glow_bloom() const{ @@ -543,7 +543,7 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode){ glow_blend_mode=p_mode; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } Environment::GlowBlendMode Environment::get_glow_blend_mode() const{ @@ -555,7 +555,7 @@ void Environment::set_glow_hdr_bleed_treshold(float p_treshold){ glow_hdr_bleed_treshold=p_treshold; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } float Environment::get_glow_hdr_bleed_treshold() const{ @@ -567,7 +567,7 @@ void Environment::set_glow_hdr_bleed_scale(float p_scale){ glow_hdr_bleed_scale=p_scale; - VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold); + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); } float Environment::get_glow_hdr_bleed_scale() const{ @@ -575,7 +575,128 @@ float Environment::get_glow_hdr_bleed_scale() const{ return glow_hdr_bleed_scale; } +void Environment::set_glow_bicubic_upscale(bool p_enable) { + glow_bicubic_upscale=p_enable; + VS::get_singleton()->environment_set_glow(environment,glow_enabled,glow_levels,glow_intensity,glow_strength,glow_bloom,VS::EnvironmentGlowBlendMode(glow_blend_mode),glow_hdr_bleed_treshold,glow_hdr_bleed_treshold,glow_bicubic_upscale); + +} + +bool Environment::is_glow_bicubic_upscale_enabled() const { + + return glow_bicubic_upscale; +} + + +void Environment::set_dof_blur_far_enabled(bool p_enable) { + + dof_blur_far_enabled=p_enable; + VS::get_singleton()->environment_set_dof_blur_far(environment,dof_blur_far_enabled,dof_blur_far_distance,dof_blur_far_transition,dof_blur_far_amount,VS::EnvironmentDOFBlurQuality(dof_blur_far_quality)); +} + +bool Environment::is_dof_blur_far_enabled() const{ + + return dof_blur_far_enabled; +} + +void Environment::set_dof_blur_far_distance(float p_distance){ + + dof_blur_far_distance=p_distance; + VS::get_singleton()->environment_set_dof_blur_far(environment,dof_blur_far_enabled,dof_blur_far_distance,dof_blur_far_transition,dof_blur_far_amount,VS::EnvironmentDOFBlurQuality(dof_blur_far_quality)); + +} +float Environment::get_dof_blur_far_distance() const{ + + return dof_blur_far_distance; +} + +void Environment::set_dof_blur_far_transition(float p_distance){ + + dof_blur_far_transition=p_distance; + VS::get_singleton()->environment_set_dof_blur_far(environment,dof_blur_far_enabled,dof_blur_far_distance,dof_blur_far_transition,dof_blur_far_amount,VS::EnvironmentDOFBlurQuality(dof_blur_far_quality)); +} +float Environment::get_dof_blur_far_transition() const{ + + return dof_blur_far_transition; +} + +void Environment::set_dof_blur_far_amount(float p_amount){ + + dof_blur_far_amount=p_amount; + VS::get_singleton()->environment_set_dof_blur_far(environment,dof_blur_far_enabled,dof_blur_far_distance,dof_blur_far_transition,dof_blur_far_amount,VS::EnvironmentDOFBlurQuality(dof_blur_far_quality)); + +} +float Environment::get_dof_blur_far_amount() const{ + + return dof_blur_far_amount; +} + +void Environment::set_dof_blur_far_quality(DOFBlurQuality p_quality) { + + dof_blur_far_quality=p_quality; + VS::get_singleton()->environment_set_dof_blur_far(environment,dof_blur_far_enabled,dof_blur_far_distance,dof_blur_far_transition,dof_blur_far_amount,VS::EnvironmentDOFBlurQuality(dof_blur_far_quality)); +} + +Environment::DOFBlurQuality Environment::get_dof_blur_far_quality() const { + + return dof_blur_far_quality; +} + + +void Environment::set_dof_blur_near_enabled(bool p_enable) { + + dof_blur_near_enabled=p_enable; + VS::get_singleton()->environment_set_dof_blur_near(environment,dof_blur_near_enabled,dof_blur_near_distance,dof_blur_near_transition,dof_blur_near_amount,VS::EnvironmentDOFBlurQuality(dof_blur_near_quality)); +} + +bool Environment::is_dof_blur_near_enabled() const{ + + return dof_blur_near_enabled; +} + +void Environment::set_dof_blur_near_distance(float p_distance){ + + dof_blur_near_distance=p_distance; + VS::get_singleton()->environment_set_dof_blur_near(environment,dof_blur_near_enabled,dof_blur_near_distance,dof_blur_near_transition,dof_blur_near_amount,VS::EnvironmentDOFBlurQuality(dof_blur_near_quality)); +} + +float Environment::get_dof_blur_near_distance() const{ + + return dof_blur_near_distance; +} + +void Environment::set_dof_blur_near_transition(float p_distance){ + + dof_blur_near_transition=p_distance; + VS::get_singleton()->environment_set_dof_blur_near(environment,dof_blur_near_enabled,dof_blur_near_distance,dof_blur_near_transition,dof_blur_near_amount,VS::EnvironmentDOFBlurQuality(dof_blur_near_quality)); +} + +float Environment::get_dof_blur_near_transition() const{ + + return dof_blur_near_transition; +} + +void Environment::set_dof_blur_near_amount(float p_amount){ + + dof_blur_near_amount=p_amount; + VS::get_singleton()->environment_set_dof_blur_near(environment,dof_blur_near_enabled,dof_blur_near_distance,dof_blur_near_transition,dof_blur_near_amount,VS::EnvironmentDOFBlurQuality(dof_blur_near_quality)); +} + +float Environment::get_dof_blur_near_amount() const{ + + return dof_blur_near_amount; +} + +void Environment::set_dof_blur_near_quality(DOFBlurQuality p_quality) { + + dof_blur_near_quality=p_quality; + VS::get_singleton()->environment_set_dof_blur_near(environment,dof_blur_near_enabled,dof_blur_near_distance,dof_blur_near_transition,dof_blur_near_amount,VS::EnvironmentDOFBlurQuality(dof_blur_near_quality)); +} + +Environment::DOFBlurQuality Environment::get_dof_blur_near_quality() const { + + return dof_blur_near_quality; +} void Environment::_bind_methods() { @@ -679,6 +800,48 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR,"ambient_occlusion/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_ssao_color"),_SCS("get_ssao_color") ); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"ambient_occlusion/blur"),_SCS("set_ssao_blur"),_SCS("is_ssao_blur_enabled") ); + ObjectTypeDB::bind_method(_MD("set_dof_blur_far_enabled","enabled"),&Environment::set_dof_blur_far_enabled); + ObjectTypeDB::bind_method(_MD("is_dof_blur_far_enabled"),&Environment::is_dof_blur_far_enabled); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_far_distance","intensity"),&Environment::set_dof_blur_far_distance); + ObjectTypeDB::bind_method(_MD("get_dof_blur_far_distance"),&Environment::get_dof_blur_far_distance); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_far_transition","intensity"),&Environment::set_dof_blur_far_transition); + ObjectTypeDB::bind_method(_MD("get_dof_blur_far_transition"),&Environment::get_dof_blur_far_transition); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_far_amount","intensity"),&Environment::set_dof_blur_far_amount); + ObjectTypeDB::bind_method(_MD("get_dof_blur_far_amount"),&Environment::get_dof_blur_far_amount); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_far_quality","intensity"),&Environment::set_dof_blur_far_quality); + ObjectTypeDB::bind_method(_MD("get_dof_blur_far_quality"),&Environment::get_dof_blur_far_quality); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_near_enabled","enabled"),&Environment::set_dof_blur_near_enabled); + ObjectTypeDB::bind_method(_MD("is_dof_blur_near_enabled"),&Environment::is_dof_blur_near_enabled); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_near_distance","intensity"),&Environment::set_dof_blur_near_distance); + ObjectTypeDB::bind_method(_MD("get_dof_blur_near_distance"),&Environment::get_dof_blur_near_distance); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_near_transition","intensity"),&Environment::set_dof_blur_near_transition); + ObjectTypeDB::bind_method(_MD("get_dof_blur_near_transition"),&Environment::get_dof_blur_near_transition); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_near_amount","intensity"),&Environment::set_dof_blur_near_amount); + ObjectTypeDB::bind_method(_MD("get_dof_blur_near_amount"),&Environment::get_dof_blur_near_amount); + + ObjectTypeDB::bind_method(_MD("set_dof_blur_near_quality","level"),&Environment::set_dof_blur_near_quality); + ObjectTypeDB::bind_method(_MD("get_dof_blur_near_quality"),&Environment::get_dof_blur_near_quality); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_far/enabled"),_SCS("set_dof_blur_far_enabled"),_SCS("is_dof_blur_far_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_distance"),_SCS("get_dof_blur_far_distance") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_far_transition"),_SCS("get_dof_blur_far_transition") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_far/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_far_amount"),_SCS("get_dof_blur_far_amount") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_far/quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_far_quality"),_SCS("get_dof_blur_far_quality") ); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"dof_blur_near/enabled"),_SCS("set_dof_blur_near_enabled"),_SCS("is_dof_blur_near_enabled") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/distance",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_distance"),_SCS("get_dof_blur_near_distance") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/transition",PROPERTY_HINT_EXP_RANGE,"0.01,8192,0.01"),_SCS("set_dof_blur_near_transition"),_SCS("get_dof_blur_near_transition") ); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"dof_blur_near/amount",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_dof_blur_near_amount"),_SCS("get_dof_blur_near_amount") ); + ADD_PROPERTY(PropertyInfo(Variant::INT,"dof_blur_near/quality",PROPERTY_HINT_ENUM,"Low,Medium,High"),_SCS("set_dof_blur_near_quality"),_SCS("get_dof_blur_near_quality") ); + ObjectTypeDB::bind_method(_MD("set_glow_enabled","enabled"),&Environment::set_glow_enabled); ObjectTypeDB::bind_method(_MD("is_glow_enabled"),&Environment::is_glow_enabled); @@ -704,6 +867,8 @@ void Environment::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_glow_hdr_bleed_scale","scale"),&Environment::set_glow_hdr_bleed_scale); ObjectTypeDB::bind_method(_MD("get_glow_hdr_bleed_scale"),&Environment::get_glow_hdr_bleed_scale); + ObjectTypeDB::bind_method(_MD("set_glow_bicubic_upscale","enabled"),&Environment::set_glow_bicubic_upscale); + ObjectTypeDB::bind_method(_MD("is_glow_bicubic_upscale_enabled"),&Environment::is_glow_bicubic_upscale_enabled); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_glow_enabled"),_SCS("is_glow_enabled") ); ADD_PROPERTYI(PropertyInfo(Variant::BOOL,"glow/levels/1"),_SCS("set_glow_level"),_SCS("is_glow_level_enabled"),0 ); @@ -720,6 +885,7 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"glow/blend_mode",PROPERTY_HINT_ENUM,"Additive,Screen,Softlight,Replace"),_SCS("set_glow_blend_mode"),_SCS("get_glow_blend_mode") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_treshold",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_treshold"),_SCS("get_glow_hdr_bleed_treshold") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"glow/hdr_scale",PROPERTY_HINT_RANGE,"0.0,4.0,0.01"),_SCS("set_glow_hdr_bleed_scale"),_SCS("get_glow_hdr_bleed_scale") ); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"glow/bicubic_upscale"),_SCS("set_glow_bicubic_upscale"),_SCS("is_glow_bicubic_upscale_enabled") ); ObjectTypeDB::bind_method(_MD("set_tonemapper","mode"),&Environment::set_tonemapper); @@ -795,6 +961,9 @@ void Environment::_bind_methods() { BIND_CONSTANT(TONE_MAPPER_REINHARDT); BIND_CONSTANT(TONE_MAPPER_FILMIC); BIND_CONSTANT(TONE_MAPPER_ACES); + BIND_CONSTANT(DOF_BLUR_QUALITY_LOW); + BIND_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); + BIND_CONSTANT(DOF_BLUR_QUALITY_HIGH); } @@ -854,6 +1023,19 @@ Environment::Environment() { glow_blend_mode=GLOW_BLEND_MODE_SOFTLIGHT; glow_hdr_bleed_treshold=1.0; glow_hdr_bleed_scale=2.0; + glow_bicubic_upscale=false; + + dof_blur_far_enabled=false; + dof_blur_far_distance=10; + dof_blur_far_transition=5; + dof_blur_far_amount=0.1; + dof_blur_far_quality=DOF_BLUR_QUALITY_MEDIUM; + + dof_blur_near_enabled=false; + dof_blur_near_distance=2; + dof_blur_near_transition=1; + dof_blur_near_amount=0.1; + dof_blur_near_quality=DOF_BLUR_QUALITY_MEDIUM; } diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 50c48165e8..fcf3e1edc6 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -65,6 +65,11 @@ public: GLOW_BLEND_MODE_REPLACE, }; + enum DOFBlurQuality { + DOF_BLUR_QUALITY_LOW, + DOF_BLUR_QUALITY_MEDIUM, + DOF_BLUR_QUALITY_HIGH, + }; private: RID environment; @@ -120,7 +125,19 @@ private: GlowBlendMode glow_blend_mode; float glow_hdr_bleed_treshold; float glow_hdr_bleed_scale; + bool glow_bicubic_upscale; + + bool dof_blur_far_enabled; + float dof_blur_far_distance; + float dof_blur_far_transition; + float dof_blur_far_amount; + DOFBlurQuality dof_blur_far_quality; + bool dof_blur_near_enabled; + float dof_blur_near_distance; + float dof_blur_near_transition; + float dof_blur_near_amount; + DOFBlurQuality dof_blur_near_quality; protected: @@ -199,7 +216,7 @@ public: void set_ssr_accel(float p_accel); float get_ssr_accel() const; - void set_ssr_fade(float p_fade); + void set_ssr_fade(float p_transition); float get_ssr_fade() const; void set_ssr_depth_tolerance(float p_depth_tolerance); @@ -263,6 +280,38 @@ public: void set_glow_hdr_bleed_scale(float p_scale); float get_glow_hdr_bleed_scale() const; + void set_glow_bicubic_upscale(bool p_enable); + bool is_glow_bicubic_upscale_enabled() const; + + void set_dof_blur_far_enabled(bool p_enable); + bool is_dof_blur_far_enabled() const; + + void set_dof_blur_far_distance(float p_distance); + float get_dof_blur_far_distance() const; + + void set_dof_blur_far_transition(float p_distance); + float get_dof_blur_far_transition() const; + + void set_dof_blur_far_amount(float p_amount); + float get_dof_blur_far_amount() const; + + void set_dof_blur_far_quality(DOFBlurQuality p_quality); + DOFBlurQuality get_dof_blur_far_quality() const; + + void set_dof_blur_near_enabled(bool p_enable); + bool is_dof_blur_near_enabled() const; + + void set_dof_blur_near_distance(float p_distance); + float get_dof_blur_near_distance() const; + + void set_dof_blur_near_transition(float p_distance); + float get_dof_blur_near_transition() const; + + void set_dof_blur_near_amount(float p_amount); + float get_dof_blur_near_amount() const; + + void set_dof_blur_near_quality(DOFBlurQuality p_quality); + DOFBlurQuality get_dof_blur_near_quality() const; virtual RID get_rid() const; @@ -277,6 +326,6 @@ public: VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::ToneMapper) VARIANT_ENUM_CAST(Environment::GlowBlendMode) - +VARIANT_ENUM_CAST(Environment::DOFBlurQuality) #endif // ENVIRONMENT_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 2b1829283f..228afffdb5 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -61,7 +61,9 @@ public: virtual void environment_set_canvas_max_layer(RID p_env,int p_max_layer)=0; virtual void environment_set_ambient_light(RID p_env,const Color& p_color,float p_energy=1.0,float p_skybox_contribution=0.0)=0; - virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale)=0; + virtual void environment_set_dof_blur_near(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality)=0; + virtual void environment_set_dof_blur_far(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality)=0; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale,bool p_bicubic_upscale)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; virtual void environment_set_ssr(RID p_env,bool p_enable, int p_max_steps,float p_accel,float p_fade,float p_depth_tolerance,bool p_smooth,bool p_roughness)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 52c156cd6f..78b0e3cadd 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -879,7 +879,10 @@ public: BIND10(environment_set_ssao,RID ,bool , float , float , float,float,float , float ,const Color &,bool ) - BIND9(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode,float,float ) + + BIND6(environment_set_dof_blur_near,RID,bool ,float,float,float,EnvironmentDOFBlurQuality) + BIND6(environment_set_dof_blur_far,RID,bool ,float,float,float,EnvironmentDOFBlurQuality) + BIND10(environment_set_glow,RID,bool ,int ,float ,float ,float ,EnvironmentGlowBlendMode,float,float,bool ) BIND5(environment_set_fog,RID,bool ,float ,float ,RID ) BIND9(environment_set_tonemap,RID,EnvironmentToneMapper, float ,float ,bool, float ,float ,float,float ) diff --git a/servers/visual_server.h b/servers/visual_server.h index adc9f4960c..7558fbf818 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -536,13 +536,22 @@ public: //set default SSR options //set default SSSSS options + enum EnvironmentDOFBlurQuality { + ENV_DOF_BLUR_QUALITY_LOW, + ENV_DOF_BLUR_QUALITY_MEDIUM, + ENV_DOF_BLUR_QUALITY_HIGH, + }; + + virtual void environment_set_dof_blur_near(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,EnvironmentDOFBlurQuality p_quality)=0; + virtual void environment_set_dof_blur_far(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,EnvironmentDOFBlurQuality p_quality)=0; + enum EnvironmentGlowBlendMode { GLOW_BLEND_MODE_ADDITIVE, GLOW_BLEND_MODE_SCREEN, GLOW_BLEND_MODE_SOFTLIGHT, GLOW_BLEND_MODE_REPLACE, }; - virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale)=0; + virtual void environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_treshold,EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_treshold,float p_hdr_bleed_scale,bool p_bicubic_upscale)=0; virtual void environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)=0; -- cgit v1.2.3 From 075fde7f26d6c3b02df5108065d1a9f979437bb8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 20 Dec 2016 00:21:07 -0300 Subject: work in progress global illumination --- core/image.cpp | 22 +- drivers/gles3/rasterizer_scene_gles3.cpp | 85 +- drivers/gles3/rasterizer_scene_gles3.h | 26 +- drivers/gles3/rasterizer_storage_gles3.cpp | 317 +++- drivers/gles3/rasterizer_storage_gles3.h | 79 + drivers/gles3/shaders/scene.glsl | 135 +- scene/3d/baked_light_instance.cpp | 1722 +++++++++++++++++++- scene/3d/baked_light_instance.h | 122 +- scene/3d/gi_probe.cpp | 1248 ++++++++++++++ scene/3d/gi_probe.h | 174 ++ scene/3d/light.cpp | 34 +- scene/3d/light.h | 6 + scene/3d/visual_instance.cpp | 65 - scene/3d/visual_instance.h | 10 +- scene/register_scene_types.cpp | 5 +- scene/resources/baked_light.cpp | 574 ------- scene/resources/baked_light.h | 163 -- servers/visual/rasterizer.h | 45 +- servers/visual/visual_server_light_baker.cpp | 6 + servers/visual/visual_server_light_baker.h | 29 + servers/visual/visual_server_raster.cpp | 3 +- servers/visual/visual_server_raster.h | 30 +- servers/visual/visual_server_scene.cpp | 865 +++++++++- servers/visual/visual_server_scene.h | 162 +- servers/visual_server.h | 38 +- tools/editor/io_plugins/editor_import_collada.cpp | 17 +- .../io_plugins/editor_scene_import_plugin.cpp | 2 +- tools/editor/spatial_editor_gizmos.cpp | 170 +- tools/editor/spatial_editor_gizmos.h | 22 + 29 files changed, 5217 insertions(+), 959 deletions(-) create mode 100644 scene/3d/gi_probe.cpp create mode 100644 scene/3d/gi_probe.h create mode 100644 servers/visual/visual_server_light_baker.cpp create mode 100644 servers/visual/visual_server_light_baker.h diff --git a/core/image.cpp b/core/image.cpp index 73a2ab8013..0b63d9c524 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -390,16 +390,16 @@ void Image::convert( Format p_new_format ){ case FORMAT_R8|(FORMAT_RG8<<8): _convert<1,false,2,false,false,false>( width, height,rptr, wptr ); break; case FORMAT_R8|(FORMAT_RGB8<<8): _convert<1,false,3,false,false,false>( width, height,rptr, wptr ); break; case FORMAT_R8|(FORMAT_RGBA8<<8): _convert<1,false,3,true,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RG8|(FORMAT_L8<<8): _convert<1,false,1,false,false,true>( width, height,rptr, wptr ); break; - case FORMAT_RG8|(FORMAT_LA8<<8): _convert<1,false,1,true,false,true>( width, height,rptr, wptr ); break; - case FORMAT_RG8|(FORMAT_R8<<8): _convert<1,false,1,false,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RG8|(FORMAT_RGB8<<8): _convert<1,false,3,false,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RG8|(FORMAT_RGBA8<<8): _convert<1,false,3,true,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RGB8|(FORMAT_L8<<8): _convert<2,false,1,false,false,true>( width, height,rptr, wptr ); break; - case FORMAT_RGB8|(FORMAT_LA8<<8): _convert<2,false,1,true,false,true>( width, height,rptr, wptr ); break; - case FORMAT_RGB8|(FORMAT_R8<<8): _convert<2,false,1,false,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RGB8|(FORMAT_RG8<<8): _convert<2,false,2,false,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RGB8|(FORMAT_RGBA8<<8): _convert<2,false,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_L8<<8): _convert<2,false,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_LA8<<8): _convert<2,false,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_R8<<8): _convert<2,false,1,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_RGB8<<8): _convert<2,false,3,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RG8|(FORMAT_RGBA8<<8): _convert<2,false,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_L8<<8): _convert<3,false,1,false,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_LA8<<8): _convert<3,false,1,true,false,true>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_R8<<8): _convert<3,false,1,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_RG8<<8): _convert<3,false,2,false,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGB8|(FORMAT_RGBA8<<8): _convert<3,false,3,true,false,false>( width, height,rptr, wptr ); break; case FORMAT_RGBA8|(FORMAT_L8<<8): _convert<3,true,1,false,false,true>( width, height,rptr, wptr ); break; case FORMAT_RGBA8|(FORMAT_LA8<<8): _convert<3,true,1,true,false,true>( width, height,rptr, wptr ); break; case FORMAT_RGBA8|(FORMAT_R8<<8): _convert<3,true,1,false,false,false>( width, height,rptr, wptr ); break; @@ -414,7 +414,7 @@ void Image::convert( Format p_new_format ){ bool gen_mipmaps=mipmaps; - mipmaps=false; +// mipmaps=false; *this=new_img; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 2c6c9dd9ba..524e683738 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1010,6 +1010,48 @@ void RasterizerSceneGLES3::light_instance_mark_visible(RID p_light_instance) { light_instance->last_scene_pass=scene_pass; } + +////////////////////// + +RID RasterizerSceneGLES3::gi_probe_instance_create() { + + GIProbeInstance *gipi = memnew(GIProbeInstance); + + return gi_probe_instance_owner.make_rid(gipi); +} + +void RasterizerSceneGLES3::gi_probe_instance_set_light_data(RID p_probe,RID p_data) { + + GIProbeInstance *gipi = gi_probe_instance_owner.getornull(p_probe); + ERR_FAIL_COND(!gipi); + gipi->data=p_data; + if (p_data.is_valid()) { + RasterizerStorageGLES3::GIProbeData *gipd = storage->gi_probe_data_owner.getornull(p_data); + ERR_FAIL_COND(!gipd); + if (gipd) { + gipi->tex_cache=gipd->tex_id; + gipi->cell_size_cache.x=1.0/gipd->width; + gipi->cell_size_cache.y=1.0/gipd->height; + gipi->cell_size_cache.z=1.0/gipd->depth; + } + } +} +void RasterizerSceneGLES3::gi_probe_instance_set_transform_to_data(RID p_probe,const Transform& p_xform) { + + GIProbeInstance *gipi = gi_probe_instance_owner.getornull(p_probe); + ERR_FAIL_COND(!gipi); + gipi->transform_to_data=p_xform; + +} + +void RasterizerSceneGLES3::gi_probe_instance_set_bounds(RID p_probe,const Vector3& p_bounds) { + + GIProbeInstance *gipi = gi_probe_instance_owner.getornull(p_probe); + ERR_FAIL_COND(!gipi); + gipi->bounds=p_bounds; + +} + //////////////////////////// //////////////////////////// //////////////////////////// @@ -1438,7 +1480,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } -void RasterizerSceneGLES3::_setup_light(RenderList::Element *e) { +void RasterizerSceneGLES3::_setup_light(RenderList::Element *e,const Transform& p_view_transform) { int omni_indices[16]; int omni_count=0; @@ -1509,7 +1551,33 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e) { glUniform1iv(state.scene_shader.get_uniform(SceneShaderGLES3::REFLECTION_INDICES),reflection_count,reflection_indices); } + int gi_probe_count = e->instance->gi_probe_instances.size(); + if (gi_probe_count) { + const RID * ridp = e->instance->gi_probe_instances.ptr(); + GIProbeInstance *gipi = gi_probe_instance_owner.getptr(ridp[0]); + + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-6); + glBindTexture(GL_TEXTURE_3D,gipi->tex_cache); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_XFORM1, gipi->transform_to_data * p_view_transform); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BOUNDS1, gipi->bounds); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_CELL_SIZE1, gipi->cell_size_cache); + if (gi_probe_count>1) { + + GIProbeInstance *gipi2 = gi_probe_instance_owner.getptr(ridp[1]); + + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-7); + glBindTexture(GL_TEXTURE_3D,gipi2->tex_cache); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_XFORM2, gipi2->transform_to_data * p_view_transform); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BOUNDS2, gipi2->bounds); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_CELL_SIZE2, gipi2->cell_size_cache); + + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE2_ENABLED, true ); + } else { + + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE2_ENABLED, false ); + } + } } @@ -1672,11 +1740,15 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.scene_shader.set_conditional(SceneShaderGLES3::LIGHT_USE_PSSM_BLEND,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES,false); //state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,true); } else { + + state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES,e->instance->gi_probe_instances.size()>0); + state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING,!p_directional_add); state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL,false); @@ -1711,9 +1783,12 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } + + rebind=true; } + if (p_alpha_pass || p_directional_add) { int desired_blend_mode; if (p_directional_add) { @@ -1794,7 +1869,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e } if (!(e->sort_key&RenderList::SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) { - _setup_light(e); + _setup_light(e,p_view_transform); + } @@ -1837,6 +1913,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5,false); state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13,false); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_GI_PROBES,false); } @@ -1950,6 +2027,10 @@ void RasterizerSceneGLES3::_add_geometry( RasterizerStorageGLES3::Geometry* p_g copymem(oe,e,sizeof(RenderList::Element)); } + + if (e->instance->gi_probe_instances.size()) { + e->sort_key|=RenderList::SORT_KEY_GI_PROBES_FLAG; + } } //if (e->geometry->type==RasterizerStorageGLES3::Geometry::GEOMETRY_MULTISURFACE) diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 78e8b3e477..5eb2be1cc2 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -526,6 +526,25 @@ public: virtual void light_instance_set_shadow_transform(RID p_light_instance,const CameraMatrix& p_projection,const Transform& p_transform,float p_far,float p_split,int p_pass); virtual void light_instance_mark_visible(RID p_light_instance); + /* REFLECTION INSTANCE */ + + struct GIProbeInstance : public RID_Data { + RID data; + GLuint tex_cache; + Vector3 cell_size_cache; + Vector3 bounds; + Transform transform_to_data; + }; + + + + mutable RID_Owner gi_probe_instance_owner; + + virtual RID gi_probe_instance_create(); + virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_data); + virtual void gi_probe_instance_set_transform_to_data(RID p_probe,const Transform& p_xform); + virtual void gi_probe_instance_set_bounds(RID p_probe,const Vector3& p_bounds); + /* RENDER LIST */ struct RenderList { @@ -541,8 +560,9 @@ public: SORT_KEY_DEPTH_LAYER_SHIFT=60, SORT_KEY_UNSHADED_FLAG=uint64_t(1)<<59, SORT_KEY_NO_DIRECTIONAL_FLAG=uint64_t(1)<<58, - SORT_KEY_SHADING_SHIFT=58, - SORT_KEY_SHADING_MASK=3, + SORT_KEY_GI_PROBES_FLAG=uint64_t(1)<<57, + SORT_KEY_SHADING_SHIFT=57, + SORT_KEY_SHADING_MASK=7, SORT_KEY_MATERIAL_INDEX_SHIFT=40, SORT_KEY_GEOMETRY_INDEX_SHIFT=20, SORT_KEY_GEOMETRY_TYPE_SHIFT=15, @@ -669,7 +689,7 @@ public: _FORCE_INLINE_ void _setup_transform(InstanceBase *p_instance,const Transform& p_view_transform,const CameraMatrix& p_projection); _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); - _FORCE_INLINE_ void _setup_light(RenderList::Element *e); + _FORCE_INLINE_ void _setup_light(RenderList::Element *e,const Transform& p_view_transform); void _render_list(RenderList::Element **p_elements, int p_element_count, const Transform& p_view_transform, const CameraMatrix& p_projection, GLuint p_base_env, bool p_reverse_cull, bool p_alpha_pass, bool p_shadow, bool p_directional_add, bool p_directional_shadows); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index cfa50f6100..8262487f9d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1514,6 +1514,7 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { p_shader->valid=true; p_shader->version++; + } void RasterizerStorageGLES3::update_dirty_shaders() { @@ -3600,16 +3601,15 @@ void RasterizerStorageGLES3::multimesh_instance_set_color(RID p_multimesh,int p_ ERR_FAIL_COND(multimesh->color_format==VS::MULTIMESH_COLOR_NONE); int stride = multimesh->color_floats+multimesh->xform_floats; - float *dataptr=&multimesh->data[stride*p_index+multimesh->color_floats]; + float *dataptr=&multimesh->data[stride*p_index+multimesh->xform_floats]; if (multimesh->color_format==VS::MULTIMESH_COLOR_8BIT) { - union { - uint32_t colu; - float colf; - } cu; - cu.colu=p_color.to_32(); - dataptr[ 0]=cu.colf; + uint8_t *data8=(uint8_t*)dataptr; + data8[0]=CLAMP(p_color.r*255.0,0,255); + data8[1]=CLAMP(p_color.g*255.0,0,255); + data8[2]=CLAMP(p_color.b*255.0,0,255); + data8[3]=CLAMP(p_color.a*255.0,0,255); } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { dataptr[ 0]=p_color.r; @@ -3701,7 +3701,7 @@ Color RasterizerStorageGLES3::multimesh_instance_get_color(RID p_multimesh,int p float colf; } cu; - return Color::hex(cu.colu); + return Color::hex(BSWAP32(cu.colu)); } else if (multimesh->color_format==VS::MULTIMESH_COLOR_FLOAT) { Color c; @@ -4385,6 +4385,15 @@ float RasterizerStorageGLES3::light_get_param(RID p_light,VS::LightParam p_param return light->param[p_param]; } +Color RasterizerStorageGLES3::light_get_color(RID p_light) { + + const Light * light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light,Color()); + + return light->color; + +} + bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const { const Light * light = light_owner.getornull(p_light); @@ -4668,6 +4677,261 @@ void RasterizerStorageGLES3::portal_set_disabled_color(RID p_portal, const Color } +RID RasterizerStorageGLES3::gi_probe_create() { + + GIProbe *gip = memnew( GIProbe ); + + gip->data_width=0; + gip->data_height=0; + gip->data_depth=0; + gip->bounds=AABB(Vector3(),Vector3(1,1,1)); + gip->dynamic_range=1.0; + gip->version=1; + gip->cell_size=1.0; + + return gi_probe_owner.make_rid(gip); +} + +void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe,const AABB& p_bounds){ + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->bounds=p_bounds; + gip->version++; + gip->instance_change_notify(); +} +AABB RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,AABB()); + + return gip->bounds; +} + +void RasterizerStorageGLES3::gi_probe_set_cell_size(RID p_probe,float p_size) { + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->cell_size=p_size; + gip->version++; + gip->instance_change_notify(); +} + +float RasterizerStorageGLES3::gi_probe_get_cell_size(RID p_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->cell_size; + +} + +void RasterizerStorageGLES3::gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform) { + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->to_cell=p_xform; +} + +Transform RasterizerStorageGLES3::gi_probe_get_to_cell_xform(RID p_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,Transform()); + + return gip->to_cell; + +} + + + +void RasterizerStorageGLES3::gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data){ + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->dynamic_data=p_data; + gip->version++; + gip->instance_change_notify(); + +} +DVector RasterizerStorageGLES3::gi_probe_get_dynamic_data(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,DVector()); + + return gip->dynamic_data; +} + +void RasterizerStorageGLES3::gi_probe_set_dynamic_range(RID p_probe,float p_range){ + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->dynamic_range=p_range; + +} +float RasterizerStorageGLES3::gi_probe_get_dynamic_range(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->dynamic_range; +} + + +void RasterizerStorageGLES3::gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth) { + + GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); + ERR_FAIL_COND(!gip); + + if (gip->data.is_valid()) { + free(gip->data); + } + + gip->data=RID(); + //this is platform dependent + + gip->version++; + gip->instance_change_notify(); + +} +DVector RasterizerStorageGLES3::gi_probe_get_static_data(RID p_gi_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); + ERR_FAIL_COND_V(!gip,DVector()); + + //platform dependent + return DVector(); +} +VS::GIProbeDataFormat RasterizerStorageGLES3::gi_probe_get_static_data_format(RID p_gi_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); + ERR_FAIL_COND_V(!gip,VS::GI_PROBE_DATA_RGBA8); + + return gip->data_format; +} +int RasterizerStorageGLES3::gi_probe_get_static_data_width(RID p_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->data_width; +} +int RasterizerStorageGLES3::gi_probe_get_static_data_height(RID p_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + return gip->data_height; +} +int RasterizerStorageGLES3::gi_probe_get_static_data_depth(RID p_probe) const { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + return gip->data_depth; +} + +RID RasterizerStorageGLES3::gi_probe_get_data(RID p_probe) { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,RID()); + + return gip->data; +} + +uint32_t RasterizerStorageGLES3::gi_probe_get_version(RID p_probe) { + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->version; +} + +RID RasterizerStorageGLES3::gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth) { + + GIProbeData *gipd = memnew( GIProbeData ); + + gipd->width=p_width; + gipd->height=p_height; + gipd->depth=p_depth; + + glActiveTexture(GL_TEXTURE0); + glGenTextures(1,&gipd->tex_id); + glBindTexture(GL_TEXTURE_3D,gipd->tex_id); + + int level=0; + + print_line("dyndata create"); + while(true) { + + Vector data; + data.resize(p_width*p_height*p_depth*4); + + + for(int i=0;i>=1; + p_height>>=1; + p_depth>>=1; + level++; + } + + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, level); + + gipd->levels=level+1; + + return gi_probe_data_owner.make_rid(gipd); +} + +void RasterizerStorageGLES3::gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) { + + GIProbeData *gipd = gi_probe_data_owner.getornull(p_gi_probe_data); + ERR_FAIL_COND(!gipd); +/* + Vector data; + data.resize((gipd->width>>p_mipmap)*(gipd->height>>p_mipmap)*(gipd->depth>>p_mipmap)*4); + + for(int i=0;i<(gipd->width>>p_mipmap);i++) { + for(int j=0;j<(gipd->height>>p_mipmap);j++) { + for(int k=0;k<(gipd->depth>>p_mipmap);k++) { + + int ofs = (k*(gipd->height>>p_mipmap)*(gipd->width>>p_mipmap)) + j *(gipd->width>>p_mipmap) + i; + ofs*=4; + data[ofs+0]=i*0xFF/(gipd->width>>p_mipmap); + data[ofs+1]=j*0xFF/(gipd->height>>p_mipmap); + data[ofs+2]=k*0xFF/(gipd->depth>>p_mipmap); + data[ofs+3]=0xFF; + } + } + } +*/ + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_3D,gipd->tex_id); + glTexSubImage3D(GL_TEXTURE_3D,p_mipmap,0,0,p_depth_slice,gipd->width>>p_mipmap,gipd->height>>p_mipmap,p_slice_count,GL_RGBA,GL_UNSIGNED_BYTE,p_data); + //glTexImage3D(GL_TEXTURE_3D,p_mipmap,GL_RGBA8,gipd->width>>p_mipmap,gipd->height>>p_mipmap,gipd->depth>>p_mipmap,0,GL_RGBA,GL_UNSIGNED_BYTE,p_data); + //glTexImage3D(GL_TEXTURE_3D,p_mipmap,GL_RGBA8,gipd->width>>p_mipmap,gipd->height>>p_mipmap,gipd->depth>>p_mipmap,0,GL_RGBA,GL_UNSIGNED_BYTE,data.ptr()); + print_line("update rgba8 "+itos(p_mipmap)); +} + + + + void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance) { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -4709,6 +4973,10 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base,RasterizerScene: inst = light_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_GI_PROBE: { + inst = gi_probe_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; default: { if (!inst) { ERR_FAIL(); @@ -4744,6 +5012,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce inst = light_owner.getornull(p_base); ERR_FAIL_COND(!inst); } break; + case VS::INSTANCE_GI_PROBE: { + inst = gi_probe_owner.getornull(p_base); + ERR_FAIL_COND(!inst); + } break; default: { if (!inst) { @@ -5395,19 +5667,27 @@ VS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { return VS::INSTANCE_MESH; } + if (multimesh_owner.owns(p_rid)) { return VS::INSTANCE_MULTIMESH; } + if (immediate_owner.owns(p_rid)) { return VS::INSTANCE_IMMEDIATE; } + if (light_owner.owns(p_rid)) { return VS::INSTANCE_LIGHT; } + if (reflection_probe_owner.owns(p_rid)) { return VS::INSTANCE_REFLECTION_PROBE; } + if (gi_probe_owner.owns(p_rid)) { + return VS::INSTANCE_GI_PROBE; + } + return VS::INSTANCE_NONE; } @@ -5561,6 +5841,27 @@ bool RasterizerStorageGLES3::free(RID p_rid){ reflection_probe_owner.free(p_rid); memdelete(reflection_probe); + } else if (gi_probe_owner.owns(p_rid)) { + + // delete the texture + GIProbe *gi_probe = gi_probe_owner.get(p_rid); + + if (gi_probe->data.is_valid()) { + free(gi_probe->data); + } + + gi_probe_owner.free(p_rid); + memdelete(gi_probe); + } else if (gi_probe_data_owner.owns(p_rid)) { + + // delete the texture + GIProbeData *gi_probe_data = gi_probe_data_owner.get(p_rid); + + print_line("dyndata delete"); + glDeleteTextures(1,&gi_probe_data->tex_id); + gi_probe_owner.free(p_rid); + memdelete(gi_probe_data); + } else if (canvas_occluder_owner.owns(p_rid)) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 7802b28158..b81c3df78a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -799,6 +799,7 @@ public: virtual VS::LightType light_get_type(RID p_light) const; virtual float light_get_param(RID p_light,VS::LightParam p_param); + virtual Color light_get_color(RID p_light); virtual AABB light_get_aabb(RID p_light) const; virtual uint64_t light_get_version(RID p_light) const; @@ -868,6 +869,84 @@ public: virtual void portal_set_disable_distance(RID p_portal, float p_distance); virtual void portal_set_disabled_color(RID p_portal, const Color& p_color); + + + + + + + /* GI PROBE API */ + + struct GIProbe : public Instantiable { + + + AABB bounds; + Transform to_cell; + float cell_size; + + float dynamic_range; + + uint32_t version; + + DVector dynamic_data; + + RID data; + int data_width; + int data_height; + int data_depth; + VS::GIProbeDataFormat data_format; + + + }; + + mutable RID_Owner gi_probe_owner; + + virtual RID gi_probe_create(); + + virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds); + virtual AABB gi_probe_get_bounds(RID p_probe) const; + + virtual void gi_probe_set_cell_size(RID p_probe, float p_size); + virtual float gi_probe_get_cell_size(RID p_probe) const; + + virtual void gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform); + virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const; + + virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data); + virtual DVector gi_probe_get_dynamic_data(RID p_probe) const; + + virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range); + virtual float gi_probe_get_dynamic_range(RID p_probe) const; + + + virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth); + virtual DVector gi_probe_get_static_data(RID p_gi_probe) const; + virtual VS::GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const; + virtual int gi_probe_get_static_data_width(RID p_probe) const; + virtual int gi_probe_get_static_data_height(RID p_probe) const; + virtual int gi_probe_get_static_data_depth(RID p_probe) const; + + virtual RID gi_probe_get_data(RID p_probe); //get data in case this is static + virtual uint32_t gi_probe_get_version(RID p_probe); + + struct GIProbeData : public RID_Data { + + int width; + int height; + int depth; + int levels; + GLuint tex_id; + + GIProbeData() { + } + }; + + mutable RID_Owner gi_probe_data_owner; + + virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth); + virtual void gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data); + + virtual void instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); virtual void instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 61e9e37d2b..bf561a7e46 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -838,6 +838,131 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta } } +#ifdef USE_GI_PROBES + +uniform mediump sampler3D gi_probe1; //texunit:-6 +uniform highp mat4 gi_probe_xform1; +uniform highp vec3 gi_probe_bounds1; +uniform highp vec3 gi_probe_cell_size1; + +uniform mediump sampler3D gi_probe2; //texunit:-7 +uniform highp mat4 gi_probe_xform2; +uniform highp vec3 gi_probe_bounds2; +uniform highp vec3 gi_probe_cell_size2; +uniform bool gi_probe2_enabled; + +vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance) { + + + float dist = dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0; + float alpha=0.0; + vec4 color = vec4(0.0); + + while(dist < max_distance && alpha < 0.95) { + float diameter = max(1.0, 2.0 * tan_half_angle * dist); + vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) ); + float a = (1.0 - alpha); + color.rgb += a * scolor.rgb; + alpha += a * scolor.a; + dist += diameter * 0.5; + } + + return color.rgb; +} + +void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, mat3 normal_mtx,vec3 ref_vec, float roughness, out vec4 out_spec, out vec4 out_diff) { + + + + vec3 probe_pos = (probe_xform * vec4(pos,1.0)).xyz; + vec3 ref_pos = (probe_xform * vec4(pos+ref_vec,1.0)).xyz; + + ref_vec = normalize(ref_pos - probe_pos); + +/* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0); + out_diff.a = 1.0; + return;*/ + //out_diff = vec4(textureLod(probe,probe_pos*cell_size,3.0).rgb,1.0); + //return; + + if (any(bvec2(any(lessThan(probe_pos,vec3(0.0))),any(greaterThan(probe_pos,bounds))))) + return; + + vec3 blendv = probe_pos/bounds * 2.0 - 1.0; + float blend = 1.001-max(blendv.x,max(blendv.y,blendv.z)); + blend=1.0; + + //radiance + +#define MAX_CONE_DIRS 6 + vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( + vec3(0, 0, 1), + vec3(0.866025, 0, 0.5), + vec3(0.267617, 0.823639, 0.5), + vec3(-0.700629, 0.509037, 0.5), + vec3(-0.700629, -0.509037, 0.5), + vec3(0.267617, -0.823639, 0.5) + ); + + float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15); + + float max_distance = length(bounds); + vec3 light=vec3(0.0); + for(int i=0;i0.0) { + diff_accum.rgb/=diff_accum.a; + } + + if (spec_accum.a>0.0) { + spec_accum.rgb/=spec_accum.a; + } + + out_specular+=spec_accum.rgb; + out_ambient+=diff_accum.rgb; + +} + +#endif + + void main() { #ifdef RENDER_SHADOW_DUAL_PARABOLOID @@ -1161,21 +1286,27 @@ FRAGMENT_SHADER_CODE #endif //#USE_LIGHT_DIRECTIONAL +#ifdef USE_GI_PROBES + gi_probes_compute(vertex,normal,roughness,specular,specular_light,ambient_light); +#endif + #ifdef USE_FORWARD_LIGHTING highp vec4 reflection_accum = vec4(0.0,0.0,0.0,0.0); highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0); + + for(int i=0;i0.0) { - specular_light=reflection_accum.rgb/reflection_accum.a; + specular_light+=reflection_accum.rgb/reflection_accum.a; } if (ambient_accum.a>0.0) { - ambient_light=ambient_accum.rgb/ambient_accum.a; + ambient_light+=ambient_accum.rgb/ambient_accum.a; } for(int i=0;imax) max=x1;\ + if(x2max) max=x2; + +static bool planeBoxOverlap(Vector3 normal,float d, Vector3 maxbox) +{ + int q; + Vector3 vmin,vmax; + for(q=0;q<=2;q++) + { + if(normal[q]>0.0f) + { + vmin[q]=-maxbox[q]; + vmax[q]=maxbox[q]; + } + else + { + vmin[q]=maxbox[q]; + vmax[q]=-maxbox[q]; + } + } + if(normal.dot(vmin)+d>0.0f) return false; + if(normal.dot(vmax)+d>=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(p0rad || 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(p0rad || 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(p0rad || 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(p0rad || 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(p2rad || 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(p0rad || max<-rad) return false; + +static bool fast_tri_box_overlap(const Vector3& boxcenter,const Vector3 boxhalfsize,const Vector3 *triverts) { + + /* 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,d,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=triverts[0]-boxcenter; + v1=triverts[1]-boxcenter; + v2=triverts[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 = Math::abs(e0.x); + fey = Math::abs(e0.y); + fez = Math::abs(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 = Math::abs(e1.x); + fey = Math::abs(e1.y); + fez = Math::abs(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 = Math::abs(e2.x); + fey = Math::abs(e2.y); + fez = Math::abs(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=e0.cross(e1); + d=-normal.dot(v0); /* plane eq: normal.x+d=0 */ + if(!planeBoxOverlap(normal,d,boxhalfsize)) return false; + + return true; /* box and triangle overlaps */ +} + + +Vector BakedLight::_get_bake_texture(Image &p_image,const Color& p_color) { + + Vector ret; + + if (p_image.empty()) { + + ret.resize(bake_texture_size*bake_texture_size); + for(int i=0;i::Read r = p_image.get_data().read(); + ret.resize(bake_texture_size*bake_texture_size); + + for(int i=0;i p_material) { + + //this way of obtaining materials is inaccurate and also does not support some compressed formats very well + Ref mat = p_material; + + Ref material = mat; //hack for now + + if (material_cache.has(material)) { + return material_cache[material]; + } + + MaterialCache mc; + + if (mat.is_valid()) { + + + Ref albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO); + + Image img_albedo; + if (albedo_tex.is_valid()) { + + img_albedo = albedo_tex->get_data(); + } + + mc.albedo=_get_bake_texture(img_albedo,mat->get_albedo()); + + Ref emission_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_EMISSION); + + Color emission_col = mat->get_emission(); + emission_col.r*=mat->get_emission_energy(); + emission_col.g*=mat->get_emission_energy(); + emission_col.b*=mat->get_emission_energy(); + + Image img_emission; + + if (emission_tex.is_valid()) { + + img_emission = emission_tex->get_data(); + } + + mc.emission=_get_bake_texture(img_emission,emission_col); + + } else { + Image empty; + + mc.albedo=_get_bake_texture(empty,Color(0.7,0.7,0.7)); + mc.emission=_get_bake_texture(empty,Color(0,0,0)); + + + } + + material_cache[p_material]=mc; + return mc; + + +} + + + +static _FORCE_INLINE_ Vector2 get_uv(const Vector3& p_pos, const Vector3 *p_vtx, const Vector2* p_uv) { + + if (p_pos.distance_squared_to(p_vtx[0])closest_dot) { + closest_axis=i; + closest_dot=dot; + } + } + + Vector3 axis; + axis[closest_axis]=1.0; + Vector3 t1; + t1[(closest_axis+1)%3]=1.0; + Vector3 t2; + t2[(closest_axis+2)%3]=1.0; + + t1*=p_aabb.size[(closest_axis+1)%3]/float(color_scan_cell_width); + t2*=p_aabb.size[(closest_axis+2)%3]/float(color_scan_cell_width); + + Color albedo_accum; + Color emission_accum; + float alpha=0.0; + + //map to a grid average in the best axis for this face + for(int i=0;iCMP_EPSILON) { + bake_cells_write[p_idx].used_sides|=(1<::Write(); + bake_cells.resize(1<=size || y<0 || y>=size || z<0 || z>=size) { + //neighbour is out, can't use it + bake_cells_write[p_idx].used_sides&=~(1<= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } + + neighbour = bc->childs[child]; + if (neighbour==CHILD_EMPTY) { + break; + } + + half>>=1; + } + + if (neighbour!=CHILD_EMPTY) { + bake_cells_write[p_idx].used_sides&=~(1<> (p_level+1); + for(int i=0;i<8;i++) { + + uint32_t child = bake_cells_write[p_idx].childs[i]; + + if (child==CHILD_EMPTY) + continue; + + + int nx=p_x; + int ny=p_y; + int nz=p_z; + + if (i&1) + nx+=half; + if (i&2) + ny+=half; + if (i&4) + nz+=half; + + _fixup_plot(child,p_level+1,nx,ny,nz); + alpha_average+=bake_cells_write[child].alpha; + } + + bake_cells_write[p_idx].alpha=alpha_average/8.0; + bake_cells_write[p_idx].light[0]=0; + bake_cells_write[p_idx].light[1]=0; + bake_cells_write[p_idx].light[2]=0; + bake_cells_write[p_idx].albedo[0]=0; + bake_cells_write[p_idx].albedo[1]=0; + bake_cells_write[p_idx].albedo[2]=0; + + } + + //clean up light + bake_cells_write[p_idx].light_pass=0; + //find neighbours + + + +} + + +void BakedLight::_bake_add_mesh(const Transform& p_xform,Ref& p_mesh) { + + + for(int i=0;iget_surface_count();i++) { + + if (p_mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) + continue; //only triangles + + MaterialCache material = _get_material_cache(p_mesh->surface_get_material(i)); + + Array a = p_mesh->surface_get_arrays(i); + + + DVector vertices = a[Mesh::ARRAY_VERTEX]; + DVector::Read vr=vertices.read(); + DVector uv = a[Mesh::ARRAY_TEX_UV]; + DVector::Read uvr; + DVector index = a[Mesh::ARRAY_INDEX]; + + bool read_uv=false; + + if (uv.size()) { + + uvr=uv.read(); + read_uv=true; + } + + if (index.size()) { + + int facecount = index.size()/3; + DVector::Read ir=index.read(); + + for(int j=0;j& p_mesh,bool &first) { + + for(int i=0;iget_surface_count();i++) { + + if (p_mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) + continue; //only triangles + + Array a = p_mesh->surface_get_arrays(i); + DVector vertices = a[Mesh::ARRAY_VERTEX]; + int vc = vertices.size(); + DVector::Read vr=vertices.read(); + + if (first) { + bounds.pos=p_xform.xform(vr[0]); + first=false; + } + + + for(int j=0;j::Element *E=geometries.front();E;E=E->next()) { + + print_line("aabb geom "+itos(count)+"/"+itos(geometries.size())); + + GeometryInstance *geom = E->get(); + + if (geom->cast_to()) { + + MeshInstance *mesh_instance = geom->cast_to(); + Ref mesh = mesh_instance->get_mesh(); + if (mesh.is_valid()) { + + _bake_add_to_aabb(geom->get_relative_transform(this),mesh,aabb_first); + } + } + count++; + } + + print_line("AABB: "+bounds); + ERR_FAIL_COND(aabb_first); + + bake_cells_write = bake_cells.write(); + count=0; + + for (Set::Element *E=geometries.front();E;E=E->next()) { + + GeometryInstance *geom = E->get(); + print_line("plot geom "+itos(count)+"/"+itos(geometries.size())); + + if (geom->cast_to()) { + + MeshInstance *mesh_instance = geom->cast_to(); + Ref mesh = mesh_instance->get_mesh(); + if (mesh.is_valid()) { + + _bake_add_mesh(geom->get_relative_transform(this),mesh); + } + } + + count++; + } + + + _fixup_plot(0, 0,0,0,0); + + + bake_cells_write=DVector::Write(); + + bake_cells.resize(bake_cells_used); + + + + print_line("total bake cells used: "+itos(bake_cells_used)); + for(int i=0;i=0 && light_pass!=bake_cells_write[idx].light_pass) { + //hit something, add or remove light to it + + Color albedo = Color(bake_cells_write[idx].albedo[0],bake_cells_write[idx].albedo[1],bake_cells_write[idx].albedo[2]); + bake_cells_write[idx].light[0]+=albedo.r*p_color.r*p_sign; + bake_cells_write[idx].light[1]+=albedo.g*p_color.g*p_sign; + bake_cells_write[idx].light[2]+=albedo.b*p_color.b*p_sign; + bake_cells_write[idx].light_pass=light_pass; + + } + + + } else { + + int half = cells_per_axis >> (p_level+1); + + //go down + for(int i=0;i<8;i++) { + + uint32_t child = bake_cells_write[p_idx].childs[i]; + + if (child==CHILD_EMPTY) + continue; + + int nx=p_x; + int ny=p_y; + int nz=p_z; + + if (i&1) + nx+=half; + if (i&2) + ny+=half; + if (i&4) + nz+=half; + + + _bake_directional(child,p_level+1,nx,ny,nz,p_dir,p_color,p_sign); + } + } +} + + + + +void BakedLight::_bake_light(Light* p_light) { + + if (p_light->cast_to()) { + + DirectionalLight * dl = p_light->cast_to(); + + Transform rel_xf = dl->get_relative_transform(this); + + Vector3 light_dir = -rel_xf.basis.get_axis(2); + + Color color = dl->get_color(); + float nrg = dl->get_param(Light::PARAM_ENERGY);; + color.r*=nrg; + color.g*=nrg; + color.b*=nrg; + + light_pass++; + _bake_directional(0,0,0,0,0,light_dir,color,1); + + } +} + + +void BakedLight::_upscale_light(int p_idx,int p_level) { + + + //go down + + float light_accum[3]={0,0,0}; + float alpha_accum=0; + + bool check_children = p_level < (cell_subdiv -2); + + for(int i=0;i<8;i++) { + + uint32_t child = bake_cells_write[p_idx].childs[i]; + + if (child==CHILD_EMPTY) + continue; + + if (check_children) { + _upscale_light(child,p_level+1); + } + + light_accum[0]+=bake_cells_write[child].light[0]; + light_accum[1]+=bake_cells_write[child].light[1]; + light_accum[2]+=bake_cells_write[child].light[2]; + alpha_accum+=bake_cells_write[child].alpha; + + } + + bake_cells_write[p_idx].light[0]=light_accum[0]/8.0; + bake_cells_write[p_idx].light[1]=light_accum[1]/8.0; + bake_cells_write[p_idx].light[2]=light_accum[2]/8.0; + bake_cells_write[p_idx].alpha=alpha_accum/8.0; + +} + + +void BakedLight::bake_lights() { + + ERR_FAIL_COND(bake_cells.size()==0); + + bake_cells_write = bake_cells.write(); + + for(Set::Element *E=lights.front();E;E=E->next()) { + + _bake_light(E->get()); + } + + + _upscale_light(0,0); + + bake_cells_write=DVector::Write(); + +} + + + +Color BakedLight::_cone_trace(const Vector3& p_from, const Vector3& p_dir, float p_half_angle) { + + + Color color(0,0,0,0); + float tha = Math::tan(p_half_angle);//tan half angle + Vector3 from =(p_from-bounds.pos)/bounds.size; //convert to 0..1 + from/=cells_per_axis; //convert to voxels of size 1 + Vector3 dir = (p_dir/bounds.size).normalized(); + + float max_dist = Vector3(cells_per_axis,cells_per_axis,cells_per_axis).length(); + + float dist = 1.0; + // self occlusion in flat surfaces + + float alpha=0; + + + while(dist < max_dist && alpha < 0.95) { + +#if 0 + // smallest sample diameter possible is the voxel size + float diameter = MAX(1.0, 2.0 * tha * dist); + float lod = log2(diameter); + + Vector3 sample_pos = from + dist * dir; + + + Color samples_base[2][8]={{Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0)}, + {Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0),Color(0,0,0,0)}}; + + float levelf = Math::fposmod(lod,1.0); + float fx = Math::fposmod(sample_pos.x,1.0); + float fy = Math::fposmod(sample_pos.y,1.0); + float fz = Math::fposmod(sample_pos.z,1.0); + + for(int l=0;l<2;l++){ + + int bx = Math::floor(sample_pos.x); + int by = Math::floor(sample_pos.y); + int bz = Math::floor(sample_pos.z); + + int lodn=int(Math::floor(lod))-l; + + bx>>=lodn; + by>>=lodn; + bz>>=lodn; + + int limit = MAX(0,cell_subdiv-lodn-1); + + for(int c=0;c<8;c++) { + + int x = bx; + int y = by; + int z = bz; + + if (c&1) { + x+=1; + } + if (c&2) { + y+=1; + } + if (c&4) { + z+=1; + } + + int ofs_x=0; + int ofs_y=0; + int ofs_z=0; + int size = cells_per_axis>>lodn; + int half=size/2; + + bool outside=x<0 || x>=size || y<0 || y>=size || z<0 || z>=size; + + if (outside) + continue; + + + uint32_t cell=0; + + for(int i=0;i= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } + + cell = bc->childs[child]; + if (cell==CHILD_EMPTY) + break; + + half>>=1; + } + + if (cell!=CHILD_EMPTY) { + + samples_base[l][c].r=bake_cells_write[cell].light[0]; + samples_base[l][c].g=bake_cells_write[cell].light[1]; + samples_base[l][c].b=bake_cells_write[cell].light[2]; + samples_base[l][c].a=bake_cells_write[cell].alpha; + } + + } + + + } + + Color m0x0 = samples_base[0][0].linear_interpolate(samples_base[0][1],fx); + Color m0x1 = samples_base[0][2].linear_interpolate(samples_base[0][3],fx); + Color m0y0 = m0x0.linear_interpolate(m0x1,fy); + m0x0 = samples_base[0][4].linear_interpolate(samples_base[0][5],fx); + m0x1 = samples_base[0][6].linear_interpolate(samples_base[0][7],fx); + Color m0y1 = m0x0.linear_interpolate(m0x1,fy); + Color m0z = m0y0.linear_interpolate(m0y1,fz); + + Color m1x0 = samples_base[1][0].linear_interpolate(samples_base[1][1],fx); + Color m1x1 = samples_base[1][2].linear_interpolate(samples_base[1][3],fx); + Color m1y0 = m1x0.linear_interpolate(m1x1,fy); + m1x0 = samples_base[1][4].linear_interpolate(samples_base[1][5],fx); + m1x1 = samples_base[1][6].linear_interpolate(samples_base[1][7],fx); + Color m1y1 = m1x0.linear_interpolate(m1x1,fy); + Color m1z = m1y0.linear_interpolate(m1y1,fz); + + Color m = m0z.linear_interpolate(m1z,levelf); +#else + float diameter = 1.0; + Vector3 sample_pos = from + dist * dir; + + Color m(0,0,0,0); + { + int x = Math::floor(sample_pos.x); + int y = Math::floor(sample_pos.y); + int z = Math::floor(sample_pos.z); + + int ofs_x=0; + int ofs_y=0; + int ofs_z=0; + int size = cells_per_axis; + int half=size/2; + + bool outside=x<0 || x>=size || y<0 || y>=size || z<0 || z>=size; + + if (!outside) { + + + uint32_t cell=0; + + for(int i=0;i= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } + + cell = bc->childs[child]; + if (cell==CHILD_EMPTY) + break; + + half>>=1; + } + + if (cell!=CHILD_EMPTY) { + + m.r=bake_cells_write[cell].light[0]; + m.g=bake_cells_write[cell].light[1]; + m.b=bake_cells_write[cell].light[2]; + m.a=bake_cells_write[cell].alpha; + } + } + } + +#endif + // front-to-back compositing + float a = (1.0 - alpha); + color.r += a * m.r; + color.g += a * m.g; + color.b += a * m.b; + alpha += a * m.a; + //occlusion += a * voxelColor.a; + //occlusion += (a * voxelColor.a) / (1.0 + 0.03 * diameter); + dist += diameter * 0.5; // smoother + //dist += diameter; // faster but misses more voxels + } + + return color; +} + + + +void BakedLight::_bake_radiance(int p_idx, int p_level, int p_x,int p_y,int p_z) { + + + + + if (p_level==cell_subdiv-1) { + + const int NUM_CONES = 6; + Vector3 cone_directions[6] = { + Vector3(1, 0, 0), + Vector3(0.5, 0.866025, 0), + Vector3( 0.5, 0.267617, 0.823639), + Vector3( 0.5, -0.700629, 0.509037), + Vector3( 0.5, -0.700629, -0.509037), + Vector3( 0.5, 0.267617, -0.823639) + }; + float coneWeights[6] = {0.25, 0.15, 0.15, 0.15, 0.15, 0.15}; + + Vector3 pos = (Vector3(p_x,p_y,p_z)/float(cells_per_axis))*bounds.size+bounds.pos; + Vector3 voxel_size = bounds.size/float(cells_per_axis); + pos+=voxel_size*0.5; + + Color accum; + + bake_cells_write[p_idx].light[0]=0; + bake_cells_write[p_idx].light[1]=0; + bake_cells_write[p_idx].light[2]=0; + + int freepix=0; + for(int i=0;i<6;i++) { + + if (!(bake_cells_write[p_idx].used_sides&(1<> (p_level+1); + + //go down + for(int i=0;i<8;i++) { + + uint32_t child = bake_cells_write[p_idx].childs[i]; + + if (child==CHILD_EMPTY) + continue; + + int nx=p_x; + int ny=p_y; + int nz=p_z; + + if (i&1) + nx+=half; + if (i&2) + ny+=half; + if (i&4) + nz+=half; + + + _bake_radiance(child,p_level+1,nx,ny,nz); + } + } +} + +void BakedLight::bake_radiance() { + + ERR_FAIL_COND(bake_cells.size()==0); + + bake_cells_write = bake_cells.write(); + + _bake_radiance(0,0,0,0,0); + + bake_cells_write=DVector::Write(); -RID BakedLightInstance::get_baked_light_instance() const { +} +int BakedLight::_find_cell(int x,int y, int z) { + + + uint32_t cell=0; + + int ofs_x=0; + int ofs_y=0; + int ofs_z=0; + int size = cells_per_axis; + int half=size/2; + + if (x<0 || x>=size) + return -1; + if (y<0 || y>=size) + return -1; + if (z<0 || z>=size) + return -1; + + for(int i=0;i= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } - if (baked_light.is_null()) - return RID(); - else - return get_instance(); + cell = bc->childs[child]; + if (cell==CHILD_EMPTY) + return -1; + + half>>=1; + } + + return cell; } -void BakedLightInstance::set_baked_light(const Ref& p_baked_light) { - baked_light=p_baked_light; +int BakedLight::_plot_ray(const Vector3& p_from, const Vector3& p_to) { + + Vector3 from = (p_from - bounds.pos) / bounds.size; + Vector3 to = (p_to - bounds.pos) / bounds.size; - RID base_rid; + int x1 = Math::floor(from.x*cells_per_axis); + int y1 = Math::floor(from.y*cells_per_axis); + int z1 = Math::floor(from.z*cells_per_axis); - if (baked_light.is_valid()) - base_rid=baked_light->get_rid(); - else - base_rid=RID(); + int x2 = Math::floor(to.x*cells_per_axis); + int y2 = Math::floor(to.y*cells_per_axis); + int z2 = Math::floor(to.z*cells_per_axis); - set_base(base_rid); - if (is_inside_world()) { + int i, dx, dy, dz, l, m, n, x_inc, y_inc, z_inc, err_1, err_2, dx2, dy2, dz2; + int point[3]; - emit_signal(SceneStringNames::get_singleton()->baked_light_changed); + point[0] = x1; + point[1] = y1; + point[2] = z1; + dx = x2 - x1; + dy = y2 - y1; + dz = z2 - z1; + x_inc = (dx < 0) ? -1 : 1; + l = ABS(dx); + y_inc = (dy < 0) ? -1 : 1; + m = ABS(dy); + z_inc = (dz < 0) ? -1 : 1; + n = ABS(dz); + dx2 = l << 1; + dy2 = m << 1; + dz2 = n << 1; -// for (List::Element *E=baked_geometry.front();E;E=E->next()) { -// VS::get_singleton()->instance_geometry_set_baked_light(E->get()->get_instance(),baked_light.is_valid()?get_instance():RID()); -// } + if ((l >= m) && (l >= n)) { + err_1 = dy2 - l; + err_2 = dz2 - l; + for (i = 0; i < l; i++) { + int cell = _find_cell(point[0],point[1],point[2]); + if (cell>=0) + return cell; + + if (err_1 > 0) { + point[1] += y_inc; + err_1 -= dx2; + } + if (err_2 > 0) { + point[2] += z_inc; + err_2 -= dx2; + } + err_1 += dy2; + err_2 += dz2; + point[0] += x_inc; + } + } else if ((m >= l) && (m >= n)) { + err_1 = dx2 - m; + err_2 = dz2 - m; + for (i = 0; i < m; i++) { + int cell = _find_cell(point[0],point[1],point[2]); + if (cell>=0) + return cell; + if (err_1 > 0) { + point[0] += x_inc; + err_1 -= dy2; + } + if (err_2 > 0) { + point[2] += z_inc; + err_2 -= dy2; + } + err_1 += dx2; + err_2 += dz2; + point[1] += y_inc; + } + } else { + err_1 = dy2 - n; + err_2 = dx2 - n; + for (i = 0; i < n; i++) { + int cell = _find_cell(point[0],point[1],point[2]); + if (cell>=0) + return cell; + + if (err_1 > 0) { + point[1] += y_inc; + err_1 -= dz2; + } + if (err_2 > 0) { + point[0] += x_inc; + err_2 -= dz2; + } + err_1 += dy2; + err_2 += dx2; + point[2] += z_inc; + } } + return _find_cell(point[0],point[1],point[2]); + +} - update_configuration_warning(); + +void BakedLight::set_cell_subdiv(int p_subdiv) { + + cell_subdiv=p_subdiv; + +// VS::get_singleton()->baked_light_set_subdivision(baked_light,p_subdiv); } -Ref BakedLightInstance::get_baked_light() const{ +int BakedLight::get_cell_subdiv() const { - return baked_light; + return cell_subdiv; } -AABB BakedLightInstance::get_aabb() const { + + +AABB BakedLight::get_aabb() const { return AABB(Vector3(0,0,0),Vector3(1,1,1)); } -DVector BakedLightInstance::get_faces(uint32_t p_usage_flags) const { +DVector BakedLight::get_faces(uint32_t p_usage_flags) const { return DVector(); } -String BakedLightInstance::get_configuration_warning() const { - if (get_baked_light().is_null()) { - return TTR("BakedLightInstance does not contain a BakedLight resource."); - } +String BakedLight::get_configuration_warning() const { return String(); } -void BakedLightInstance::_bind_methods() { +void BakedLight::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,DebugMode p_mode,Ref &p_multimesh,int &idx) { + + + if (p_level==cell_subdiv-1) { + + Vector3 center = p_aabb.pos+p_aabb.size*0.5; + Transform xform; + xform.origin=center; + xform.basis.scale(p_aabb.size*0.5); + p_multimesh->set_instance_transform(idx,xform); + Color col; + switch(p_mode) { + case DEBUG_ALBEDO: { + col=Color(bake_cells_write[p_idx].albedo[0],bake_cells_write[p_idx].albedo[1],bake_cells_write[p_idx].albedo[2]); + } break; + case DEBUG_LIGHT: { + col=Color(bake_cells_write[p_idx].light[0],bake_cells_write[p_idx].light[1],bake_cells_write[p_idx].light[2]); + Color colr=Color(bake_cells_write[p_idx].radiance[0],bake_cells_write[p_idx].radiance[1],bake_cells_write[p_idx].radiance[2]); + col.r+=colr.r; + col.g+=colr.g; + col.b+=colr.b; + } break; + + } + p_multimesh->set_instance_color(idx,col); + + + idx++; + + } else { + + for(int i=0;i<8;i++) { + + if (bake_cells_write[p_idx].childs[i]==CHILD_EMPTY) + continue; + + AABB aabb=p_aabb; + aabb.size*=0.5; + + if (i&1) + aabb.pos.x+=aabb.size.x; + if (i&2) + aabb.pos.y+=aabb.size.y; + if (i&4) + aabb.pos.z+=aabb.size.z; + + _debug_mesh(bake_cells_write[p_idx].childs[i],p_level+1,aabb,p_mode,p_multimesh,idx); + } + + } + +} + + +void BakedLight::create_debug_mesh(DebugMode p_mode) { + + Ref mm; + mm.instance(); + + mm->set_transform_format(MultiMesh::TRANSFORM_3D); + mm->set_color_format(MultiMesh::COLOR_8BIT); + mm->set_instance_count(bake_cells_level_used[cell_subdiv-1]); + + Ref mesh; + mesh.instance(); + + + + { + Array arr; + arr.resize(Mesh::ARRAY_MAX); + + DVector vertices; + DVector colors; + + int vtx_idx=0; + #define ADD_VTX(m_idx);\ + vertices.push_back( face_points[m_idx] );\ + colors.push_back( Color(1,1,1,1) );\ + vtx_idx++;\ + + for (int i=0;i<6;i++) { + + + Vector3 face_points[4]; + + for (int j=0;j<4;j++) { + + float v[3]; + v[0]=1.0; + v[1]=1-2*((j>>1)&1); + v[2]=v[1]*(1-2*(j&1)); + + for (int k=0;k<3;k++) { + + if (i<3) + face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1); + else + face_points[3-j][(i+k)%3]=v[k]*(i>=3?-1:1); + } + } + + //tri 1 + ADD_VTX(0); + ADD_VTX(1); + ADD_VTX(2); + //tri 2 + ADD_VTX(2); + ADD_VTX(3); + ADD_VTX(0); + + } + + + arr[Mesh::ARRAY_VERTEX]=vertices; + arr[Mesh::ARRAY_COLOR]=colors; + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,arr); + } + + { + Ref fsm; + fsm.instance(); + fsm->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + fsm->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + fsm->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + fsm->set_albedo(Color(1,1,1,1)); + + mesh->surface_set_material(0,fsm); + } + + mm->set_mesh(mesh); + + + bake_cells_write = bake_cells.write(); + + + + int idx=0; + _debug_mesh(0,0,bounds,p_mode,mm,idx); + + print_line("written: "+itos(idx)+" total: "+itos(bake_cells_level_used[cell_subdiv-1])); + + + MultiMeshInstance *mmi = memnew( MultiMeshInstance ); + mmi->set_multimesh(mm); + add_child(mmi); + if (get_tree()->get_edited_scene_root()==this){ + mmi->set_owner(this); + } else { + mmi->set_owner(get_owner()); + + } + +} + +void BakedLight::_debug_mesh_albedo() { + create_debug_mesh(DEBUG_ALBEDO); +} + +void BakedLight::_debug_mesh_light() { + create_debug_mesh(DEBUG_LIGHT); +} + + +void BakedLight::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_cell_subdiv","steps"),&BakedLight::set_cell_subdiv); + ObjectTypeDB::bind_method(_MD("get_cell_subdiv"),&BakedLight::get_cell_subdiv); + + ObjectTypeDB::bind_method(_MD("bake"),&BakedLight::bake); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("bake"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + + ObjectTypeDB::bind_method(_MD("bake_lights"),&BakedLight::bake_lights); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("bake_lights"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + + ObjectTypeDB::bind_method(_MD("bake_radiance"),&BakedLight::bake_radiance); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("bake_radiance"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + + ObjectTypeDB::bind_method(_MD("debug_mesh_albedo"),&BakedLight::_debug_mesh_albedo); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("debug_mesh_albedo"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + - ObjectTypeDB::bind_method(_MD("set_baked_light","baked_light"),&BakedLightInstance::set_baked_light); - ObjectTypeDB::bind_method(_MD("get_baked_light"),&BakedLightInstance::get_baked_light); - ObjectTypeDB::bind_method(_MD("get_baked_light_instance"),&BakedLightInstance::get_baked_light_instance); + ObjectTypeDB::bind_method(_MD("debug_mesh_light"),&BakedLight::_debug_mesh_light); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("debug_mesh_light"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"baked_light",PROPERTY_HINT_RESOURCE_TYPE,"BakedLight"),_SCS("set_baked_light"),_SCS("get_baked_light")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"cell_subdiv"),_SCS("set_cell_subdiv"),_SCS("get_cell_subdiv")); ADD_SIGNAL( MethodInfo("baked_light_changed")); + } -BakedLightInstance::BakedLightInstance() { +BakedLight::BakedLight() { +// baked_light=VisualServer::get_singleton()->baked_light_create(); + VS::get_singleton()->instance_set_base(get_instance(),baked_light); + cell_subdiv=8; + bake_texture_size=128; + color_scan_cell_width=8; + light_pass=0; } -///////////////////////// +BakedLight::~BakedLight() { + + VS::get_singleton()->free(baked_light); +} + +///////////////////////// + +#if 0 void BakedLightSampler::set_param(Param p_param,float p_value) { ERR_FAIL_INDEX(p_param,PARAM_MAX); params[p_param]=p_value; diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h index 15f04fea31..314e5f1450 100644 --- a/scene/3d/baked_light_instance.h +++ b/scene/3d/baked_light_instance.h @@ -31,38 +31,142 @@ #include "scene/3d/visual_instance.h" #include "scene/resources/baked_light.h" +#include "scene/3d/multimesh_instance.h" + -#if 0 class BakedLightBaker; +class Light; + +class BakedLight : public VisualInstance { + OBJ_TYPE(BakedLight,VisualInstance); + +public: + enum DebugMode { + DEBUG_ALBEDO, + DEBUG_LIGHT + }; + +private: + RID baked_light; + int cell_subdiv; + AABB bounds; + int cells_per_axis; + + enum { + CHILD_EMPTY=0xFFFFFFFF, + }; + + + /* BAKE DATA */ + + struct BakeCell { + + uint32_t childs[8]; + float albedo[3]; //albedo in RGB24 + float light[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast) + float radiance[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast) + uint32_t used_sides; + float alpha; //used for upsampling + uint32_t light_pass; //used for baking light + + BakeCell() { + for(int i=0;i<8;i++) { + childs[i]=0xFFFFFFFF; + } + + for(int i=0;i<3;i++) { + light[i]=0; + albedo[i]=0; + radiance[i]=0; + } + alpha=0; + light_pass=0; + used_sides=0; + } + }; + + + int bake_texture_size; + int color_scan_cell_width; + + struct MaterialCache { + //128x128 textures + Vector albedo; + Vector emission; + }; + + Vector _get_bake_texture(Image &p_image, const Color &p_color); -class BakedLightInstance : public VisualInstance { - OBJ_TYPE(BakedLightInstance,VisualInstance); - Ref baked_light; + Map,MaterialCache> material_cache; + MaterialCache _get_material_cache(Ref p_material); + int bake_cells_alloc; + int bake_cells_used; + int zero_alphas; + Vector bake_cells_level_used; + DVector bake_cells; + DVector::Write bake_cells_write; + + + + void _plot_face(int p_idx,int p_level,const Vector3 *p_vtx,const Vector2* p_uv, const MaterialCache& p_material,const AABB& p_aabb); + void _fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z); + void _bake_add_mesh(const Transform& p_xform,Ref& p_mesh); + void _bake_add_to_aabb(const Transform& p_xform,Ref& p_mesh,bool &first); + + void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb,DebugMode p_mode,Ref &p_multimesh,int &idx); + void _debug_mesh_albedo(); + void _debug_mesh_light(); + + + _FORCE_INLINE_ int _find_cell(int x,int y, int z); + int _plot_ray(const Vector3& p_from, const Vector3& p_to); + + uint32_t light_pass; + + + void _bake_directional(int p_idx, int p_level, int p_x,int p_y,int p_z,const Vector3& p_dir,const Color& p_color,int p_sign); + void _upscale_light(int p_idx,int p_level); + void _bake_light(Light* p_light); + + Color _cone_trace(const Vector3& p_from, const Vector3& p_dir, float p_half_angle); + void _bake_radiance(int p_idx, int p_level, int p_x,int p_y,int p_z); + +friend class GeometryInstance; + + Set geometries; +friend class Light; + + Set lights; protected: static void _bind_methods(); public: + void set_cell_subdiv(int p_subdiv); + int get_cell_subdiv() const; + + void bake(); + void bake_lights(); + void bake_radiance(); - RID get_baked_light_instance() const; - void set_baked_light(const Ref& baked_light); - Ref get_baked_light() const; + void create_debug_mesh(DebugMode p_mode); virtual AABB get_aabb() const; virtual DVector get_faces(uint32_t p_usage_flags) const; String get_configuration_warning() const; - BakedLightInstance(); + BakedLight(); + ~BakedLight(); }; - +#if 0 class BakedLightSampler : public VisualInstance { OBJ_TYPE(BakedLightSampler,VisualInstance); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp new file mode 100644 index 0000000000..ce360859d6 --- /dev/null +++ b/scene/3d/gi_probe.cpp @@ -0,0 +1,1248 @@ +#include "gi_probe.h" +#include "mesh_instance.h" + +enum DataFormat { + DATA_RGBA8, + DATA_DXT5, + DATA_ETC2_EAC, +}; + + +void GIProbeData::set_bounds(const AABB& p_bounds) { + + VS::get_singleton()->gi_probe_set_bounds(probe,p_bounds); +} + +AABB GIProbeData::get_bounds() const{ + + return VS::get_singleton()->gi_probe_get_bounds(probe); +} + +void GIProbeData::set_cell_size(float p_size) { + + VS::get_singleton()->gi_probe_set_cell_size(probe,p_size); + +} + +float GIProbeData::get_cell_size() const { + + return VS::get_singleton()->gi_probe_get_cell_size(probe); + +} + +void GIProbeData::set_to_cell_xform(const Transform& p_xform) { + + VS::get_singleton()->gi_probe_set_to_cell_xform(probe,p_xform); + +} + +Transform GIProbeData::get_to_cell_xform() const { + + return VS::get_singleton()->gi_probe_get_to_cell_xform(probe); + +} + + +void GIProbeData::set_dynamic_data(const DVector& p_data){ + + VS::get_singleton()->gi_probe_set_dynamic_data(probe,p_data); + +} +DVector GIProbeData::get_dynamic_data() const{ + + return VS::get_singleton()->gi_probe_get_dynamic_data(probe); +} + +void GIProbeData::set_dynamic_range(float p_range){ + + VS::get_singleton()->gi_probe_set_dynamic_range(probe,p_range); + +} +float GIProbeData::get_dynamic_range() const{ + + + return VS::get_singleton()->gi_probe_get_dynamic_range(probe); +} + +void GIProbeData::set_static_data(const DVector& p_data,DataFormat p_format,int p_width,int p_height,int p_depth){ + + VS::get_singleton()->gi_probe_set_static_data(probe,p_data,VS::GIProbeDataFormat(p_format),p_width,p_height,p_depth); + +} +DVector GIProbeData::get_static_data() const{ + + return VS::get_singleton()->gi_probe_get_static_data(probe); + +} +GIProbeData::DataFormat GIProbeData::get_static_data_format() const{ + + return GIProbeData::DataFormat(VS::get_singleton()->gi_probe_get_static_data_format(probe)); + +} +int GIProbeData::get_static_data_width() const{ + + return VS::get_singleton()->gi_probe_get_static_data_width(probe); + +} +int GIProbeData::get_static_data_height() const{ + + return VS::get_singleton()->gi_probe_get_static_data_height(probe); + +} +int GIProbeData::get_static_data_depth() const{ + + return VS::get_singleton()->gi_probe_get_static_data_depth(probe); + +} + +RID GIProbeData::get_rid() const { + + return probe; +} + +GIProbeData::GIProbeData() { + + probe=VS::get_singleton()->gi_probe_create(); +} + +GIProbeData::~GIProbeData() { + + VS::get_singleton()->free(probe); +} + + +////////////////////// +////////////////////// + + +void GIProbe::set_probe_data(const Ref& p_data) { + + if (p_data.is_valid()) { + VS::get_singleton()->instance_set_base(get_instance(),p_data->get_rid()); + } else { + VS::get_singleton()->instance_set_base(get_instance(),RID()); + } + + probe_data=p_data; +} + +Ref GIProbe::get_probe_data() const { + + return probe_data; +} + +void GIProbe::set_subdiv(Subdiv p_subdiv) { + + ERR_FAIL_INDEX(p_subdiv,SUBDIV_MAX); + subdiv=p_subdiv; + update_gizmo(); +} + +GIProbe::Subdiv GIProbe::get_subdiv() const { + + return subdiv; +} + +void GIProbe::set_extents(const Vector3& p_extents) { + + extents=p_extents; + update_gizmo(); +} + +Vector3 GIProbe::get_extents() const { + + return extents; +} + +void GIProbe::set_dynamic_range(float p_dynamic_range) { + + dynamic_range=p_dynamic_range; +} +float GIProbe::get_dynamic_range() const { + + return dynamic_range; +} + +#include "math.h" + +#define FINDMINMAX(x0,x1,x2,min,max) \ + min = max = x0; \ + if(x1max) max=x1;\ + if(x2max) max=x2; + +static bool planeBoxOverlap(Vector3 normal,float d, Vector3 maxbox) +{ + int q; + Vector3 vmin,vmax; + for(q=0;q<=2;q++) + { + if(normal[q]>0.0f) + { + vmin[q]=-maxbox[q]; + vmax[q]=maxbox[q]; + } + else + { + vmin[q]=maxbox[q]; + vmax[q]=-maxbox[q]; + } + } + if(normal.dot(vmin)+d>0.0f) return false; + if(normal.dot(vmax)+d>=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(p0rad || 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(p0rad || 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(p0rad || 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(p0rad || 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(p2rad || 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(p0rad || max<-rad) return false; + +static bool fast_tri_box_overlap(const Vector3& boxcenter,const Vector3 boxhalfsize,const Vector3 *triverts) { + + /* 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,d,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=triverts[0]-boxcenter; + v1=triverts[1]-boxcenter; + v2=triverts[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 = Math::abs(e0.x); + fey = Math::abs(e0.y); + fez = Math::abs(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 = Math::abs(e1.x); + fey = Math::abs(e1.y); + fez = Math::abs(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 = Math::abs(e2.x); + fey = Math::abs(e2.y); + fez = Math::abs(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=e0.cross(e1); + d=-normal.dot(v0); /* plane eq: normal.x+d=0 */ + if(!planeBoxOverlap(normal,d,boxhalfsize)) return false; + + return true; /* box and triangle overlaps */ +} + + + +static _FORCE_INLINE_ Vector2 get_uv(const Vector3& p_pos, const Vector3 *p_vtx, const Vector2* p_uv) { + + if (p_pos.distance_squared_to(p_vtx[0])cell_subdiv-1) { + //plot the face by guessing it's albedo and emission value + + //find best axis to map to, for scanning values + int closest_axis; + float closest_dot; + + Vector3 normal = Plane(p_vtx[0],p_vtx[1],p_vtx[2]).normal; + + for(int i=0;i<3;i++) { + + Vector3 axis; + axis[i]=1.0; + float dot=ABS(normal.dot(axis)); + if (i==0 || dot>closest_dot) { + closest_axis=i; + closest_dot=dot; + } + } + + Vector3 axis; + axis[closest_axis]=1.0; + Vector3 t1; + t1[(closest_axis+1)%3]=1.0; + Vector3 t2; + t2[(closest_axis+2)%3]=1.0; + + t1*=p_aabb.size[(closest_axis+1)%3]/float(color_scan_cell_width); + t2*=p_aabb.size[(closest_axis+2)%3]/float(color_scan_cell_width); + + Color albedo_accum; + Color emission_accum; + float alpha=0.0; + + //map to a grid average in the best axis for this face + for(int i=0;ibake_cells[p_idx].albedo[0]+=albedo_accum.r; + p_baker->bake_cells[p_idx].albedo[1]+=albedo_accum.g; + p_baker->bake_cells[p_idx].albedo[2]+=albedo_accum.b; + p_baker->bake_cells[p_idx].emission[0]+=emission_accum.r; + p_baker->bake_cells[p_idx].emission[1]+=emission_accum.g; + p_baker->bake_cells[p_idx].emission[2]+=emission_accum.b; + p_baker->bake_cells[p_idx].alpha+=alpha; + + static const Vector3 side_normals[6]={ + Vector3(-1, 0, 0), + Vector3( 1, 0, 0), + Vector3( 0,-1, 0), + Vector3( 0, 1, 0), + Vector3( 0, 0,-1), + Vector3( 0, 0, 1), + }; + + for(int i=0;i<6;i++) { + if (normal.dot(side_normals[i])>CMP_EPSILON) { + p_baker->bake_cells[p_idx].used_sides|=(1<cell_subdiv-1)) >> (p_level+1); + for(int i=0;i<8;i++) { + + AABB aabb=p_aabb; + aabb.size*=0.5; + + int nx=p_x; + int ny=p_y; + int nz=p_z; + + if (i&1) { + aabb.pos.x+=aabb.size.x; + nx+=half; + } + if (i&2) { + aabb.pos.y+=aabb.size.y; + ny+=half; + } + if (i&4) { + aabb.pos.z+=aabb.size.z; + nz+=half; + } + //make sure to not plot beyond limits + if (nx<0 || nx>=p_baker->axis_cell_size[0] || ny<0 || ny>=p_baker->axis_cell_size[1] || nz<0 || nz>=p_baker->axis_cell_size[2]) + continue; + + { + AABB test_aabb=aabb; + //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time + Vector3 qsize = test_aabb.size*0.5; //quarter size, for fast aabb test + + if (!fast_tri_box_overlap(test_aabb.pos+qsize,qsize,p_vtx)) { + //if (!Face3(p_vtx[0],p_vtx[1],p_vtx[2]).intersects_aabb2(aabb)) { + //does not fit in child, go on + continue; + } + + } + + if (p_baker->bake_cells[p_idx].childs[i]==Baker::CHILD_EMPTY) { + //sub cell must be created + + p_baker->bake_cells[p_idx].childs[i]=p_baker->bake_cells.size(); + p_baker->bake_cells.resize( p_baker->bake_cells.size() + 1); + + } + + + _plot_face(p_baker->bake_cells[p_idx].childs[i],p_level+1,nx,ny,nz,p_vtx,p_uv,p_material,aabb,p_baker); + } + } +} + + + +void GIProbe::_fixup_plot(int p_idx, int p_level,int p_x,int p_y, int p_z,Baker *p_baker) { + + + + if (p_level==p_baker->cell_subdiv-1) { + + p_baker->leaf_voxel_count++; + float alpha = p_baker->bake_cells[p_idx].alpha; + + p_baker->bake_cells[p_idx].albedo[0]/=alpha; + p_baker->bake_cells[p_idx].albedo[1]/=alpha; + p_baker->bake_cells[p_idx].albedo[2]/=alpha; + + //transfer emission to light + p_baker->bake_cells[p_idx].emission[0]/=alpha; + p_baker->bake_cells[p_idx].emission[1]/=alpha; + p_baker->bake_cells[p_idx].emission[2]/=alpha; + + p_baker->bake_cells[p_idx].alpha=1.0; + + //remove neighbours from used sides + + for(int n=0;n<6;n++) { + + int ofs[3]={0,0,0}; + + ofs[n/2]=(n&1)?1:-1; + + //convert to x,y,z on this level + int x=p_x; + int y=p_y; + int z=p_z; + + x+=ofs[0]; + y+=ofs[1]; + z+=ofs[2]; + + int ofs_x=0; + int ofs_y=0; + int ofs_z=0; + int size = 1<=size || y<0 || y>=size || z<0 || z>=size) { + //neighbour is out, can't use it + p_baker->bake_cells[p_idx].used_sides&=~(1<cell_subdiv-1;i++) { + + Baker::Cell *bc = &p_baker->bake_cells[neighbour]; + + int child = 0; + if (x >= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } + + neighbour = bc->childs[child]; + if (neighbour==Baker::CHILD_EMPTY) { + break; + } + + half>>=1; + } + + if (neighbour!=Baker::CHILD_EMPTY) { + p_baker->bake_cells[p_idx].used_sides&=~(1<cell_subdiv-1)) >> (p_level+1); + for(int i=0;i<8;i++) { + + uint32_t child = p_baker->bake_cells[p_idx].childs[i]; + + if (child==Baker::CHILD_EMPTY) + continue; + + + int nx=p_x; + int ny=p_y; + int nz=p_z; + + if (i&1) + nx+=half; + if (i&2) + ny+=half; + if (i&4) + nz+=half; + + _fixup_plot(child,p_level+1,nx,ny,nz,p_baker); + alpha_average+=p_baker->bake_cells[child].alpha; + } + + p_baker->bake_cells[p_idx].alpha=alpha_average/8.0; + p_baker->bake_cells[p_idx].emission[0]=0; + p_baker->bake_cells[p_idx].emission[1]=0; + p_baker->bake_cells[p_idx].emission[2]=0; + p_baker->bake_cells[p_idx].albedo[0]=0; + p_baker->bake_cells[p_idx].albedo[1]=0; + p_baker->bake_cells[p_idx].albedo[2]=0; + + } + +} + + + +Vector GIProbe::_get_bake_texture(Image &p_image,const Color& p_color) { + + Vector ret; + + if (p_image.empty()) { + + ret.resize(bake_texture_size*bake_texture_size); + for(int i=0;i::Read r = p_image.get_data().read(); + ret.resize(bake_texture_size*bake_texture_size); + + for(int i=0;i p_material,Baker *p_baker) { + + //this way of obtaining materials is inaccurate and also does not support some compressed formats very well + Ref mat = p_material; + + Ref material = mat; //hack for now + + if (p_baker->material_cache.has(material)) { + return p_baker->material_cache[material]; + } + + Baker::MaterialCache mc; + + if (mat.is_valid()) { + + + Ref albedo_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_ALBEDO); + + Image img_albedo; + if (albedo_tex.is_valid()) { + + img_albedo = albedo_tex->get_data(); + } + + mc.albedo=_get_bake_texture(img_albedo,mat->get_albedo()); + + Ref emission_tex = mat->get_texture(FixedSpatialMaterial::TEXTURE_EMISSION); + + Color emission_col = mat->get_emission(); + emission_col.r*=mat->get_emission_energy(); + emission_col.g*=mat->get_emission_energy(); + emission_col.b*=mat->get_emission_energy(); + + Image img_emission; + + if (emission_tex.is_valid()) { + + img_emission = emission_tex->get_data(); + } + + mc.emission=_get_bake_texture(img_emission,emission_col); + + } else { + Image empty; + + mc.albedo=_get_bake_texture(empty,Color(0.7,0.7,0.7)); + mc.emission=_get_bake_texture(empty,Color(0,0,0)); + + + } + + p_baker->material_cache[p_material]=mc; + return mc; + + +} + +void GIProbe::_plot_mesh(const Transform& p_xform, Ref& p_mesh, Baker *p_baker) { + + + for(int i=0;iget_surface_count();i++) { + + if (p_mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) + continue; //only triangles + + Baker::MaterialCache material = _get_material_cache(p_mesh->surface_get_material(i),p_baker); + + Array a = p_mesh->surface_get_arrays(i); + + + DVector vertices = a[Mesh::ARRAY_VERTEX]; + DVector::Read vr=vertices.read(); + DVector uv = a[Mesh::ARRAY_TEX_UV]; + DVector::Read uvr; + DVector index = a[Mesh::ARRAY_INDEX]; + + bool read_uv=false; + + if (uv.size()) { + + uvr=uv.read(); + read_uv=true; + } + + if (index.size()) { + + int facecount = index.size()/3; + DVector::Read ir=index.read(); + + for(int j=0;jpo2_bounds,p_baker); + } + + + + } else { + + int facecount = vertices.size()/3; + + for(int j=0;jpo2_bounds,p_baker); + } + + } + } +} + + + +void GIProbe::_find_meshes(Node *p_at_node,Baker *p_baker){ + + MeshInstance *mi = p_at_node->cast_to(); + if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT)) { + Ref mesh = mi->get_mesh(); + if (mesh.is_valid()) { + + AABB aabb = mesh->get_aabb(); + + Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform(); + + if (AABB(-extents,extents*2).intersects(xf.xform(aabb))) { + Baker::PlotMesh pm; + pm.local_xform=xf; + pm.mesh=mesh; + p_baker->mesh_list.push_back(pm); + + } + } + } + + for(int i=0;iget_child_count();i++) { + + Node *child = p_at_node->get_child(i); + if (!child->get_owner()) + continue; //maybe a helper + + _find_meshes(child,p_baker); + + } +} + + + + +void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ + + Baker baker; + + static const int subdiv_value[SUBDIV_MAX]={7,8,9,10}; + + baker.cell_subdiv=subdiv_value[subdiv]; + baker.bake_cells.resize(1); + + //find out the actual real bounds, power of 2, which gets the highest subdivision + baker.po2_bounds=AABB(-extents,extents*2.0); + int longest_axis = baker.po2_bounds.get_longest_axis_index(); + baker.axis_cell_size[longest_axis]=(1<<(baker.cell_subdiv-1)); + baker.leaf_voxel_count=0; + + for(int i=0;i<3;i++) { + + if (i==longest_axis) + continue; + + baker.axis_cell_size[i]=baker.axis_cell_size[longest_axis]; + float axis_size = baker.po2_bounds.size[longest_axis]; + + //shrink until fit subdiv + while (axis_size/2.0 >= baker.po2_bounds.size[i]) { + axis_size/=2.0; + baker.axis_cell_size[i]>>=1; + } + + baker.po2_bounds.size[i]=baker.po2_bounds.size[longest_axis]; + } + + + + Transform to_bounds; + to_bounds.basis.scale(Vector3(baker.po2_bounds.size[longest_axis],baker.po2_bounds.size[longest_axis],baker.po2_bounds.size[longest_axis])); + to_bounds.origin=baker.po2_bounds.pos; + + Transform to_grid; + to_grid.basis.scale(Vector3(baker.axis_cell_size[longest_axis],baker.axis_cell_size[longest_axis],baker.axis_cell_size[longest_axis])); + + baker.to_cell_space = to_grid * to_bounds.affine_inverse(); + + + _find_meshes(p_from_node?p_from_node:get_parent(),&baker); + + + + int pmc=0; + + for(List::Element *E=baker.mesh_list.front();E;E=E->next()) { + + print_line("plotting mesh "+itos(pmc++)+"/"+itos(baker.mesh_list.size())); + + _plot_mesh(E->get().local_xform,E->get().mesh,&baker); + } + + _fixup_plot(0,0,0,0,0,&baker); + + //create the data for visual server + + DVector data; + + data.resize( 16+(8+1+1+1+1)*baker.bake_cells.size() ); //4 for header, rest for rest. + + { + DVector::Write w = data.write(); + + uint32_t * w32 = (uint32_t*)w.ptr(); + + w32[0]=0;//version + w32[1]=baker.cell_subdiv; //subdiv + w32[2]=baker.axis_cell_size[0]; + w32[3]=baker.axis_cell_size[1]; + w32[4]=baker.axis_cell_size[2]; + w32[5]=baker.bake_cells.size(); + w32[6]=baker.leaf_voxel_count; + + int ofs=16; + + for(int i=0;i0) { + e.normalize(); + l=CLAMP(l/8.0,0,1.0); + } + + uint32_t em=uint32_t(CLAMP(e[0]*255,0,255))<<24; + em|=uint32_t(CLAMP(e[1]*255,0,255))<<16; + em|=uint32_t(CLAMP(e[2]*255,0,255))<<8; + em|=uint32_t(CLAMP(l*255,0,255)); + + w32[ofs++]=em; + } + + w32[ofs++]=baker.bake_cells[i].used_sides; + w32[ofs++]=uint32_t(baker.bake_cells[i].alpha*65535.0); + + } + + } + + Ref probe_data; + probe_data.instance(); + probe_data->set_bounds(AABB(-extents,extents*2.0)); + probe_data->set_cell_size(baker.po2_bounds.size[longest_axis]/baker.axis_cell_size[longest_axis]); + probe_data->set_dynamic_data(data); + probe_data->set_to_cell_xform(baker.to_cell_space); + + set_probe_data(probe_data); + + + if (p_create_visual_debug) { + // _create_debug_mesh(&baker); + } + + + +} + + +void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb,Ref &p_multimesh,int &idx,Baker *p_baker) { + + + if (p_level==p_baker->cell_subdiv-1) { + + Vector3 center = p_aabb.pos+p_aabb.size*0.5; + Transform xform; + xform.origin=center; + xform.basis.scale(p_aabb.size*0.5); + p_multimesh->set_instance_transform(idx,xform); + Color col=Color(p_baker->bake_cells[p_idx].albedo[0],p_baker->bake_cells[p_idx].albedo[1],p_baker->bake_cells[p_idx].albedo[2]); + p_multimesh->set_instance_color(idx,col); + + idx++; + + } else { + + for(int i=0;i<8;i++) { + + if (p_baker->bake_cells[p_idx].childs[i]==Baker::CHILD_EMPTY) + continue; + + AABB aabb=p_aabb; + aabb.size*=0.5; + + if (i&1) + aabb.pos.x+=aabb.size.x; + if (i&2) + aabb.pos.y+=aabb.size.y; + if (i&4) + aabb.pos.z+=aabb.size.z; + + _debug_mesh(p_baker->bake_cells[p_idx].childs[i],p_level+1,aabb,p_multimesh,idx,p_baker); + } + + } + +} + + +void GIProbe::_create_debug_mesh(Baker *p_baker) { + + Ref mm; + mm.instance(); + + mm->set_transform_format(MultiMesh::TRANSFORM_3D); + mm->set_color_format(MultiMesh::COLOR_8BIT); + print_line("leaf voxels: "+itos(p_baker->leaf_voxel_count)); + mm->set_instance_count(p_baker->leaf_voxel_count); + + Ref mesh; + mesh.instance(); + + { + Array arr; + arr.resize(Mesh::ARRAY_MAX); + + DVector vertices; + DVector colors; + + int vtx_idx=0; + #define ADD_VTX(m_idx);\ + vertices.push_back( face_points[m_idx] );\ + colors.push_back( Color(1,1,1,1) );\ + vtx_idx++;\ + + for (int i=0;i<6;i++) { + + + Vector3 face_points[4]; + + for (int j=0;j<4;j++) { + + float v[3]; + v[0]=1.0; + v[1]=1-2*((j>>1)&1); + v[2]=v[1]*(1-2*(j&1)); + + for (int k=0;k<3;k++) { + + if (i<3) + face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1); + else + face_points[3-j][(i+k)%3]=v[k]*(i>=3?-1:1); + } + } + + //tri 1 + ADD_VTX(0); + ADD_VTX(1); + ADD_VTX(2); + //tri 2 + ADD_VTX(2); + ADD_VTX(3); + ADD_VTX(0); + + } + + + arr[Mesh::ARRAY_VERTEX]=vertices; + arr[Mesh::ARRAY_COLOR]=colors; + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,arr); + } + + { + Ref fsm; + fsm.instance(); + fsm->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + fsm->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + fsm->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); + fsm->set_albedo(Color(1,1,1,1)); + + mesh->surface_set_material(0,fsm); + } + + mm->set_mesh(mesh); + + + int idx=0; + _debug_mesh(0,0,p_baker->po2_bounds,mm,idx,p_baker); + + MultiMeshInstance *mmi = memnew( MultiMeshInstance ); + mmi->set_multimesh(mm); + add_child(mmi); + if (get_tree()->get_edited_scene_root()==this){ + mmi->set_owner(this); + } else { + mmi->set_owner(get_owner()); + + } + +} + +void GIProbe::_debug_bake() { + + bake(NULL,true); +} + +AABB GIProbe::get_aabb() const { + + return AABB(-extents,extents*2); +} + +DVector GIProbe::get_faces(uint32_t p_usage_flags) const { + + return DVector(); +} + +void GIProbe::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("set_probe_data","data"),&GIProbe::set_probe_data); + ObjectTypeDB::bind_method(_MD("get_probe_data"),&GIProbe::get_probe_data); + + ObjectTypeDB::bind_method(_MD("set_subdiv","subdiv"),&GIProbe::set_subdiv); + ObjectTypeDB::bind_method(_MD("get_subdiv"),&GIProbe::get_subdiv); + + ObjectTypeDB::bind_method(_MD("set_extents","extents"),&GIProbe::set_extents); + ObjectTypeDB::bind_method(_MD("get_extents"),&GIProbe::get_extents); + + ObjectTypeDB::bind_method(_MD("set_dynamic_range","max"),&GIProbe::set_dynamic_range); + ObjectTypeDB::bind_method(_MD("get_dynamic_range"),&GIProbe::get_dynamic_range); + + ObjectTypeDB::bind_method(_MD("bake","from_node","create_visual_debug"),&GIProbe::bake,DEFVAL(Variant()),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("debug_bake"),&GIProbe::_debug_bake); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("debug_bake"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + + ADD_PROPERTY( PropertyInfo(Variant::INT,"subdiv",PROPERTY_HINT_ENUM,"64,128,256,512"),_SCS("set_subdiv"),_SCS("get_subdiv")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"extents"),_SCS("set_extents"),_SCS("get_extents")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"dynamic_range",PROPERTY_HINT_RANGE,"0,8,0.01"),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); + ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"data",PROPERTY_HINT_RESOURCE_TYPE,"GIProbeData"),_SCS("set_probe_data"),_SCS("get_probe_data")); + + + BIND_CONSTANT( SUBDIV_64 ); + BIND_CONSTANT( SUBDIV_128 ); + BIND_CONSTANT( SUBDIV_256 ); + BIND_CONSTANT( SUBDIV_MAX ); + +} + +GIProbe::GIProbe() { + + subdiv=SUBDIV_128; + dynamic_range=1.0; + extents=Vector3(10,10,10); + color_scan_cell_width=4; + bake_texture_size=128; + + gi_probe = VS::get_singleton()->gi_probe_create(); + + +} + +GIProbe::~GIProbe() { + + +} diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h new file mode 100644 index 0000000000..e2017acfc3 --- /dev/null +++ b/scene/3d/gi_probe.h @@ -0,0 +1,174 @@ +#ifndef GIPROBE_H +#define GIPROBE_H + +#include "scene/3d/visual_instance.h" +#include "multimesh_instance.h" + +class GIProbeData : public Resource { + + OBJ_TYPE(GIProbeData,Resource); + + RID probe; + +public: + + enum DataFormat { + DATA_RGBA8, + DATA_DXT5, + DATA_ETC2_EAC, + }; + + + void set_bounds(const AABB& p_bounds); + AABB get_bounds() const; + + void set_cell_size(float p_size); + float get_cell_size() const; + + void set_to_cell_xform(const Transform& p_xform); + Transform get_to_cell_xform() const; + + void set_dynamic_data(const DVector& p_data); + DVector get_dynamic_data() const; + + void set_dynamic_range(float p_range); + float get_dynamic_range() const; + + void set_static_data(const DVector& p_data,DataFormat p_format,int p_width,int p_height,int p_depth); + DVector get_static_data() const; + DataFormat get_static_data_format() const; + int get_static_data_width() const; + int get_static_data_height() const; + int get_static_data_depth() const; + + virtual RID get_rid() const; + + GIProbeData(); + ~GIProbeData(); +}; + +VARIANT_ENUM_CAST(GIProbeData::DataFormat); + +class GIProbe : public VisualInstance { + OBJ_TYPE(GIProbe,VisualInstance); +public: + enum Subdiv{ + SUBDIV_64, + SUBDIV_128, + SUBDIV_256, + SUBDIV_512, + SUBDIV_MAX + + }; +private: + + //stuff used for bake + struct Baker { + + enum { + CHILD_EMPTY=0xFFFFFFFF + }; + struct Cell { + + uint32_t childs[8]; + float albedo[3]; //albedo in RGB24 + float emission[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast) + uint32_t used_sides; + float alpha; //used for upsampling + + Cell() { + for(int i=0;i<8;i++) { + childs[i]=CHILD_EMPTY; + } + + for(int i=0;i<3;i++) { + emission[i]=0; + albedo[i]=0; + } + alpha=0; + used_sides=0; + } + }; + + Vector bake_cells; + int cell_subdiv; + + struct MaterialCache { + //128x128 textures + Vector albedo; + Vector emission; + }; + + + Vector _get_bake_texture(Image &p_image, const Color &p_color); + Map,MaterialCache> material_cache; + MaterialCache _get_material_cache(Ref p_material); + int leaf_voxel_count; + + + AABB po2_bounds; + int axis_cell_size[3]; + + struct PlotMesh { + Ref mesh; + Transform local_xform; + }; + + Transform to_cell_space; + + List mesh_list; + }; + + + Ref probe_data; + + RID gi_probe; + + Subdiv subdiv; + Vector3 extents; + float dynamic_range; + + int color_scan_cell_width; + int bake_texture_size; + + Vector _get_bake_texture(Image &p_image,const Color& p_color); + Baker::MaterialCache _get_material_cache(Ref p_material,Baker *p_baker); + void _plot_face(int p_idx, int p_level, int p_x,int p_y,int p_z,const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const AABB &p_aabb,Baker *p_baker); + void _plot_mesh(const Transform& p_xform, Ref& p_mesh, Baker *p_baker); + void _find_meshes(Node *p_at_node,Baker *p_baker); + void _fixup_plot(int p_idx, int p_level,int p_x,int p_y, int p_z,Baker *p_baker); + + void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb,Ref &p_multimesh,int &idx,Baker *p_baker); + void _create_debug_mesh(Baker *p_baker); + + void _debug_bake(); + +protected: + + static void _bind_methods(); +public: + + void set_probe_data(const Ref& p_data); + Ref get_probe_data() const; + + void set_subdiv(Subdiv p_subdiv); + Subdiv get_subdiv() const; + + void set_extents(const Vector3& p_extents); + Vector3 get_extents() const; + + void set_dynamic_range(float p_dynamic_range); + float get_dynamic_range() const; + + void bake(Node *p_from_node=NULL,bool p_create_visual_debug=false); + + virtual AABB get_aabb() const; + virtual DVector get_faces(uint32_t p_usage_flags) const; + + GIProbe(); + ~GIProbe(); +}; + +VARIANT_ENUM_CAST(GIProbe::Subdiv) + +#endif // GIPROBE_H diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 7177e21e1e..1566743e1b 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -30,7 +30,7 @@ #include "globals.h" #include "scene/resources/surface_tool.h" - +#include "baked_light_instance.h" bool Light::_can_gizmo_scale() const { @@ -168,9 +168,37 @@ void Light::_update_visibility() { void Light::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_TREE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { + + if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + _update_visibility(); + + } + + if (p_what==NOTIFICATION_ENTER_TREE) { + _update_visibility(); + + Node *node = this; + + while(node) { + + baked_light=node->cast_to(); + if (baked_light) { + baked_light->lights.insert(this); + break; + } + + node=node->get_parent(); + } } + + if (p_what==NOTIFICATION_EXIT_TREE) { + + if (baked_light) { + baked_light->lights.erase(this); + } + } + } @@ -247,6 +275,8 @@ Light::Light(VisualServer::LightType p_type) { light=VisualServer::get_singleton()->light_create(p_type); VS::get_singleton()->instance_set_base(get_instance(),light); + baked_light=NULL; + editor_only=false; set_color(Color(1,1,1,1)); set_shadow(false); diff --git a/scene/3d/light.h b/scene/3d/light.h index fcf5ce90f9..45adfc1dee 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -37,6 +37,10 @@ /** @author Juan Linietsky */ + + +class BakedLight; + class Light : public VisualInstance { OBJ_TYPE( Light, VisualInstance ); @@ -72,6 +76,8 @@ private: VS::LightType type; bool editor_only; void _update_visibility(); + + BakedLight *baked_light; // bind helpers protected: diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 5bc332f8fb..f5dbf7c53a 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -31,7 +31,6 @@ #include "servers/visual_server.h" #include "room_instance.h" #include "scene/scene_string_names.h" -#include "baked_light_instance.h" #include "skeleton.h" AABB VisualInstance::get_transformed_aabb() const { @@ -227,7 +226,6 @@ void GeometryInstance::_notification(int p_what) { if (flags[FLAG_USE_BAKED_LIGHT]) { - _find_baked_light(); } _update_visibility(); @@ -236,11 +234,6 @@ void GeometryInstance::_notification(int p_what) { if (flags[FLAG_USE_BAKED_LIGHT]) { - if (baked_light_instance) { - // baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); - // baked_light_instance=NULL; - } - _baked_light_changed(); } @@ -252,37 +245,6 @@ void GeometryInstance::_notification(int p_what) { } -void GeometryInstance::_baked_light_changed() { - - //if (!baked_light_instance) - // VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),RID()); -// else -// VS::get_singleton()->instance_geometry_set_baked_light(get_instance(),baked_light_instance->get_baked_light_instance()); - -} - -void GeometryInstance::_find_baked_light() { -/* - Node *n=get_parent(); - while(n) { - - BakedLightInstance *bl=n->cast_to(); - if (bl) { - - baked_light_instance=bl; - baked_light_instance->connect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); - _baked_light_changed(); - - return; - } - - n=n->get_parent(); - } - - _baked_light_changed(); - */ -} - void GeometryInstance::_update_visibility() { if (!is_inside_tree()) @@ -314,17 +276,6 @@ void GeometryInstance::set_flag(Flags p_flag,bool p_value) { } if (p_flag==FLAG_USE_BAKED_LIGHT) { - /* if (is_inside_world()) { - if (!p_value) { - if (baked_light_instance) { - baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); - baked_light_instance=NULL; - } - _baked_light_changed(); - } else { - _find_baked_light(); - } - }*/ } } @@ -357,17 +308,8 @@ GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_settin return shadow_casting_setting; } -void GeometryInstance::set_baked_light_texture_id(int p_id) { -// baked_light_texture_id=p_id; -// VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),baked_light_texture_id); -} - -int GeometryInstance::get_baked_light_texture_id() const{ - - return baked_light_texture_id; -} void GeometryInstance::set_extra_cull_margin(float p_margin) { @@ -405,15 +347,11 @@ void GeometryInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_lod_min_distance"), &GeometryInstance::get_lod_min_distance); - ObjectTypeDB::bind_method(_MD("set_baked_light_texture_id","id"), &GeometryInstance::set_baked_light_texture_id); - ObjectTypeDB::bind_method(_MD("get_baked_light_texture_id"), &GeometryInstance::get_baked_light_texture_id); - ObjectTypeDB::bind_method(_MD("set_extra_cull_margin","margin"), &GeometryInstance::set_extra_cull_margin); ObjectTypeDB::bind_method(_MD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); ObjectTypeDB::bind_method(_MD("get_aabb"),&GeometryInstance::get_aabb); - ObjectTypeDB::bind_method(_MD("_baked_light_changed"), &GeometryInstance::_baked_light_changed); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "geometry/material_override",PROPERTY_HINT_RESOURCE_TYPE,"Material"), _SCS("set_material_override"), _SCS("get_material_override")); @@ -424,7 +362,6 @@ void GeometryInstance::_bind_methods() { ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/depth_scale"), _SCS("set_flag"), _SCS("get_flag"),FLAG_DEPH_SCALE); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible_in_all_rooms"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE_IN_ALL_ROOMS); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/use_baked_light"), _SCS("set_flag"), _SCS("get_flag"),FLAG_USE_BAKED_LIGHT); - ADD_PROPERTY( PropertyInfo( Variant::INT, "geometry/baked_light_tex_id"), _SCS("set_baked_light_texture_id"), _SCS("get_baked_light_texture_id")); ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_distance"), _SCS("get_lod_min_distance")); ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/min_hysteresis",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_min_hysteresis"), _SCS("get_lod_min_hysteresis")); ADD_PROPERTY( PropertyInfo( Variant::INT, "lod/max_distance",PROPERTY_HINT_RANGE,"0,32768,0.01"), _SCS("set_lod_max_distance"), _SCS("get_lod_max_distance")); @@ -461,8 +398,6 @@ GeometryInstance::GeometryInstance() { flags[FLAG_CAST_SHADOW]=true; shadow_casting_setting=SHADOW_CASTING_SETTING_ON; - baked_light_instance=NULL; - baked_light_texture_id=0; extra_cull_margin=0; // VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index b168bcbfe5..5fd0830d3f 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -79,7 +79,7 @@ public: }; -class BakedLightInstance; +class BakedLight; class GeometryInstance : public VisualInstance { @@ -114,12 +114,9 @@ private: float lod_max_distance; float lod_min_hysteresis; float lod_max_hysteresis; - void _find_baked_light(); - BakedLightInstance *baked_light_instance; - int baked_light_texture_id; + float extra_cull_margin; - void _baked_light_changed(); void _update_visibility(); protected: @@ -148,9 +145,6 @@ public: void set_material_override(const Ref& p_material); Ref get_material_override() const; - void set_baked_light_texture_id(int p_id); - int get_baked_light_texture_id() const; - void set_extra_cull_margin(float p_margin); float get_extra_cull_margin() const; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index d2b9def5c7..1c2620ec9a 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -205,6 +205,7 @@ #include "scene/3d/quad.h" #include "scene/3d/light.h" #include "scene/3d/reflection_probe.h" +#include "scene/3d/gi_probe.h" #include "scene/3d/particles.h" #include "scene/3d/portal.h" #include "scene/resources/environment.h" @@ -424,6 +425,8 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); @@ -455,7 +458,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); - //ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); //ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp index 38ed661cdd..0d53eff7d3 100644 --- a/scene/resources/baked_light.cpp +++ b/scene/resources/baked_light.cpp @@ -29,577 +29,3 @@ #include "baked_light.h" #include "servers/visual_server.h" -#if 0 - -void BakedLight::set_mode(Mode p_mode) { - - mode=p_mode; - VS::get_singleton()->baked_light_set_mode(baked_light,(VS::BakedLightMode(p_mode))); - -} - -BakedLight::Mode BakedLight::get_mode() const{ - - return mode; -} - -void BakedLight::set_octree(const DVector& p_octree) { - - VS::get_singleton()->baked_light_set_octree(baked_light,p_octree); -} - -DVector BakedLight::get_octree() const { - - return VS::get_singleton()->baked_light_get_octree(baked_light); -} - -void BakedLight::set_light(const DVector& p_light) { - - VS::get_singleton()->baked_light_set_light(baked_light,p_light); -} - -DVector BakedLight::get_light() const { - - return VS::get_singleton()->baked_light_get_light(baked_light); -} - - -void BakedLight::set_sampler_octree(const DVector& p_sampler_octree) { - - VS::get_singleton()->baked_light_set_sampler_octree(baked_light,p_sampler_octree); -} - -DVector BakedLight::get_sampler_octree() const { - - return VS::get_singleton()->baked_light_get_sampler_octree(baked_light); -} - - - - - -void BakedLight::add_lightmap(const Ref &p_texture,Size2 p_gen_size) { - - LightMap lm; - lm.texture=p_texture; - lm.gen_size=p_gen_size; - lightmaps.push_back(lm); - _update_lightmaps(); - _change_notify(); -} - -void BakedLight::set_lightmap_gen_size(int p_idx,const Size2& p_size){ - - ERR_FAIL_INDEX(p_idx,lightmaps.size()); - lightmaps[p_idx].gen_size=p_size; - _update_lightmaps(); -} -Size2 BakedLight::get_lightmap_gen_size(int p_idx) const{ - - ERR_FAIL_INDEX_V(p_idx,lightmaps.size(),Size2()); - return lightmaps[p_idx].gen_size; - -} -void BakedLight::set_lightmap_texture(int p_idx,const Ref &p_texture){ - - ERR_FAIL_INDEX(p_idx,lightmaps.size()); - lightmaps[p_idx].texture=p_texture; - _update_lightmaps(); - -} -Ref BakedLight::get_lightmap_texture(int p_idx) const{ - - ERR_FAIL_INDEX_V(p_idx,lightmaps.size(),Ref()); - return lightmaps[p_idx].texture; - -} -void BakedLight::erase_lightmap(int p_idx){ - - ERR_FAIL_INDEX(p_idx,lightmaps.size()); - lightmaps.remove(p_idx); - _update_lightmaps(); - _change_notify(); - -} -int BakedLight::get_lightmaps_count() const{ - - return lightmaps.size(); -} -void BakedLight::clear_lightmaps(){ - - lightmaps.clear(); - _update_lightmaps(); - _change_notify(); -} - - - -void BakedLight::_update_lightmaps() { - - VS::get_singleton()->baked_light_clear_lightmaps(baked_light); - for(int i=0;iget_rid(); - VS::get_singleton()->baked_light_add_lightmap(baked_light,tid,i); - } -} - - - -RID BakedLight::get_rid() const { - - return baked_light; -} - -Array BakedLight::_get_lightmap_data() const { - - Array ret; - ret.resize(lightmaps.size()*2); - - int idx=0; - for(int i=0;i tex = p_array[i+1]; -// ERR_CONTINUE(tex.is_null()); - LightMap lm; - lm.gen_size=size; - lm.texture=tex; - lightmaps.push_back(lm); - } - _update_lightmaps(); -} - - -void BakedLight::set_cell_subdivision(int p_subdiv) { - - cell_subdiv=p_subdiv; -} - -int BakedLight::get_cell_subdivision() const{ - - return cell_subdiv; -} - -void BakedLight::set_initial_lattice_subdiv(int p_size){ - - lattice_subdiv=p_size; -} -int BakedLight::get_initial_lattice_subdiv() const{ - - return lattice_subdiv; -} - -void BakedLight::set_plot_size(float p_size){ - - plot_size=p_size; -} -float BakedLight::get_plot_size() const{ - - return plot_size; -} - -void BakedLight::set_bounces(int p_size){ - - bounces=p_size; -} -int BakedLight::get_bounces() const{ - - return bounces; -} - -void BakedLight::set_cell_extra_margin(float p_margin) { - cell_extra_margin=p_margin; -} - -float BakedLight::get_cell_extra_margin() const { - - return cell_extra_margin; -} - -void BakedLight::set_edge_damp(float p_margin) { - edge_damp=p_margin; -} - -float BakedLight::get_edge_damp() const { - - return edge_damp; -} - - -void BakedLight::set_normal_damp(float p_margin) { - normal_damp=p_margin; -} - -float BakedLight::get_normal_damp() const { - - return normal_damp; -} - -void BakedLight::set_tint(float p_margin) { - tint=p_margin; -} - -float BakedLight::get_tint() const { - - return tint; -} - -void BakedLight::set_saturation(float p_margin) { - saturation=p_margin; -} - -float BakedLight::get_saturation() const { - - return saturation; -} - -void BakedLight::set_ao_radius(float p_ao_radius) { - ao_radius=p_ao_radius; -} - -float BakedLight::get_ao_radius() const { - return ao_radius; -} - -void BakedLight::set_ao_strength(float p_ao_strength) { - - ao_strength=p_ao_strength; -} - -float BakedLight::get_ao_strength() const { - - return ao_strength; -} - -void BakedLight::set_realtime_color_enabled(const bool p_realtime_color_enabled) { - - VS::get_singleton()->baked_light_set_realtime_color_enabled(baked_light, p_realtime_color_enabled); -} - -bool BakedLight::get_realtime_color_enabled() const { - - return VS::get_singleton()->baked_light_get_realtime_color_enabled(baked_light); -} - - -void BakedLight::set_realtime_color(const Color &p_realtime_color) { - - VS::get_singleton()->baked_light_set_realtime_color(baked_light, p_realtime_color); -} - -Color BakedLight::get_realtime_color() const { - - return VS::get_singleton()->baked_light_get_realtime_color(baked_light); -} - -void BakedLight::set_realtime_energy(const float p_realtime_energy) { - - VS::get_singleton()->baked_light_set_realtime_energy(baked_light, p_realtime_energy); -} - -float BakedLight::get_realtime_energy() const { - - return VS::get_singleton()->baked_light_get_realtime_energy(baked_light); -} - - - -void BakedLight::set_energy_multiplier(float p_multiplier){ - - energy_multiply=p_multiplier; -} -float BakedLight::get_energy_multiplier() const{ - - return energy_multiply; -} - -void BakedLight::set_gamma_adjust(float p_adjust){ - - gamma_adjust=p_adjust; -} -float BakedLight::get_gamma_adjust() const{ - - return gamma_adjust; -} - -void BakedLight::set_bake_flag(BakeFlags p_flags,bool p_enable){ - - flags[p_flags]=p_enable; -} -bool BakedLight::get_bake_flag(BakeFlags p_flags) const{ - - return flags[p_flags]; -} - -void BakedLight::set_format(Format p_format) { - - format=p_format; - VS::get_singleton()->baked_light_set_lightmap_multiplier(baked_light,format==FORMAT_HDR8?8.0:1.0); -} - -BakedLight::Format BakedLight::get_format() const{ - - return format; -} - -void BakedLight::set_transfer_lightmaps_only_to_uv2(bool p_enable) { - - transfer_only_uv2=p_enable; -} - -bool BakedLight::get_transfer_lightmaps_only_to_uv2() const{ - - return transfer_only_uv2; -} - - -bool BakedLight::_set(const StringName& p_name, const Variant& p_value) { - - String n = p_name; - if (!n.begins_with("lightmap")) - return false; - int idx = n.get_slicec('/',1).to_int(); - ERR_FAIL_COND_V(idx<0,false); - ERR_FAIL_COND_V(idx>lightmaps.size(),false); - - String what = n.get_slicec('/',2); - Ref tex; - Size2 gens; - - if (what=="texture") - tex=p_value; - else if (what=="gen_size") - gens=p_value; - - if (idx==lightmaps.size()) { - if (tex.is_valid() || gens!=Size2()) - add_lightmap(tex,gens); - } else { - if (tex.is_valid()) - set_lightmap_texture(idx,tex); - else if (gens!=Size2()) - set_lightmap_gen_size(idx,gens); - } - - - return true; -} - -bool BakedLight::_get(const StringName& p_name,Variant &r_ret) const{ - - String n = p_name; - if (!n.begins_with("lightmap")) - return false; - int idx = n.get_slicec('/',1).to_int(); - ERR_FAIL_COND_V(idx<0,false); - ERR_FAIL_COND_V(idx>lightmaps.size(),false); - - String what = n.get_slicec('/',2); - - if (what=="texture") { - if (idx==lightmaps.size()) - r_ret=Ref(); - else - r_ret=lightmaps[idx].texture; - - } else if (what=="gen_size") { - - if (idx==lightmaps.size()) - r_ret=Size2(); - else - r_ret=Size2(lightmaps[idx].gen_size); - } else - return false; - - return true; - - -} -void BakedLight::_get_property_list( List *p_list) const{ - - for(int i=0;i<=lightmaps.size();i++) { - - p_list->push_back(PropertyInfo(Variant::VECTOR2,"lightmaps/"+itos(i)+"/gen_size",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR)); - p_list->push_back(PropertyInfo(Variant::OBJECT,"lightmaps/"+itos(i)+"/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture",PROPERTY_USAGE_EDITOR)); - } -} - - -void BakedLight::_bind_methods(){ - - - ObjectTypeDB::bind_method(_MD("set_mode","mode"),&BakedLight::set_mode); - ObjectTypeDB::bind_method(_MD("get_mode"),&BakedLight::get_mode); - - ObjectTypeDB::bind_method(_MD("set_octree","octree"),&BakedLight::set_octree); - ObjectTypeDB::bind_method(_MD("get_octree"),&BakedLight::get_octree); - - ObjectTypeDB::bind_method(_MD("set_light","light"),&BakedLight::set_light); - ObjectTypeDB::bind_method(_MD("get_light"),&BakedLight::get_light); - - ObjectTypeDB::bind_method(_MD("set_sampler_octree","sampler_octree"),&BakedLight::set_sampler_octree); - ObjectTypeDB::bind_method(_MD("get_sampler_octree"),&BakedLight::get_sampler_octree); - - - ObjectTypeDB::bind_method(_MD("add_lightmap","texture:Texture","gen_size"),&BakedLight::add_lightmap); - ObjectTypeDB::bind_method(_MD("erase_lightmap","id"),&BakedLight::erase_lightmap); - ObjectTypeDB::bind_method(_MD("clear_lightmaps"),&BakedLight::clear_lightmaps); - - ObjectTypeDB::bind_method(_MD("_set_lightmap_data","lightmap_data"),&BakedLight::_set_lightmap_data); - ObjectTypeDB::bind_method(_MD("_get_lightmap_data"),&BakedLight::_get_lightmap_data); - - ObjectTypeDB::bind_method(_MD("set_cell_subdivision","cell_subdivision"),&BakedLight::set_cell_subdivision); - ObjectTypeDB::bind_method(_MD("get_cell_subdivision"),&BakedLight::get_cell_subdivision); - - ObjectTypeDB::bind_method(_MD("set_initial_lattice_subdiv","cell_subdivision"),&BakedLight::set_initial_lattice_subdiv); - ObjectTypeDB::bind_method(_MD("get_initial_lattice_subdiv","cell_subdivision"),&BakedLight::get_initial_lattice_subdiv); - - ObjectTypeDB::bind_method(_MD("set_plot_size","plot_size"),&BakedLight::set_plot_size); - ObjectTypeDB::bind_method(_MD("get_plot_size"),&BakedLight::get_plot_size); - - ObjectTypeDB::bind_method(_MD("set_bounces","bounces"),&BakedLight::set_bounces); - ObjectTypeDB::bind_method(_MD("get_bounces"),&BakedLight::get_bounces); - - ObjectTypeDB::bind_method(_MD("set_cell_extra_margin","cell_extra_margin"),&BakedLight::set_cell_extra_margin); - ObjectTypeDB::bind_method(_MD("get_cell_extra_margin"),&BakedLight::get_cell_extra_margin); - - ObjectTypeDB::bind_method(_MD("set_edge_damp","edge_damp"),&BakedLight::set_edge_damp); - ObjectTypeDB::bind_method(_MD("get_edge_damp"),&BakedLight::get_edge_damp); - - ObjectTypeDB::bind_method(_MD("set_normal_damp","normal_damp"),&BakedLight::set_normal_damp); - ObjectTypeDB::bind_method(_MD("get_normal_damp"),&BakedLight::get_normal_damp); - - ObjectTypeDB::bind_method(_MD("set_tint","tint"),&BakedLight::set_tint); - ObjectTypeDB::bind_method(_MD("get_tint"),&BakedLight::get_tint); - - ObjectTypeDB::bind_method(_MD("set_saturation","saturation"),&BakedLight::set_saturation); - ObjectTypeDB::bind_method(_MD("get_saturation"),&BakedLight::get_saturation); - - ObjectTypeDB::bind_method(_MD("set_ao_radius","ao_radius"),&BakedLight::set_ao_radius); - ObjectTypeDB::bind_method(_MD("get_ao_radius"),&BakedLight::get_ao_radius); - - ObjectTypeDB::bind_method(_MD("set_ao_strength","ao_strength"),&BakedLight::set_ao_strength); - ObjectTypeDB::bind_method(_MD("get_ao_strength"),&BakedLight::get_ao_strength); - - ObjectTypeDB::bind_method(_MD("set_realtime_color_enabled", "enabled"), &BakedLight::set_realtime_color_enabled); - ObjectTypeDB::bind_method(_MD("get_realtime_color_enabled"), &BakedLight::get_realtime_color_enabled); - - ObjectTypeDB::bind_method(_MD("set_realtime_color", "tint"), &BakedLight::set_realtime_color); - ObjectTypeDB::bind_method(_MD("get_realtime_color"), &BakedLight::get_realtime_color); - - ObjectTypeDB::bind_method(_MD("set_realtime_energy", "energy"), &BakedLight::set_realtime_energy); - ObjectTypeDB::bind_method(_MD("get_realtime_energy"), &BakedLight::get_realtime_energy); - - ObjectTypeDB::bind_method(_MD("set_format","format"),&BakedLight::set_format); - ObjectTypeDB::bind_method(_MD("get_format"),&BakedLight::get_format); - - ObjectTypeDB::bind_method(_MD("set_transfer_lightmaps_only_to_uv2","enable"),&BakedLight::set_transfer_lightmaps_only_to_uv2); - ObjectTypeDB::bind_method(_MD("get_transfer_lightmaps_only_to_uv2"),&BakedLight::get_transfer_lightmaps_only_to_uv2); - - - - - ObjectTypeDB::bind_method(_MD("set_energy_multiplier","energy_multiplier"),&BakedLight::set_energy_multiplier); - ObjectTypeDB::bind_method(_MD("get_energy_multiplier"),&BakedLight::get_energy_multiplier); - - ObjectTypeDB::bind_method(_MD("set_gamma_adjust","gamma_adjust"),&BakedLight::set_gamma_adjust); - ObjectTypeDB::bind_method(_MD("get_gamma_adjust"),&BakedLight::get_gamma_adjust); - - ObjectTypeDB::bind_method(_MD("set_bake_flag","flag","enabled"),&BakedLight::set_bake_flag); - ObjectTypeDB::bind_method(_MD("get_bake_flag","flag"),&BakedLight::get_bake_flag); - - ADD_PROPERTY( PropertyInfo(Variant::INT,"mode/mode",PROPERTY_HINT_ENUM,"Octree,Lightmaps"),_SCS("set_mode"),_SCS("get_mode")); - - ADD_PROPERTY( PropertyInfo(Variant::INT,"baking/format",PROPERTY_HINT_ENUM,"RGB,HDR8,HDR16"),_SCS("set_format"),_SCS("get_format")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"baking/cell_subdiv",PROPERTY_HINT_RANGE,"4,14,1"),_SCS("set_cell_subdivision"),_SCS("get_cell_subdivision")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"baking/lattice_subdiv",PROPERTY_HINT_RANGE,"1,5,1"),_SCS("set_initial_lattice_subdiv"),_SCS("get_initial_lattice_subdiv")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"baking/light_bounces",PROPERTY_HINT_RANGE,"0,3,1"),_SCS("set_bounces"),_SCS("get_bounces")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"baking/plot_size",PROPERTY_HINT_RANGE,"1.0,16.0,0.01"),_SCS("set_plot_size"),_SCS("get_plot_size")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"baking/energy_mult",PROPERTY_HINT_RANGE,"0.01,4096.0,0.01"),_SCS("set_energy_multiplier"),_SCS("get_energy_multiplier")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"baking/gamma_adjust",PROPERTY_HINT_EXP_EASING),_SCS("set_gamma_adjust"),_SCS("get_gamma_adjust")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"baking/saturation",PROPERTY_HINT_RANGE,"0,8,0.01"),_SCS("set_saturation"),_SCS("get_saturation")); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"baking_flags/diffuse"),_SCS("set_bake_flag"),_SCS("get_bake_flag"),BAKE_DIFFUSE); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"baking_flags/specular"),_SCS("set_bake_flag"),_SCS("get_bake_flag"),BAKE_SPECULAR); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"baking_flags/translucent"),_SCS("set_bake_flag"),_SCS("get_bake_flag"),BAKE_TRANSLUCENT); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"baking_flags/conserve_energy"),_SCS("set_bake_flag"),_SCS("get_bake_flag"),BAKE_CONSERVE_ENERGY); - ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"baking_flags/linear_color"),_SCS("set_bake_flag"),_SCS("get_bake_flag"),BAKE_LINEAR_COLOR); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"lightmap/use_only_uv2"),_SCS("set_transfer_lightmaps_only_to_uv2"),_SCS("get_transfer_lightmaps_only_to_uv2")); - - ADD_PROPERTY( PropertyInfo(Variant::RAW_ARRAY,"octree",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_octree"),_SCS("get_octree")); - ADD_PROPERTY( PropertyInfo(Variant::RAW_ARRAY,"light",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_light"),_SCS("get_light")); - ADD_PROPERTY( PropertyInfo(Variant::INT_ARRAY,"sampler_octree",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_sampler_octree"),_SCS("get_sampler_octree")); - ADD_PROPERTY( PropertyInfo(Variant::ARRAY,"lightmaps",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_lightmap_data"),_SCS("_get_lightmap_data")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/cell_margin",PROPERTY_HINT_RANGE,"0.01,0.8,0.01"),_SCS("set_cell_extra_margin"),_SCS("get_cell_extra_margin")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/edge_damp",PROPERTY_HINT_RANGE,"0.0,8.0,0.1"),_SCS("set_edge_damp"),_SCS("get_edge_damp")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/normal_damp",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_normal_damp"),_SCS("get_normal_damp")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/light_tint",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_tint"),_SCS("get_tint")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_radius",PROPERTY_HINT_RANGE,"0.0,16.0,0.01"),_SCS("set_ao_radius"),_SCS("get_ao_radius")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_strength",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_ao_strength"),_SCS("get_ao_strength")); - - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "realtime/enabled"), _SCS("set_realtime_color_enabled"), _SCS("get_realtime_color_enabled")); - ADD_PROPERTY(PropertyInfo(Variant::COLOR, "realtime/color", PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_realtime_color"), _SCS("get_realtime_color")); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "realtime/energy", PROPERTY_HINT_RANGE, "0.01,4096.0,0.01"), _SCS("set_realtime_energy"), _SCS("get_realtime_energy")); - - - BIND_CONSTANT( MODE_OCTREE ); - BIND_CONSTANT( MODE_LIGHTMAPS ); - - BIND_CONSTANT( BAKE_DIFFUSE ); - BIND_CONSTANT( BAKE_SPECULAR ); - BIND_CONSTANT( BAKE_TRANSLUCENT ); - BIND_CONSTANT( BAKE_CONSERVE_ENERGY ); - BIND_CONSTANT( BAKE_MAX ); - - -} - - -BakedLight::BakedLight() { - - cell_subdiv=8; - lattice_subdiv=4; - plot_size=2.5; - bounces=1; - energy_multiply=2.0; - gamma_adjust=0.7; - cell_extra_margin=0.05; - edge_damp=0.0; - normal_damp=0.0; - saturation=1; - tint=0.0; - ao_radius=2.5; - ao_strength=0.7; - format=FORMAT_RGB8; - transfer_only_uv2=false; - - - flags[BAKE_DIFFUSE]=true; - flags[BAKE_SPECULAR]=false; - flags[BAKE_TRANSLUCENT]=true; - flags[BAKE_CONSERVE_ENERGY]=false; - flags[BAKE_LINEAR_COLOR]=false; - - mode=MODE_OCTREE; - baked_light=VS::get_singleton()->baked_light_create(); -} - -BakedLight::~BakedLight() { - - VS::get_singleton()->free(baked_light); -} -#endif diff --git a/scene/resources/baked_light.h b/scene/resources/baked_light.h index 0eaa3df276..6a0742dd27 100644 --- a/scene/resources/baked_light.h +++ b/scene/resources/baked_light.h @@ -32,169 +32,6 @@ #include "resource.h" #include "scene/resources/texture.h" -#if 0 -class BakedLight : public Resource { - OBJ_TYPE( BakedLight, Resource); -public: - enum Mode { - MODE_OCTREE, - MODE_LIGHTMAPS - }; - - enum Format { - - FORMAT_RGB8, - FORMAT_HDR8, - FORMAT_HDR16 - }; - - enum BakeFlags { - BAKE_DIFFUSE, - BAKE_SPECULAR, - BAKE_TRANSLUCENT, - BAKE_CONSERVE_ENERGY, - BAKE_LINEAR_COLOR, - BAKE_MAX - }; - -private: - - RID baked_light; - Mode mode; - struct LightMap { - Size2i gen_size; - Ref texture; - }; - - - Vector< LightMap> lightmaps; - - //bake vars - int cell_subdiv; - int lattice_subdiv; - float plot_size; - float energy_multiply; - float gamma_adjust; - float cell_extra_margin; - float edge_damp; - float normal_damp; - float tint; - float ao_radius; - float ao_strength; - float saturation; - int bounces; - bool transfer_only_uv2; - Format format; - bool flags[BAKE_MAX]; - - - - void _update_lightmaps(); - - Array _get_lightmap_data() const; - void _set_lightmap_data(Array p_array); - -protected: - - bool _set(const StringName& p_name, const Variant& p_value); - bool _get(const StringName& p_name,Variant &r_ret) const; - void _get_property_list( List *p_list) const; - - static void _bind_methods(); - -public: - - void set_cell_subdivision(int p_subdiv); - int get_cell_subdivision() const; - - void set_initial_lattice_subdiv(int p_size); - int get_initial_lattice_subdiv() const; - - void set_plot_size(float p_size); - float get_plot_size() const; - - void set_bounces(int p_size); - int get_bounces() const; - - void set_energy_multiplier(float p_multiplier); - float get_energy_multiplier() const; - - void set_gamma_adjust(float p_adjust); - float get_gamma_adjust() const; - - void set_cell_extra_margin(float p_margin); - float get_cell_extra_margin() const; - - void set_edge_damp(float p_margin); - float get_edge_damp() const; - - void set_normal_damp(float p_margin); - float get_normal_damp() const; - - void set_tint(float p_margin); - float get_tint() const; - - void set_saturation(float p_saturation); - float get_saturation() const; - - void set_ao_radius(float p_ao_radius); - float get_ao_radius() const; - - void set_ao_strength(float p_ao_strength); - float get_ao_strength() const; - - void set_realtime_color_enabled(const bool p_enabled); - bool get_realtime_color_enabled() const; - - void set_realtime_color(const Color& p_realtime_color); - Color get_realtime_color() const; - - void set_realtime_energy(const float p_realtime_energy); - float get_realtime_energy() const; - - void set_bake_flag(BakeFlags p_flags,bool p_enable); - bool get_bake_flag(BakeFlags p_flags) const; - - void set_format(Format p_margin); - Format get_format() const; - - void set_transfer_lightmaps_only_to_uv2(bool p_enable); - bool get_transfer_lightmaps_only_to_uv2() const; - - void set_mode(Mode p_mode); - Mode get_mode() const; - - void set_octree(const DVector& p_octree); - DVector get_octree() const; - - void set_light(const DVector& p_light); - DVector get_light() const; - - void set_sampler_octree(const DVector& p_sampler_octree); - DVector get_sampler_octree() const; - - - - void add_lightmap(const Ref &p_texture,Size2 p_gen_size=Size2(256,256)); - void set_lightmap_gen_size(int p_idx,const Size2& p_size); - Size2 get_lightmap_gen_size(int p_idx) const; - void set_lightmap_texture(int p_idx,const Ref &p_texture); - Ref get_lightmap_texture(int p_idx) const; - void erase_lightmap(int p_idx); - int get_lightmaps_count() const; - void clear_lightmaps(); - - virtual RID get_rid() const; - - BakedLight(); - ~BakedLight(); -}; - - -VARIANT_ENUM_CAST(BakedLight::Format); -VARIANT_ENUM_CAST(BakedLight::Mode); -VARIANT_ENUM_CAST(BakedLight::BakeFlags); -#endif #endif // BAKED_LIGHT_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 228afffdb5..79560f3486 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -91,6 +91,7 @@ public: Vector materials; Vector light_instances; Vector reflection_probe_instances; + Vector gi_probe_instances; Vector morph_values; @@ -108,12 +109,14 @@ public: float depth; //used for sorting SelfList dependency_item; + InstanceBase *baked_light; //baked light to use + SelfList baked_light_item; virtual void base_removed()=0; virtual void base_changed()=0; virtual void base_material_changed()=0; - InstanceBase() : dependency_item(this) { + InstanceBase() : dependency_item(this), baked_light_item(this) { base_type=VS::INSTANCE_NONE; cast_shadows=VS::SHADOW_CASTING_SETTING_ON; @@ -123,6 +126,7 @@ public: billboard_y=false; depth_layer=0; layer_mask=1; + baked_light=NULL; } }; @@ -144,6 +148,11 @@ public: virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas)=0; virtual bool reflection_probe_instance_postprocess_step(RID p_instance)=0; + virtual RID gi_probe_instance_create()=0; + virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_data)=0; + virtual void gi_probe_instance_set_transform_to_data(RID p_probe,const Transform& p_xform)=0; + virtual void gi_probe_instance_set_bounds(RID p_probe,const Vector3& p_bounds)=0; + virtual void render_scene(const Transform& p_cam_transform,const CameraMatrix& p_cam_projection,bool p_cam_ortogonal,InstanceBase** p_cull_result,int p_cull_count,RID* p_light_cull_result,int p_light_cull_count,RID* p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass)=0; virtual void render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase** p_cull_result,int p_cull_count)=0; @@ -340,6 +349,7 @@ public: virtual VS::LightType light_get_type(RID p_light) const=0; virtual AABB light_get_aabb(RID p_light) const=0; virtual float light_get_param(RID p_light,VS::LightParam p_param)=0; + virtual Color light_get_color(RID p_light)=0; virtual uint64_t light_get_version(RID p_light) const=0; @@ -392,6 +402,39 @@ public: virtual void instance_add_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; virtual void instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase *p_instance)=0; + /* GI PROBE API */ + + virtual RID gi_probe_create()=0; + + virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds)=0; + virtual AABB gi_probe_get_bounds(RID p_probe) const=0; + + virtual void gi_probe_set_cell_size(RID p_probe,float p_range)=0; + virtual float gi_probe_get_cell_size(RID p_probe) const=0; + + virtual void gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform)=0; + virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const=0; + + virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data)=0; + virtual DVector gi_probe_get_dynamic_data(RID p_probe) const=0; + + virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range)=0; + virtual float gi_probe_get_dynamic_range(RID p_probe) const=0; + + + virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth)=0; + virtual DVector gi_probe_get_static_data(RID p_gi_probe) const=0; + virtual VS::GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const=0; + virtual int gi_probe_get_static_data_width(RID p_probe) const=0; + virtual int gi_probe_get_static_data_height(RID p_probe) const=0; + virtual int gi_probe_get_static_data_depth(RID p_probe) const=0; + + virtual RID gi_probe_get_data(RID p_probe)=0; //get data in case this is static + virtual uint32_t gi_probe_get_version(RID p_probe)=0; + + virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth)=0; + virtual void gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data)=0; + /* RENDER TARGET */ enum RenderTargetFlags { diff --git a/servers/visual/visual_server_light_baker.cpp b/servers/visual/visual_server_light_baker.cpp new file mode 100644 index 0000000000..4956d78ab0 --- /dev/null +++ b/servers/visual/visual_server_light_baker.cpp @@ -0,0 +1,6 @@ +#include "visual_server_light_baker.h" + +VisualServerLightBaker::VisualServerLightBaker() +{ + +} diff --git a/servers/visual/visual_server_light_baker.h b/servers/visual/visual_server_light_baker.h new file mode 100644 index 0000000000..42f016f614 --- /dev/null +++ b/servers/visual/visual_server_light_baker.h @@ -0,0 +1,29 @@ +#ifndef VISUALSERVERLIGHTBAKER_H +#define VISUALSERVERLIGHTBAKER_H + +#include "servers/visual_server.h" + +class VisualServerLightBaker { +public: + + struct BakeCell { + + uint32_t cells[8]; + uint32_t neighbours[7]; //one unused + uint32_t albedo; //albedo in RGBE + uint32_t emission; //emissive light in RGBE + uint32_t light[4]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast) + float alpha; //used for upsampling + uint32_t directional_pass; //used for baking directional + + }; + + + + + + + VisualServerLightBaker(); +}; + +#endif // VISUALSERVERLIGHTBAKER_H diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 6ba63a7690..2fa45d1796 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -90,9 +90,10 @@ void VisualServerRaster::draw(){ changes=0; + VSG::rasterizer->begin_frame(); + VSG::scene->update_dirty_instances(); //update scene stuff - VSG::rasterizer->begin_frame(); VSG::viewport->draw_viewports(); VSG::scene->render_probes(); //_draw_cursors_and_margins(); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 78b0e3cadd..191330c66c 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -803,12 +803,39 @@ public: BIND2(portal_set_disable_distance,RID , float ) BIND2(portal_set_disabled_color,RID , const Color& ) - /* CAMERA API */ + /* BAKED LIGHT API */ + + BIND0R(RID, gi_probe_create) + + BIND2(gi_probe_set_bounds,RID,const AABB&) + BIND1RC(AABB,gi_probe_get_bounds,RID) + + BIND2(gi_probe_set_cell_size,RID,float) + BIND1RC(float,gi_probe_get_cell_size,RID) + + BIND2(gi_probe_set_to_cell_xform,RID,const Transform&) + BIND1RC(Transform,gi_probe_get_to_cell_xform,RID) + + BIND2(gi_probe_set_dynamic_range,RID,float) + BIND1RC(float,gi_probe_get_dynamic_range,RID) + + BIND2(gi_probe_set_dynamic_data,RID,const DVector& ) + BIND1RC( DVector,gi_probe_get_dynamic_data,RID) + + BIND6(gi_probe_set_static_data,RID,const DVector&,GIProbeDataFormat,int,int,int) + BIND1RC(DVector,gi_probe_get_static_data,RID) + BIND1RC(GIProbeDataFormat,gi_probe_get_static_data_format,RID) + BIND1RC(int,gi_probe_get_static_data_width,RID) + BIND1RC(int,gi_probe_get_static_data_height,RID) + BIND1RC(int,gi_probe_get_static_data_depth,RID) + #undef BINDBASE //from now on, calls forwarded to this singleton #define BINDBASE VSG::scene + /* CAMERA API */ + BIND0R(RID, camera_create) BIND4(camera_set_perspective,RID,float, float , float ) @@ -936,7 +963,6 @@ public: BIND5(instance_geometry_set_draw_range,RID,float ,float ,float ,float ) BIND2(instance_geometry_set_as_instance_lod,RID,RID ) - #undef BINDBASE //from now on, calls forwarded to this singleton #define BINDBASE VSG::canvas diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 6f7dac7f4d..62b3a23788 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1,9 +1,12 @@ #include "visual_server_scene.h" #include "visual_server_global.h" - +#include "os/os.h" /* CAMERA API */ + + + RID VisualServerScene::camera_create() { Camera * camera = memnew( Camera ); @@ -118,6 +121,28 @@ void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance geom->reflection_dirty=true; return E; //this element should make freeing faster + } else if (B->base_type==VS::INSTANCE_GI_PROBE && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceGIProbeData * gi_probe = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + + InstanceGIProbeData::PairInfo pinfo; + pinfo.geometry=A; + pinfo.L = geom->gi_probes.push_back(B); + + List::Element *E = gi_probe->geometries.push_back(pinfo); + + geom->gi_probes_dirty=true; + + return E; //this element should make freeing faster + + } else if (B->base_type==VS::INSTANCE_GI_PROBE && A->base_type==VS::INSTANCE_LIGHT) { + + InstanceGIProbeData * gi_probe = static_cast(B->base_data); + InstanceLightData * light = static_cast(A->base_data); + + return gi_probe->lights.insert(A); } @@ -134,14 +159,14 @@ void* VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance //attempt to conncet portal A (will go through B anyway) //this is a little hackish, but works fine in practice - } else if (A->base_type==INSTANCE_BAKED_LIGHT || B->base_type==INSTANCE_BAKED_LIGHT) { + } else if (A->base_type==INSTANCE_GI_PROBE || B->base_type==INSTANCE_GI_PROBE) { - if (B->base_type==INSTANCE_BAKED_LIGHT) { + if (B->base_type==INSTANCE_GI_PROBE) { SWAP(A,B); } - ERR_FAIL_COND_V(B->base_type!=INSTANCE_BAKED_LIGHT_SAMPLER,NULL); - B->baked_light_sampler_info->baked_lights.insert(A); + ERR_FAIL_COND_V(B->base_type!=INSTANCE_GI_PROBE_SAMPLER,NULL); + B->gi_probe_sampler_info->gi_probes.insert(A); } else if (A->base_type==INSTANCE_ROOM || B->base_type==INSTANCE_ROOM) { @@ -218,6 +243,28 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance geom->reflection_dirty=true; + } else if (B->base_type==VS::INSTANCE_GI_PROBE && (1<base_type)&VS::INSTANCE_GEOMETRY_MASK) { + + InstanceGIProbeData * gi_probe = static_cast(B->base_data); + InstanceGeometryData * geom = static_cast(A->base_data); + + List::Element *E = reinterpret_cast::Element*>(udata); + + geom->gi_probes.erase(E->get().L); + gi_probe->geometries.erase(E); + + geom->gi_probes_dirty=true; + + + } else if (B->base_type==VS::INSTANCE_GI_PROBE && A->base_type==VS::INSTANCE_LIGHT) { + + InstanceGIProbeData * gi_probe = static_cast(B->base_data); + InstanceLightData * light = static_cast(A->base_data); + + + Set::Element *E = reinterpret_cast::Element*>(udata); + + gi_probe->lights.erase(E); } #if 0 if (A->base_type==INSTANCE_PORTAL) { @@ -232,14 +279,14 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance self->_portal_attempt_connect(A); self->_portal_attempt_connect(B); - } else if (A->base_type==INSTANCE_BAKED_LIGHT || B->base_type==INSTANCE_BAKED_LIGHT) { + } else if (A->base_type==INSTANCE_GI_PROBE || B->base_type==INSTANCE_GI_PROBE) { - if (B->base_type==INSTANCE_BAKED_LIGHT) { + if (B->base_type==INSTANCE_GI_PROBE) { SWAP(A,B); } - ERR_FAIL_COND(B->base_type!=INSTANCE_BAKED_LIGHT_SAMPLER); - B->baked_light_sampler_info->baked_lights.erase(A); + ERR_FAIL_COND(B->base_type!=INSTANCE_GI_PROBE_SAMPLER); + B->gi_probe_sampler_info->gi_probes.erase(A); } else if (A->base_type==INSTANCE_ROOM || B->base_type==INSTANCE_ROOM) { @@ -397,6 +444,25 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ reflection_probe_render_list.remove(&reflection_probe->update_list); } } break; + case VS::INSTANCE_GI_PROBE: { + + InstanceGIProbeData *gi_probe = static_cast(instance->base_data); + + while(gi_probe->dynamic.updating_stage==GI_UPDATE_STAGE_LIGHTING) { + //wait until bake is done if it's baking + OS::get_singleton()->delay_usec(1); + } + if (gi_probe->update_element.in_list()) { + gi_probe_update_list.remove(&gi_probe->update_element); + } + if (gi_probe->dynamic.probe_data.is_valid()) { + VSG::storage->free(gi_probe->dynamic.probe_data); + } + + VSG::scene_render->free(gi_probe->probe_instance); + + } break; + } if (instance->base_data) { @@ -455,20 +521,20 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ } - if (instance->baked_light_info) { + if (instance->gi_probe_info) { - while(instance->baked_light_info->owned_instances.size()) { + while(instance->gi_probe_info->owned_instances.size()) { - Instance *owned=instance->baked_light_info->owned_instances.front()->get(); - owned->baked_light=NULL; - owned->data.baked_light=NULL; - owned->data.baked_light_octree_xform=NULL; + Instance *owned=instance->gi_probe_info->owned_instances.front()->get(); + owned->gi_probe=NULL; + owned->data.gi_probe=NULL; + owned->data.gi_probe_octree_xform=NULL; owned->BLE=NULL; - instance->baked_light_info->owned_instances.pop_front(); + instance->gi_probe_info->owned_instances.pop_front(); } - memdelete(instance->baked_light_info); - instance->baked_light_info=NULL; + memdelete(instance->gi_probe_info); + instance->gi_probe_info=NULL; } @@ -517,18 +583,18 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ } - if (instance->baked_light_sampler_info) { + if (instance->gi_probe_sampler_info) { - while (instance->baked_light_sampler_info->owned_instances.size()) { + while (instance->gi_probe_sampler_info->owned_instances.size()) { - instance_geometry_set_baked_light_sampler(instance->baked_light_sampler_info->owned_instances.front()->get()->self,RID()); + instance_geometry_set_gi_probe_sampler(instance->gi_probe_sampler_info->owned_instances.front()->get()->self,RID()); } - if (instance->baked_light_sampler_info->sampled_light.is_valid()) { - rasterizer->free(instance->baked_light_sampler_info->sampled_light); + if (instance->gi_probe_sampler_info->sampled_light.is_valid()) { + rasterizer->free(instance->gi_probe_sampler_info->sampled_light); } - memdelete( instance->baked_light_sampler_info ); - instance->baked_light_sampler_info=NULL; + memdelete( instance->gi_probe_sampler_info ); + instance->gi_probe_sampler_info=NULL; } #endif @@ -572,6 +638,19 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ reflection_probe->instance=VSG::scene_render->reflection_probe_instance_create(p_base); } break; + case VS::INSTANCE_GI_PROBE: { + + InstanceGIProbeData *gi_probe = memnew( InstanceGIProbeData ); + instance->base_data=gi_probe; + gi_probe->owner=instance; + + if (scenario && !gi_probe->update_element.in_list()) { + gi_probe_update_list.add(&gi_probe->update_element); + } + + gi_probe->probe_instance=VSG::scene_render->gi_probe_instance_create(); + + } break; } @@ -615,20 +694,20 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ instance->base_type=INSTANCE_PORTAL; instance->portal_info = memnew(Instance::PortalInfo); instance->portal_info->portal=portal_owner.get(p_base); - } else if (baked_light_owner.owns(p_base)) { + } else if (gi_probe_owner.owns(p_base)) { - instance->base_type=INSTANCE_BAKED_LIGHT; - instance->baked_light_info=memnew(Instance::BakedLightInfo); - instance->baked_light_info->baked_light=baked_light_owner.get(p_base); + instance->base_type=INSTANCE_GI_PROBE; + instance->gi_probe_info=memnew(Instance::BakedLightInfo); + instance->gi_probe_info->gi_probe=gi_probe_owner.get(p_base); //instance->portal_info = memnew(Instance::PortalInfo); //instance->portal_info->portal=portal_owner.get(p_base); - } else if (baked_light_sampler_owner.owns(p_base)) { + } else if (gi_probe_sampler_owner.owns(p_base)) { - instance->base_type=INSTANCE_BAKED_LIGHT_SAMPLER; - instance->baked_light_sampler_info=memnew( Instance::BakedLightSamplerInfo); - instance->baked_light_sampler_info->sampler=baked_light_sampler_owner.get(p_base); + instance->base_type=INSTANCE_GI_PROBE_SAMPLER; + instance->gi_probe_sampler_info=memnew( Instance::BakedLightSamplerInfo); + instance->gi_probe_sampler_info->sampler=gi_probe_sampler_owner.get(p_base); //instance->portal_info = memnew(Instance::PortalInfo); //instance->portal_info->portal=portal_owner.get(p_base); @@ -676,6 +755,13 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ InstanceReflectionProbeData *reflection_probe = static_cast(instance->base_data); VSG::scene_render->reflection_probe_release_atlas_index(reflection_probe->instance); } break; + case VS::INSTANCE_GI_PROBE: { + + InstanceGIProbeData *gi_probe = static_cast(instance->base_data); + if (gi_probe->update_element.in_list()) { + gi_probe_update_list.remove(&gi_probe->update_element); + } + } break; } @@ -704,6 +790,13 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario){ light->D = scenario->directional_lights.push_back(instance); } } break; + case VS::INSTANCE_GI_PROBE: { + + InstanceGIProbeData *gi_probe = static_cast(instance->base_data); + if (!gi_probe->update_element.in_list()) { + gi_probe_update_list.add(&gi_probe->update_element); + } + } break; } _instance_queue_update(instance,true,true); @@ -1006,13 +1099,13 @@ void VisualServerScene::_update_instance(Instance *p_instance) { else if (p_instance->base_type == INSTANCE_ROOM) { p_instance->room_info->affine_inverse=p_instance->data.transform.affine_inverse(); - } else if (p_instance->base_type == INSTANCE_BAKED_LIGHT) { + } else if (p_instance->base_type == INSTANCE_GI_PROBE) { Transform scale; - scale.basis.scale(p_instance->baked_light_info->baked_light->octree_aabb.size); - scale.origin=p_instance->baked_light_info->baked_light->octree_aabb.pos; + scale.basis.scale(p_instance->gi_probe_info->gi_probe->octree_aabb.size); + scale.origin=p_instance->gi_probe_info->gi_probe->octree_aabb.pos; //print_line("scale: "+scale); - p_instance->baked_light_info->affine_inverse=(p_instance->data.transform*scale).affine_inverse(); + p_instance->gi_probe_info->affine_inverse=(p_instance->data.transform*scale).affine_inverse(); } @@ -1077,6 +1170,13 @@ void VisualServerScene::_update_instance(Instance *p_instance) { pairable_mask=p_instance->visible?VS::INSTANCE_GEOMETRY_MASK:0; pairable=true; } + + if (p_instance->base_type == VS::INSTANCE_GI_PROBE) { + //lights and geometries + pairable_mask=p_instance->visible?VS::INSTANCE_GEOMETRY_MASK|(1<base_type == VS::INSTANCE_PORTAL) { @@ -1085,9 +1185,9 @@ void VisualServerScene::_update_instance(Instance *p_instance) { pairable=true; } - if (p_instance->base_type == VS::INSTANCE_BAKED_LIGHT_SAMPLER) { + if (p_instance->base_type == VS::INSTANCE_GI_PROBE_SAMPLER) { - pairable_mask=(1<reflection_probe_get_aabb(p_instance->base); } break; + case VisualServer::INSTANCE_GI_PROBE: { + + new_aabb = VSG::storage->gi_probe_get_bounds(p_instance->base); + + } break; #if 0 case VisualServer::INSTANCE_ROOM: { @@ -1208,18 +1313,18 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { } } break; - case VisualServer::INSTANCE_BAKED_LIGHT: { + case VisualServer::INSTANCE_GI_PROBE: { - BakedLight *baked_light = baked_light_owner.get( p_instance->base ); - ERR_FAIL_COND(!baked_light); - new_aabb=baked_light->octree_aabb; + BakedLight *gi_probe = gi_probe_owner.get( p_instance->base ); + ERR_FAIL_COND(!gi_probe); + new_aabb=gi_probe->octree_aabb; } break; - case VisualServer::INSTANCE_BAKED_LIGHT_SAMPLER: { + case VisualServer::INSTANCE_GI_PROBE_SAMPLER: { - BakedLightSampler *baked_light_sampler = baked_light_sampler_owner.get( p_instance->base ); - ERR_FAIL_COND(!baked_light_sampler); - float radius = baked_light_sampler->params[VS::BAKED_LIGHT_SAMPLER_RADIUS]; + BakedLightSampler *gi_probe_sampler = gi_probe_sampler_owner.get( p_instance->base ); + ERR_FAIL_COND(!gi_probe_sampler); + float radius = gi_probe_sampler->params[VS::BAKED_LIGHT_SAMPLER_RADIUS]; new_aabb=AABB(Vector3(-radius,-radius,-radius),Vector3(radius*2,radius*2,radius*2)); @@ -1805,6 +1910,13 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came } } + } else if (ins->base_type==VS::INSTANCE_GI_PROBE && ins->visible) { + + InstanceGIProbeData * gi_probe = static_cast(ins->base_data); + if (!gi_probe->update_element.in_list()) { + gi_probe_update_list.add(&gi_probe->update_element); + } + } else if ((1<base_type)&VS::INSTANCE_GEOMETRY_MASK && ins->visible && ins->cast_shadows!=VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) { keep=true; @@ -1865,10 +1977,10 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came if (max>cull_range.max) cull_range.max=max; - if (ins->sampled_light && ins->sampled_light->baked_light_sampler_info->last_pass!=render_pass) { + if (ins->sampled_light && ins->sampled_light->gi_probe_sampler_info->last_pass!=render_pass) { if (light_samplers_culledsampled_light; - ins->sampled_light->baked_light_sampler_info->last_pass=render_pass; + ins->sampled_light->gi_probe_sampler_info->last_pass=render_pass; } } } @@ -1908,6 +2020,21 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came geom->reflection_dirty=false; } + if (geom->gi_probes_dirty) { + int l=0; + //only called when reflection probe AABB enter/exit this geometry + ins->gi_probe_instances.resize(geom->gi_probes.size()); + + for (List::Element *E=geom->gi_probes.front();E;E=E->next()) { + + InstanceGIProbeData * gi_probe = static_cast(E->get()->base_data); + + ins->gi_probe_instances[l++]=gi_probe->probe_instance; + } + + geom->gi_probes_dirty=false; + } + ins->depth = near_plane.distance_to(ins->transform.origin); ins->depth_layer=CLAMP(int(ins->depth*8/z_far),0,7); @@ -2117,7 +2244,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came } -bool VisualServerScene::_render_probe_step(Instance* p_instance,int p_step) { +bool VisualServerScene::_render_reflection_probe_step(Instance* p_instance,int p_step) { InstanceReflectionProbeData *reflection_probe = static_cast(p_instance->base_data); Scenario *scenario = p_instance->scenario; @@ -2188,18 +2315,539 @@ bool VisualServerScene::_render_probe_step(Instance* p_instance,int p_step) { return false; } +void VisualServerScene::_gi_probe_fill_local_data(int p_idx, int p_level, int p_x, int p_y, int p_z, const GIProbeDataCell* p_cell, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, Vector *prev_cell) { + + if (p_level==p_header->cell_subdiv-1) { + + Vector3 emission; + emission.x=(p_cell[p_idx].emission>>24)/255.0; + emission.y=((p_cell[p_idx].emission>>16)&0xFF)/255.0; + emission.z=((p_cell[p_idx].emission>>8)&0xFF)/255.0; + float l = (p_cell[p_idx].emission&0xFF)/255.0; + l*=8.0; + + emission*=l; + + p_local_data[p_idx].energy[0]=uint16_t(emission.x*1024); //go from 0 to 1024 for light + p_local_data[p_idx].energy[1]=uint16_t(emission.y*1024); //go from 0 to 1024 for light + p_local_data[p_idx].energy[2]=uint16_t(emission.z*1024); //go from 0 to 1024 for light + } else { + + p_local_data[p_idx].energy[0]=0; + p_local_data[p_idx].energy[1]=0; + p_local_data[p_idx].energy[2]=0; + + int half=(1<<(p_header->cell_subdiv-1))>>(p_level+1); + + for(int i=0;i<8;i++) { + + uint32_t child = p_cell[p_idx].children[i]; + + if (child==0xFFFFFFFF) + continue; + + int x = p_x; + int y = p_y; + int z = p_z; + + if (i&1) + x+=half; + if (i&2) + y+=half; + if (i&4) + z+=half; + + _gi_probe_fill_local_data(child,p_level+1,x,y,z,p_cell,p_header,p_local_data,prev_cell); + } + } + + //position for each part of the mipmaped texture + p_local_data[p_idx].pos[0]=p_x>>(p_header->cell_subdiv-p_level-1); + p_local_data[p_idx].pos[1]=p_y>>(p_header->cell_subdiv-p_level-1); + p_local_data[p_idx].pos[2]=p_z>>(p_header->cell_subdiv-p_level-1); + + prev_cell[p_level].push_back(p_idx); + +} + + +void VisualServerScene::_gi_probe_bake_threads(void* self) { + + VisualServerScene* vss = (VisualServerScene*)self; + vss->_gi_probe_bake_thread(); +} + +void VisualServerScene::_setup_gi_probe(Instance *p_instance) { + + + InstanceGIProbeData *probe = static_cast(p_instance->base_data); + + if (probe->dynamic.probe_data.is_valid()) { + VSG::storage->free(probe->dynamic.probe_data); + probe->dynamic.probe_data=RID(); + } + + probe->dynamic.light_data=VSG::storage->gi_probe_get_dynamic_data(p_instance->base); + + if (probe->dynamic.light_data.size()) { + //using dynamic data + DVector::Read r=probe->dynamic.light_data.read(); + + const GIProbeDataHeader *header = (GIProbeDataHeader *)r.ptr(); + + probe->dynamic.local_data.resize(header->cell_count); + + DVector::Write ldw = probe->dynamic.local_data.write(); + + const GIProbeDataCell *cells = (GIProbeDataCell*)&r[16]; + + probe->dynamic.level_cell_lists.resize(header->cell_subdiv); + + _gi_probe_fill_local_data(0,0,0,0,0,cells,header,ldw.ptr(),probe->dynamic.level_cell_lists.ptr()); + + probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth); + + + probe->dynamic.mipmaps_3d.clear(); + + probe->dynamic.grid_size[0]=header->width; + probe->dynamic.grid_size[1]=header->height; + probe->dynamic.grid_size[2]=header->depth; + + for(int i=0;i<(int)header->cell_subdiv;i++) { + + uint32_t x = header->width >> i; + uint32_t y = header->height >> i; + uint32_t z = header->depth >> i; + + //create and clear mipmap + DVector mipmap; + mipmap.resize(x*y*z*4); + DVector::Write w = mipmap.write(); + zeromem(w.ptr(),x*y*z*4); + w = DVector::Write(); + + probe->dynamic.mipmaps_3d.push_back(mipmap); + + if (x<=1 || y<=1 || z<=1) + break; + } + + probe->dynamic.updating_stage=GI_UPDATE_STAGE_CHECK; + probe->invalid=false; + probe->dynamic.enabled=true; + + Transform cell_to_xform = VSG::storage->gi_probe_get_to_cell_xform(p_instance->base); + AABB bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); + float cell_size = VSG::storage->gi_probe_get_cell_size(p_instance->base); + + probe->dynamic.light_to_cell_xform=cell_to_xform * p_instance->transform.affine_inverse(); + + VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,probe->dynamic.probe_data); + VSG::scene_render->gi_probe_instance_set_transform_to_data(probe->probe_instance,probe->dynamic.light_to_cell_xform); + + + + VSG::scene_render->gi_probe_instance_set_bounds(probe->probe_instance,bounds.size/cell_size); + + + } else { + RID data = VSG::storage->gi_probe_get_data(p_instance->base); + + probe->dynamic.enabled=false; + probe->invalid=!data.is_valid(); + if (data.is_valid()) { + VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,data); + } + } + + probe->base_version=VSG::storage->gi_probe_get_version(p_instance->base); + +} + +void VisualServerScene::_gi_probe_bake_thread() { + + while(true) { + + probe_bake_sem->wait(); + if (probe_bake_thread_exit) { + break; + } + + Instance* to_bake=NULL; + + probe_bake_mutex->lock(); + + if (!probe_bake_list.empty()) { + to_bake=probe_bake_list.front()->get(); + probe_bake_list.pop_front(); + + } + probe_bake_mutex->unlock(); + + if (!to_bake) + continue; + + _bake_gi_probe(to_bake); + } +} + + + +uint32_t VisualServerScene::_gi_bake_find_cell(const GIProbeDataCell *cells,int x,int y, int z,int p_cell_subdiv) { + + + uint32_t cell=0; + + int ofs_x=0; + int ofs_y=0; + int ofs_z=0; + int size = 1<<(p_cell_subdiv-1); + int half=size/2; + + if (x<0 || x>=size) + return -1; + if (y<0 || y>=size) + return -1; + if (z<0 || z>=size) + return -1; + + for(int i=0;i= ofs_x + half) { + child|=1; + ofs_x+=half; + } + if (y >= ofs_y + half) { + child|=2; + ofs_y+=half; + } + if (z >= ofs_z + half) { + child|=4; + ofs_z+=half; + } + + cell = bc->children[child]; + if (cell==0xFFFFFFFF) + return 0xFFFFFFFF; + + half>>=1; + } + + return cell; + +} + +void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,const GIProbeDataCell *cells,InstanceGIProbeData::LocalData *local_data,const uint32_t *leaves,int leaf_count, const InstanceGIProbeData::LightCache& light_cache,int sign) { + + + int light_r = int(light_cache.color.r * light_cache.energy * 1024.0)*sign; + int light_g = int(light_cache.color.g * light_cache.energy * 1024.0)*sign; + int light_b = int(light_cache.color.b * light_cache.energy * 1024.0)*sign; + + switch(light_cache.type) { + + case VS::LIGHT_DIRECTIONAL: { + + float limits[3]={float(header->width),float(header->height),float(header->depth)}; + Plane clip[3]; + int clip_planes=0; + float max_len = Vector3(limits[0],limits[1],limits[2]).length()*1.1; + + Vector3 light_axis = -light_cache.transform.basis.get_axis(2).normalized(); + + print_line("transform directional, axis: "+light_axis); + print_line("limits: "+Vector3(limits[0],limits[1],limits[2])); + + for(int i=0;i<3;i++) { + + if (ABS(light_axis[i])= unorm.y) && (unorm.x >= unorm.z) ) { + // x code + unorm = normal.x > 0.0 ? Vector3( 1.0, 0.0, 0.0 ) : Vector3( -1.0, 0.0, 0.0 ) ; + } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { + // y code + unorm = normal.y > 0.0 ? Vector3( 0.0, 1.0, 0.0 ) : Vector3( 0.0, -1.0, 0.0 ) ; + } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { + // z code + unorm = normal.z > 0.0 ? Vector3( 0.0, 0.0, 1.0 ) : Vector3( 0.0, 0.0, -1.0 ) ; + } else { + // oh-no we messed up code + // has to be + unorm = Vector3( 1.0, 0.0, 0.0 ); + } + + distance_adv = 1.0/normal.dot(unorm); + + } + + int success_count=0; + + uint64_t us = OS::get_singleton()->get_ticks_usec(); + + for(int i=0;ipos[0]+0.5,light->pos[1]+0.5,light->pos[2]+0.5); + + + Vector3 from = to - max_len * light_axis; + + for(int j=0;j-distance_adv) { //use this to avoid precision errors + + result = _gi_bake_find_cell(cells,int(floor(from.x)),int(floor(from.y)),int(floor(from.z)),header->cell_subdiv); + if (result!=0xFFFFFFFF) { + break; + } + + from+=light_axis*distance_adv; + distance-=distance_adv; + } + + if (result==idx) { + //cell hit itself! hooray! + light->energy[0]+=(uint32_t(light_r)*((cell->albedo>>16)&0xFF))>>8; + light->energy[1]+=(uint32_t(light_g)*((cell->albedo>>8)&0xFF))>>8; + light->energy[2]+=(uint32_t(light_b)*((cell->albedo)&0xFF))>>8; + success_count++; + } + } + print_line("BAKE TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); + print_line("valid cells: "+itos(success_count)); + + + } break; + } +} + + +void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data) { + + //average light to upper level + p_local_data[p_idx].energy[0]=0; + p_local_data[p_idx].energy[1]=0; + p_local_data[p_idx].energy[2]=0; + + for(int i=0;i<8;i++) { + + uint32_t child = p_cells[p_idx].children[i]; + + if (child==0xFFFFFFFF) + continue; + + if (p_level+1 < (int)p_header->cell_subdiv-1) { + _bake_gi_downscale_light(child,p_level+1,p_cells,p_header,p_local_data); + } + + p_local_data[p_idx].energy[0]+=p_local_data[child].energy[0]; + p_local_data[p_idx].energy[1]+=p_local_data[child].energy[1]; + p_local_data[p_idx].energy[2]+=p_local_data[child].energy[2]; + + } + + //divide by eight for average + p_local_data[p_idx].energy[0]>>=3; + p_local_data[p_idx].energy[1]>>=3; + p_local_data[p_idx].energy[2]>>=3; + +} + + +void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { + + InstanceGIProbeData * probe_data = static_cast(p_gi_probe->base_data); + + DVector::Read r=probe_data->dynamic.light_data.read(); + + const GIProbeDataHeader *header = (const GIProbeDataHeader *)r.ptr(); + const GIProbeDataCell *cells = (const GIProbeDataCell*)&r[16]; + + int leaf_count = probe_data->dynamic.level_cell_lists[ header->cell_subdiv -1 ].size(); + const uint32_t *leaves = probe_data->dynamic.level_cell_lists[ header->cell_subdiv -1 ].ptr(); + + DVector::Write ldw = probe_data->dynamic.local_data.write(); + + InstanceGIProbeData::LocalData *local_data = ldw.ptr(); + + + //remove what must be removed + for (Map::Element *E=probe_data->dynamic.light_cache.front();E;E=E->next()) { + + RID rid = E->key(); + const InstanceGIProbeData::LightCache& lc = E->get(); + + if (!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid]==lc)) { + //erase light data + + _bake_gi_probe_light(header,cells,local_data,leaves,leaf_count,lc,-1); + } + + } + + //add what must be added + for (Map::Element *E=probe_data->dynamic.light_cache_changes.front();E;E=E->next()) { + + RID rid = E->key(); + const InstanceGIProbeData::LightCache& lc = E->get(); + + if (!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid]==lc)) { + //add light data + + _bake_gi_probe_light(header,cells,local_data,leaves,leaf_count,lc,1); + } + } + + SWAP(probe_data->dynamic.light_cache_changes,probe_data->dynamic.light_cache); + + //downscale to lower res levels + _bake_gi_downscale_light(0,0,cells,header,local_data); + + //plot result to 3D texture! + + for(int i=0;i<(int)header->cell_subdiv;i++) { + + int stage = header->cell_subdiv - i -1; + + if (stage >= probe_data->dynamic.mipmaps_3d.size()) + continue; //no mipmap for this one + + print_line("generating mipmap stage: "+itos(stage)); + int level_cell_count = probe_data->dynamic.level_cell_lists[ i ].size(); + const uint32_t *level_cells = probe_data->dynamic.level_cell_lists[ i ].ptr(); + + DVector::Write lw = probe_data->dynamic.mipmaps_3d[stage].write(); + uint8_t *mipmapw = lw.ptr(); + + uint32_t sizes[3]={header->width>>stage,header->height>>stage,header->depth>>stage}; + + for(int j=0;j>2; + uint32_t g = local_data[idx].energy[1]>>2; + uint32_t b = local_data[idx].energy[2]>>2; + uint32_t a = cells[idx].alpha>>8; + + uint32_t mm_ofs = sizes[0]*sizes[1]*(local_data[idx].pos[2]) + sizes[0]*(local_data[idx].pos[1]) + (local_data[idx].pos[0]); + mm_ofs*=4; //for RGBA (4 bytes) + + mipmapw[mm_ofs+0]=uint8_t(CLAMP(r,0,255)); + mipmapw[mm_ofs+1]=uint8_t(CLAMP(g,0,255)); + mipmapw[mm_ofs+2]=uint8_t(CLAMP(b,0,255)); + mipmapw[mm_ofs+3]=uint8_t(CLAMP(a,0,255)); + + + } + } + + //send back to main thread to update un little chunks + probe_data->dynamic.updating_stage=GI_UPDATE_STAGE_UPLOADING; + +} + +bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { + + InstanceGIProbeData * probe_data = static_cast(p_gi_probe->base_data); + + probe_data->dynamic.light_cache_changes.clear(); + + bool all_equal=true; + + + for (List::Element *E=p_gi_probe->scenario->directional_lights.front();E;E=E->next()) { + + InstanceGIProbeData::LightCache lc; + lc.type=VSG::storage->light_get_type(E->get()->base); + lc.color=VSG::storage->light_get_color(E->get()->base); + lc.energy=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_ENERGY); + lc.radius=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_RANGE); + lc.attenuation=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_ATTENUATION); + lc.spot_angle=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_SPOT_ANGLE); + lc.spot_attenuation=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_SPOT_ATTENUATION); + lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform; + + if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self]==lc)) { + all_equal=false; + } + + probe_data->dynamic.light_cache_changes[E->get()->self]=lc; + + } + + + for (Set::Element *E=probe_data->lights.front();E;E=E->next()) { + + InstanceGIProbeData::LightCache lc; + lc.type=VSG::storage->light_get_type(E->get()->base); + lc.color=VSG::storage->light_get_color(E->get()->base); + lc.energy=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_ENERGY); + lc.radius=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_RANGE); + lc.attenuation=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_ATTENUATION); + lc.spot_angle=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_SPOT_ANGLE); + lc.spot_attenuation=VSG::storage->light_get_param(E->get()->base,VS::LIGHT_PARAM_SPOT_ATTENUATION); + lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform; + + if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self]==lc)) { + all_equal=false; + } + + probe_data->dynamic.light_cache_changes[E->get()->self]=lc; + } + + //lighting changed from after to before, must do some updating + return !all_equal || probe_data->dynamic.light_cache_changes.size()!=probe_data->dynamic.light_cache.size(); + +} void VisualServerScene::render_probes() { + /* REFLECTION PROBES */ - SelfList *probe = reflection_probe_render_list.first(); + SelfList *ref_probe = reflection_probe_render_list.first(); bool busy=false; - while(probe) { + while(ref_probe) { - SelfList *next=probe->next(); - RID base = probe->self()->owner->base; + SelfList *next=ref_probe->next(); + RID base = ref_probe->self()->owner->base; switch(VSG::storage->reflection_probe_get_update_mode(base)) { @@ -2207,11 +2855,11 @@ void VisualServerScene::render_probes() { if (busy) //already rendering something break; - bool done = _render_probe_step(probe->self()->owner,probe->self()->render_step); + bool done = _render_reflection_probe_step(ref_probe->self()->owner,ref_probe->self()->render_step); if (done) { - reflection_probe_render_list.remove(probe); + reflection_probe_render_list.remove(ref_probe); } else { - probe->self()->render_step++; + ref_probe->self()->render_step++; } busy=true; //do not render another one of this kind @@ -2221,17 +2869,92 @@ void VisualServerScene::render_probes() { int step=0; bool done=false; while(!done) { - done = _render_probe_step(probe->self()->owner,step); + done = _render_reflection_probe_step(ref_probe->self()->owner,step); step++; } - reflection_probe_render_list.remove(probe); + reflection_probe_render_list.remove(ref_probe); } break; } - probe=next; + ref_probe=next; } + + /* GI PROBES */ + + SelfList *gi_probe = gi_probe_update_list.first(); + + while(gi_probe) { + + SelfList *next=gi_probe->next(); + + InstanceGIProbeData *probe = gi_probe->self(); + Instance *instance_probe = probe->owner; + + //check if probe must be setup, but don't do if on the lighting thread + + bool force_lighting=false; + + if (probe->invalid || (probe->dynamic.updating_stage==GI_UPDATE_STAGE_CHECK && probe->base_version!=VSG::storage->gi_probe_get_version(instance_probe->base))) { + + _setup_gi_probe(instance_probe); + force_lighting=true; + } + + if (probe->invalid==false && probe->dynamic.enabled) { + + switch(probe->dynamic.updating_stage) { + case GI_UPDATE_STAGE_CHECK: { + + if (_check_gi_probe(instance_probe) || force_lighting) { + //send to lighting thread + probe->dynamic.updating_stage=GI_UPDATE_STAGE_LIGHTING; + +#ifndef NO_THREADS + probe_bake_mutex->lock(); + probe_bake_list.push_back(instance_probe); + probe_bake_mutex->unlock(); + probe_bake_sem->post(); + +#else + + _bake_gi_probe(instance_probe); +#endif + + } + } break; + case GI_UPDATE_STAGE_LIGHTING: { + //do none, wait til done! + + } break; + case GI_UPDATE_STAGE_UPLOADING: { + + uint64_t us = OS::get_singleton()->get_ticks_usec(); + + for(int i=0;i<(int)probe->dynamic.mipmaps_3d.size();i++) { + + int mmsize = probe->dynamic.mipmaps_3d[i].size(); + DVector::Read r = probe->dynamic.mipmaps_3d[i].read(); + VSG::storage->gi_probe_dynamic_data_update_rgba8(probe->dynamic.probe_data,0,probe->dynamic.grid_size[2]>>i,i,r.ptr()); + } + + + probe->dynamic.updating_stage=GI_UPDATE_STAGE_CHECK; + +// print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); + } break; + + } + } + //_update_gi_probe(gi_probe->self()->owner); + + + gi_probe=next; + } + + + } void VisualServerScene::_update_dirty_instance(Instance *p_instance) { @@ -2423,10 +3146,32 @@ bool VisualServerScene::free(RID p_rid) { VisualServerScene *VisualServerScene::singleton=NULL; + VisualServerScene::VisualServerScene() { +#ifndef NO_THREADS + probe_bake_sem = Semaphore::create(); + probe_bake_mutex = Mutex::create(); + probe_bake_thread = Thread::create(_gi_probe_bake_threads,this); + probe_bake_thread_exit=false; +#endif + render_pass=1; singleton=this; } + +VisualServerScene::~VisualServerScene() { + +#ifndef NO_THREADS + probe_bake_thread_exit=true; + Thread::wait_to_finish(probe_bake_thread); + memdelete(probe_bake_thread); + memdelete(probe_bake_sem); + memdelete(probe_bake_mutex); + +#endif + + +} diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 0eaad45c97..63cb1fd2b8 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -7,6 +7,9 @@ #include "allocators.h" #include "octree.h" #include "self_list.h" +#include "os/thread.h" +#include "os/semaphore.h" +#include "semaphore.h" class VisualServerScene { public: @@ -69,6 +72,8 @@ public: #endif + /* CAMERA API */ + struct Camera : public RID_Data { enum Type { @@ -141,6 +146,7 @@ public: */ + /* SCENARIO API */ struct Instance; @@ -296,11 +302,15 @@ public: List reflection_probes; bool reflection_dirty; + List gi_probes; + bool gi_probes_dirty; + InstanceGeometryData() { lighting_dirty=false; reflection_dirty=true; can_cast_shadows=true; + gi_probes_dirty=true; } }; @@ -310,7 +320,7 @@ public: Instance *owner; struct PairInfo { - List::Element *L; //light iterator in geometry + List::Element *L; //reflection iterator in geometry Instance *geometry; }; List geometries; @@ -346,14 +356,112 @@ public: List geometries; + Instance *baked_light; + InstanceLightData() { shadow_dirty=true; D=NULL; last_version=0; + baked_light=NULL; } }; + struct InstanceGIProbeData : public InstanceBaseData { + + + Instance *owner; + + struct PairInfo { + List::Element *L; //gi probe iterator in geometry + Instance *geometry; + }; + + List geometries; + + Set lights; + + struct LightCache { + + VS::LightType type; + Transform transform; + Color color; + float energy; + float radius; + float attenuation; + float spot_angle; + float spot_attenuation; + + bool operator==(const LightCache& p_cache) { + + return (type==p_cache.type && + transform==p_cache.transform && + color==p_cache.color && + energy==p_cache.energy && + radius==p_cache.radius && + attenuation==p_cache.attenuation && + spot_angle==p_cache.spot_angle && + spot_attenuation==p_cache.spot_attenuation); + } + + LightCache() { + + type=VS::LIGHT_DIRECTIONAL; + energy=1.0; + radius=1.0; + attenuation=1.0; + spot_angle=1.0; + spot_attenuation=1.0; + + } + + }; + + struct LocalData { + uint16_t pos[3]; + uint16_t energy[3]; //using 0..1024 for float range 0..1. integer is needed for deterministic add/remove of lights + }; + + + struct Dynamic { + + Map light_cache; + Map light_cache_changes; + DVector light_data; + DVector local_data; + Vector > level_cell_lists; + RID probe_data; + bool enabled; + + Vector< DVector > mipmaps_3d; + + int updating_stage; + + int grid_size[3]; + + Transform light_to_cell_xform; + + } dynamic; + + + RID probe_instance; + + + bool invalid; + uint32_t base_version; + + SelfList update_element; + + InstanceGIProbeData() : update_element(this) { + invalid=true; + base_version=0; + } + + }; + + + SelfList::List gi_probe_update_list; + Instance *instance_cull_result[MAX_INSTANCE_CULL]; Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps @@ -410,11 +518,61 @@ public: void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas); void update_dirty_instances(); - bool _render_probe_step(Instance* p_instance,int p_step); + //probes + struct GIProbeDataHeader { + + uint32_t version; + uint32_t cell_subdiv; + uint32_t width; + uint32_t height; + uint32_t depth; + uint32_t cell_count; + uint32_t leaf_cell_count; + }; + + + struct GIProbeDataCell { + + uint32_t children[8]; + uint32_t albedo; + uint32_t emission; + uint32_t sides_used; + uint32_t alpha; + }; + + enum { + GI_UPDATE_STAGE_CHECK, + GI_UPDATE_STAGE_LIGHTING, + GI_UPDATE_STAGE_UPLOADING, + }; + + void _gi_probe_bake_thread(); + static void _gi_probe_bake_threads(void*); + + volatile bool probe_bake_thread_exit; + Thread *probe_bake_thread; + Semaphore *probe_bake_sem; + Mutex *probe_bake_mutex; + List probe_bake_list; + + bool _render_reflection_probe_step(Instance* p_instance,int p_step); + void _gi_probe_fill_local_data(int p_idx,int p_level,int p_x,int p_y,int p_z,const GIProbeDataCell* p_cell,const GIProbeDataHeader *p_header,InstanceGIProbeData::LocalData *p_local_data,Vector *prev_cell); + + _FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells,int x,int y, int z,int p_cell_subdiv); + void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data); + + void _bake_gi_probe_light(const GIProbeDataHeader *header,const GIProbeDataCell *cells,InstanceGIProbeData::LocalData *local_data,const uint32_t *leaves,int p_leaf_count, const InstanceGIProbeData::LightCache& light_cache,int p_sign); + void _bake_gi_probe(Instance *p_probe); + bool _check_gi_probe(Instance *p_gi_probe); + void _setup_gi_probe(Instance *p_instance); + void render_probes(); + + bool free(RID p_rid); VisualServerScene(); + ~VisualServerScene(); }; #endif // VISUALSERVERSCENE_H diff --git a/servers/visual_server.h b/servers/visual_server.h index 7558fbf818..6f2aa73952 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -445,7 +445,39 @@ public: virtual void portal_set_disable_distance(RID p_portal, float p_distance)=0; virtual void portal_set_disabled_color(RID p_portal, const Color& p_color)=0; - /* BAKED LIGHT API */ + /* GI PROBE API */ + + virtual RID gi_probe_create()=0; + + virtual void gi_probe_set_bounds(RID p_probe,const AABB& p_bounds)=0; + virtual AABB gi_probe_get_bounds(RID p_probe) const=0; + + virtual void gi_probe_set_cell_size(RID p_probe,float p_range)=0; + virtual float gi_probe_get_cell_size(RID p_probe) const=0; + + virtual void gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform)=0; + virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const=0; + + virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data)=0; + virtual DVector gi_probe_get_dynamic_data(RID p_probe) const=0; + + virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range)=0; + virtual float gi_probe_get_dynamic_range(RID p_probe) const=0; + + enum GIProbeDataFormat { + GI_PROBE_DATA_RGBA8, + GI_PROBE_DATA_DXT5, + GI_PROBE_DATA_ETC2_EAC, + }; + + virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,GIProbeDataFormat p_format,int p_width,int p_height,int p_depth)=0; + virtual DVector gi_probe_get_static_data(RID p_gi_probe) const=0; + virtual GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const=0; + virtual int gi_probe_get_static_data_width(RID p_probe) const=0; + virtual int gi_probe_get_static_data_height(RID p_probe) const=0; + virtual int gi_probe_get_static_data_depth(RID p_probe) const=0; + + /* CAMERA API */ @@ -600,9 +632,9 @@ public: INSTANCE_REFLECTION_PROBE, INSTANCE_ROOM, INSTANCE_PORTAL, + INSTANCE_GI_PROBE, INSTANCE_MAX, - /*INSTANCE_BAKED_LIGHT, - INSTANCE_BAKED_LIGHT_SAMPLER,*/ + /*INSTANCE_BAKED_LIGHT_SAMPLER,*/ INSTANCE_GEOMETRY_MASK=(1< texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,texture); + material->set_texture(FixedSpatialMaterial::TEXTURE_ALBEDO,texture); + material->set_albedo(Color(1,1,1,1)); // material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1,1)); } else { missing_textures.push_back(texfile.get_file()); @@ -413,6 +414,8 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_texture(FixedSpatialMaterial::TEXTURE_SPECULAR,texture); + material->set_specular(Color(1,1,1,1)); // material->set_texture(FixedSpatialMaterial::PARAM_SPECULAR,texture); // material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,Color(1,1,1,1)); @@ -435,7 +438,9 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { -// material->set_texture(FixedSpatialMaterial::PARAM_EMISSION,texture); + material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION,texture); + material->set_emission(Color(1,1,1,1)); + // material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { // missing_textures.push_back(texfile.get_file()); @@ -455,6 +460,8 @@ Error ColladaImport::_create_material(const String& p_target) { Ref texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL,texture); +// material->set_emission(Color(1,1,1,1)); // material->set_texture(FixedSpatialMaterial::PARAM_NORMAL,texture); }else { @@ -466,8 +473,10 @@ Error ColladaImport::_create_material(const String& p_target) { // material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); -// material->set_flag(Material::FLAG_DOUBLE_SIDED,effect.double_sided); -// material->set_flag(Material::FLAG_UNSHADED,effect.unshaded); + if (effect.double_sided) { + material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); + } + material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,effect.unshaded); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 41b245eb7d..e3fb8986c6 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1692,7 +1692,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map String str=name; int layer = str.substr(str.find("lm")+3,str.length()).to_int(); - mi->set_baked_light_texture_id(layer); + //mi->set_baked_light_texture_id(layer); } if (p_flags&SCENE_FLAG_CREATE_COLLISIONS && _teststr(name,"colonly")) { diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index a4a1aaedf0..98b9a126dc 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2397,6 +2397,163 @@ ReflectionProbeGizmo::ReflectionProbeGizmo(ReflectionProbe* p_probe){ +/// + + +String GIProbeGizmo::get_handle_name(int p_idx) const { + + switch(p_idx) { + case 0: return "Extents X"; + case 1: return "Extents Y"; + case 2: return "Extents Z"; + } + + return ""; +} +Variant GIProbeGizmo::get_handle_value(int p_idx) const{ + + return probe->get_extents(); +} +void GIProbeGizmo::set_handle(int p_idx,Camera *p_camera, const Point2& p_point){ + + Transform gt = probe->get_global_transform(); + //gt.orthonormalize(); + Transform gi = gt.affine_inverse(); + + + Vector3 extents = probe->get_extents(); + + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2]={gi.xform(ray_from),gi.xform(ray_from+ray_dir*16384)}; + + Vector3 axis; + axis[p_idx]=1.0; + + Vector3 ra,rb; + Geometry::get_closest_points_between_segments(Vector3(),axis*16384,sg[0],sg[1],ra,rb); + float d = ra[p_idx]; + if (d<0.001) + d=0.001; + + extents[p_idx]=d; + probe->set_extents(extents); + +} + +void GIProbeGizmo::commit_handle(int p_idx,const Variant& p_restore,bool p_cancel){ + + Vector3 restore = p_restore; + + if (p_cancel) { + probe->set_extents(restore); + return; + } + + UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + ur->create_action(TTR("Change Probe Extents")); + ur->add_do_method(probe,"set_extents",probe->get_extents()); + ur->add_undo_method(probe,"set_extents",restore); + ur->commit_action(); + +} + +void GIProbeGizmo::redraw(){ + + clear(); + + Vector lines; + Vector3 extents = probe->get_extents(); + + static const int subdivs[GIProbe::SUBDIV_MAX]={64,128,256,512}; + + AABB aabb = AABB(-extents,extents*2); + int subdiv = subdivs[probe->get_subdiv()]; + float cell_size = aabb.get_longest_axis_size()/subdiv; + + + for(int i=0;i<12;i++) { + Vector3 a,b; + aabb.get_edge(i,a,b); + lines.push_back(a); + lines.push_back(b); + } + + add_lines(lines,SpatialEditorGizmos::singleton->gi_probe_material); + add_collision_segments(lines); + + lines.clear(); + + for(int i=1;iaabb.size[j]) { + continue; + } + + Vector2 dir; + dir[j]=1.0; + Vector2 ta,tb; + int j_n1=(j+1)%3; + int j_n2=(j+2)%3; + ta[j_n1]=1.0; + tb[j_n2]=1.0; + + + for(int k=0;k<4;k++) { + + Vector3 from=aabb.pos,to=aabb.pos; + from[j]+= cell_size*i; + to[j]+=cell_size*i; + + if (k&1) { + to[j_n1]+=aabb.size[j_n1]; + } else { + + to[j_n2]+=aabb.size[j_n2]; + } + + if (k&2) { + from[j_n1]+=aabb.size[j_n1]; + from[j_n2]+=aabb.size[j_n2]; + } + + lines.push_back(from); + lines.push_back(to); + } + + } + + } + + add_lines(lines,SpatialEditorGizmos::singleton->reflection_probe_material_internal); + + Vector handles; + + + for(int i=0;i<3;i++) { + + Vector3 ax; + ax[i]=aabb.pos[i]+aabb.size[i]; + handles.push_back(ax); + } + + + add_handles(handles); + +} +GIProbeGizmo::GIProbeGizmo(GIProbe* p_probe){ + + probe=p_probe; + set_spatial_node(p_probe); +} + +//////// + void NavigationMeshSpatialGizmo::redraw() { @@ -3093,6 +3250,11 @@ Ref SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { Ref misg = memnew( ReflectionProbeGizmo(p_spatial->cast_to()) ); return misg; } + if (p_spatial->cast_to()) { + + Ref misg = memnew( GIProbeGizmo(p_spatial->cast_to()) ); + return misg; + } if (p_spatial->cast_to()) { @@ -3146,8 +3308,8 @@ Ref SpatialEditorGizmos::create_line_material(const Color& line_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); line_material->set_line_width(3.0); line_material->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true); - line_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); - line_material->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + //line_material->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + //->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); line_material->set_albedo(p_base_color); return line_material; @@ -3298,7 +3460,9 @@ SpatialEditorGizmos::SpatialEditorGizmos() { car_wheel_material = create_line_material(Color(0.6,0.8,1.0)); visibility_notifier_material = create_line_material(Color(1.0,0.5,1.0)); reflection_probe_material = create_line_material(Color(0.5,1.0,0.7)); - reflection_probe_material_internal = create_line_material(Color(0.3,0.8,0.5,0.4)); + reflection_probe_material_internal = create_line_material(Color(0.3,0.8,0.5,0.15)); + gi_probe_material = create_line_material(Color(0.7,1.0,0.5)); + gi_probe_material_internal = create_line_material(Color(0.5,0.8,0.3,0.4)); joint_material = create_line_material(Color(0.6,0.8,1.0)); stream_player_icon = Ref( memnew( FixedSpatialMaterial )); diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 2cc1a7eab8..eba143d32b 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -46,6 +46,7 @@ #include "scene/3d/ray_cast.h" #include "scene/3d/navigation_mesh.h" #include "scene/3d/reflection_probe.h" +#include "scene/3d/gi_probe.h" #include "scene/3d/vehicle_body.h" #include "scene/3d/collision_polygon.h" @@ -327,6 +328,25 @@ public: }; +class GIProbeGizmo : public EditorSpatialGizmo { + + OBJ_TYPE(GIProbeGizmo ,EditorSpatialGizmo); + + + GIProbe* probe; + +public: + + virtual String get_handle_name(int p_idx) const; + virtual Variant get_handle_value(int p_idx) const; + virtual void set_handle(int p_idx,Camera *p_camera, const Point2& p_point); + virtual void commit_handle(int p_idx,const Variant& p_restore,bool p_cancel=false); + + void redraw(); + GIProbeGizmo(GIProbe* p_notifier=NULL); + +}; + class CollisionShapeSpatialGizmo : public EditorSpatialGizmo { @@ -496,6 +516,8 @@ public: Ref skeleton_material; Ref reflection_probe_material; Ref reflection_probe_material_internal; + Ref gi_probe_material; + Ref gi_probe_material_internal; Ref room_material; Ref portal_material; Ref raycast_material; -- cgit v1.2.3 From 72b844c34999d8615450798ed1f27ef24a72d8ce Mon Sep 17 00:00:00 2001 From: reduz Date: Wed, 21 Dec 2016 02:29:58 -0300 Subject: Godot works on Windows again.. --- drivers/gles3/rasterizer_canvas_gles3.cpp | 8 ++++---- drivers/gles3/rasterizer_gles3.cpp | 2 +- drivers/gles3/rasterizer_scene_gles3.cpp | 4 ++-- drivers/gles3/rasterizer_scene_gles3.h | 2 +- drivers/gles3/rasterizer_storage_gles3.cpp | 2 +- platform/windows/context_gl_win.cpp | 10 +++++----- platform/windows/detect.py | 4 ++-- platform/windows/os_windows.cpp | 27 ++++++++++++++++----------- platform/windows/os_windows.h | 2 +- platform/windows/platform_config.h | 4 ++-- servers/visual/visual_server_scene.h | 2 +- 11 files changed, 36 insertions(+), 31 deletions(-) diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 3c6094a41d..6bd440eec1 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1257,16 +1257,16 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons CameraMatrix projection; { real_t fov = 90; - real_t near = p_near; - real_t far = p_far; + real_t nearp = p_near; + real_t farp = p_far; real_t aspect = 1.0; - real_t ymax = near * Math::tan( Math::deg2rad( fov * 0.5 ) ); + real_t ymax = nearp * Math::tan( Math::deg2rad( fov * 0.5 ) ); real_t ymin = - ymax; real_t xmin = ymin * aspect; real_t xmax = ymax * aspect; - projection.set_frustum( xmin, xmax, ymin, ymax, near, far ); + projection.set_frustum( xmin, xmax, ymin, ymax, nearp, farp ); } Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0)); diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 3924ffb75f..110436b9d5 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -131,7 +131,7 @@ void RasterizerGLES3::initialize() { } glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); - glDebugMessageCallbackARB(_gl_debug_print, NULL); +// glDebugMessageCallbackARB(_gl_debug_print, NULL); glEnable(_EXT_DEBUG_OUTPUT); #endif diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 524e683738..65591de56e 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -996,7 +996,7 @@ void RasterizerSceneGLES3::light_instance_set_shadow_transform(RID p_light_insta light_instance->shadow_transform[p_pass].camera=p_projection; light_instance->shadow_transform[p_pass].transform=p_transform; - light_instance->shadow_transform[p_pass].far=p_far; + light_instance->shadow_transform[p_pass].farplane=p_far; light_instance->shadow_transform[p_pass].split=p_split; } @@ -4443,7 +4443,7 @@ static _FORCE_INLINE_ Vector3 ImportanceSampleGGX(Vector2 Xi, float Roughness, V float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph] // Compute distribution direction - float Phi = 2.0f * M_PI * Xi.x; + float Phi = 2.0f * Math_PI * Xi.x; float CosTheta = Math::sqrt((1.0f - Xi.y) / (1.0f + (a*a - 1.0f) * Xi.y)); float SinTheta = Math::sqrt((float)Math::abs(1.0f - CosTheta * CosTheta)); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 5eb2be1cc2..ef1b7b8d38 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -482,7 +482,7 @@ public: CameraMatrix camera; Transform transform; - float far; + float farplane; float split; }; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 8262487f9d..eca916854a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -133,7 +133,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima } break; case Image::FORMAT_RGB565: { -#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-) +//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-) r_gl_internal_format=GL_RGB5; //r_gl_internal_format=GL_RGB565; r_gl_format=GL_RGB; diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index fd9e895370..57950d33ca 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -162,8 +162,8 @@ Error ContextGL_Win::initialize() { if (opengl_3_context) { int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.1 context - WGL_CONTEXT_MINOR_VERSION_ARB, 2, + WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context + WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0}; //zero indicates the end of the array @@ -182,7 +182,7 @@ Error ContextGL_Win::initialize() { if (!(new_hRC=wglCreateContextAttribsARB(hDC,0, attribs))) { wglDeleteContext(hRC); - MessageBox(NULL,"Can't Create An OpenGL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Create An OpenGL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return false } wglMakeCurrent(hDC,NULL); @@ -191,11 +191,11 @@ Error ContextGL_Win::initialize() { if (!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { - MessageBox(NULL,"Can't Activate The GL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Activate The GL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return FALSE } - printf("Activated GL 3.1 context"); + printf("Activated GL 3.3 context"); } wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT"); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 12ea5a93ee..286e6cb78c 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -244,7 +244,7 @@ def configure(env): env.Append(CCFLAGS=['/DWIN32']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED']) + env.Append(CCFLAGS=['/DOPENGL_ENABLED']) LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid'] env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS]) @@ -372,7 +372,7 @@ def configure(env): env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows']) env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED']) - env.Append(CCFLAGS=['-DGLES2_ENABLED']) + env.Append(CCFLAGS=['-DOPENGL_ENABLED']) env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid']) # if (env["bits"]=="32"): diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 92359892a8..7321f5d1b1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -26,9 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "drivers/gles2/rasterizer_gles2.h" + #include "os_windows.h" +#include "drivers/gles3/rasterizer_gles3.h" + #include "drivers/nedmalloc/memory_pool_static_nedmalloc.h" #include "drivers/unix/memory_pool_static_malloc.h" #include "os/memory_pool_dynamic_static.h" @@ -42,7 +44,7 @@ #include "servers/visual/visual_server_raster.h" #include "servers/audio/audio_server_sw.h" -#include "servers/visual/visual_server_wrap_mt.h" +//#include "servers/visual/visual_server_wrap_mt.h" #include "tcp_server_winsock.h" #include "packet_peer_udp_winsock.h" @@ -1079,21 +1081,24 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ }; -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED) - gl_context = memnew( ContextGL_Win(hWnd,false) ); +#if defined(OPENGL_ENABLED) + gl_context = memnew( ContextGL_Win(hWnd,true) ); gl_context->initialize(); - rasterizer = memnew( RasterizerGLES2 ); + + RasterizerGLES3::register_config(); + + RasterizerGLES3::make_current(); #else #ifdef DX9_ENABLED rasterizer = memnew( RasterizerDX9(hWnd) ); #endif #endif - visual_server = memnew( VisualServerRaster(rasterizer) ); - if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { - - visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); - } + visual_server = memnew( VisualServerRaster ); + //if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { +// +// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); +// } // physics_server = memnew( PhysicsServerSW ); @@ -1758,7 +1763,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: "); break; case ERR_WARNING: print("WARNING: "); break; case ERR_SCRIPT: print("SCRIPT ERROR: "); break; - case ERR_SCRIPT: print("SHADER ERROR: "); break; + case ERR_SHADER: print("SHADER ERROR: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 70ef694957..bbacdb1a91 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -92,7 +92,7 @@ class OS_Windows : public OS { int old_x,old_y; Point2i center; unsigned int last_id; -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_Win *gl_context; #endif VisualServer *visual_server; diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 296a778ac8..fbcf0f74d2 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -30,7 +30,7 @@ //#else //#include //#endif -#define GLES2_INCLUDE_H "gl_context/GL/glew.h" -#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +//#define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/glad/glad.h" diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 63cb1fd2b8..894d3529af 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -9,7 +9,7 @@ #include "self_list.h" #include "os/thread.h" #include "os/semaphore.h" -#include "semaphore.h" +#include "os/semaphore.h" class VisualServerScene { public: -- cgit v1.2.3 From 37f558cd7b2308f6442f74c5265f12425d9887c8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 21 Dec 2016 14:20:35 -0300 Subject: Some BRDF fixes --- core/ustring.cpp | 2 ++ drivers/gles3/rasterizer_gles3.cpp | 19 +++++++++++-- drivers/gles3/rasterizer_scene_gles3.cpp | 21 +++++++++++++- drivers/gles3/rasterizer_scene_gles3.h | 1 + drivers/gles3/rasterizer_storage_gles3.cpp | 13 +++++++-- drivers/gles3/rasterizer_storage_gles3.h | 6 ++++ drivers/gles3/shaders/scene.glsl | 44 ++++++++++++++++++++++-------- platform/x11/context_gl_x11.cpp | 2 +- servers/visual/visual_server_scene.cpp | 2 +- tools/editor/editor_initialize_ssl.cpp | 3 +- tools/editor/editor_resource_preview.cpp | 2 ++ 11 files changed, 95 insertions(+), 20 deletions(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index 2e907381f7..abda1f1a34 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -612,6 +612,8 @@ String String::get_slicec(CharType p_splitter, int p_slice) const { if (p_slice==count) { return substr(prev,i-prev); + } else if (c[i]==0) { + return String(); } else { count++; prev=i+1; diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 110436b9d5..cb42790e67 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -130,9 +130,9 @@ void RasterizerGLES3::initialize() { ERR_PRINT("Error initializing GLAD"); } - glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); +// glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); // glDebugMessageCallbackARB(_gl_debug_print, NULL); - glEnable(_EXT_DEBUG_OUTPUT); +// glEnable(_EXT_DEBUG_OUTPUT); #endif @@ -169,6 +169,14 @@ void RasterizerGLES3::begin_frame(){ storage->update_dirty_skeletons(); storage->update_dirty_shaders(); storage->update_dirty_materials(); + + storage->info.render_object_count=0; + storage->info.render_material_switch_count=0; + storage->info.render_surface_switch_count=0; + storage->info.render_shader_rebind_count=0; + storage->info.render_vertices_count=0; + + scene->iteration(); @@ -277,6 +285,13 @@ void RasterizerGLES3::end_frame(){ canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1)); #endif OS::get_singleton()->swap_buffers(); + +/* print_line("objects: "+itos(storage->info.render_object_count)); + print_line("material chages: "+itos(storage->info.render_material_switch_count)); + print_line("surface changes: "+itos(storage->info.render_surface_switch_count)); + print_line("shader changes: "+itos(storage->info.render_shader_rebind_count)); + print_line("vertices: "+itos(storage->info.render_vertices_count)); +*/ } void RasterizerGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 65591de56e..675b6f228d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1331,10 +1331,14 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { glDrawElements(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0); + storage->info.render_vertices_count+=s->index_array_len; + } else { glDrawArrays(gl_primitive[s->primitive],0,s->array_len); + storage->info.render_vertices_count+=s->array_len; + } } break; @@ -1349,10 +1353,14 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { glDrawElementsInstanced(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0,amount); + storage->info.render_vertices_count+=s->index_array_len * amount; + } else { glDrawArraysInstanced(gl_primitive[s->primitive],0,s->array_len,amount); + storage->info.render_vertices_count+=s->array_len * amount; + } } break; @@ -1379,6 +1387,8 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { int vertices = c.vertices.size(); uint32_t buf_ofs=0; + storage->info.render_vertices_count+=vertices; + if (c.texture.is_valid() && storage->texture_owner.owns(c.texture)) { const RasterizerStorageGLES3::Texture *t = storage->texture_owner.get(c.texture); @@ -1704,6 +1714,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e bool first=true; + storage->info.render_object_count+=p_element_count; + for (int i=0;iinfo.render_material_switch_count++; + rebind = _setup_material(material,p_alpha_pass); -// _rinfo.mat_change_count++; + + if (rebind) { + storage->info.render_shader_rebind_count++; + } } if (!(e->sort_key&RenderList::SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) { @@ -1877,6 +1894,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e if (prev_base_type != e->instance->base_type || prev_geometry!=e->geometry) { _setup_geometry(e); + storage->info.render_surface_switch_count++; + } _set_cull(e->sort_key&RenderList::SORT_KEY_MIRROR_FLAG,p_reverse_cull); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index ef1b7b8d38..ce869da131 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -148,6 +148,7 @@ public: } state; + /* SHADOW ATLAS API */ struct ShadowAtlas : public RID_Data { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index eca916854a..9edc37fe3b 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -826,15 +826,20 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c DVector data; - int data_size = Image::get_image_data_size(texture->width,texture->height,texture->format,texture->mipmaps>1?-1:0); + int data_size = Image::get_image_data_size(texture->alloc_width,texture->alloc_height,texture->format,texture->mipmaps>1?-1:0); - data.resize(data_size); + data.resize(data_size*2); //add some memory at the end, just in case for buggy drivers DVector::Write wb = data.write(); glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target,texture->tex_id); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + + print_line("GET FORMAT: "+Image::get_format_name(texture->format)+" mipmaps: "+itos(texture->mipmaps)); + + for(int i=0;imipmaps;i++) { int ofs=0; @@ -848,7 +853,9 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c glGetCompressedTexImage(texture->target,i,&wb[ofs]); } else { + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glGetTexImage(texture->target,i,texture->gl_format_cache,texture->gl_type_cache,&wb[ofs]); } } @@ -856,6 +863,8 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c wb=DVector::Write(); + data.resize(data_size); + Image img(texture->alloc_width,texture->alloc_height,texture->mipmaps>1?true:false,texture->format,data); return img; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b81c3df78a..5d07d0be87 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -91,6 +91,12 @@ public: uint64_t texture_mem; + uint32_t render_object_count; + uint32_t render_material_switch_count; + uint32_t render_surface_switch_count; + uint32_t render_shader_rebind_count; + uint32_t render_vertices_count; + } info; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index bf561a7e46..c9de56be4f 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -569,7 +569,7 @@ void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 di float speci = dotNL * D * F * vis; - specular += speci * light_color * specular_color * specular_blob_intensity; + specular += speci * light_color /* specular_color*/ * specular_blob_intensity; #if defined(LIGHT_USE_CLEARCOAT) float Dr = GTR1(dotNH, mix(.1,.001,clearcoat_gloss)); @@ -780,7 +780,8 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw); highp vec4 reflection; - reflection.rgb = textureLod(reflection_atlas,splane.xy,roughness*5.0).rgb * ( brdf.x + brdf.y); + reflection.rgb = textureLod(reflection_atlas,splane.xy,roughness*5.0).rgb * brdf.x + brdf.y; + if (reflections[idx].params.z < 0.5) { reflection.rgb = mix(skybox,reflection.rgb,blend); } @@ -893,6 +894,7 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s blend=1.0; //radiance +#ifdef VCT_QUALITY_HIGH #define MAX_CONE_DIRS 6 vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( @@ -905,13 +907,28 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s ); float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15); + float cone_angle_tan = 0.577; +#else + +#define MAX_CONE_DIRS 4 + + vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( + vec3(0.707107, 0, 0.707107), + vec3(0, 0.707107, 0.707107), + vec3(-0.707107, 0, 0.707107), + vec3(0, -0.707107, 0.707107) + ); + + float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25); + float cone_angle_tan = 0.98269; +#endif float max_distance = length(bounds); vec3 light=vec3(0.0); for(int i=0;idirectional_lights.size()); int directional_shadow_count=0; for (List::Element *E=scenario->directional_lights.front();E;E=E->next()) { diff --git a/tools/editor/editor_initialize_ssl.cpp b/tools/editor/editor_initialize_ssl.cpp index c0b55b302f..968afba9d6 100644 --- a/tools/editor/editor_initialize_ssl.cpp +++ b/tools/editor/editor_initialize_ssl.cpp @@ -35,10 +35,11 @@ void editor_initialize_certificates() { ByteArray data; - data.resize(_certs_uncompressed_size); + data.resize(_certs_uncompressed_size+1); { ByteArray::Write w = data.write(); Compression::decompress(w.ptr(),_certs_uncompressed_size,_certs_compressed,_certs_compressed_size,Compression::MODE_DEFLATE); + w[_certs_uncompressed_size]=0; //make sure it ends at zero } StreamPeerSSL::load_certs_from_memory(data); diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 6afc3e2a34..46b81dc072 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -267,6 +267,8 @@ void EditorResourcePreview::_thread() { memdelete(f); } + cache_valid=false; + if (cache_valid) { texture = ResourceLoader::load(cache_base+".png","ImageTexture",true); -- cgit v1.2.3 From f9603d82365823938129e68823a19739a3dd0b23 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 22 Dec 2016 10:00:15 -0300 Subject: can bake for omni and spotlight store normal when baking --- drivers/gles3/rasterizer_gles3.cpp | 6 +- drivers/gles3/rasterizer_scene_gles3.cpp | 39 +++--- drivers/gles3/rasterizer_scene_gles3.h | 3 +- drivers/gles3/rasterizer_storage_gles3.cpp | 41 +++++- drivers/gles3/rasterizer_storage_gles3.h | 13 +- drivers/gles3/shaders/scene.glsl | 29 +++- scene/3d/gi_probe.cpp | 129 ++++++++++++++++-- scene/3d/gi_probe.h | 27 +++- scene/main/viewport.cpp | 3 + servers/visual/rasterizer.h | 11 +- servers/visual/visual_server_raster.h | 10 +- servers/visual/visual_server_scene.cpp | 207 +++++++++++++++++++++++------ servers/visual/visual_server_scene.h | 4 +- servers/visual_server.h | 10 +- 14 files changed, 440 insertions(+), 92 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index cb42790e67..bf3b902c5c 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -130,9 +130,9 @@ void RasterizerGLES3::initialize() { ERR_PRINT("Error initializing GLAD"); } -// glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); -// glDebugMessageCallbackARB(_gl_debug_print, NULL); -// glEnable(_EXT_DEBUG_OUTPUT); + glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); + glDebugMessageCallbackARB(_gl_debug_print, NULL); + glEnable(_EXT_DEBUG_OUTPUT); #endif diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 675b6f228d..1a63d451b1 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -100,6 +100,8 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ shadow_atlas->depth=0; shadow_atlas->fbo=0; + + print_line("erasing atlas"); } for(int i=0;i<4;i++) { //clear subdivisions @@ -130,19 +132,18 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); - //interpola nearest (though nvidia can improve this) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - // Remove artifact on the edges of the shadowmap glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - // We'll use a depth texture to store the depths in the shadow map - // Attach the depth texture to FBO depth attachment point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadow_atlas->depth, 0); + + glViewport(0,0,shadow_atlas->size,shadow_atlas->size); + glClearDepth(0); + glClear(GL_DEPTH_BUFFER_BIT); + } } @@ -523,12 +524,19 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas,int p_size) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + mmsize=reflection_atlas->size; for(int i=0;i<6;i++) { glGenFramebuffers(1, &reflection_atlas->fbo[i]); glBindFramebuffer(GL_FRAMEBUFFER, reflection_atlas->fbo[i]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, reflection_atlas->color, i); + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + ERR_CONTINUE(status!=GL_FRAMEBUFFER_COMPLETE); + glDisable(GL_SCISSOR_TEST); glViewport(0,0,mmsize,mmsize); glClearColor(0,0,0,0); @@ -538,8 +546,6 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas,int p_size) } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); } @@ -1020,11 +1026,12 @@ RID RasterizerSceneGLES3::gi_probe_instance_create() { return gi_probe_instance_owner.make_rid(gipi); } -void RasterizerSceneGLES3::gi_probe_instance_set_light_data(RID p_probe,RID p_data) { +void RasterizerSceneGLES3::gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) { GIProbeInstance *gipi = gi_probe_instance_owner.getornull(p_probe); ERR_FAIL_COND(!gipi); gipi->data=p_data; + gipi->probe=storage->gi_probe_owner.getornull(p_base); if (p_data.is_valid()) { RasterizerStorageGLES3::GIProbeData *gipd = storage->gi_probe_data_owner.getornull(p_data); ERR_FAIL_COND(!gipd); @@ -1571,6 +1578,8 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e,const Transform& glBindTexture(GL_TEXTURE_3D,gipi->tex_cache); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_XFORM1, gipi->transform_to_data * p_view_transform); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BOUNDS1, gipi->bounds); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_MULTIPLIER1, gipi->probe?gipi->probe->dynamic_range*gipi->probe->energy:0.0); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BLEND_AMBIENT1, gipi->probe?!gipi->probe->interior:false); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_CELL_SIZE1, gipi->cell_size_cache); if (gi_probe_count>1) { @@ -1581,7 +1590,8 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e,const Transform& state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_XFORM2, gipi2->transform_to_data * p_view_transform); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BOUNDS2, gipi2->bounds); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_CELL_SIZE2, gipi2->cell_size_cache); - + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_MULTIPLIER2, gipi2->probe?gipi2->probe->dynamic_range*gipi2->probe->energy:0.0); + state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE_BLEND_AMBIENT2, gipi2->probe?!gipi2->probe->interior:false); state.scene_shader.set_uniform(SceneShaderGLES3::GI_PROBE2_ENABLED, true ); } else { @@ -4209,7 +4219,6 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa fbo=shadow_atlas->fbo; vp_height=shadow_atlas->size; - uint32_t key = shadow_atlas->shadow_owners[p_light]; uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT)&0x3; @@ -4299,24 +4308,22 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa render_list.sort_by_depth(false); //shadow is front to back for performance glDepthMask(true); - glColorMask(0,0,0,0); + glColorMask(1,1,1,1); glDisable(GL_BLEND); glDisable(GL_DITHER); glEnable(GL_DEPTH_TEST); - glBindFramebuffer(GL_FRAMEBUFFER,fbo); if (custom_vp_size) { glViewport(0,0,custom_vp_size,custom_vp_size); glScissor(0,0,custom_vp_size,custom_vp_size); + } else { glViewport(x,y,width,height); glScissor(x,y,width,height); } - //glViewport(x,vp_height-(height+y),width,height); - //glScissor(x,vp_height-(height+y),width,height); glEnable(GL_SCISSOR_TEST); glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT); @@ -4331,7 +4338,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,true); - _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,NULL,!flip_facing,false,true,false,false); + _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,0,!flip_facing,false,true,false,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,false); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index ce869da131..31d9964ab0 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -531,6 +531,7 @@ public: struct GIProbeInstance : public RID_Data { RID data; + RasterizerStorageGLES3::GIProbe *probe; GLuint tex_cache; Vector3 cell_size_cache; Vector3 bounds; @@ -542,7 +543,7 @@ public: mutable RID_Owner gi_probe_instance_owner; virtual RID gi_probe_instance_create(); - virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_data); + virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_base,RID p_data); virtual void gi_probe_instance_set_transform_to_data(RID p_probe,const Transform& p_xform); virtual void gi_probe_instance_set_bounds(RID p_probe,const Vector3& p_bounds); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 9edc37fe3b..fe8373b20d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4695,6 +4695,8 @@ RID RasterizerStorageGLES3::gi_probe_create() { gip->data_depth=0; gip->bounds=AABB(Vector3(),Vector3(1,1,1)); gip->dynamic_range=1.0; + gip->energy=1.0; + gip->interior=false; gip->version=1; gip->cell_size=1.0; @@ -4773,7 +4775,7 @@ DVector RasterizerStorageGLES3::gi_probe_get_dynamic_data(RID p_probe) cons return gip->dynamic_data; } -void RasterizerStorageGLES3::gi_probe_set_dynamic_range(RID p_probe,float p_range){ +void RasterizerStorageGLES3::gi_probe_set_dynamic_range(RID p_probe,int p_range){ GIProbe *gip = gi_probe_owner.getornull(p_probe); ERR_FAIL_COND(!gip); @@ -4781,7 +4783,7 @@ void RasterizerStorageGLES3::gi_probe_set_dynamic_range(RID p_probe,float p_rang gip->dynamic_range=p_range; } -float RasterizerStorageGLES3::gi_probe_get_dynamic_range(RID p_probe) const{ +int RasterizerStorageGLES3::gi_probe_get_dynamic_range(RID p_probe) const{ const GIProbe *gip = gi_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!gip,0); @@ -4789,6 +4791,41 @@ float RasterizerStorageGLES3::gi_probe_get_dynamic_range(RID p_probe) const{ return gip->dynamic_range; } +void RasterizerStorageGLES3::gi_probe_set_energy(RID p_probe,float p_range){ + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->energy=p_range; + +} + +void RasterizerStorageGLES3::gi_probe_set_interior(RID p_probe,bool p_enable) { + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->interior=p_enable; + +} + +bool RasterizerStorageGLES3::gi_probe_is_interior(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,false); + + return gip->interior; + +} + +float RasterizerStorageGLES3::gi_probe_get_energy(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->energy; +} + void RasterizerStorageGLES3::gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5d07d0be87..c51cd8d90b 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -890,7 +890,9 @@ public: Transform to_cell; float cell_size; - float dynamic_range; + int dynamic_range; + float energy; + bool interior; uint32_t version; @@ -921,9 +923,14 @@ public: virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data); virtual DVector gi_probe_get_dynamic_data(RID p_probe) const; - virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range); - virtual float gi_probe_get_dynamic_range(RID p_probe) const; + virtual void gi_probe_set_dynamic_range(RID p_probe,int p_range); + virtual int gi_probe_get_dynamic_range(RID p_probe) const; + + virtual void gi_probe_set_energy(RID p_probe,float p_range); + virtual float gi_probe_get_energy(RID p_probe) const; + virtual void gi_probe_set_interior(RID p_probe,bool p_enable); + virtual bool gi_probe_is_interior(RID p_probe) const; virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth); virtual DVector gi_probe_get_static_data(RID p_gi_probe) const; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index c9de56be4f..2dfbbd340d 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -845,14 +845,18 @@ uniform mediump sampler3D gi_probe1; //texunit:-6 uniform highp mat4 gi_probe_xform1; uniform highp vec3 gi_probe_bounds1; uniform highp vec3 gi_probe_cell_size1; +uniform highp float gi_probe_multiplier1; +uniform bool gi_probe_blend_ambient1; uniform mediump sampler3D gi_probe2; //texunit:-7 uniform highp mat4 gi_probe_xform2; uniform highp vec3 gi_probe_bounds2; uniform highp vec3 gi_probe_cell_size2; +uniform highp float gi_probe_multiplier2; uniform bool gi_probe2_enabled; +uniform bool gi_probe_blend_ambient2; -vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance) { +vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, bool blend_ambient, vec3 direction, float tan_half_angle, float max_distance) { float dist = dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0; @@ -868,10 +872,12 @@ vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 direction, dist += diameter * 0.5; } + color.rgb = mix(color.rgb,mix(ambient,color.rgb,alpha),blend_ambient); + return color.rgb; } -void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, mat3 normal_mtx,vec3 ref_vec, float roughness, out vec4 out_spec, out vec4 out_diff) { +void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient,float multiplier, mat3 normal_mtx,vec3 ref_vec, float roughness, out vec4 out_spec, out vec4 out_diff) { @@ -928,15 +934,19 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s for(int i=0;i0.0) { diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index ce360859d6..93d3e51a8e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -53,12 +53,35 @@ DVector GIProbeData::get_dynamic_data() const{ return VS::get_singleton()->gi_probe_get_dynamic_data(probe); } -void GIProbeData::set_dynamic_range(float p_range){ +void GIProbeData::set_dynamic_range(int p_range){ VS::get_singleton()->gi_probe_set_dynamic_range(probe,p_range); } -float GIProbeData::get_dynamic_range() const{ + +void GIProbeData::set_energy(float p_range) { + + VS::get_singleton()->gi_probe_set_energy(probe,p_range); +} + +float GIProbeData::get_energy() const{ + + return VS::get_singleton()->gi_probe_get_energy(probe); + +} + +void GIProbeData::set_interior(bool p_enable) { + + VS::get_singleton()->gi_probe_set_interior(probe,p_enable); + +} + +bool GIProbeData::is_interior() const{ + + return VS::get_singleton()->gi_probe_is_interior(probe); +} + +int GIProbeData::get_dynamic_range() const{ return VS::get_singleton()->gi_probe_get_dynamic_range(probe); @@ -154,15 +177,42 @@ Vector3 GIProbe::get_extents() const { return extents; } -void GIProbe::set_dynamic_range(float p_dynamic_range) { +void GIProbe::set_dynamic_range(int p_dynamic_range) { dynamic_range=p_dynamic_range; } -float GIProbe::get_dynamic_range() const { +int GIProbe::get_dynamic_range() const { return dynamic_range; } +void GIProbe::set_energy(float p_energy) { + + energy=p_energy; + if (probe_data.is_valid()) { + probe_data->set_energy(energy); + } +} +float GIProbe::get_energy() const { + + return energy; +} + +void GIProbe::set_interior(bool p_enable) { + + interior=p_enable; + if (probe_data.is_valid()) { + probe_data->set_interior(p_enable); + } +} + +bool GIProbe::is_interior() const { + + return interior; +} + + + #include "math.h" #define FINDMINMAX(x0,x1,x2,min,max) \ @@ -384,6 +434,8 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V Color albedo_accum; Color emission_accum; + Vector3 normal_accum; + float alpha=0.0; //map to a grid average in the best axis for this face @@ -441,6 +493,9 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V emission_accum.r+=p_material.emission[ofs].r; emission_accum.g+=p_material.emission[ofs].g; emission_accum.b+=p_material.emission[ofs].b; + + normal_accum+=normal; + alpha+=1.0; } @@ -471,6 +526,7 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V emission_accum.g=p_material.emission[ofs].g*alpha; emission_accum.b=p_material.emission[ofs].b*alpha; + normal_accum*=alpha; } else { @@ -486,6 +542,9 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V emission_accum.r*=accdiv; emission_accum.g*=accdiv; emission_accum.b*=accdiv; + + normal_accum*=accdiv; + } //put this temporarily here, corrected in a later step @@ -495,6 +554,9 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V p_baker->bake_cells[p_idx].emission[0]+=emission_accum.r; p_baker->bake_cells[p_idx].emission[1]+=emission_accum.g; p_baker->bake_cells[p_idx].emission[2]+=emission_accum.b; + p_baker->bake_cells[p_idx].normal[0]+=normal_accum.x; + p_baker->bake_cells[p_idx].normal[1]+=normal_accum.y; + p_baker->bake_cells[p_idx].normal[2]+=normal_accum.z; p_baker->bake_cells[p_idx].alpha+=alpha; static const Vector3 side_normals[6]={ @@ -506,11 +568,12 @@ void GIProbe::_plot_face(int p_idx, int p_level,int p_x,int p_y,int p_z, const V Vector3( 0, 0, 1), }; + /* for(int i=0;i<6;i++) { if (normal.dot(side_normals[i])>CMP_EPSILON) { p_baker->bake_cells[p_idx].used_sides|=(1<bake_cells[p_idx].emission[1]/=alpha; p_baker->bake_cells[p_idx].emission[2]/=alpha; + p_baker->bake_cells[p_idx].normal[0]/=alpha; + p_baker->bake_cells[p_idx].normal[1]/=alpha; + p_baker->bake_cells[p_idx].normal[2]/=alpha; + + Vector3 n(p_baker->bake_cells[p_idx].normal[0],p_baker->bake_cells[p_idx].normal[1],p_baker->bake_cells[p_idx].normal[2]); + if (n.length()<0.01) { + //too much fight over normal, zero it + p_baker->bake_cells[p_idx].normal[0]=0; + p_baker->bake_cells[p_idx].normal[1]=0; + p_baker->bake_cells[p_idx].normal[2]=0; + } else { + n.normalize(); + p_baker->bake_cells[p_idx].normal[0]=n.x; + p_baker->bake_cells[p_idx].normal[1]=n.y; + p_baker->bake_cells[p_idx].normal[2]=n.z; + } + + p_baker->bake_cells[p_idx].alpha=1.0; + /* //remove neighbours from used sides for(int n=0;n<6;n++) { @@ -653,6 +735,7 @@ void GIProbe::_fixup_plot(int p_idx, int p_level,int p_x,int p_y, int p_z,Baker p_baker->bake_cells[p_idx].used_sides&=~(1<bake_cells[p_idx].emission[0]=0; p_baker->bake_cells[p_idx].emission[1]=0; p_baker->bake_cells[p_idx].emission[2]=0; + p_baker->bake_cells[p_idx].normal[0]=0; + p_baker->bake_cells[p_idx].normal[1]=0; + p_baker->bake_cells[p_idx].normal[2]=0; p_baker->bake_cells[p_idx].albedo[0]=0; p_baker->bake_cells[p_idx].albedo[1]=0; p_baker->bake_cells[p_idx].albedo[2]=0; @@ -1024,7 +1110,21 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ w32[ofs++]=em; } - w32[ofs++]=baker.bake_cells[i].used_sides; + //w32[ofs++]=baker.bake_cells[i].used_sides; + { //normal + + Vector3 n(baker.bake_cells[i].normal[0],baker.bake_cells[i].normal[1],baker.bake_cells[i].normal[2]); + n=n*Vector3(0.5,0.5,0.5)+Vector3(0.5,0.5,0.5); + uint32_t norm=0; + + + norm|=uint32_t(CLAMP( n.x*255.0, 0, 255))<<16; + norm|=uint32_t(CLAMP( n.y*255.0, 0, 255))<<8; + norm|=uint32_t(CLAMP( n.z*255.0, 0, 255))<<0; + + w32[ofs++]=norm; + } + w32[ofs++]=uint32_t(baker.bake_cells[i].alpha*65535.0); } @@ -1036,6 +1136,9 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ probe_data->set_bounds(AABB(-extents,extents*2.0)); probe_data->set_cell_size(baker.po2_bounds.size[longest_axis]/baker.axis_cell_size[longest_axis]); probe_data->set_dynamic_data(data); + probe_data->set_dynamic_range(dynamic_range); + probe_data->set_energy(energy); + probe_data->set_interior(interior); probe_data->set_to_cell_xform(baker.to_cell_space); set_probe_data(probe_data); @@ -1212,13 +1315,21 @@ void GIProbe::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_dynamic_range","max"),&GIProbe::set_dynamic_range); ObjectTypeDB::bind_method(_MD("get_dynamic_range"),&GIProbe::get_dynamic_range); + ObjectTypeDB::bind_method(_MD("set_energy","max"),&GIProbe::set_energy); + ObjectTypeDB::bind_method(_MD("get_energy"),&GIProbe::get_energy); + + ObjectTypeDB::bind_method(_MD("set_interior","enable"),&GIProbe::set_interior); + ObjectTypeDB::bind_method(_MD("is_interior"),&GIProbe::is_interior); + ObjectTypeDB::bind_method(_MD("bake","from_node","create_visual_debug"),&GIProbe::bake,DEFVAL(Variant()),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("debug_bake"),&GIProbe::_debug_bake); ObjectTypeDB::set_method_flags(get_type_static(),_SCS("debug_bake"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); ADD_PROPERTY( PropertyInfo(Variant::INT,"subdiv",PROPERTY_HINT_ENUM,"64,128,256,512"),_SCS("set_subdiv"),_SCS("get_subdiv")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"extents"),_SCS("set_extents"),_SCS("get_extents")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"dynamic_range",PROPERTY_HINT_RANGE,"0,8,0.01"),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_RANGE,"1,16,1"),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_energy"),_SCS("get_energy")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior"),_SCS("set_interior"),_SCS("is_interior")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"data",PROPERTY_HINT_RESOURCE_TYPE,"GIProbeData"),_SCS("set_probe_data"),_SCS("get_probe_data")); @@ -1232,10 +1343,12 @@ void GIProbe::_bind_methods() { GIProbe::GIProbe() { subdiv=SUBDIV_128; - dynamic_range=1.0; + dynamic_range=4; + energy=1.0; extents=Vector3(10,10,10); color_scan_cell_width=4; bake_texture_size=128; + interior=false; gi_probe = VS::get_singleton()->gi_probe_create(); diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index e2017acfc3..297672198c 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -31,8 +31,14 @@ public: void set_dynamic_data(const DVector& p_data); DVector get_dynamic_data() const; - void set_dynamic_range(float p_range); - float get_dynamic_range() const; + void set_dynamic_range(int p_range); + int get_dynamic_range() const; + + void set_energy(float p_range); + float get_energy() const; + + void set_interior(bool p_enable); + bool is_interior() const; void set_static_data(const DVector& p_data,DataFormat p_format,int p_width,int p_height,int p_depth); DVector get_static_data() const; @@ -73,6 +79,7 @@ private: uint32_t childs[8]; float albedo[3]; //albedo in RGB24 float emission[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast) + float normal[3]; uint32_t used_sides; float alpha; //used for upsampling @@ -84,6 +91,7 @@ private: for(int i=0;i<3;i++) { emission[i]=0; albedo[i]=0; + normal[i]=0; } alpha=0; used_sides=0; @@ -126,7 +134,9 @@ private: Subdiv subdiv; Vector3 extents; - float dynamic_range; + int dynamic_range; + float energy; + bool interior; int color_scan_cell_width; int bake_texture_size; @@ -157,8 +167,15 @@ public: void set_extents(const Vector3& p_extents); Vector3 get_extents() const; - void set_dynamic_range(float p_dynamic_range); - float get_dynamic_range() const; + void set_dynamic_range(int p_dynamic_range); + int get_dynamic_range() const; + + void set_energy(float p_energy); + float get_energy() const; + + void set_interior(bool p_enable); + bool is_interior() const; + void bake(Node *p_from_node=NULL,bool p_create_visual_debug=false); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index bd5eb0a4e6..728997e794 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1283,6 +1283,9 @@ bool Viewport::get_clear_on_new_frame() const{ void Viewport::set_shadow_atlas_size(int p_size) { + if (shadow_atlas_size==p_size) + return; + shadow_atlas_size=p_size; VS::get_singleton()->viewport_set_shadow_atlas_size(viewport,p_size); } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 79560f3486..f22b7e04f6 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -149,7 +149,7 @@ public: virtual bool reflection_probe_instance_postprocess_step(RID p_instance)=0; virtual RID gi_probe_instance_create()=0; - virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_data)=0; + virtual void gi_probe_instance_set_light_data(RID p_probe,RID p_base,RID p_data)=0; virtual void gi_probe_instance_set_transform_to_data(RID p_probe,const Transform& p_xform)=0; virtual void gi_probe_instance_set_bounds(RID p_probe,const Vector3& p_bounds)=0; @@ -418,9 +418,14 @@ public: virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data)=0; virtual DVector gi_probe_get_dynamic_data(RID p_probe) const=0; - virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range)=0; - virtual float gi_probe_get_dynamic_range(RID p_probe) const=0; + virtual void gi_probe_set_dynamic_range(RID p_probe,int p_range)=0; + virtual int gi_probe_get_dynamic_range(RID p_probe) const=0; + virtual void gi_probe_set_energy(RID p_probe,float p_range)=0; + virtual float gi_probe_get_energy(RID p_probe) const=0; + + virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; + virtual bool gi_probe_is_interior(RID p_probe) const=0; virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth)=0; virtual DVector gi_probe_get_static_data(RID p_gi_probe) const=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 191330c66c..9dec587d1e 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -816,8 +816,14 @@ public: BIND2(gi_probe_set_to_cell_xform,RID,const Transform&) BIND1RC(Transform,gi_probe_get_to_cell_xform,RID) - BIND2(gi_probe_set_dynamic_range,RID,float) - BIND1RC(float,gi_probe_get_dynamic_range,RID) + BIND2(gi_probe_set_dynamic_range,RID,int) + BIND1RC(int,gi_probe_get_dynamic_range,RID) + + BIND2(gi_probe_set_energy,RID,float) + BIND1RC(float,gi_probe_get_energy,RID) + + BIND2(gi_probe_set_interior,RID,bool) + BIND1RC(bool,gi_probe_is_interior,RID) BIND2(gi_probe_set_dynamic_data,RID,const DVector& ) BIND1RC( DVector,gi_probe_get_dynamic_data,RID) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 162647e420..d74f5265e4 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1641,6 +1641,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance,const } } + VSG::scene_render->light_instance_set_shadow_transform(light->instance,cm,xform,radius,0,i); VSG::scene_render->render_shadow(light->instance,p_shadow_atlas,i,(RasterizerScene::InstanceBase**)instance_shadow_cull_result,cull_count); } @@ -2203,10 +2204,10 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came } - bool redraw = VSG::scene_render->shadow_atlas_update_light(p_shadow_atlas,light->instance,coverage,light->last_version); if (redraw) { + print_line("redraw shadow"); //must redraw! _light_instance_update_shadow(ins,p_cam_transform,p_cam_projection,p_cam_orthogonal,p_shadow_atlas,scenario); } @@ -2407,6 +2408,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth); + probe->dynamic.bake_dynamic_range=VSG::storage->gi_probe_get_dynamic_range(p_instance->base); probe->dynamic.mipmaps_3d.clear(); @@ -2443,7 +2445,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.light_to_cell_xform=cell_to_xform * p_instance->transform.affine_inverse(); - VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,probe->dynamic.probe_data); + VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,probe->dynamic.probe_data); VSG::scene_render->gi_probe_instance_set_transform_to_data(probe->probe_instance,probe->dynamic.light_to_cell_xform); @@ -2457,7 +2459,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.enabled=false; probe->invalid=!data.is_valid(); if (data.is_valid()) { - VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,data); + VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,data); } } @@ -2541,6 +2543,30 @@ uint32_t VisualServerScene::_gi_bake_find_cell(const GIProbeDataCell *cells,int } +static float _get_normal_advance(const Vector3& p_normal ) { + + Vector3 normal = p_normal; + Vector3 unorm = normal.abs(); + + if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) { + // x code + unorm = normal.x > 0.0 ? Vector3( 1.0, 0.0, 0.0 ) : Vector3( -1.0, 0.0, 0.0 ) ; + } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { + // y code + unorm = normal.y > 0.0 ? Vector3( 0.0, 1.0, 0.0 ) : Vector3( 0.0, -1.0, 0.0 ) ; + } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { + // z code + unorm = normal.z > 0.0 ? Vector3( 0.0, 0.0, 1.0 ) : Vector3( 0.0, 0.0, -1.0 ) ; + } else { + // oh-no we messed up code + // has to be + unorm = Vector3( 1.0, 0.0, 0.0 ); + } + + return 1.0/normal.dot(unorm); + +} + void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,const GIProbeDataCell *cells,InstanceGIProbeData::LocalData *local_data,const uint32_t *leaves,int leaf_count, const InstanceGIProbeData::LightCache& light_cache,int sign) { @@ -2548,20 +2574,20 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,con int light_g = int(light_cache.color.g * light_cache.energy * 1024.0)*sign; int light_b = int(light_cache.color.b * light_cache.energy * 1024.0)*sign; + float limits[3]={float(header->width),float(header->height),float(header->depth)}; + Plane clip[3]; + int clip_planes=0; + + + switch(light_cache.type) { case VS::LIGHT_DIRECTIONAL: { - float limits[3]={float(header->width),float(header->height),float(header->depth)}; - Plane clip[3]; - int clip_planes=0; float max_len = Vector3(limits[0],limits[1],limits[2]).length()*1.1; Vector3 light_axis = -light_cache.transform.basis.get_axis(2).normalized(); - print_line("transform directional, axis: "+light_axis); - print_line("limits: "+Vector3(limits[0],limits[1],limits[2])); - for(int i=0;i<3;i++) { if (ABS(light_axis[i])= unorm.y) && (unorm.x >= unorm.z) ) { - // x code - unorm = normal.x > 0.0 ? Vector3( 1.0, 0.0, 0.0 ) : Vector3( -1.0, 0.0, 0.0 ) ; - } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) { - // y code - unorm = normal.y > 0.0 ? Vector3( 0.0, 1.0, 0.0 ) : Vector3( 0.0, -1.0, 0.0 ) ; - } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) { - // z code - unorm = normal.z > 0.0 ? Vector3( 0.0, 0.0, 1.0 ) : Vector3( 0.0, 0.0, -1.0 ) ; - } else { - // oh-no we messed up code - // has to be - unorm = Vector3( 1.0, 0.0, 0.0 ); - } - - distance_adv = 1.0/normal.dot(unorm); - - } + float distance_adv = _get_normal_advance(light_axis); int success_count=0; @@ -2614,7 +2618,18 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,con InstanceGIProbeData::LocalData *light = &local_data[idx]; Vector3 to(light->pos[0]+0.5,light->pos[1]+0.5,light->pos[2]+0.5); + Vector3 norm ( + (((cells[idx].normal>>16)&0xFF)/255.0)*2.0-1.0, + (((cells[idx].normal>>8)&0xFF)/255.0)*2.0-1.0, + (((cells[idx].normal>>0)&0xFF)/255.0)*2.0-1.0 + ); + + float att = norm.dot(-light_axis); + if (att<0.001) { + //not lighting towards this + continue; + } Vector3 from = to - max_len * light_axis; @@ -2642,16 +2657,130 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,con if (result==idx) { //cell hit itself! hooray! - light->energy[0]+=(uint32_t(light_r)*((cell->albedo>>16)&0xFF))>>8; - light->energy[1]+=(uint32_t(light_g)*((cell->albedo>>8)&0xFF))>>8; - light->energy[2]+=(uint32_t(light_b)*((cell->albedo)&0xFF))>>8; - success_count++; + light->energy[0]+=int32_t(light_r*att*((cell->albedo>>16)&0xFF)/255.0); + light->energy[1]+=int32_t(light_g*att*((cell->albedo>>8)&0xFF)/255.0); + light->energy[2]+=int32_t(light_b*att*((cell->albedo)&0xFF)/255.0); + success_count++; } } print_line("BAKE TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); print_line("valid cells: "+itos(success_count)); + } break; + case VS::LIGHT_OMNI: + case VS::LIGHT_SPOT: { + + + uint64_t us = OS::get_singleton()->get_ticks_usec(); + + Vector3 light_pos = light_cache.transform.origin; + Vector3 spot_axis = -light_cache.transform.basis.get_axis(2).normalized(); + + + float local_radius = light_cache.radius * light_cache.transform.basis.get_axis(2).length(); + + for(int i=0;ipos[0]+0.5,light->pos[1]+0.5,light->pos[2]+0.5); + Vector3 norm ( + (((cells[idx].normal>>16)&0xFF)/255.0)*2.0-1.0, + (((cells[idx].normal>>8)&0xFF)/255.0)*2.0-1.0, + (((cells[idx].normal>>0)&0xFF)/255.0)*2.0-1.0 + ); + + Vector3 light_axis = (to - light_pos).normalized(); + float distance_adv = _get_normal_advance(light_axis); + + float att = norm.dot(-light_axis); + if (att<0.001) { + //not lighting towards this + continue; + } + + { + float d = light_pos.distance_to(to); + if (d+distance_adv > local_radius) + continue; // too far away + + float dt = CLAMP((d+distance_adv)/local_radius,0,1); + att*= pow(1.0-dt,light_cache.attenuation); + } + + + if (light_cache.type==VS::LIGHT_SPOT) { + + float angle = Math::rad2deg(acos(light_axis.dot(spot_axis))); + if (angle > light_cache.spot_angle) + continue; + + float d = CLAMP(angle/light_cache.spot_angle,1,0); + att*= pow(1.0-d,light_cache.spot_attenuation); + + } + + clip_planes=0; + + for(int c=0;c<3;c++) { + + if (ABS(light_axis[c])-distance_adv) { //use this to avoid precision errors + + result = _gi_bake_find_cell(cells,int(floor(from.x)),int(floor(from.y)),int(floor(from.z)),header->cell_subdiv); + if (result!=0xFFFFFFFF) { + break; + } + + from+=light_axis*distance_adv; + distance-=distance_adv; + } + + if (result==idx) { + //cell hit itself! hooray! + + light->energy[0]+=int32_t(light_r*att*((cell->albedo>>16)&0xFF)/255.0); + light->energy[1]+=int32_t(light_g*att*((cell->albedo>>8)&0xFF)/255.0); + light->energy[2]+=int32_t(light_b*att*((cell->albedo)&0xFF)/255.0); + + } + } + print_line("BAKE TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); + + } break; } } @@ -2760,9 +2889,9 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { uint32_t idx = level_cells[j]; - uint32_t r = local_data[idx].energy[0]>>2; - uint32_t g = local_data[idx].energy[1]>>2; - uint32_t b = local_data[idx].energy[2]>>2; + uint32_t r = (uint32_t(local_data[idx].energy[0])/probe_data->dynamic.bake_dynamic_range)>>2; + uint32_t g = (uint32_t(local_data[idx].energy[1])/probe_data->dynamic.bake_dynamic_range)>>2; + uint32_t b = (uint32_t(local_data[idx].energy[2])/probe_data->dynamic.bake_dynamic_range)>>2; uint32_t a = cells[idx].alpha>>8; uint32_t mm_ofs = sizes[0]*sizes[1]*(local_data[idx].pos[2]) + sizes[0]*(local_data[idx].pos[1]) + (local_data[idx].pos[0]); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 894d3529af..418e8387bf 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -432,6 +432,7 @@ public: Vector > level_cell_lists; RID probe_data; bool enabled; + int bake_dynamic_range; Vector< DVector > mipmaps_3d; @@ -536,7 +537,7 @@ public: uint32_t children[8]; uint32_t albedo; uint32_t emission; - uint32_t sides_used; + uint32_t normal; uint32_t alpha; }; @@ -560,7 +561,6 @@ public: _FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells,int x,int y, int z,int p_cell_subdiv); void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data); - void _bake_gi_probe_light(const GIProbeDataHeader *header,const GIProbeDataCell *cells,InstanceGIProbeData::LocalData *local_data,const uint32_t *leaves,int p_leaf_count, const InstanceGIProbeData::LightCache& light_cache,int p_sign); void _bake_gi_probe(Instance *p_probe); bool _check_gi_probe(Instance *p_gi_probe); diff --git a/servers/visual_server.h b/servers/visual_server.h index 6f2aa73952..20fe8e7d76 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -461,8 +461,14 @@ public: virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector& p_data)=0; virtual DVector gi_probe_get_dynamic_data(RID p_probe) const=0; - virtual void gi_probe_set_dynamic_range(RID p_probe,float p_range)=0; - virtual float gi_probe_get_dynamic_range(RID p_probe) const=0; + virtual void gi_probe_set_dynamic_range(RID p_probe,int p_range)=0; + virtual int gi_probe_get_dynamic_range(RID p_probe) const=0; + + virtual void gi_probe_set_energy(RID p_probe,float p_range)=0; + virtual float gi_probe_get_energy(RID p_probe) const=0; + + virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; + virtual bool gi_probe_is_interior(RID p_probe) const=0; enum GIProbeDataFormat { GI_PROBE_DATA_RGBA8, -- cgit v1.2.3 From 4e729f38e02274afc91319d8dc9d2dfea9e9438e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 23 Dec 2016 00:37:38 -0300 Subject: baking now shows a proper button, and bakes can be saved. --- drivers/gles3/rasterizer_storage_gles3.cpp | 78 ++++----------------- drivers/gles3/rasterizer_storage_gles3.h | 20 ++---- scene/3d/gi_probe.cpp | 49 +++++++------- scene/3d/gi_probe.h | 17 ++--- servers/visual/rasterizer.h | 11 +-- servers/visual/visual_server_raster.h | 8 +-- servers/visual/visual_server_scene.cpp | 90 +++++++++++-------------- servers/visual_server.h | 16 +---- tools/editor/editor_node.cpp | 4 ++ tools/editor/plugins/gi_probe_editor_plugin.cpp | 58 ++++++++++++++++ tools/editor/plugins/gi_probe_editor_plugin.h | 37 ++++++++++ 11 files changed, 194 insertions(+), 194 deletions(-) create mode 100644 tools/editor/plugins/gi_probe_editor_plugin.cpp create mode 100644 tools/editor/plugins/gi_probe_editor_plugin.h diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index fe8373b20d..24e6be588e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -645,6 +645,10 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image bool srgb; + if (config.keep_original_textures && !(texture->flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING)) { + texture->images[p_cube_side]=p_image; + } + Image img = _get_gl_image_and_format(p_image, p_image.get_format(),texture->flags,format,internal_format,type,compressed,srgb); if (config.shrink_textures_x2 && (p_image.has_mipmaps() || !p_image.is_compressed()) && !(texture->flags&VS::TEXTURE_FLAG_USED_FOR_STREAMING)) { @@ -822,6 +826,9 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c ERR_FAIL_COND_V(texture->data_size==0,Image()); ERR_FAIL_COND_V(texture->render_target,Image()); + if (!texture->images[p_cube_side].empty()) + return texture->images[p_cube_side]; + #ifdef GLES_OVER_GL DVector data; @@ -871,6 +878,7 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c #else ERR_EXPLAIN("Sorry, It's not posible to obtain images back in OpenGL ES"); + return Image(); #endif } @@ -1047,6 +1055,11 @@ void RasterizerStorageGLES3::texture_set_shrink_all_x2_on_set_data(bool p_enable config.shrink_textures_x2=p_enable; } +void RasterizerStorageGLES3::textures_keep_original(bool p_enable) { + + config.keep_original_textures=p_enable; +} + RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_resolution) const { Texture * texture = texture_owner.get(p_source); @@ -4690,9 +4703,6 @@ RID RasterizerStorageGLES3::gi_probe_create() { GIProbe *gip = memnew( GIProbe ); - gip->data_width=0; - gip->data_height=0; - gip->data_depth=0; gip->bounds=AABB(Vector3(),Vector3(1,1,1)); gip->dynamic_range=1.0; gip->energy=1.0; @@ -4827,64 +4837,6 @@ float RasterizerStorageGLES3::gi_probe_get_energy(RID p_probe) const{ } -void RasterizerStorageGLES3::gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth) { - - GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND(!gip); - - if (gip->data.is_valid()) { - free(gip->data); - } - - gip->data=RID(); - //this is platform dependent - - gip->version++; - gip->instance_change_notify(); - -} -DVector RasterizerStorageGLES3::gi_probe_get_static_data(RID p_gi_probe) const { - - const GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gip,DVector()); - - //platform dependent - return DVector(); -} -VS::GIProbeDataFormat RasterizerStorageGLES3::gi_probe_get_static_data_format(RID p_gi_probe) const { - - const GIProbe *gip = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gip,VS::GI_PROBE_DATA_RGBA8); - - return gip->data_format; -} -int RasterizerStorageGLES3::gi_probe_get_static_data_width(RID p_probe) const { - - const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,0); - - return gip->data_width; -} -int RasterizerStorageGLES3::gi_probe_get_static_data_height(RID p_probe) const { - - const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,0); - return gip->data_height; -} -int RasterizerStorageGLES3::gi_probe_get_static_data_depth(RID p_probe) const { - - const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,0); - return gip->data_depth; -} - -RID RasterizerStorageGLES3::gi_probe_get_data(RID p_probe) { - - const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,RID()); - - return gip->data; -} uint32_t RasterizerStorageGLES3::gi_probe_get_version(RID p_probe) { @@ -5892,9 +5844,6 @@ bool RasterizerStorageGLES3::free(RID p_rid){ // delete the texture GIProbe *gi_probe = gi_probe_owner.get(p_rid); - if (gi_probe->data.is_valid()) { - free(gi_probe->data); - } gi_probe_owner.free(p_rid); memdelete(gi_probe); @@ -6119,6 +6068,7 @@ void RasterizerStorageGLES3::initialize() { glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); frame.count=0; + config.keep_original_textures=false; } void RasterizerStorageGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index c51cd8d90b..5a8246f030 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -56,6 +56,8 @@ public: int max_texture_size; Set extensions; + + bool keep_original_textures; } config; mutable struct Shaders { @@ -221,6 +223,8 @@ public: RenderTarget *render_target; + Image images[6]; + Texture() { using_srgb=false; @@ -272,6 +276,8 @@ public: virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const; + virtual void textures_keep_original(bool p_enable); + /* SKYBOX API */ struct SkyBox : public RID_Data { @@ -898,12 +904,6 @@ public: DVector dynamic_data; - RID data; - int data_width; - int data_height; - int data_depth; - VS::GIProbeDataFormat data_format; - }; @@ -932,14 +932,6 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable); virtual bool gi_probe_is_interior(RID p_probe) const; - virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth); - virtual DVector gi_probe_get_static_data(RID p_gi_probe) const; - virtual VS::GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const; - virtual int gi_probe_get_static_data_width(RID p_probe) const; - virtual int gi_probe_get_static_data_height(RID p_probe) const; - virtual int gi_probe_get_static_data_depth(RID p_probe) const; - - virtual RID gi_probe_get_data(RID p_probe); //get data in case this is static virtual uint32_t gi_probe_get_version(RID p_probe); struct GIProbeData : public RID_Data { diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 93d3e51a8e..24ed12027e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1,12 +1,6 @@ #include "gi_probe.h" #include "mesh_instance.h" -enum DataFormat { - DATA_RGBA8, - DATA_DXT5, - DATA_ETC2_EAC, -}; - void GIProbeData::set_bounds(const AABB& p_bounds) { @@ -87,40 +81,45 @@ int GIProbeData::get_dynamic_range() const{ return VS::get_singleton()->gi_probe_get_dynamic_range(probe); } -void GIProbeData::set_static_data(const DVector& p_data,DataFormat p_format,int p_width,int p_height,int p_depth){ - VS::get_singleton()->gi_probe_set_static_data(probe,p_data,VS::GIProbeDataFormat(p_format),p_width,p_height,p_depth); +RID GIProbeData::get_rid() const { + return probe; } -DVector GIProbeData::get_static_data() const{ - return VS::get_singleton()->gi_probe_get_static_data(probe); -} -GIProbeData::DataFormat GIProbeData::get_static_data_format() const{ +void GIProbeData::_bind_methods() { - return GIProbeData::DataFormat(VS::get_singleton()->gi_probe_get_static_data_format(probe)); + ObjectTypeDB::bind_method(_MD("set_bounds","bounds"),&GIProbeData::set_bounds); + ObjectTypeDB::bind_method(_MD("get_bounds"),&GIProbeData::get_bounds); -} -int GIProbeData::get_static_data_width() const{ + ObjectTypeDB::bind_method(_MD("set_cell_size","cell_size"),&GIProbeData::set_cell_size); + ObjectTypeDB::bind_method(_MD("get_cell_size"),&GIProbeData::get_cell_size); - return VS::get_singleton()->gi_probe_get_static_data_width(probe); + ObjectTypeDB::bind_method(_MD("set_to_cell_xform","to_cell_xform"),&GIProbeData::set_to_cell_xform); + ObjectTypeDB::bind_method(_MD("get_to_cell_xform"),&GIProbeData::get_to_cell_xform); -} -int GIProbeData::get_static_data_height() const{ + ObjectTypeDB::bind_method(_MD("set_dynamic_data","dynamic_data"),&GIProbeData::set_dynamic_data); + ObjectTypeDB::bind_method(_MD("get_dynamic_data"),&GIProbeData::get_dynamic_data); - return VS::get_singleton()->gi_probe_get_static_data_height(probe); + ObjectTypeDB::bind_method(_MD("set_dynamic_range","dynamic_range"),&GIProbeData::set_dynamic_range); + ObjectTypeDB::bind_method(_MD("get_dynamic_range"),&GIProbeData::get_dynamic_range); -} -int GIProbeData::get_static_data_depth() const{ + ObjectTypeDB::bind_method(_MD("set_energy","energy"),&GIProbeData::set_energy); + ObjectTypeDB::bind_method(_MD("get_energy"),&GIProbeData::get_energy); - return VS::get_singleton()->gi_probe_get_static_data_depth(probe); + ObjectTypeDB::bind_method(_MD("set_interior","interior"),&GIProbeData::set_interior); + ObjectTypeDB::bind_method(_MD("is_interior"),&GIProbeData::is_interior); -} + ADD_PROPERTY(PropertyInfo(Variant::_AABB,"bounds",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_bounds"),_SCS("get_bounds")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"cell_size",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_cell_size"),_SCS("get_cell_size")); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM,"to_cell_xform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_to_cell_xform"),_SCS("get_to_cell_xform")); -RID GIProbeData::get_rid() const { + ADD_PROPERTY(PropertyInfo(Variant::INT_ARRAY,"dynamic_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_data"),_SCS("get_dynamic_data")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_energy"),_SCS("get_energy")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"interior",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_interior"),_SCS("is_interior")); - return probe; } GIProbeData::GIProbeData() { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 297672198c..aea01b5367 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -10,13 +10,11 @@ class GIProbeData : public Resource { RID probe; +protected: + + static void _bind_methods(); public: - enum DataFormat { - DATA_RGBA8, - DATA_DXT5, - DATA_ETC2_EAC, - }; void set_bounds(const AABB& p_bounds); @@ -40,20 +38,13 @@ public: void set_interior(bool p_enable); bool is_interior() const; - void set_static_data(const DVector& p_data,DataFormat p_format,int p_width,int p_height,int p_depth); - DVector get_static_data() const; - DataFormat get_static_data_format() const; - int get_static_data_width() const; - int get_static_data_height() const; - int get_static_data_depth() const; - virtual RID get_rid() const; GIProbeData(); ~GIProbeData(); }; -VARIANT_ENUM_CAST(GIProbeData::DataFormat); + class GIProbe : public VisualInstance { OBJ_TYPE(GIProbe,VisualInstance); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index f22b7e04f6..725a325909 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -193,6 +193,9 @@ public: virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; + + virtual void textures_keep_original(bool p_enable)=0; + /* SKYBOX API */ virtual RID skybox_create()=0; @@ -427,14 +430,6 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; - virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,VS::GIProbeDataFormat p_format,int p_width,int p_height,int p_depth)=0; - virtual DVector gi_probe_get_static_data(RID p_gi_probe) const=0; - virtual VS::GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const=0; - virtual int gi_probe_get_static_data_width(RID p_probe) const=0; - virtual int gi_probe_get_static_data_height(RID p_probe) const=0; - virtual int gi_probe_get_static_data_depth(RID p_probe) const=0; - - virtual RID gi_probe_get_data(RID p_probe)=0; //get data in case this is static virtual uint32_t gi_probe_get_version(RID p_probe)=0; virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 9dec587d1e..fcfaf52e0b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -629,6 +629,8 @@ public: BIND1(texture_set_shrink_all_x2_on_set_data,bool) BIND1(texture_debug_usage,List*) + BIND1(textures_keep_original,bool) + /* SKYBOX API */ BIND0R(RID,skybox_create) @@ -828,12 +830,6 @@ public: BIND2(gi_probe_set_dynamic_data,RID,const DVector& ) BIND1RC( DVector,gi_probe_get_dynamic_data,RID) - BIND6(gi_probe_set_static_data,RID,const DVector&,GIProbeDataFormat,int,int,int) - BIND1RC(DVector,gi_probe_get_static_data,RID) - BIND1RC(GIProbeDataFormat,gi_probe_get_static_data_format,RID) - BIND1RC(int,gi_probe_get_static_data_width,RID) - BIND1RC(int,gi_probe_get_static_data_height,RID) - BIND1RC(int,gi_probe_get_static_data_depth,RID) #undef BINDBASE diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index d74f5265e4..a7876d0815 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2390,78 +2390,68 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.light_data=VSG::storage->gi_probe_get_dynamic_data(p_instance->base); - if (probe->dynamic.light_data.size()) { - //using dynamic data - DVector::Read r=probe->dynamic.light_data.read(); + if (probe->dynamic.light_data.size()==0) + return; + //using dynamic data + DVector::Read r=probe->dynamic.light_data.read(); - const GIProbeDataHeader *header = (GIProbeDataHeader *)r.ptr(); + const GIProbeDataHeader *header = (GIProbeDataHeader *)r.ptr(); - probe->dynamic.local_data.resize(header->cell_count); + probe->dynamic.local_data.resize(header->cell_count); - DVector::Write ldw = probe->dynamic.local_data.write(); + DVector::Write ldw = probe->dynamic.local_data.write(); - const GIProbeDataCell *cells = (GIProbeDataCell*)&r[16]; + const GIProbeDataCell *cells = (GIProbeDataCell*)&r[16]; - probe->dynamic.level_cell_lists.resize(header->cell_subdiv); + probe->dynamic.level_cell_lists.resize(header->cell_subdiv); - _gi_probe_fill_local_data(0,0,0,0,0,cells,header,ldw.ptr(),probe->dynamic.level_cell_lists.ptr()); + _gi_probe_fill_local_data(0,0,0,0,0,cells,header,ldw.ptr(),probe->dynamic.level_cell_lists.ptr()); - probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth); + probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth); - probe->dynamic.bake_dynamic_range=VSG::storage->gi_probe_get_dynamic_range(p_instance->base); + probe->dynamic.bake_dynamic_range=VSG::storage->gi_probe_get_dynamic_range(p_instance->base); - probe->dynamic.mipmaps_3d.clear(); + probe->dynamic.mipmaps_3d.clear(); - probe->dynamic.grid_size[0]=header->width; - probe->dynamic.grid_size[1]=header->height; - probe->dynamic.grid_size[2]=header->depth; + probe->dynamic.grid_size[0]=header->width; + probe->dynamic.grid_size[1]=header->height; + probe->dynamic.grid_size[2]=header->depth; - for(int i=0;i<(int)header->cell_subdiv;i++) { - - uint32_t x = header->width >> i; - uint32_t y = header->height >> i; - uint32_t z = header->depth >> i; - - //create and clear mipmap - DVector mipmap; - mipmap.resize(x*y*z*4); - DVector::Write w = mipmap.write(); - zeromem(w.ptr(),x*y*z*4); - w = DVector::Write(); - - probe->dynamic.mipmaps_3d.push_back(mipmap); + for(int i=0;i<(int)header->cell_subdiv;i++) { - if (x<=1 || y<=1 || z<=1) - break; - } + uint32_t x = header->width >> i; + uint32_t y = header->height >> i; + uint32_t z = header->depth >> i; - probe->dynamic.updating_stage=GI_UPDATE_STAGE_CHECK; - probe->invalid=false; - probe->dynamic.enabled=true; + //create and clear mipmap + DVector mipmap; + mipmap.resize(x*y*z*4); + DVector::Write w = mipmap.write(); + zeromem(w.ptr(),x*y*z*4); + w = DVector::Write(); - Transform cell_to_xform = VSG::storage->gi_probe_get_to_cell_xform(p_instance->base); - AABB bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); - float cell_size = VSG::storage->gi_probe_get_cell_size(p_instance->base); + probe->dynamic.mipmaps_3d.push_back(mipmap); - probe->dynamic.light_to_cell_xform=cell_to_xform * p_instance->transform.affine_inverse(); + if (x<=1 || y<=1 || z<=1) + break; + } - VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,probe->dynamic.probe_data); - VSG::scene_render->gi_probe_instance_set_transform_to_data(probe->probe_instance,probe->dynamic.light_to_cell_xform); + probe->dynamic.updating_stage=GI_UPDATE_STAGE_CHECK; + probe->invalid=false; + probe->dynamic.enabled=true; + Transform cell_to_xform = VSG::storage->gi_probe_get_to_cell_xform(p_instance->base); + AABB bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); + float cell_size = VSG::storage->gi_probe_get_cell_size(p_instance->base); + probe->dynamic.light_to_cell_xform=cell_to_xform * p_instance->transform.affine_inverse(); - VSG::scene_render->gi_probe_instance_set_bounds(probe->probe_instance,bounds.size/cell_size); + VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,probe->dynamic.probe_data); + VSG::scene_render->gi_probe_instance_set_transform_to_data(probe->probe_instance,probe->dynamic.light_to_cell_xform); - } else { - RID data = VSG::storage->gi_probe_get_data(p_instance->base); - probe->dynamic.enabled=false; - probe->invalid=!data.is_valid(); - if (data.is_valid()) { - VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,data); - } - } + VSG::scene_render->gi_probe_instance_set_bounds(probe->probe_instance,bounds.size/cell_size); probe->base_version=VSG::storage->gi_probe_get_version(p_instance->base); diff --git a/servers/visual_server.h b/servers/visual_server.h index 20fe8e7d76..ef7cbc03af 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -139,6 +139,8 @@ public: virtual void texture_debug_usage(List *r_info)=0; + virtual void textures_keep_original(bool p_enable)=0; + /* SKYBOX API */ virtual RID skybox_create()=0; @@ -470,20 +472,6 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; - enum GIProbeDataFormat { - GI_PROBE_DATA_RGBA8, - GI_PROBE_DATA_DXT5, - GI_PROBE_DATA_ETC2_EAC, - }; - - virtual void gi_probe_set_static_data(RID p_gi_probe,const DVector& p_data,GIProbeDataFormat p_format,int p_width,int p_height,int p_depth)=0; - virtual DVector gi_probe_get_static_data(RID p_gi_probe) const=0; - virtual GIProbeDataFormat gi_probe_get_static_data_format(RID p_gi_probe) const=0; - virtual int gi_probe_get_static_data_width(RID p_probe) const=0; - virtual int gi_probe_get_static_data_height(RID p_probe) const=0; - virtual int gi_probe_get_static_data_depth(RID p_probe) const=0; - - /* CAMERA API */ diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 99c2b468fa..8ec10756c8 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -99,6 +99,7 @@ #include "plugins/light_occluder_2d_editor_plugin.h" #include "plugins/color_ramp_editor_plugin.h" #include "plugins/collision_shape_2d_editor_plugin.h" +#include "plugins/gi_probe_editor_plugin.h" #include "main/input_default.h" // end #include "tools/editor/io_plugins/editor_texture_import_plugin.h" @@ -5361,6 +5362,8 @@ void EditorNode::_bind_methods() { EditorNode::EditorNode() { + VisualServer::get_singleton()->textures_keep_original(true); + EditorHelp::generate_doc(); //before any editor classes are crated SceneState::set_disable_placeholders(true); editor_initialize_certificates(); //for asset sharing @@ -6567,6 +6570,7 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( SpriteFramesEditorPlugin(this) ) ); add_editor_plugin( memnew( TextureRegionEditorPlugin(this) ) ); add_editor_plugin( memnew( Particles2DEditorPlugin(this) ) ); + add_editor_plugin( memnew( GIProbeEditorPlugin(this) ) ); add_editor_plugin( memnew( Path2DEditorPlugin(this) ) ); // add_editor_plugin( memnew( PathEditorPlugin(this) ) ); //add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) ); diff --git a/tools/editor/plugins/gi_probe_editor_plugin.cpp b/tools/editor/plugins/gi_probe_editor_plugin.cpp new file mode 100644 index 0000000000..5beee1d915 --- /dev/null +++ b/tools/editor/plugins/gi_probe_editor_plugin.cpp @@ -0,0 +1,58 @@ +#include "gi_probe_editor_plugin.h" + + +void GIProbeEditorPlugin::_bake() { + + if (gi_probe) { + gi_probe->bake(); + } +} + + +void GIProbeEditorPlugin::edit(Object *p_object) { + + GIProbe * s = p_object->cast_to(); + if (!s) + return; + + gi_probe=s; +} + +bool GIProbeEditorPlugin::handles(Object *p_object) const { + + return p_object->is_type("GIProbe"); +} + +void GIProbeEditorPlugin::make_visible(bool p_visible) { + + if (p_visible) { + bake->show(); + } else { + + bake->hide(); + } + +} + +void GIProbeEditorPlugin::_bind_methods() { + + ObjectTypeDB::bind_method("_bake",&GIProbeEditorPlugin::_bake); +} + +GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { + + editor=p_node; + bake = memnew( Button ); + bake->set_text("Bake GI!"); + bake->set_icon(editor->get_gui_base()->get_icon("BakedLight","EditorIcons")); + bake->hide();; + bake->connect("pressed",this,"_bake"); + add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU,bake); + gi_probe=NULL; +} + + +GIProbeEditorPlugin::~GIProbeEditorPlugin() { + + memdelete(bake); +} diff --git a/tools/editor/plugins/gi_probe_editor_plugin.h b/tools/editor/plugins/gi_probe_editor_plugin.h new file mode 100644 index 0000000000..7db91bebaf --- /dev/null +++ b/tools/editor/plugins/gi_probe_editor_plugin.h @@ -0,0 +1,37 @@ +#ifndef GIPROBEEDITORPLUGIN_H +#define GIPROBEEDITORPLUGIN_H + +#include "tools/editor/editor_plugin.h" +#include "tools/editor/editor_node.h" +#include "scene/resources/material.h" +#include "scene/3d/gi_probe.h" + + + +class GIProbeEditorPlugin : public EditorPlugin { + + OBJ_TYPE( GIProbeEditorPlugin, EditorPlugin ); + + GIProbe *gi_probe; + + Button *bake; + EditorNode *editor; + + void _bake(); +protected: + + static void _bind_methods(); +public: + + virtual String get_name() const { return "GIProbe"; } + bool has_main_screen() const { return false; } + virtual void edit(Object *p_node); + virtual bool handles(Object *p_node) const; + virtual void make_visible(bool p_visible); + + GIProbeEditorPlugin(EditorNode *p_node); + ~GIProbeEditorPlugin(); + +}; + +#endif // GIPROBEEDITORPLUGIN_H -- cgit v1.2.3 From 19ba45587c878e1859383797a454852c5b525c64 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 23 Dec 2016 01:05:21 -0300 Subject: put some limits to max ubo sizes to avoid crashes --- drivers/gles3/rasterizer_scene_gles3.cpp | 6 +++--- drivers/gles3/rasterizer_scene_gles3.h | 1 + tools/editor/plugins/gi_probe_editor_plugin.cpp | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 1a63d451b1..d559d96287 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4706,7 +4706,7 @@ void RasterizerSceneGLES3::initialize() { glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE,&max_ubo_size); const int ubo_light_size=160; state.ubo_light_size=ubo_light_size; - state.max_ubo_lights=max_ubo_size/ubo_light_size; + state.max_ubo_lights=MIN(RenderList::MAX_LIGHTS,max_ubo_size/ubo_light_size); print_line("max ubo light: "+itos(state.max_ubo_lights)); state.spot_array_tmp = (uint8_t*)memalloc(ubo_light_size*state.max_ubo_lights); @@ -4734,7 +4734,7 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_LIGHT_DATA_STRUCTS "+itos(state.max_ubo_lights)+"\n"); state.scene_shader.add_custom_define("#define MAX_FORWARD_LIGHTS "+itos(state.max_forward_lights_per_object)+"\n"); - state.max_ubo_reflections=max_ubo_size/sizeof(ReflectionProbeDataUBO); + state.max_ubo_reflections=MIN(RenderList::MAX_REFLECTIONS,max_ubo_size/sizeof(ReflectionProbeDataUBO)); print_line("max ubo reflections: "+itos(state.max_ubo_reflections)+" ubo size: "+itos(sizeof(ReflectionProbeDataUBO))); state.reflection_array_tmp = (uint8_t*)memalloc(sizeof(ReflectionProbeDataUBO)*state.max_ubo_reflections); @@ -4746,7 +4746,7 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_REFLECTION_DATA_STRUCTS "+itos(state.max_ubo_reflections)+"\n"); - state.max_skeleton_bones=max_ubo_size/(12*sizeof(float)); + state.max_skeleton_bones=MIN(2048,max_ubo_size/(12*sizeof(float))); state.scene_shader.add_custom_define("#define MAX_SKELETON_BONES "+itos(state.max_skeleton_bones)+"\n"); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 31d9964ab0..61628f102f 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -557,6 +557,7 @@ public: SORT_FLAG_INSTANCING=2, MAX_DIRECTIONAL_LIGHTS=16, MAX_LIGHTS=4096, + MAX_REFLECTIONS=1024, SORT_KEY_DEPTH_LAYER_SHIFT=60, diff --git a/tools/editor/plugins/gi_probe_editor_plugin.cpp b/tools/editor/plugins/gi_probe_editor_plugin.cpp index 5beee1d915..4ec95eb8c6 100644 --- a/tools/editor/plugins/gi_probe_editor_plugin.cpp +++ b/tools/editor/plugins/gi_probe_editor_plugin.cpp @@ -43,7 +43,6 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { editor=p_node; bake = memnew( Button ); - bake->set_text("Bake GI!"); bake->set_icon(editor->get_gui_base()->get_icon("BakedLight","EditorIcons")); bake->hide();; bake->connect("pressed",this,"_bake"); -- cgit v1.2.3 From 6b35211c53f14e5c9ea00b4e8382f497a11240c8 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 23 Dec 2016 01:16:04 -0300 Subject: eliminated some crashes according to llvm address sanitizer --- drivers/gles3/rasterizer_scene_gles3.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 61628f102f..3fdbdb95d0 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -536,6 +536,8 @@ public: Vector3 cell_size_cache; Vector3 bounds; Transform transform_to_data; + + GIProbeInstance() { probe=NULL; tex_cache=0; } }; -- cgit v1.2.3 From 3adb42e217d29033e0637ae334790aa1d742d194 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 23 Dec 2016 08:47:16 -0300 Subject: Fixed many more bugs reported by Valgrind --- drivers/gles3/rasterizer_scene_gles3.cpp | 4 ++++ drivers/gles3/rasterizer_storage_gles3.cpp | 3 +++ drivers/gles3/shader_compiler_gles3.cpp | 1 + scene/main/viewport.cpp | 2 +- servers/visual/visual_server_viewport.h | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index d559d96287..d380d8d149 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -454,6 +454,7 @@ RID RasterizerSceneGLES3::reflection_atlas_create() { ReflectionAtlas *reflection_atlas = memnew( ReflectionAtlas ); reflection_atlas->subdiv=0; reflection_atlas->color=0; + reflection_atlas->size=0; for(int i=0;i<6;i++) { reflection_atlas->fbo[i]=0; } @@ -4576,6 +4577,9 @@ void RasterizerSceneGLES3::_generate_brdf() { void RasterizerSceneGLES3::initialize() { + + render_pass=0; + state.scene_shader.init(); default_shader = storage->shader_create(VS::SHADER_SPATIAL); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 24e6be588e..ec71f64049 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1476,9 +1476,11 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { p_shader->spatial.depth_draw_mode=Shader::Spatial::DEPTH_DRAW_OPAQUE; p_shader->spatial.cull_mode=Shader::Spatial::CULL_MODE_BACK; p_shader->spatial.uses_alpha=false; + p_shader->spatial.uses_discard=false; p_shader->spatial.unshaded=false; p_shader->spatial.ontop=false; p_shader->spatial.uses_sss=false; + p_shader->spatial.uses_vertex=false; shaders.actions_scene.render_mode_values["blend_add"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_ADD); shaders.actions_scene.render_mode_values["blend_mix"]=Pair(&p_shader->spatial.blend_mode,Shader::Spatial::BLEND_MODE_MIX); @@ -1501,6 +1503,7 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { shaders.actions_scene.usage_flag_pointers["VERTEX"]=&p_shader->spatial.uses_vertex; shaders.actions_scene.usage_flag_pointers["SSS_STRENGTH"]=&p_shader->spatial.uses_sss; + shaders.actions_scene.usage_flag_pointers["DISCARD"]=&p_shader->spatial.uses_discard; actions=&shaders.actions_scene; actions->uniforms=&p_shader->uniforms; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 5c7a72ab17..336cf7b34b 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -579,6 +579,7 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, r_gen_code.uses_vertex_time=false; + used_name_defines.clear(); used_rmode_defines.clear(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 728997e794..8dec34a4cd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2760,7 +2760,7 @@ Viewport::Viewport() { shadow_atlas_size=0; for(int i=0;i<4;i++) { - shadow_atlas_quadrant_subdiv[0]=SHADOW_ATLAS_QUADRANT_SUBDIV_MAX; + shadow_atlas_quadrant_subdiv[i]=SHADOW_ATLAS_QUADRANT_SUBDIV_MAX; } set_shadow_atlas_quadrant_subdiv(0,SHADOW_ATLAS_QUADRANT_SUBDIV_4); set_shadow_atlas_quadrant_subdiv(1,SHADOW_ATLAS_QUADRANT_SUBDIV_4); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index a9b8fe4e94..2eb0ea4679 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -71,6 +71,7 @@ public: disable_environment=false; viewport_to_screen=0; shadow_atlas_size=0; + disable_3d=false; } }; -- cgit v1.2.3 From 0d4abf2aa3a336a8a04c83f0576c6b42783ba6e9 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 24 Dec 2016 16:23:30 -0300 Subject: fixed a horrible bug on Windows AMD, scenes saved until now in this branch are no longer valid :( --- drivers/gles3/rasterizer_gles3.cpp | 8 +++++++- drivers/gles3/rasterizer_scene_gles3.cpp | 4 ++++ drivers/gles3/rasterizer_storage_gles3.cpp | 13 ++++++++----- drivers/gles3/shaders/scene.glsl | 2 +- platform/windows/context_gl_win.cpp | 2 +- scene/resources/mesh.cpp | 6 ++++-- servers/visual/visual_server_scene.cpp | 4 ++-- servers/visual_server.cpp | 17 +++++++++++++---- 8 files changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index bf3b902c5c..ccc5c70c97 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -42,7 +42,13 @@ RasterizerScene *RasterizerGLES3::get_scene() { #define _EXT_DEBUG_SEVERITY_LOW_ARB 0x9148 #define _EXT_DEBUG_OUTPUT 0x92E0 -static void _gl_debug_print(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam) +#ifdef WINDOWS_ENABLED +#define GLAPIENTRY APIENTRY +#else +#define GLAPIENTRY +#endif + +static void GLAPIENTRY _gl_debug_print(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam) { if (type==_EXT_DEBUG_TYPE_OTHER_ARB) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index d380d8d149..7fdd08a834 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1337,6 +1337,7 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { if (s->index_array_len>0) { + glDrawElements(gl_primitive[s->primitive],s->index_array_len, (s->array_len>=(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT,0); storage->info.render_vertices_count+=s->index_array_len; @@ -1349,6 +1350,9 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { } + + + } break; case VS::INSTANCE_MULTIMESH: { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ec71f64049..ffcd462808 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2481,6 +2481,8 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P for(int i=0;iindex_id); glBufferData(GL_ELEMENT_ARRAY_BUFFER,index_array_size,ir.ptr(),GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); //unbind + + } //generate arrays for faster state switching - for(int i=0;i<2;i++) { + for(int ai=0;ai<2;ai++) { - if (i==0) { + if (ai==0) { //for normal draw glGenVertexArrays(1,&surface->array_id); glBindVertexArray(surface->array_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - } else if (i==1) { + } else if (ai==1) { //for instancing draw (can be changed and no one cares) glGenVertexArrays(1,&surface->instancing_array_id); glBindVertexArray(surface->instancing_array_id); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 2dfbbd340d..b0b2782307 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -872,7 +872,7 @@ vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, b dist += diameter * 0.5; } - color.rgb = mix(color.rgb,mix(ambient,color.rgb,alpha),blend_ambient); + //color.rgb = mix(color.rgb,mix(ambient,color.rgb,alpha),blend_ambient); return color.rgb; } diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 57950d33ca..fc6e33f408 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -165,7 +165,7 @@ Error ContextGL_Win::initialize() { WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality - WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB/*|WGL_CONTEXT_DEBUG_BIT_ARB*/, 0}; //zero indicates the end of the array PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index ec33bb53d9..c454301e02 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -775,8 +775,10 @@ Ref Mesh::generate_triangle_mesh() const { DVector indices = a[ARRAY_INDEX]; DVector::Read ir = indices.read(); - for(int i=0;i p elem_size*=sizeof(float); } + if (elem_size==6) { + elem_size=8; + } + } break; case VS::ARRAY_NORMAL: { @@ -1207,7 +1216,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p break; } /* determine wether using 16 or 32 bits indices */ - if (p_index_len>=(1<<16)) { + if (p_vertex_len>=(1<<16)) { elem_size=4; @@ -1505,7 +1514,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector p DVector arr; arr.resize(p_index_len); - if (p_index_len<(1<<16)) { + if (p_vertex_len<(1<<16)) { DVector::Write w = arr.write(); -- cgit v1.2.3 From 289bc881aaec35cc127256137abc7dcf116afd48 Mon Sep 17 00:00:00 2001 From: reduz Date: Sun, 25 Dec 2016 08:05:23 -0300 Subject: now it really works on window for real --- drivers/gles3/rasterizer_storage_gles3.cpp | 38 +++++++++++++++++++++++++++--- platform/windows/context_gl_win.cpp | 3 ++- servers/visual/rasterizer.h | 8 +++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ffcd462808..698788316c 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2460,6 +2460,8 @@ RID RasterizerStorageGLES3::mesh_create(){ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector& p_array,int p_vertex_count,const DVector& p_index_array,int p_index_count,const AABB& p_aabb,const Vector >& p_blend_shapes,const Vector& p_bone_aabbs){ + DVector array = p_array; + Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2657,7 +2659,35 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P int array_size = stride * p_vertex_count; int index_array_size=0; - ERR_FAIL_COND(p_array.size()!=array_size); + print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size())); + if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) { + //old format, convert + array = DVector(); + + array.resize( p_array.size()+p_vertex_count*2 ); + + DVector::Write w = array.write(); + DVector::Read r = p_array.read(); + + uint16_t *w16 = (uint16_t*)w.ptr(); + const uint16_t *r16 = (uint16_t*)r.ptr(); + + uint16_t one = Math::make_half_float(1); + + for(int i=0;iactive=true; surface->array_len=p_vertex_count; surface->index_array_len=p_index_count; - surface->array_byte_size=p_array.size(); + surface->array_byte_size=array.size(); surface->index_array_byte_size=p_index_array.size(); surface->primitive=p_primitive; surface->mesh=mesh; @@ -2704,7 +2734,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P { - DVector::Read vr = p_array.read(); + DVector::Read vr = array.read(); glGenBuffers(1,&surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); @@ -5907,7 +5937,9 @@ void RasterizerStorageGLES3::initialize() { { int max_extensions=0; + print_line("getting extensions"); glGetIntegerv(GL_NUM_EXTENSIONS,&max_extensions); + print_line("total "+itos(max_extensions)); for(int i=0;i Date: Fri, 30 Dec 2016 08:35:54 -0300 Subject: begin work on new particle system --- drivers/gles3/rasterizer_storage_gles3.cpp | 194 ++++++++++++++-- drivers/gles3/rasterizer_storage_gles3.h | 86 +++++++- drivers/gles3/shaders/SCsub | 1 + drivers/gles3/shaders/particles.glsl | 114 ++++++++++ drivers/gles3/shaders/scene.glsl | 10 +- scene/2d/particles_2d.h | 1 - scene/3d/gi_probe.cpp | 11 +- scene/3d/gi_probe.h | 2 + servers/visual/rasterizer.h | 36 ++- servers/visual/visual_server_raster.h | 28 +++ servers/visual/visual_server_scene.cpp | 341 ++++++++++++++++++++++++++--- servers/visual/visual_server_scene.h | 11 +- servers/visual_server.h | 56 +++++ 13 files changed, 832 insertions(+), 59 deletions(-) create mode 100644 drivers/gles3/shaders/particles.glsl diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 698788316c..3fc0513542 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4882,37 +4882,45 @@ uint32_t RasterizerStorageGLES3::gi_probe_get_version(RID p_probe) { return gip->version; } -RID RasterizerStorageGLES3::gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth) { +RasterizerStorage::GIProbeCompression RasterizerStorageGLES3::gi_probe_get_dynamic_data_get_preferred_compression() const { + if (config.s3tc_supported) { + return GI_PROBE_S3TC; + } else { + return GI_PROBE_UNCOMPRESSED; + } +} + +RID RasterizerStorageGLES3::gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) { GIProbeData *gipd = memnew( GIProbeData ); gipd->width=p_width; gipd->height=p_height; gipd->depth=p_depth; + gipd->compression=p_compression; glActiveTexture(GL_TEXTURE0); glGenTextures(1,&gipd->tex_id); glBindTexture(GL_TEXTURE_3D,gipd->tex_id); int level=0; + int min_size=1; + + if (gipd->compression==GI_PROBE_S3TC) { + min_size=4; + } print_line("dyndata create"); while(true) { - Vector data; - data.resize(p_width*p_height*p_depth*4); - - - for(int i=0;icompression==GI_PROBE_S3TC) { + int size = p_width * p_height * p_depth; + glCompressedTexImage3D(GL_TEXTURE_3D,level,_EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT,p_width,p_height,p_depth,0, size,NULL); + } else { + glTexImage3D(GL_TEXTURE_3D,level,GL_RGBA8,p_width,p_height,p_depth,0,GL_RGBA,GL_UNSIGNED_BYTE,NULL); } - glTexImage3D(GL_TEXTURE_3D,level,GL_RGBA8,p_width,p_height,p_depth,0,GL_RGBA,GL_UNSIGNED_BYTE,data.ptr()); - if (p_width<=1 || p_height<=1 || p_depth<=1) + if (p_width<=min_size || p_height<=min_size || p_depth<=min_size) break; p_width>>=1; p_height>>=1; @@ -4933,7 +4941,7 @@ RID RasterizerStorageGLES3::gi_probe_dynamic_data_create(int p_width,int p_heigh return gi_probe_data_owner.make_rid(gipd); } -void RasterizerStorageGLES3::gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) { +void RasterizerStorageGLES3::gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) { GIProbeData *gipd = gi_probe_data_owner.getornull(p_gi_probe_data); ERR_FAIL_COND(!gipd); @@ -4957,14 +4965,168 @@ void RasterizerStorageGLES3::gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_d */ glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_3D,gipd->tex_id); - glTexSubImage3D(GL_TEXTURE_3D,p_mipmap,0,0,p_depth_slice,gipd->width>>p_mipmap,gipd->height>>p_mipmap,p_slice_count,GL_RGBA,GL_UNSIGNED_BYTE,p_data); + if (gipd->compression==GI_PROBE_S3TC) { + int size = (gipd->width>>p_mipmap) * (gipd->height>>p_mipmap) * p_slice_count; + glCompressedTexSubImage3D(GL_TEXTURE_3D,p_mipmap,0,0,p_depth_slice,gipd->width>>p_mipmap,gipd->height>>p_mipmap,p_slice_count,_EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT,size, p_data); + } else { + glTexSubImage3D(GL_TEXTURE_3D,p_mipmap,0,0,p_depth_slice,gipd->width>>p_mipmap,gipd->height>>p_mipmap,p_slice_count,GL_RGBA,GL_UNSIGNED_BYTE,p_data); + } //glTexImage3D(GL_TEXTURE_3D,p_mipmap,GL_RGBA8,gipd->width>>p_mipmap,gipd->height>>p_mipmap,gipd->depth>>p_mipmap,0,GL_RGBA,GL_UNSIGNED_BYTE,p_data); //glTexImage3D(GL_TEXTURE_3D,p_mipmap,GL_RGBA8,gipd->width>>p_mipmap,gipd->height>>p_mipmap,gipd->depth>>p_mipmap,0,GL_RGBA,GL_UNSIGNED_BYTE,data.ptr()); - print_line("update rgba8 "+itos(p_mipmap)); + +} + +/////// + + +RID RasterizerStorageGLES3::particles_create() { + + Particles *particles = memnew( Particles ); + + + return particles_owner.make_rid(particles); +} + +void RasterizerStorageGLES3::particles_set_emitting(RID p_particles,bool p_emitting) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->emitting=p_emitting; + +} +void RasterizerStorageGLES3::particles_set_amount(RID p_particles,int p_amount) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + +} +void RasterizerStorageGLES3::particles_set_lifetime(RID p_particles,float p_lifetime){ + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->lifetime=p_lifetime; +} +void RasterizerStorageGLES3::particles_set_pre_process_time(RID p_particles,float p_time) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->pre_process_time=p_time; + +} +void RasterizerStorageGLES3::particles_set_explosiveness_ratio(RID p_particles,float p_ratio) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->explosiveness=p_ratio; +} +void RasterizerStorageGLES3::particles_set_randomness_ratio(RID p_particles,float p_ratio) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->randomness=p_ratio; + +} +void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles,const AABB& p_aabb) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->custom_aabb=p_aabb; + } +void RasterizerStorageGLES3::particles_set_gravity(RID p_particles,const Vector3& p_gravity) { + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + particles->gravity=p_gravity; + +} +void RasterizerStorageGLES3::particles_set_use_local_coordinates(RID p_particles,bool p_enable) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->use_local_coords=p_enable; +} +void RasterizerStorageGLES3::particles_set_process_material(RID p_particles,RID p_material) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->process_material=p_material; +} + +void RasterizerStorageGLES3::particles_set_emission_shape(RID p_particles, VS::ParticlesEmissionShape p_shape) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->emission_shape=p_shape; +} +void RasterizerStorageGLES3::particles_set_emission_sphere_radius(RID p_particles,float p_radius) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->emission_sphere_radius=p_radius; +} +void RasterizerStorageGLES3::particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->emission_box_extents=p_extents; +} +void RasterizerStorageGLES3::particles_set_emission_points(RID p_particles,const DVector& p_points) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->emission_points=p_points; +} + + +void RasterizerStorageGLES3::particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->draw_order=p_order; +} + +void RasterizerStorageGLES3::particles_set_draw_passes(RID p_particles,int p_count) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + + particles->draw_passes.resize(p_count); +} +void RasterizerStorageGLES3::particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + ERR_FAIL_INDEX(p_pass,particles->draw_passes.size()); + p_pass,particles->draw_passes[p_pass].material=p_material; + +} +void RasterizerStorageGLES3::particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh) { + + Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND(!particles); + ERR_FAIL_INDEX(p_pass,particles->draw_passes.size()); + p_pass,particles->draw_passes[p_pass].mesh=p_mesh; + +} + +AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { + + const Particles *particles = particles_owner.getornull(p_particles); + ERR_FAIL_COND_V(!particles,AABB()); + + return particles->computed_aabb; +} +//////// void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance) { diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5a8246f030..b0f9800159 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -941,6 +941,7 @@ public: int depth; int levels; GLuint tex_id; + GIProbeCompression compression; GIProbeData() { } @@ -948,9 +949,90 @@ public: mutable RID_Owner gi_probe_data_owner; - virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth); - virtual void gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data); + virtual GIProbeCompression gi_probe_get_dynamic_data_get_preferred_compression() const; + virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth,GIProbeCompression p_compression); + virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data); + /* PARTICLES */ + + struct Particles : public Instantiable { + + bool emitting; + int amount; + float lifetime; + float pre_process_time; + float explosiveness; + float randomness; + AABB custom_aabb; + Vector3 gravity; + bool use_local_coords; + RID process_material; + + VS::ParticlesEmissionShape emission_shape; + float emission_sphere_radius; + Vector3 emission_box_extents; + DVector emission_points; + GLuint emission_point_texture; + + VS::ParticlesDrawOrder draw_order; + struct DrawPass { + RID mesh; + RID material; + }; + + Vector draw_passes; + + AABB computed_aabb; + + Particles() { + emitting=false; + amount=0; + lifetime=1.0;; + pre_process_time=0.0; + explosiveness=0.0; + randomness=0.0; + use_local_coords=true; + + draw_order=VS::PARTICLES_DRAW_ORDER_INDEX; + emission_shape=VS::PARTICLES_EMSSION_POINT; + emission_sphere_radius=1.0; + float emission_sphere_radius; + emission_box_extents=Vector3(1,1,1); + emission_point_texture=0; + } + + }; + + mutable RID_Owner particles_owner; + + virtual RID particles_create(); + + virtual void particles_set_emitting(RID p_particles,bool p_emitting); + virtual void particles_set_amount(RID p_particles,int p_amount); + virtual void particles_set_lifetime(RID p_particles,float p_lifetime); + virtual void particles_set_pre_process_time(RID p_particles,float p_time); + virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio); + virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio); + virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb); + virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity); + virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable); + virtual void particles_set_process_material(RID p_particles,RID p_material); + + virtual void particles_set_emission_shape(RID p_particles,VS::ParticlesEmissionShape p_shape); + virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius); + virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents); + virtual void particles_set_emission_points(RID p_particles,const DVector& p_points); + + + virtual void particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order); + + virtual void particles_set_draw_passes(RID p_particles,int p_count); + virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material); + virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh); + + virtual AABB particles_get_current_aabb(RID p_particles); + + /* INSTANCE */ virtual void instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); virtual void instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance); diff --git a/drivers/gles3/shaders/SCsub b/drivers/gles3/shaders/SCsub index 272f9bb5e1..f9baeae97d 100644 --- a/drivers/gles3/shaders/SCsub +++ b/drivers/gles3/shaders/SCsub @@ -17,5 +17,6 @@ if env['BUILDERS'].has_key('GLES3_GLSL'): env.GLES3_GLSL('ssao_blur.glsl'); env.GLES3_GLSL('exposure.glsl'); env.GLES3_GLSL('tonemap.glsl'); + env.GLES3_GLSL('particles.glsl'); diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl new file mode 100644 index 0000000000..fb6060957e --- /dev/null +++ b/drivers/gles3/shaders/particles.glsl @@ -0,0 +1,114 @@ +[vertex] + + + +layout(location=0) in highp vec4 pos_lifetime; +layout(location=1) in highp vec4 color; +layout(location=2) in highp vec4 velocity_seed; +layout(location=3) in highp vec4 rot_active; + + +struct Attractor { + + vec3 pos; + vec3 dir; + float radius; + float eat_radius; + float strength; + float attenuation; +}; + +#define MAX_ATTRACTORS 64 + +uniform mat4 origin; +uniform float system_phase; +uniform float prev_system_phase; +uniform float total_particles; +uniform float explosiveness; +uniform vec4 time; +uniform float delta; +uniform vec3 gravity; +uniform int attractor_count; +uniform Attractor attractors[MAX_ATTRACTORS]; + + +out highp vec4 out_pos_lifetime; //tfb: +out highp vec4 out_color; //tfb: +out highp vec4 out_velocity_seed; //tfb: +out highp vec4 out_rot_active; //tfb: + +void main() { + + bool apply_forces=true; + bool apply_velocity=true; + + float mass = 1.0; + + float restart_phase = float(gl_InstanceID)/total_particles; + restart_phase*= explosiveness; + bool restart=false; + + if (system_phase > prev_system_phase) { + restart = prev_system_phase < restart_phase && system_phase >= restart_phase; + } else { + restart = prev_system_phase < restart_phase || system_phase >= restart_phase; + } + + if (restart) { + out_rot_active.a=1.0; + } + + out_pos_lifetime=pos_lifetime; + out_color=color; + out_velocity_seed=velocity_seed; + out_rot_active=rot_active; + + if (out_rot_active.a) { + //execute shader + + } + + + if (apply_forces) { + + vec3 force = gravity; + for(int i=0;i0 && attractors[i].eat_radius > dist) { + rot_active.a=0.0; + } + + rel_vec = normalize(rel_vec); + + float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation); + + if (attractors[i].dir==vec3(0.0)) { + //towards center + force+=attractors[i].strength * rel_vec * attenuation * mass; + } else { + force+=attractors[i].strength * attractors[i].dir * attenuation *mass; + + } + } + + out_velocity_seed.xyz += force * delta; + } + + if (apply_velocity) { + + out_pos_lifetime.xyz += out_velocity_seed.xyz * delta; + } + +} + +[fragment] + + +void main() { + + +} diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index b0b2782307..90c501ea32 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -899,8 +899,10 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s float blend = 1.001-max(blendv.x,max(blendv.y,blendv.z)); blend=1.0; + float max_distance = length(bounds); + //radiance -#ifdef VCT_QUALITY_HIGH +#ifndef VCT_QUALITY_HIGH #define MAX_CONE_DIRS 6 vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( @@ -914,6 +916,7 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15); float cone_angle_tan = 0.577; + float min_ref_tan = 0.0; #else #define MAX_CONE_DIRS 4 @@ -927,9 +930,10 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25); float cone_angle_tan = 0.98269; + max_distance*=0.5; + float min_ref_tan = 0.2; #endif - float max_distance = length(bounds); vec3 light=vec3(0.0); for(int i=0;ibake_cells[p_idx].childs[i]==Baker::CHILD_EMPTY) { //sub cell must be created - p_baker->bake_cells[p_idx].childs[i]=p_baker->bake_cells.size(); + uint32_t child_idx = p_baker->bake_cells.size(); + p_baker->bake_cells[p_idx].childs[i]=child_idx; p_baker->bake_cells.resize( p_baker->bake_cells.size() + 1); + p_baker->bake_cells[child_idx].level=p_level+1; } @@ -1124,7 +1126,12 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ w32[ofs++]=norm; } - w32[ofs++]=uint32_t(baker.bake_cells[i].alpha*65535.0); + { + uint16_t alpha = CLAMP(uint32_t(baker.bake_cells[i].alpha*65535.0),0,65535); + uint16_t level = baker.bake_cells[i].level; + + w32[ofs++] = (uint32_t(level)<<16)|uint32_t(alpha); + } } diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index aea01b5367..ca882856cf 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -73,6 +73,7 @@ private: float normal[3]; uint32_t used_sides; float alpha; //used for upsampling + int level; Cell() { for(int i=0;i<8;i++) { @@ -86,6 +87,7 @@ private: } alpha=0; used_sides=0; + level=0; } }; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 844504372e..eda67f2ed4 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -432,14 +432,44 @@ public: virtual uint32_t gi_probe_get_version(RID p_probe)=0; - enum GIProbeCompress { + enum GIProbeCompression { GI_PROBE_UNCOMPRESSED, GI_PROBE_S3TC, GI_PROBE_ETC2 }; - virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth)=0; - virtual void gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data)=0; + virtual GIProbeCompression gi_probe_get_dynamic_data_get_preferred_compression() const=0; + virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth,GIProbeCompression p_compression)=0; + virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data)=0; + + /* PARTICLES */ + + virtual RID particles_create()=0; + + virtual void particles_set_emitting(RID p_particles,bool p_emitting)=0; + virtual void particles_set_amount(RID p_particles,int p_amount)=0; + virtual void particles_set_lifetime(RID p_particles,float p_lifetime)=0; + virtual void particles_set_pre_process_time(RID p_particles,float p_time)=0; + virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio)=0; + virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio)=0; + virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb)=0; + virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity)=0; + virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable)=0; + virtual void particles_set_process_material(RID p_particles,RID p_material)=0; + + virtual void particles_set_emission_shape(RID p_particles,VS::ParticlesEmissionShape p_shape)=0; + virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius)=0; + virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents)=0; + virtual void particles_set_emission_points(RID p_particles,const DVector& p_points)=0; + + + virtual void particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order)=0; + + virtual void particles_set_draw_passes(RID p_particles,int p_count)=0; + virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material)=0; + virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh)=0; + + virtual AABB particles_get_current_aabb(RID p_particles)=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index fcfaf52e0b..5088dedb53 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -830,6 +830,34 @@ public: BIND2(gi_probe_set_dynamic_data,RID,const DVector& ) BIND1RC( DVector,gi_probe_get_dynamic_data,RID) + /* PARTICLES */ + + BIND0R(RID, particles_create) + + BIND2(particles_set_emitting,RID,bool) + BIND2(particles_set_amount,RID,int ) + BIND2(particles_set_lifetime,RID,float ) + BIND2(particles_set_pre_process_time,RID,float ) + BIND2(particles_set_explosiveness_ratio,RID,float ) + BIND2(particles_set_randomness_ratio,RID,float ) + BIND2(particles_set_custom_aabb,RID,const AABB& ) + BIND2(particles_set_gravity,RID,const Vector3& ) + BIND2(particles_set_use_local_coordinates,RID,bool ) + BIND2(particles_set_process_material,RID,RID ) + + BIND2(particles_set_emission_shape,RID,VS::ParticlesEmissionShape ) + BIND2(particles_set_emission_sphere_radius,RID,float ) + BIND2(particles_set_emission_box_extents,RID,const Vector3& ) + BIND2(particles_set_emission_points,RID,const DVector& ) + + + BIND2(particles_set_draw_order,RID,VS::ParticlesDrawOrder ) + + BIND2(particles_set_draw_passes,RID,int ) + BIND3(particles_set_draw_pass_material,RID,int , RID ) + BIND3(particles_set_draw_pass_mesh,RID,int , RID ) + + BIND1R(AABB,particles_get_current_aabb,RID); #undef BINDBASE diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index aa97b2ebd6..deb391c77e 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2391,7 +2391,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.light_data=VSG::storage->gi_probe_get_dynamic_data(p_instance->base); if (probe->dynamic.light_data.size()==0) - return; + return; //using dynamic data DVector::Read r=probe->dynamic.light_data.read(); @@ -2399,15 +2399,17 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.local_data.resize(header->cell_count); + int cell_count = probe->dynamic.local_data.size(); DVector::Write ldw = probe->dynamic.local_data.write(); - const GIProbeDataCell *cells = (GIProbeDataCell*)&r[16]; probe->dynamic.level_cell_lists.resize(header->cell_subdiv); _gi_probe_fill_local_data(0,0,0,0,0,cells,header,ldw.ptr(),probe->dynamic.level_cell_lists.ptr()); - probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth); + probe->dynamic.compression = VSG::storage->gi_probe_get_dynamic_data_get_preferred_compression(); + + probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth,probe->dynamic.compression); probe->dynamic.bake_dynamic_range=VSG::storage->gi_probe_get_dynamic_range(p_instance->base); @@ -2417,6 +2419,14 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.grid_size[1]=header->height; probe->dynamic.grid_size[2]=header->depth; + int size_limit = 1; + int size_divisor = 1; + + if (probe->dynamic.compression==RasterizerStorage::GI_PROBE_S3TC) { + print_line("S3TC"); + size_limit=4; + size_divisor=4; + } for(int i=0;i<(int)header->cell_subdiv;i++) { uint32_t x = header->width >> i; @@ -2425,14 +2435,16 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { //create and clear mipmap DVector mipmap; - mipmap.resize(x*y*z*4); + int size = x*y*z*4; + size/=size_divisor; + mipmap.resize(size); DVector::Write w = mipmap.write(); - zeromem(w.ptr(),x*y*z*4); + zeromem(w.ptr(),size); w = DVector::Write(); probe->dynamic.mipmaps_3d.push_back(mipmap); - if (x<=1 || y<=1 || z<=1) + if (x<=size_limit || y<=size_limit || z<=size_limit) break; } @@ -2449,12 +2461,132 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { VSG::scene_render->gi_probe_instance_set_light_data(probe->probe_instance,p_instance->base,probe->dynamic.probe_data); VSG::scene_render->gi_probe_instance_set_transform_to_data(probe->probe_instance,probe->dynamic.light_to_cell_xform); - - VSG::scene_render->gi_probe_instance_set_bounds(probe->probe_instance,bounds.size/cell_size); probe->base_version=VSG::storage->gi_probe_get_version(p_instance->base); + //if compression is S3TC, fill it up + if (probe->dynamic.compression==RasterizerStorage::GI_PROBE_S3TC) { + + //create all blocks + Vector > comp_blocks; + int mipmap_count = probe->dynamic.mipmaps_3d.size(); + comp_blocks.resize(mipmap_count); + + for(int i=0;i>16; + int mipmap = header->cell_subdiv - level -1; + if (mipmap >= mipmap_count) + continue;//uninteresting + + + int blockx = (ld.pos[0]>>2); + int blocky = (ld.pos[1]>>2); + int blockz = (ld.pos[2]); //compression is x/y only + + int blockw = (header->width >> mipmap) >> 2; + int blockh = (header->height >> mipmap) >> 2; + + //print_line("cell "+itos(i)+" level "+itos(level)+"mipmap: "+itos(mipmap)+" pos: "+Vector3(blockx,blocky,blockz)+" size "+Vector2(blockw,blockh)); + + uint32_t key = blockz * blockw*blockh + blocky * blockw + blockx; + + Map & cmap = comp_blocks[mipmap]; + + if (!cmap.has(key)) { + + InstanceGIProbeData::CompBlockS3TC k; + k.offset=key; //use offset as counter first + k.source_count=0; + cmap[key]=k; + } + + InstanceGIProbeData::CompBlockS3TC &k=cmap[key]; + ERR_CONTINUE(k.source_count==16); + k.sources[k.source_count++]=i; + } + + //fix the blocks, precomputing what is needed + probe->dynamic.mipmaps_s3tc.resize(mipmap_count); + + for(int i=0;idynamic.mipmaps_s3tc[i].resize(comp_blocks[i].size()); + DVector::Write w = probe->dynamic.mipmaps_s3tc[i].write(); + int block_idx=0; + + for (Map::Element *E=comp_blocks[i].front();E;E=E->next()) { + + InstanceGIProbeData::CompBlockS3TC k = E->get(); + + //PRECOMPUTE ALPHA + int max_alpha=-100000; + int min_alpha=k.source_count==16 ?100000 :0; //if the block is not completely full, minimum is always 0, (and those blocks will map to 1, which will be zero) + + uint8_t alpha_block[4][4]={ {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }; + + for(int j=0;j>8)&0xFF; + if (alphamax_alpha) + max_alpha=alpha; + //fill up alpha block + alpha_block[ldw[k.sources[j]].pos[0]%4][ldw[k.sources[j]].pos[1]%4]=alpha; + + } + + //use the first mode (8 adjustable levels) + k.alpha[0]=max_alpha; + k.alpha[1]=min_alpha; + + uint64_t alpha_bits=0; + + if (max_alpha!=min_alpha) { + + int idx=0; + + for(int y=0;y<4;y++) { + for(int x=0;x<4;x++) { + + //substract minimum + uint32_t a = uint32_t(alpha_block[x][y])-min_alpha; + //convert range to 3 bits + a =int((a * 7.0 / (max_alpha-min_alpha))+0.5); + a = CLAMP(a,0,7); //just to be sure + a = 7-a; //because range is inverted in this mode + if (a==0) { + //do none, remain + } else if (a==7) { + a=1; + } else { + a=a+1; + } + + alpha_bits|=uint64_t(a)<<(idx*3); + idx++; + } + } + } + + k.alpha[2]=(alpha_bits >> 0)&0xFF; + k.alpha[3]=(alpha_bits >> 8)&0xFF; + k.alpha[4]=(alpha_bits >> 16)&0xFF; + k.alpha[5]=(alpha_bits >> 24)&0xFF; + k.alpha[6]=(alpha_bits >> 32)&0xFF; + k.alpha[7]=(alpha_bits >> 40)&0xFF; + + w[block_idx++]=k; + + } + + } + } + } void VisualServerScene::_gi_probe_bake_thread() { @@ -2859,43 +2991,190 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { //plot result to 3D texture! - for(int i=0;i<(int)header->cell_subdiv;i++) { + if (probe_data->dynamic.compression==RasterizerStorage::GI_PROBE_UNCOMPRESSED) { + + for(int i=0;i<(int)header->cell_subdiv;i++) { + + int stage = header->cell_subdiv - i -1; + + if (stage >= probe_data->dynamic.mipmaps_3d.size()) + continue; //no mipmap for this one + + print_line("generating mipmap stage: "+itos(stage)); + int level_cell_count = probe_data->dynamic.level_cell_lists[ i ].size(); + const uint32_t *level_cells = probe_data->dynamic.level_cell_lists[ i ].ptr(); - int stage = header->cell_subdiv - i -1; + DVector::Write lw = probe_data->dynamic.mipmaps_3d[stage].write(); + uint8_t *mipmapw = lw.ptr(); - if (stage >= probe_data->dynamic.mipmaps_3d.size()) - continue; //no mipmap for this one + uint32_t sizes[3]={header->width>>stage,header->height>>stage,header->depth>>stage}; - print_line("generating mipmap stage: "+itos(stage)); - int level_cell_count = probe_data->dynamic.level_cell_lists[ i ].size(); - const uint32_t *level_cells = probe_data->dynamic.level_cell_lists[ i ].ptr(); + for(int j=0;j::Write lw = probe_data->dynamic.mipmaps_3d[stage].write(); - uint8_t *mipmapw = lw.ptr(); + uint32_t idx = level_cells[j]; - uint32_t sizes[3]={header->width>>stage,header->height>>stage,header->depth>>stage}; + uint32_t r = (uint32_t(local_data[idx].energy[0])/probe_data->dynamic.bake_dynamic_range)>>2; + uint32_t g = (uint32_t(local_data[idx].energy[1])/probe_data->dynamic.bake_dynamic_range)>>2; + uint32_t b = (uint32_t(local_data[idx].energy[2])/probe_data->dynamic.bake_dynamic_range)>>2; + uint32_t a = (cells[idx].level_alpha>>8)&0xFF; - for(int j=0;jdynamic.bake_dynamic_range)>>2; - uint32_t g = (uint32_t(local_data[idx].energy[1])/probe_data->dynamic.bake_dynamic_range)>>2; - uint32_t b = (uint32_t(local_data[idx].energy[2])/probe_data->dynamic.bake_dynamic_range)>>2; - uint32_t a = cells[idx].alpha>>8; - uint32_t mm_ofs = sizes[0]*sizes[1]*(local_data[idx].pos[2]) + sizes[0]*(local_data[idx].pos[1]) + (local_data[idx].pos[0]); - mm_ofs*=4; //for RGBA (4 bytes) + } + } + } else if (probe_data->dynamic.compression==RasterizerStorage::GI_PROBE_S3TC) { + + + int mipmap_count = probe_data->dynamic.mipmaps_3d.size(); + + for(int mmi=0;mmi::Write mmw = probe_data->dynamic.mipmaps_3d[mmi].write(); + int block_count = probe_data->dynamic.mipmaps_s3tc[mmi].size(); + DVector::Read mmr = probe_data->dynamic.mipmaps_s3tc[mmi].read(); + + for(int i=0;idynamic.bake_dynamic_range))/1024.0; + colors[j].y=(local_data[b.sources[j]].energy[1]/float(probe_data->dynamic.bake_dynamic_range))/1024.0; + colors[j].z=(local_data[b.sources[j]].energy[2]/float(probe_data->dynamic.bake_dynamic_range))/1024.0; + } + //super quick and dirty compression + //find 2 most futher apart + float distance=0; + Vector3 from,to; + + if (b.source_count==16) { + //all cells are used so, find minmax between them + int further_apart[2]={0,0}; + for(int j=0;jdistance) { + distance=d; + further_apart[0]=j; + further_apart[1]=k; + } + } + } + + from = colors[further_apart[0]]; + to = colors[further_apart[1]]; + + } else { + //if a block is missing, the priority is that this block remains black, + //otherwise the geometry will appear deformed + //correct shape wins over correct color in this case + //average all colors first + Vector3 average; + + for(int j=0;j color_0) { + SWAP(color_1,color_0); + SWAP(from,to); + //} - mipmapw[mm_ofs+0]=uint8_t(CLAMP(r,0,255)); - mipmapw[mm_ofs+1]=uint8_t(CLAMP(g,0,255)); - mipmapw[mm_ofs+2]=uint8_t(CLAMP(b,0,255)); - mipmapw[mm_ofs+3]=uint8_t(CLAMP(a,0,255)); + + if (distance>0) { + + Vector3 dir = (to-from).normalized(); + + + for(int j=0;j>8)&0xFF; + blockptr[10]=color_1&0xFF; + blockptr[11]=(color_1>>8)&0xFF; + blockptr[12]=encode&0xFF; + blockptr[13]=(encode>>8)&0xFF; + blockptr[14]=(encode>>16)&0xFF; + blockptr[15]=(encode>>24)&0xFF; + + } } + } + //send back to main thread to update un little chunks probe_data->dynamic.updating_stage=GI_UPDATE_STAGE_UPLOADING; @@ -3055,7 +3334,7 @@ void VisualServerScene::render_probes() { int mmsize = probe->dynamic.mipmaps_3d[i].size(); DVector::Read r = probe->dynamic.mipmaps_3d[i].read(); - VSG::storage->gi_probe_dynamic_data_update_rgba8(probe->dynamic.probe_data,0,probe->dynamic.grid_size[2]>>i,i,r.ptr()); + VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data,0,probe->dynamic.grid_size[2]>>i,i,r.ptr()); } diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 418e8387bf..aa498e2752 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -422,6 +422,13 @@ public: uint16_t energy[3]; //using 0..1024 for float range 0..1. integer is needed for deterministic add/remove of lights }; + struct CompBlockS3TC { + uint32_t offset; //offset in mipmap + uint32_t source_count; //sources + uint32_t sources[16]; //id for each source + uint8_t alpha[8]; //alpha block is pre-computed + }; + struct Dynamic { @@ -433,8 +440,10 @@ public: RID probe_data; bool enabled; int bake_dynamic_range; + RasterizerStorage::GIProbeCompression compression; Vector< DVector > mipmaps_3d; + Vector< DVector > mipmaps_s3tc; //for s3tc int updating_stage; @@ -538,7 +547,7 @@ public: uint32_t albedo; uint32_t emission; uint32_t normal; - uint32_t alpha; + uint32_t level_alpha; }; enum { diff --git a/servers/visual_server.h b/servers/visual_server.h index ef7cbc03af..33a4083489 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -472,6 +472,53 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; + /* PARTICLES API */ + + virtual RID particles_create()=0; + + virtual void particles_set_emitting(RID p_particles,bool p_emitting)=0; + virtual void particles_set_amount(RID p_particles,int p_amount)=0; + virtual void particles_set_lifetime(RID p_particles,float p_lifetime)=0; + virtual void particles_set_pre_process_time(RID p_particles,float p_time)=0; + virtual void particles_set_explosiveness_ratio(RID p_particles,float p_ratio)=0; + virtual void particles_set_randomness_ratio(RID p_particles,float p_ratio)=0; + virtual void particles_set_custom_aabb(RID p_particles,const AABB& p_aabb)=0; + virtual void particles_set_gravity(RID p_particles,const Vector3& p_gravity)=0; + virtual void particles_set_use_local_coordinates(RID p_particles,bool p_enable)=0; + virtual void particles_set_process_material(RID p_particles,RID p_material)=0; + + enum ParticlesEmissionShape { + PARTICLES_EMSSION_POINT, + PARTICLES_EMSSION_SPHERE, + PARTICLES_EMSSION_BOX, + PARTICLES_EMSSION_POINTS, + PARTICLES_EMSSION_SEGMENTS, + }; + + virtual void particles_set_emission_shape(RID p_particles,ParticlesEmissionShape)=0; + virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius)=0; + virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents)=0; + virtual void particles_set_emission_points(RID p_particles,const DVector& p_points)=0; + + enum ParticlesDrawOrder { + PARTICLES_DRAW_ORDER_INDEX, + PARTICLES_DRAW_ORDER_LIFETIME, + PARTICLES_DRAW_ORDER_VIEW_DEPTH, + }; + + virtual void particles_set_draw_order(RID p_particles,ParticlesDrawOrder p_order)=0; + + enum ParticlesDrawPassMode { + PARTICLES_DRAW_PASS_MODE_QUAD, + PARTICLES_DRAW_PASS_MODE_MESH + }; + + + virtual void particles_set_draw_passes(RID p_particles,int p_count)=0; + virtual void particles_set_draw_pass_material(RID p_particles,int p_pass, RID p_material)=0; + virtual void particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh)=0; + + virtual AABB particles_get_current_aabb(RID p_particles)=0; /* CAMERA API */ @@ -483,7 +530,15 @@ public: virtual void camera_set_environment(RID p_camera,RID p_env)=0; virtual void camera_set_use_vertical_aspect(RID p_camera,bool p_enable)=0; +/* + enum ParticlesCollisionMode { + PARTICLES_COLLISION_NONE, + PARTICLES_COLLISION_TEXTURE, + PARTICLES_COLLISION_CUBEMAP, + }; + virtual void particles_set_collision(RID p_particles,ParticlesCollisionMode p_mode,const Transform&, p_xform,const RID p_depth_tex,const RID p_normal_tex)=0; +*/ /* VIEWPORT TARGET API */ virtual RID viewport_create()=0; @@ -622,6 +677,7 @@ public: INSTANCE_MESH, INSTANCE_MULTIMESH, INSTANCE_IMMEDIATE, + INSTANCE_PARTICLES, INSTANCE_LIGHT, INSTANCE_REFLECTION_PROBE, INSTANCE_ROOM, -- cgit v1.2.3 From a62c99c4e4325ca0c015d731f2bcb9b07410bb65 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 31 Dec 2016 10:53:29 -0300 Subject: Some fixes and clean ups --- core/image.cpp | 2 +- drivers/gles3/rasterizer_scene_gles3.cpp | 53 ++++++++++++++++++++++++++---- drivers/gles3/rasterizer_storage_gles3.cpp | 19 +++++++++++ drivers/gles3/rasterizer_storage_gles3.h | 4 +++ drivers/gles3/shaders/scene.glsl | 28 ++++++++-------- scene/3d/gi_probe.cpp | 36 ++++++++++++++++++++ scene/3d/gi_probe.h | 6 ++++ servers/visual/rasterizer.h | 4 +++ servers/visual/visual_server_raster.h | 3 ++ servers/visual/visual_server_scene.cpp | 8 +++-- servers/visual_server.h | 3 ++ 11 files changed, 141 insertions(+), 25 deletions(-) diff --git a/core/image.cpp b/core/image.cpp index 0b63d9c524..fe5c067b05 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -404,7 +404,7 @@ void Image::convert( Format p_new_format ){ case FORMAT_RGBA8|(FORMAT_LA8<<8): _convert<3,true,1,true,false,true>( width, height,rptr, wptr ); break; case FORMAT_RGBA8|(FORMAT_R8<<8): _convert<3,true,1,false,false,false>( width, height,rptr, wptr ); break; case FORMAT_RGBA8|(FORMAT_RG8<<8): _convert<3,true,2,false,false,false>( width, height,rptr, wptr ); break; - case FORMAT_RGBA8|(FORMAT_RGB8<<8): _convert<3,true,3,true,false,false>( width, height,rptr, wptr ); break; + case FORMAT_RGBA8|(FORMAT_RGB8<<8): _convert<3,true,3,false,false,false>( width, height,rptr, wptr ); break; } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 7fdd08a834..1b080a1216 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -3687,9 +3687,47 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C state.ubo_data.subsurface_scatter_width=subsurface_scatter_size; + state.ubo_data.shadow_z_offset=0; + state.ubo_data.shadow_slope_scale=0; + state.ubo_data.shadow_dual_paraboloid_render_side=0; + state.ubo_data.shadow_dual_paraboloid_render_zfar=0; _setup_environment(env,p_cam_projection,p_cam_transform); + bool fb_cleared=false; + + glDepthFunc(GL_LEQUAL); + + + if (storage->frame.current_rt && true) { + //pre z pass + glDisable(GL_BLEND); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); + + glColorMask(0,0,0,0); + + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); + + + render_list.clear(); + _fill_render_list(p_cull_result,p_cull_count,true); + render_list.sort_by_depth(false); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,true); + _render_list(render_list.elements,render_list.element_count,p_cam_transform,p_cam_projection,0,false,false,true,false,false); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,false); + + glColorMask(1,1,1,1); + + fb_cleared=true; + render_pass++; + } + + _setup_lights(p_light_cull_result,p_light_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_shadow_atlas); _setup_reflections(p_reflection_probe_cull_result,p_reflection_probe_cull_count,p_cam_transform.affine_inverse(),p_cam_projection,p_reflection_atlas,env); @@ -3778,9 +3816,10 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } } - - glClearDepth(1.0); - glClear(GL_DEPTH_BUFFER_BIT); + if (!fb_cleared) { + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); + } Color clear_color(0,0,0,0); @@ -4287,7 +4326,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa zfar=light->param[VS::LIGHT_PARAM_RANGE]; bias=light->param[VS::LIGHT_PARAM_SHADOW_BIAS]; - state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,true); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH_DUAL_PARABOLOID,true); } } else if (light->type==VS::LIGHT_SPOT) { @@ -4341,12 +4380,12 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa _setup_environment(NULL,light_projection,light_transform); - state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,true); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,true); _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,0,!flip_facing,false,true,false,false); - state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW,false); - state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_SHADOW_DUAL_PARABOLOID,false); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,false); + state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH_DUAL_PARABOLOID,false); if (light->type==VS::LIGHT_OMNI && light->omni_shadow_mode==VS::LIGHT_OMNI_SHADOW_CUBE && p_pass==5) { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 3fc0513542..2875c1f788 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4743,6 +4743,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { gip->dynamic_range=1.0; gip->energy=1.0; gip->interior=false; + gip->compress=false; gip->version=1; gip->cell_size=1.0; @@ -4864,6 +4865,24 @@ bool RasterizerStorageGLES3::gi_probe_is_interior(RID p_probe) const{ } + +void RasterizerStorageGLES3::gi_probe_set_compress(RID p_probe,bool p_enable) { + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->compress=p_enable; + +} + +bool RasterizerStorageGLES3::gi_probe_is_compressed(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,false); + + return gip->compress; + +} float RasterizerStorageGLES3::gi_probe_get_energy(RID p_probe) const{ const GIProbe *gip = gi_probe_owner.getornull(p_probe); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b0f9800159..690a169ca2 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -899,6 +899,7 @@ public: int dynamic_range; float energy; bool interior; + bool compress; uint32_t version; @@ -932,6 +933,9 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable); virtual bool gi_probe_is_interior(RID p_probe) const; + virtual void gi_probe_set_compress(RID p_probe,bool p_enable); + virtual bool gi_probe_is_compressed(RID p_probe) const; + virtual uint32_t gi_probe_get_version(RID p_probe); struct GIProbeData : public RID_Data { diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 90c501ea32..c18a356a54 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -146,7 +146,7 @@ MATERIAL_UNIFORMS #endif -#ifdef RENDER_SHADOW_DUAL_PARABOLOID +#ifdef RENDER_DEPTH_DUAL_PARABOLOID out highp float dp_clip; @@ -253,10 +253,10 @@ VERTEX_SHADER_CODE binormal_interp = binormal; #endif -#ifdef RENDER_SHADOW +#ifdef RENDER_DEPTH -#ifdef RENDER_SHADOW_DUAL_PARABOLOID +#ifdef RENDER_DEPTH_DUAL_PARABOLOID vertex_interp.z*= shadow_dual_paraboloid_render_side; normal_interp.z*= shadow_dual_paraboloid_render_side; @@ -282,12 +282,12 @@ VERTEX_SHADER_CODE z_ofs += (1.0-abs(normal_interp.z))*shadow_z_slope_scale; vertex_interp.z-=z_ofs; -#endif //RENDER_SHADOW_DUAL_PARABOLOID +#endif //RENDER_DEPTH_DUAL_PARABOLOID -#endif //RENDER_SHADOW +#endif //RENDER_DEPTH -#if !defined(SKIP_TRANSFORM_USED) && !defined(RENDER_SHADOW_DUAL_PARABOLOID) +#if !defined(SKIP_TRANSFORM_USED) && !defined(RENDER_DEPTH_DUAL_PARABOLOID) gl_Position = projection_matrix * vec4(vertex_interp,1.0); #else gl_Position = vertex; @@ -622,7 +622,7 @@ float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 p } -#ifdef RENDER_SHADOW_DUAL_PARABOLOID +#ifdef RENDER_DEPTH_DUAL_PARABOLOID in highp float dp_clip; @@ -861,20 +861,20 @@ vec3 voxel_cone_trace(sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, b float dist = dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0; float alpha=0.0; - vec4 color = vec4(0.0); + vec3 color = vec3(0.0); while(dist < max_distance && alpha < 0.95) { float diameter = max(1.0, 2.0 * tan_half_angle * dist); vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) ); float a = (1.0 - alpha); - color.rgb += a * scolor.rgb; + color += scolor.rgb * a; alpha += a * scolor.a; dist += diameter * 0.5; } //color.rgb = mix(color.rgb,mix(ambient,color.rgb,alpha),blend_ambient); - return color.rgb; + return color; } void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient,float multiplier, mat3 normal_mtx,vec3 ref_vec, float roughness, out vec4 out_spec, out vec4 out_diff) { @@ -1004,7 +1004,7 @@ void gi_probes_compute(vec3 pos, vec3 normal, float roughness, vec3 specular, in void main() { -#ifdef RENDER_SHADOW_DUAL_PARABOLOID +#ifdef RENDER_DEPTH_DUAL_PARABOLOID if (dp_clip>0.0) discard; @@ -1128,7 +1128,7 @@ FRAGMENT_SHADER_CODE vec3 eye_vec = -normalize( vertex_interp ); -#ifndef RENDER_SHADOW +#ifndef RENDER_DEPTH float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); vec2 brdf = texture(brdf_texture, vec2(roughness, ndotv)).xy; @@ -1370,7 +1370,7 @@ LIGHT_SHADER_CODE } #endif -#ifdef RENDER_SHADOW +#ifdef RENDER_DEPTH //nothing happens, so a tree-ssa optimizer will result in no fragment shader :) #else @@ -1424,7 +1424,7 @@ LIGHT_SHADER_CODE -#endif //RENDER_SHADOW +#endif //RENDER_DEPTH } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index de2d9c1b98..f8d8213b82 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -75,6 +75,19 @@ bool GIProbeData::is_interior() const{ return VS::get_singleton()->gi_probe_is_interior(probe); } + +bool GIProbeData::is_compressed() const{ + + return VS::get_singleton()->gi_probe_is_compressed(probe); +} + + +void GIProbeData::set_compress(bool p_enable) { + + VS::get_singleton()->gi_probe_set_compress(probe,p_enable); + +} + int GIProbeData::get_dynamic_range() const{ @@ -111,6 +124,9 @@ void GIProbeData::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_interior","interior"),&GIProbeData::set_interior); ObjectTypeDB::bind_method(_MD("is_interior"),&GIProbeData::is_interior); + ObjectTypeDB::bind_method(_MD("set_compress","compress"),&GIProbeData::set_compress); + ObjectTypeDB::bind_method(_MD("is_compressed"),&GIProbeData::is_compressed); + ADD_PROPERTY(PropertyInfo(Variant::_AABB,"bounds",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_bounds"),_SCS("get_bounds")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"cell_size",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_cell_size"),_SCS("get_cell_size")); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM,"to_cell_xform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_to_cell_xform"),_SCS("get_to_cell_xform")); @@ -119,6 +135,7 @@ void GIProbeData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_energy"),_SCS("get_energy")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"interior",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_interior"),_SCS("is_interior")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"compress",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_compress"),_SCS("is_compressed")); } @@ -211,6 +228,19 @@ bool GIProbe::is_interior() const { } +void GIProbe::set_compress(bool p_enable) { + + compress=p_enable; + if (probe_data.is_valid()) { + probe_data->set_compress(p_enable); + } +} + +bool GIProbe::is_compressed() const { + + return compress; +} + #include "math.h" @@ -1145,6 +1175,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ probe_data->set_dynamic_range(dynamic_range); probe_data->set_energy(energy); probe_data->set_interior(interior); + probe_data->set_compress(compress); probe_data->set_to_cell_xform(baker.to_cell_space); set_probe_data(probe_data); @@ -1327,6 +1358,9 @@ void GIProbe::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_interior","enable"),&GIProbe::set_interior); ObjectTypeDB::bind_method(_MD("is_interior"),&GIProbe::is_interior); + ObjectTypeDB::bind_method(_MD("set_compress","enable"),&GIProbe::set_compress); + ObjectTypeDB::bind_method(_MD("is_compressed"),&GIProbe::is_compressed); + ObjectTypeDB::bind_method(_MD("bake","from_node","create_visual_debug"),&GIProbe::bake,DEFVAL(Variant()),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("debug_bake"),&GIProbe::_debug_bake); ObjectTypeDB::set_method_flags(get_type_static(),_SCS("debug_bake"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); @@ -1336,6 +1370,7 @@ void GIProbe::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_RANGE,"1,16,1"),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_energy"),_SCS("get_energy")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior"),_SCS("set_interior"),_SCS("is_interior")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"compress"),_SCS("set_compress"),_SCS("is_compressed")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"data",PROPERTY_HINT_RESOURCE_TYPE,"GIProbeData"),_SCS("set_probe_data"),_SCS("get_probe_data")); @@ -1355,6 +1390,7 @@ GIProbe::GIProbe() { color_scan_cell_width=4; bake_texture_size=128; interior=false; + compress=false; gi_probe = VS::get_singleton()->gi_probe_create(); diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index ca882856cf..59747761b8 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -38,6 +38,9 @@ public: void set_interior(bool p_enable); bool is_interior() const; + void set_compress(bool p_enable); + bool is_compressed() const; + virtual RID get_rid() const; GIProbeData(); @@ -130,6 +133,7 @@ private: int dynamic_range; float energy; bool interior; + bool compress; int color_scan_cell_width; int bake_texture_size; @@ -169,6 +173,8 @@ public: void set_interior(bool p_enable); bool is_interior() const; + void set_compress(bool p_enable); + bool is_compressed() const; void bake(Node *p_from_node=NULL,bool p_create_visual_debug=false); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index eda67f2ed4..7452985522 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -430,6 +430,9 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; + virtual void gi_probe_set_compress(RID p_probe,bool p_enable)=0; + virtual bool gi_probe_is_compressed(RID p_probe) const=0; + virtual uint32_t gi_probe_get_version(RID p_probe)=0; enum GIProbeCompression { @@ -442,6 +445,7 @@ public: virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth,GIProbeCompression p_compression)=0; virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data)=0; + /* PARTICLES */ virtual RID particles_create()=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 5088dedb53..e67c140b2d 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -827,6 +827,9 @@ public: BIND2(gi_probe_set_interior,RID,bool) BIND1RC(bool,gi_probe_is_interior,RID) + BIND2(gi_probe_set_compress,RID,bool) + BIND1RC(bool,gi_probe_is_compressed,RID) + BIND2(gi_probe_set_dynamic_data,RID,const DVector& ) BIND1RC( DVector,gi_probe_get_dynamic_data,RID) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index deb391c77e..6b170d3797 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2407,7 +2407,9 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { _gi_probe_fill_local_data(0,0,0,0,0,cells,header,ldw.ptr(),probe->dynamic.level_cell_lists.ptr()); - probe->dynamic.compression = VSG::storage->gi_probe_get_dynamic_data_get_preferred_compression(); + bool compress = VSG::storage->gi_probe_is_compressed(p_instance->base); + + probe->dynamic.compression = compress ? VSG::storage->gi_probe_get_dynamic_data_get_preferred_compression() : RasterizerStorage::GI_PROBE_UNCOMPRESSED; probe->dynamic.probe_data=VSG::storage->gi_probe_dynamic_data_create(header->width,header->height,header->depth,probe->dynamic.compression); @@ -3112,10 +3114,10 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { color_1 |= CLAMP(int(to.y*63),0,63)<<5; color_1 |= CLAMP(int(to.z*31),0,31); - //if (color_1 > color_0) { + if (color_1 > color_0) { SWAP(color_1,color_0); SWAP(from,to); - //} + } if (distance>0) { diff --git a/servers/visual_server.h b/servers/visual_server.h index 33a4083489..f4848ff34e 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -472,6 +472,9 @@ public: virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; + virtual void gi_probe_set_compress(RID p_probe,bool p_enable)=0; + virtual bool gi_probe_is_compressed(RID p_probe) const=0; + /* PARTICLES API */ virtual RID particles_create()=0; -- cgit v1.2.3 From c2a217c3501b8006a3d2cdf2c678e33def15f275 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 1 Jan 2017 22:16:52 -0300 Subject: WIP particle system Ability to enable and change MSAA settings Ability to change VCT quality Ability to enable/disable HDR rendering --- drivers/gles3/rasterizer_gles3.cpp | 16 +- drivers/gles3/rasterizer_scene_gles3.cpp | 124 +++++++--- drivers/gles3/rasterizer_scene_gles3.h | 1 - drivers/gles3/rasterizer_storage_gles3.cpp | 318 ++++++++++++++++++++----- drivers/gles3/rasterizer_storage_gles3.h | 53 ++++- drivers/gles3/shader_compiler_gles3.cpp | 19 +- drivers/gles3/shaders/particles.glsl | 121 +++++++--- drivers/gles3/shaders/scene.glsl | 6 +- drivers/gles3/shaders/subsurf_scattering.glsl | 4 +- scene/main/scene_main_loop.cpp | 5 + scene/main/viewport.cpp | 48 +++- scene/main/viewport.h | 22 +- scene/register_scene_types.cpp | 1 + scene/resources/shader.cpp | 2 +- scene/resources/shader.h | 10 +- servers/visual/rasterizer.h | 2 + servers/visual/shader_types.cpp | 20 +- servers/visual/visual_server_raster.h | 3 + servers/visual/visual_server_viewport.cpp | 16 ++ servers/visual/visual_server_viewport.h | 3 + servers/visual_server.h | 12 +- tools/editor/plugins/spatial_editor_plugin.cpp | 11 + 22 files changed, 665 insertions(+), 152 deletions(-) diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index ccc5c70c97..0998d9c423 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -163,18 +163,30 @@ void RasterizerGLES3::initialize() { void RasterizerGLES3::begin_frame(){ - double time_total = double(OS::get_singleton()->get_ticks_usec())/1000000.0; + uint64_t tick = OS::get_singleton()->get_ticks_usec(); + + double time_total = double(tick)/1000000.0; storage->frame.time[0]=time_total; storage->frame.time[1]=Math::fmod(time_total,3600); storage->frame.time[2]=Math::fmod(time_total,900); storage->frame.time[3]=Math::fmod(time_total,60); storage->frame.count++; + storage->frame.delta = double(tick-storage->frame.prev_tick)/1000000.0; + if (storage->frame.prev_tick==0) { + //to avoid hiccups + storage->frame.delta=0.001; + } + + storage->frame.prev_tick=tick; + + storage->update_dirty_multimeshes(); storage->update_dirty_skeletons(); storage->update_dirty_shaders(); storage->update_dirty_materials(); + storage->update_particles(); storage->info.render_object_count=0; storage->info.render_material_switch_count=0; @@ -186,6 +198,8 @@ void RasterizerGLES3::begin_frame(){ scene->iteration(); + + } void RasterizerGLES3::set_current_render_target(RID p_render_target){ diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 1b080a1216..17e429657b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2880,10 +2880,17 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glDisable(GL_CULL_FACE); glDisable(GL_BLEND); - bool diffuse_copied=false; if (env->ssao_enabled) { - //ssao + //copy diffuse to front buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + //copy from depth, convert to linear GLint ss[2]; @@ -2960,7 +2967,7 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.linear_depth); glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_rough); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.effect); glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.ssao.blur_fbo[0]); //copy to front first Color white(1,1,1,1); @@ -3001,23 +3008,36 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c state.effect_blur_shader.bind(); state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::SSAO_COLOR,env->ssao_color); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); //previous level, since mipmaps[0] starts one level bigger + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->color); //previous level, since mipmaps[0] starts one level bigger glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.ssao.blur_red[0]); //previous level, since mipmaps[0] starts one level bigger glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level _copy_screen(); state.effect_blur_shader.set_conditional(EffectBlurShaderGLES3::SSAO_MERGE,false); + } else { + //copy diffuse to effect buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - diffuse_copied=true; } if (state.used_sss) {//sss enabled //copy diffuse while performing sss + //copy normal and roughness to effect buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT3); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT , GL_NEAREST); + state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_11_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_LOW); state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_17_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_MEDIUM); state.sss_shader.set_conditional(SubsurfScatteringShaderGLES3::USE_25_SAMPLES,subsurface_scatter_quality==SSS_QUALITY_HIGH); @@ -3030,15 +3050,10 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c state.sss_shader.set_uniform(SubsurfScatteringShaderGLES3::DIR,Vector2(1,0)); glActiveTexture(GL_TEXTURE0); - if (diffuse_copied) { - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); - } else { - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); - diffuse_copied=true; - } + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.motion_sss); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.effect); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); @@ -3056,19 +3071,16 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c } - if (!diffuse_copied) { - // just copy diffuse - storage->shaders.copy.bind(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); // copy to base level - _copy_screen(); - } + if (env->ssr_enabled) { + //copy normal and roughness to effect buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT2); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT , GL_NEAREST); - if (env->ssr_enabled) { //blur diffuse into effect mipmaps using separatable convolution //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); for(int i=0;iframe.current_rt->effects.mip_maps[1].sizes.size();i++) { @@ -3127,14 +3139,12 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.normal_rough); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.effect); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); - glActiveTexture(GL_TEXTURE3); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->effects.mip_maps[1].sizes[0].fbo); glViewport(0,0,ssr_w,ssr_h); @@ -3145,11 +3155,22 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c } + + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT1); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo); + //glDrawBuffer(GL_COLOR_ATTACHMENT0); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + glReadBuffer(GL_COLOR_ATTACHMENT0); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + //copy reflection over diffuse, resolving SSR if needed state.resolve_shader.set_conditional(ResolveShaderGLES3::USE_SSR,env->ssr_enabled); state.resolve_shader.bind(); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.specular); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->color); if (env->ssr_enabled) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[1].color); @@ -3169,7 +3190,12 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env,const CameraMatrix &p_c state.effect_blur_shader.bind(); state.effect_blur_shader.set_uniform(EffectBlurShaderGLES3::LOD,float(0)); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + { + GLuint db = GL_COLOR_ATTACHMENT0; + glDrawBuffers(1,&db); + } + + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); @@ -3193,11 +3219,23 @@ void RasterizerSceneGLES3::_post_process(Environment *env,const CameraMatrix &p_ //turn off everything used + //copy specular to front buffer + //copy diffuse to effect buffer + + + glReadBuffer(GL_COLOR_ATTACHMENT0); + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->effects.mip_maps[0].sizes[0].fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + if (!env) { //no environment, simply return and convert to SRGB glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->buffers.diffuse); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->effects.mip_maps[0].color); storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB,true); storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA,true); storage->shaders.copy.bind(); @@ -3219,7 +3257,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env,const CameraMatrix &p_ //4) Tonemap //5) Adjustments - GLuint composite_from = storage->frame.current_rt->buffers.diffuse; + GLuint composite_from = storage->frame.current_rt->effects.mip_maps[0].color; if (env->dof_blur_far_enabled) { @@ -3701,11 +3739,15 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C if (storage->frame.current_rt && true) { //pre z pass + + glDisable(GL_BLEND); glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->fbo); + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); + glDrawBuffers(0,NULL); + glViewport(0,0,storage->frame.current_rt->width,storage->frame.current_rt->height); glColorMask(0,0,0,0); @@ -3808,10 +3850,15 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C } else { - current_fbo = storage->frame.current_rt->buffers.alpha_fbo; - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); + + + current_fbo = storage->frame.current_rt->buffers.fbo; + glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS,false); + Vector draw_buffers; + draw_buffers.push_back(GL_COLOR_ATTACHMENT0); + glDrawBuffers(draw_buffers.size(),draw_buffers.ptr()); } } @@ -3902,9 +3949,9 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C if (env && env->bg_mode==VS::ENV_BG_SKYBOX) { - if (use_mrt) { - glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.alpha_fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters - } + //if (use_mrt) { + // glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for skybox, only diffuse/ambient matters + // _draw_skybox(skybox,p_cam_projection,p_cam_transform,storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP],env->skybox_scale); } @@ -4902,6 +4949,10 @@ void RasterizerSceneGLES3::initialize() { GLOBAL_DEF("rendering/gles3/subsurface_scattering/max_size",1.0); Globals::get_singleton()->set_custom_property_info("rendering/gles3/subsurface_scattering/max_size",PropertyInfo(Variant::INT,"rendering/gles3/subsurface_scattering/max_size",PROPERTY_HINT_RANGE,"0.01,8,0.01")); GLOBAL_DEF("rendering/gles3/subsurface_scattering/follow_surface",false); + + GLOBAL_DEF("rendering/gles3/high_quality_vct_gi",true); + + } exposure_shrink_size=243; @@ -4940,6 +4991,9 @@ void RasterizerSceneGLES3::iteration() { subsurface_scatter_follow_surface=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/follow_surface"); subsurface_scatter_quality=SubSurfaceScatterQuality(int(Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/quality"))); subsurface_scatter_size=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/max_size"); + + + state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH,Globals::get_singleton()->get("rendering/gles3/high_quality_vct_gi")); } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 3fdbdb95d0..7838345e59 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -53,7 +53,6 @@ public: Vector exposure_shrink; int exposure_shrink_size; - struct State { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 2875c1f788..c632d1c2da 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1401,7 +1401,7 @@ void RasterizerStorageGLES3::shader_set_mode(RID p_shader,VS::ShaderMode p_mode) ShaderGLES3* shaders[VS::SHADER_MAX]={ &scene->state.scene_shader, &canvas->state.canvas_shader, - &canvas->state.canvas_shader, + &this->shaders.particles, }; @@ -1510,6 +1510,11 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { } + case VS::SHADER_PARTICLES: { + + actions=&shaders.actions_particles; + actions->uniforms=&p_shader->uniforms; + } } @@ -4998,6 +5003,7 @@ void RasterizerStorageGLES3::gi_probe_dynamic_data_update(RID p_gi_probe_data, i /////// + RID RasterizerStorageGLES3::particles_create() { Particles *particles = memnew( Particles ); @@ -5018,7 +5024,30 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles,int p_amount) Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); + int floats = p_amount*24; + float * data = memnew_arr(float,floats); + + for(int i=0;iparticle_buffers[0]); + glBufferData(GL_ARRAY_BUFFER,floats*sizeof(float),data,GL_DYNAMIC_DRAW); + + glBindBuffer(GL_ARRAY_BUFFER,particles->particle_buffers[1]); + glBufferData(GL_ARRAY_BUFFER,floats*sizeof(float),data,GL_DYNAMIC_DRAW); + + glBindBuffer(GL_ARRAY_BUFFER,0); + + particles->prev_ticks=0; + particles->phase=0; + particles->prev_phase=0; + + memdelete_arr(data); + } + void RasterizerStorageGLES3::particles_set_lifetime(RID p_particles,float p_lifetime){ Particles *particles = particles_owner.getornull(p_particles); @@ -5125,7 +5154,7 @@ void RasterizerStorageGLES3::particles_set_draw_pass_material(RID p_particles,in Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); ERR_FAIL_INDEX(p_pass,particles->draw_passes.size()); - p_pass,particles->draw_passes[p_pass].material=p_material; + particles->draw_passes[p_pass].material=p_material; } void RasterizerStorageGLES3::particles_set_draw_pass_mesh(RID p_particles,int p_pass, RID p_mesh) { @@ -5133,7 +5162,7 @@ void RasterizerStorageGLES3::particles_set_draw_pass_mesh(RID p_particles,int p_ Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); ERR_FAIL_INDEX(p_pass,particles->draw_passes.size()); - p_pass,particles->draw_passes[p_pass].mesh=p_mesh; + particles->draw_passes[p_pass].mesh=p_mesh; } @@ -5145,6 +5174,124 @@ AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { return particles->computed_aabb; } +void RasterizerStorageGLES3::update_particles() { + + glEnable(GL_RASTERIZER_DISCARD); + glBindVertexArray(0); + + + while (particle_update_list.first()) { + + //use transform feedback to process particles + + Particles *particles = particle_update_list.first()->self(); + + + Material *material = material_owner.getornull(particles->process_material); + if (!material || !material->shader || material->shader->mode!=VS::SHADER_PARTICLES) { + + shaders.particles.set_custom_shader(0); + } else { + shaders.particles.set_custom_shader( material->shader->custom_code_id ); + + if (material->ubo_id) { + + glBindBufferBase(GL_UNIFORM_BUFFER,0,material->ubo_id); + } + + int tc = material->textures.size(); + RID* textures = material->textures.ptr(); + ShaderLanguage::ShaderNode::Uniform::Hint* texture_hints = material->shader->texture_hints.ptr(); + + + for(int i=0;itarget; + tex = t->tex_id; + + } + + glBindTexture(target,tex); + } + + } + + shaders.particles.bind(); + + shaders.particles.set_uniform(ParticlesShaderGLES3::ORIGIN,particles->origin); + + float new_phase = Math::fmod(particles->phase+(frame.delta/particles->lifetime),1.0); + + shaders.particles.set_uniform(ParticlesShaderGLES3::SYSTEM_PHASE,new_phase); + shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE,particles->phase); + particles->phase = new_phase; + + shaders.particles.set_uniform(ParticlesShaderGLES3::TOTAL_PARTICLES,particles->amount); + shaders.particles.set_uniform(ParticlesShaderGLES3::TIME,0.0); + shaders.particles.set_uniform(ParticlesShaderGLES3::EXPLOSIVENESS,particles->explosiveness); + shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA,frame.delta); + shaders.particles.set_uniform(ParticlesShaderGLES3::GRAVITY,particles->gravity); + shaders.particles.set_uniform(ParticlesShaderGLES3::ATTRACTOR_COUNT,0); + + + + + glBindBuffer(GL_ARRAY_BUFFER,particles->particle_buffers[0]); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particles->particle_buffers[1]); + + for(int i=0;i<6;i++) { + glEnableVertexAttribArray(i); + glVertexAttribPointer(i,4,GL_FLOAT,GL_FALSE,sizeof(float)*4*6,((uint8_t*)0)+(i*16)); + } + + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS,0,particles->amount); + glEndTransformFeedback(); + + particle_update_list.remove(particle_update_list.first()); + + SWAP(particles->particle_buffers[0],particles->particle_buffers[1]); + } + + glDisable(GL_RASTERIZER_DISCARD); + + for(int i=0;i<6;i++) { + glDisableVertexAttribArray(i); + } + +} + //////// void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase *p_instance) { @@ -5258,13 +5405,15 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { if (rt->buffers.fbo) { glDeleteFramebuffers(1,&rt->buffers.fbo); - glDeleteFramebuffers(1,&rt->buffers.alpha_fbo); - glDeleteTextures(1,&rt->buffers.diffuse); - glDeleteTextures(1,&rt->buffers.specular); - glDeleteTextures(1,&rt->buffers.normal_rough); - glDeleteTextures(1,&rt->buffers.motion_sss); + glDeleteRenderbuffers(1,&rt->buffers.depth); + glDeleteRenderbuffers(1,&rt->buffers.diffuse); + glDeleteRenderbuffers(1,&rt->buffers.specular); + glDeleteRenderbuffers(1,&rt->buffers.normal_rough); + glDeleteRenderbuffers(1,&rt->buffers.motion_sss); + glDeleteFramebuffers(1,&rt->buffers.effect_fbo); + glDeleteTextures(1,&rt->buffers.effect); + rt->buffers.fbo=0; - rt->buffers.alpha_fbo=0; } if (rt->depth) { @@ -5327,19 +5476,12 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ - if (config.render_arch==RENDER_ARCH_MOBILE || rt->flags[RENDER_TARGET_NO_3D]) { + if (!rt->flags[RENDER_TARGET_HDR] || rt->flags[RENDER_TARGET_NO_3D]) { - if (rt->flags[RENDER_TARGET_TRANSPARENT]) { - color_internal_format=GL_RGBA8; - color_format=GL_RGBA; - color_type=GL_UNSIGNED_BYTE; - image_format=Image::FORMAT_RGBA8; - } else { - color_internal_format=GL_RGB10_A2; - color_format=GL_RGBA; - color_type=GL_UNSIGNED_INT_2_10_10_10_REV; - image_format=Image::FORMAT_RGBA8;//todo - } + color_internal_format=GL_RGBA8; + color_format=GL_RGBA; + color_type=GL_UNSIGNED_BYTE; + image_format=Image::FORMAT_RGBA8; } else { color_internal_format=GL_RGBA16F; color_format=GL_RGBA; @@ -5347,6 +5489,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ image_format=Image::FORMAT_RGBAH; } + { /* FRONT FBO */ @@ -5407,69 +5550,99 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ + static const int msaa_value[]={0,2,4,8,16}; + int msaa=msaa_value[rt->msaa]; + //regular fbo glGenFramebuffers(1, &rt->buffers.fbo); glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, rt->depth, 0); + glGenRenderbuffers(1, &rt->buffers.depth); + glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.depth); + if (msaa==0) + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8,rt->width,rt->height); + else + glRenderbufferStorageMultisample(GL_RENDERBUFFER,msaa,GL_DEPTH24_STENCIL8,rt->width,rt->height); - glGenTextures(1, &rt->buffers.diffuse); - glBindTexture(GL_TEXTURE_2D, rt->buffers.diffuse); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, rt->width, rt->height, 0, GL_RGBA, GL_HALF_FLOAT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_RENDERBUFFER,rt->buffers.depth); + + glGenRenderbuffers(1, &rt->buffers.diffuse); + glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.diffuse); - glGenTextures(1, &rt->buffers.specular); - glBindTexture(GL_TEXTURE_2D, rt->buffers.specular); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, rt->width, rt->height, 0, GL_RGBA, GL_HALF_FLOAT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, rt->buffers.specular, 0); + if (msaa==0) + glRenderbufferStorage(GL_RENDERBUFFER,color_internal_format,rt->width,rt->height); + else + glRenderbufferStorageMultisample(GL_RENDERBUFFER,msaa,GL_RGBA16F,rt->width,rt->height); - glGenTextures(1, &rt->buffers.normal_rough); - glBindTexture(GL_TEXTURE_2D, rt->buffers.normal_rough); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, rt->buffers.normal_rough, 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_RENDERBUFFER,rt->buffers.diffuse); + + glGenRenderbuffers(1, &rt->buffers.specular); + glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.specular); + + if (msaa==0) + glRenderbufferStorage(GL_RENDERBUFFER,GL_RGBA16F,rt->width,rt->height); + else + glRenderbufferStorageMultisample(GL_RENDERBUFFER,msaa,color_internal_format,rt->width,rt->height); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT1,GL_RENDERBUFFER,rt->buffers.specular); + + glGenRenderbuffers(1, &rt->buffers.normal_rough); + glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.normal_rough); + + if (msaa==0) + glRenderbufferStorage(GL_RENDERBUFFER,GL_RGBA8,rt->width,rt->height); + else + glRenderbufferStorageMultisample(GL_RENDERBUFFER,msaa,GL_RGBA8,rt->width,rt->height); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT2,GL_RENDERBUFFER,rt->buffers.normal_rough); + + + glGenRenderbuffers(1, &rt->buffers.motion_sss); + glBindRenderbuffer(GL_RENDERBUFFER, rt->buffers.motion_sss); + + if (msaa==0) + glRenderbufferStorage(GL_RENDERBUFFER,GL_RGBA8,rt->width,rt->height); + else + glRenderbufferStorageMultisample(GL_RENDERBUFFER,msaa,GL_RGBA8,rt->width,rt->height); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT3,GL_RENDERBUFFER,rt->buffers.motion_sss); - glGenTextures(1, &rt->buffers.motion_sss); - glBindTexture(GL_TEXTURE_2D, rt->buffers.motion_sss); - glTexImage2D(GL_TEXTURE_2D, 0, GL_R32UI, rt->width, rt->height, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, rt->buffers.motion_sss, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); if (status != GL_FRAMEBUFFER_COMPLETE) { + printf("err status: %x\n",status); _render_target_clear(rt); ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); - } + } + glBindRenderbuffer(GL_RENDERBUFFER,0); - //alpha fbo - glGenFramebuffers(1, &rt->buffers.alpha_fbo); - glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.alpha_fbo); + // effect resolver - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, rt->depth, 0); + glGenFramebuffers(1, &rt->buffers.effect_fbo); + glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.effect_fbo); + + glGenTextures(1, &rt->buffers.effect); + glBindTexture(GL_TEXTURE_2D, rt->buffers.effect); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rt->width, rt->height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, rt->buffers.effect, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->buffers.diffuse, 0); - status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + printf("err status: %x\n",status); + _render_target_clear(rt); + ERR_FAIL_COND( status != GL_FRAMEBUFFER_COMPLETE ); + } + glBindFramebuffer(GL_FRAMEBUFFER, config.system_fbo); if (status != GL_FRAMEBUFFER_COMPLETE) { @@ -5499,7 +5672,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ RenderTarget::Effects::MipMaps::Size mm; - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA16F, w, h, 0, GL_RGBA, GL_HALF_FLOAT, NULL); + glTexImage2D(GL_TEXTURE_2D, level, color_internal_format, w, h, 0, color_format, color_type, NULL); mm.width=w; mm.height=h; rt->effects.mip_maps[i].sizes.push_back(mm); @@ -5711,6 +5884,20 @@ bool RasterizerStorageGLES3::render_target_renedered_in_frame(RID p_render_targe return false; } +void RasterizerStorageGLES3::render_target_set_msaa(RID p_render_target,VS::ViewportMSAA p_msaa) { + + RenderTarget *rt = render_target_owner.getornull(p_render_target); + ERR_FAIL_COND(!rt); + + if (rt->msaa==p_msaa) + return; + + _render_target_clear(rt); + rt->msaa=p_msaa; + _render_target_allocate(rt); + +} + /* CANVAS SHADOW */ @@ -6283,10 +6470,13 @@ void RasterizerStorageGLES3::initialize() { } shaders.cubemap_filter.init(); + shaders.particles.init(); glEnable(_EXT_TEXTURE_CUBE_MAP_SEAMLESS); frame.count=0; + frame.prev_tick=0; + frame.delta=0; config.keep_original_textures=false; } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 690a169ca2..357b69183e 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -8,6 +8,7 @@ #include "shaders/canvas.glsl.h" #include "shaders/blend_shape.glsl.h" #include "shaders/cubemap_filter.glsl.h" +#include "shaders/particles.glsl.h" #include "self_list.h" #include "shader_compiler_gles3.h" @@ -70,8 +71,11 @@ public: BlendShapeShaderGLES3 blend_shapes; + ParticlesShaderGLES3 particles; + ShaderCompilerGLES3::IdentifierActions actions_canvas; ShaderCompilerGLES3::IdentifierActions actions_scene; + ShaderCompilerGLES3::IdentifierActions actions_particles; } shaders; struct Resources { @@ -385,6 +389,12 @@ public: } spatial; + struct Particles { + + + } particles; + + bool uses_vertex_time; bool uses_fragment_time; @@ -988,7 +998,17 @@ public: AABB computed_aabb; - Particles() { + GLuint particle_buffers[2]; + + SelfList particle_element; + + float phase; + float prev_phase; + uint64_t prev_ticks; + + Transform origin; + + Particles() : particle_element(this) { emitting=false; amount=0; lifetime=1.0;; @@ -1000,13 +1020,29 @@ public: draw_order=VS::PARTICLES_DRAW_ORDER_INDEX; emission_shape=VS::PARTICLES_EMSSION_POINT; emission_sphere_radius=1.0; - float emission_sphere_radius; emission_box_extents=Vector3(1,1,1); emission_point_texture=0; + particle_buffers[0]=0; + particle_buffers[1]=0; + + prev_ticks=0; + + glGenBuffers(2,particle_buffers); } + ~Particles() { + + glDeleteBuffers(2,particle_buffers); + } + + }; + SelfList::List particle_update_list; + + void update_particles(); + + mutable RID_Owner particles_owner; virtual RID particles_create(); @@ -1054,11 +1090,15 @@ public: struct Buffers { GLuint fbo; - GLuint alpha_fbo; //single buffer, just diffuse (for alpha pass) + GLuint depth; GLuint specular; GLuint diffuse; GLuint normal_rough; GLuint motion_sss; + + GLuint effect_fbo; + GLuint effect; + } buffers; struct Effects { @@ -1110,22 +1150,24 @@ public: bool flags[RENDER_TARGET_FLAG_MAX]; bool used_in_frame; + VS::ViewportMSAA msaa; RID texture; RenderTarget() { + msaa=VS::VIEWPORT_MSAA_DISABLED; width=0; height=0; depth=0; fbo=0; buffers.fbo=0; - buffers.alpha_fbo=0; used_in_frame=false; flags[RENDER_TARGET_VFLIP]=false; flags[RENDER_TARGET_TRANSPARENT]=false; flags[RENDER_TARGET_NO_3D]=false; + flags[RENDER_TARGET_HDR]=true; flags[RENDER_TARGET_NO_SAMPLING]=false; last_exposure_tick=0; @@ -1143,6 +1185,7 @@ public: virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value); virtual bool render_target_renedered_in_frame(RID p_render_target); + virtual void render_target_set_msaa(RID p_render_target,VS::ViewportMSAA p_msaa); /* CANVAS SHADOW */ @@ -1187,6 +1230,8 @@ public: Color clear_request_color; int canvas_draw_commands; float time[4]; + float delta; + uint64_t prev_tick; uint64_t count; } frame; diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 336cf7b34b..26b9aeada4 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -703,6 +703,24 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].render_mode_defines["skip_transform"]="#define SKIP_TRANSFORM_USED\n"; + /* PARTICLES SHADER */ + + actions[VS::SHADER_PARTICLES].renames["COLOR"]="color"; + actions[VS::SHADER_PARTICLES].renames["VELOCITY"]="out_velocity_active.xyz"; + actions[VS::SHADER_PARTICLES].renames["MASS"]="mass"; + actions[VS::SHADER_PARTICLES].renames["ACTIVE"]="active"; + actions[VS::SHADER_PARTICLES].renames["RESTART"]="restart"; + actions[VS::SHADER_PARTICLES].renames["CUSTOM"]="out_custom"; + actions[VS::SHADER_PARTICLES].renames["TRANSFORM"]="xform"; + actions[VS::SHADER_PARTICLES].renames["TIME"]="time"; + actions[VS::SHADER_PARTICLES].renames["LIFETIME"]="lifetime"; + actions[VS::SHADER_PARTICLES].renames["DELTA"]="delta"; + actions[VS::SHADER_PARTICLES].renames["SEED"]="seed"; + actions[VS::SHADER_PARTICLES].renames["ORIGIN"]="origin"; + actions[VS::SHADER_PARTICLES].renames["INDEX"]="index"; + + actions[VS::SHADER_SPATIAL].render_mode_defines["disable_force"]="#define DISABLE_FORCE\n"; + actions[VS::SHADER_SPATIAL].render_mode_defines["disable_velocity"]="#define DISABLE_VELOCITY\n"; vertex_name="vertex"; @@ -710,7 +728,6 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { time_name="TIME"; - List func_list; ShaderLanguage::get_builtin_funcs(&func_list); diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl index fb6060957e..e72f12cc5e 100644 --- a/drivers/gles3/shaders/particles.glsl +++ b/drivers/gles3/shaders/particles.glsl @@ -2,10 +2,12 @@ -layout(location=0) in highp vec4 pos_lifetime; -layout(location=1) in highp vec4 color; -layout(location=2) in highp vec4 velocity_seed; -layout(location=3) in highp vec4 rot_active; +layout(location=0) in highp vec4 color; +layout(location=1) in highp vec4 velocity_active; +layout(location=2) in highp vec4 custom; +layout(location=3) in highp vec4 xform_1; +layout(location=4) in highp vec4 xform_2; +layout(location=5) in highp vec4 xform_3; struct Attractor { @@ -32,10 +34,24 @@ uniform int attractor_count; uniform Attractor attractors[MAX_ATTRACTORS]; -out highp vec4 out_pos_lifetime; //tfb: out highp vec4 out_color; //tfb: -out highp vec4 out_velocity_seed; //tfb: -out highp vec4 out_rot_active; //tfb: +out highp vec4 out_velocity_active; //tfb: +out highp vec4 out_custom; //tfb: +out highp vec4 out_xform_1; //tfb: +out highp vec4 out_xform_2; //tfb: +out highp vec4 out_xform_3; //tfb: + +VERTEX_SHADER_GLOBALS + +#if defined(USE_MATERIAL) + +layout(std140) uniform UniformData { //ubo:0 + +MATERIAL_UNIFORMS + +}; + +#endif void main() { @@ -47,6 +63,7 @@ void main() { float restart_phase = float(gl_InstanceID)/total_particles; restart_phase*= explosiveness; bool restart=false; + bool active = out_velocity_active.a > 0.5; if (system_phase > prev_system_phase) { restart = prev_system_phase < restart_phase && system_phase >= restart_phase; @@ -55,60 +72,96 @@ void main() { } if (restart) { - out_rot_active.a=1.0; + active=true; } - out_pos_lifetime=pos_lifetime; out_color=color; - out_velocity_seed=velocity_seed; + out_velocity_active=velocity_active; + out_custom=custom; + + mat4 xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0))); + + out_rot_active=rot_active; - if (out_rot_active.a) { + if (active) { //execute shader - } + { + VERTEX_SHADER_CODE + } +#if !defined(DISABLE_FORCE) - if (apply_forces) { + { - vec3 force = gravity; - for(int i=0;i0 && attractors[i].eat_radius > dist) { - rot_active.a=0.0; - } + vec3 rel_vec = out_pos_lifetime.xyz - attractors[i].pos; + float dist = rel_vec.length(); + if (attractors[i].radius < dist) + continue; + if (attractors[i].eat_radius>0 && attractors[i].eat_radius > dist) { + out_velocity_active.a=0.0; + } - rel_vec = normalize(rel_vec); + rel_vec = normalize(rel_vec); - float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation); + float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation); - if (attractors[i].dir==vec3(0.0)) { - //towards center - force+=attractors[i].strength * rel_vec * attenuation * mass; - } else { - force+=attractors[i].strength * attractors[i].dir * attenuation *mass; + if (attractors[i].dir==vec3(0.0)) { + //towards center + force+=attractors[i].strength * rel_vec * attenuation * mass; + } else { + force+=attractors[i].strength * attractors[i].dir * attenuation *mass; + } } + + out_velocity_seed.xyz += force * delta; } +#endif - out_velocity_seed.xyz += force * delta; - } +#if !defined(DISABLE_VELOCITY) - if (apply_velocity) { + { - out_pos_lifetime.xyz += out_velocity_seed.xyz * delta; + out_pos_lifetime.xyz += out_velocity_seed.xyz * delta; + } +#endif } + xform = transpose(xform); + + out_velocity_active.a = mix(0.0,1.0,active); + + out_xform_1 = xform[0]; + out_xform_2 = xform[1]; + out_xform_3 = xform[2]; + + } [fragment] +//any code here is never executed, stuff is filled just so it works -void main() { +FRAGMENT_SHADER_GLOBALS + +#if defined(USE_MATERIAL) +layout(std140) uniform UniformData { +MATERIAL_UNIFORMS + +}; + +#endif + +void main() { + + { + FRAGMENT_SHADER_CODE + } } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index c18a356a54..c5af010c96 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -484,7 +484,7 @@ layout(location=0) out vec4 diffuse_buffer; layout(location=1) out vec4 specular_buffer; layout(location=2) out vec4 normal_mr_buffer; #if defined (ENABLE_SSS_MOTION) -layout(location=3) out uint motion_ssr_buffer; +layout(location=3) out vec4 motion_ssr_buffer; #endif #else @@ -902,7 +902,7 @@ void gi_probe_compute(sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_s float max_distance = length(bounds); //radiance -#ifndef VCT_QUALITY_HIGH +#ifdef VCT_QUALITY_HIGH #define MAX_CONE_DIRS 6 vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] ( @@ -1407,7 +1407,7 @@ LIGHT_SHADER_CODE normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness); #if defined (ENABLE_SSS_MOTION) - motion_ssr_buffer = uint(clamp(sqrt(sss_strength)*255.0,0.0,255))<<24; + motion_ssr_buffer = vec4(vec3(0.0),sss_strength); #endif #else diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl index 89e618b66c..eb329dbaed 100644 --- a/drivers/gles3/shaders/subsurf_scattering.glsl +++ b/drivers/gles3/shaders/subsurf_scattering.glsl @@ -107,14 +107,14 @@ uniform vec2 dir; in vec2 uv_interp; uniform sampler2D source_diffuse; //texunit:0 -uniform highp usampler2D source_motion_ss; //texunit:1 +uniform sampler2D source_motion_ss; //texunit:1 uniform sampler2D source_depth; //texunit:2 layout(location = 0) out vec4 frag_color; void main() { - float strength = float(texture(source_motion_ss,uv_interp).r>>24)*(1.0/255.0); + float strength = texture(source_motion_ss,uv_interp).a; strength*=strength; //stored as sqrt // Fetch color of current pixel: diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index abc4bf3fe2..3145be1dbf 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2322,6 +2322,11 @@ SceneTree::SceneTree() { int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size",2048); int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv",8); + int msaa_mode = GLOBAL_DEF("rendering/antialias/msaa",0); + Globals::get_singleton()->set_custom_property_info("rendering/antialias/msaa",PropertyInfo(Variant::INT,"rendering/antialias/msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x")); + root->set_msaa(Viewport::MSAA(msaa_mode)); + bool hdr = GLOBAL_DEF("rendering/dynamic_range/hdr",true); + root->set_hdr(hdr); VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(),ref_atlas_size,ref_atlas_subdiv); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 8dec34a4cd..29b18c090b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2593,6 +2593,36 @@ int Viewport::gui_get_canvas_sort_index() { return gui.canvas_sort_index++; } +void Viewport::set_msaa(MSAA p_msaa) { + + ERR_FAIL_INDEX(p_msaa,5); + if (msaa==p_msaa) + return; + msaa=p_msaa; + VS::get_singleton()->viewport_set_msaa(viewport,VS::ViewportMSAA(p_msaa)); +} + +Viewport::MSAA Viewport::get_msaa() const { + + return msaa; +} + +void Viewport::set_hdr(bool p_hdr) { + + if (hdr==p_hdr) + return; + + hdr=p_hdr; + VS::get_singleton()->viewport_set_hdr(viewport,p_hdr); + +} + +bool Viewport::get_hdr() const{ + + return hdr; +} + + void Viewport::_bind_methods() { @@ -2643,6 +2673,12 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_update_mode","mode"), &Viewport::set_update_mode); ObjectTypeDB::bind_method(_MD("get_update_mode"), &Viewport::get_update_mode); + ObjectTypeDB::bind_method(_MD("set_msaa","msaa"), &Viewport::set_msaa); + ObjectTypeDB::bind_method(_MD("get_msaa"), &Viewport::get_msaa); + + ObjectTypeDB::bind_method(_MD("set_hdr","enable"), &Viewport::set_hdr); + ObjectTypeDB::bind_method(_MD("get_hdr"), &Viewport::get_hdr); + ObjectTypeDB::bind_method(_MD("get_texture:ViewportTexture"), &Viewport::get_texture); ObjectTypeDB::bind_method(_MD("set_physics_object_picking","enable"), &Viewport::set_physics_object_picking); @@ -2692,6 +2728,8 @@ void Viewport::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") ); // ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") ); + ADD_PROPERTY( PropertyInfo(Variant::INT,"msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x"), _SCS("set_msaa"), _SCS("get_msaa") ); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"hdr"), _SCS("set_hdr"), _SCS("get_hdr") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/v_flip"), _SCS("set_vflip"), _SCS("get_vflip") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/clear_on_new_frame"), _SCS("set_clear_on_new_frame"), _SCS("get_clear_on_new_frame") ); ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_update_mode"), _SCS("get_update_mode") ); @@ -2721,6 +2759,13 @@ void Viewport::_bind_methods() { BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_256 ); BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_1024 ); BIND_CONSTANT( SHADOW_ATLAS_QUADRANT_SUBDIV_MAX ); + + BIND_CONSTANT( MSAA_DISABLED ); + BIND_CONSTANT( MSAA_2X ); + BIND_CONSTANT( MSAA_4X ); + BIND_CONSTANT( MSAA_8X ); + BIND_CONSTANT( MSAA_16X ); + } @@ -2790,7 +2835,8 @@ Viewport::Viewport() { gui.canvas_sort_index=0; - + msaa=MSAA_DISABLED; + hdr=false; } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 462ecff93e..46e88e068e 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -98,6 +98,14 @@ public: }; + enum MSAA { + MSAA_DISABLED, + MSAA_2X, + MSAA_4X, + MSAA_8X, + MSAA_16X, + }; + private: friend class ViewportTexture; @@ -188,6 +196,9 @@ friend class ViewportTexture; int shadow_atlas_size; ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4]; + MSAA msaa; + bool hdr; + struct GUI { // info used when this is a window @@ -366,6 +377,12 @@ public: void set_shadow_atlas_quadrant_subdiv(int p_quadrant,ShadowAtlasQuadrantSubdiv p_subdiv); ShadowAtlasQuadrantSubdiv get_shadow_atlas_quadrant_subdiv(int p_quadrant) const; + void set_msaa(MSAA p_msaa); + MSAA get_msaa() const; + + void set_hdr(bool p_hdr); + bool get_hdr() const; + Vector2 get_camera_coords(const Vector2& p_viewport_coords) const; Vector2 get_camera_rect_size() const; @@ -410,7 +427,8 @@ public: }; -VARIANT_ENUM_CAST(Viewport::UpdateMode); -VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv); +VARIANT_ENUM_CAST( Viewport::UpdateMode ); +VARIANT_ENUM_CAST( Viewport::ShadowAtlasQuadrantSubdiv ); +VARIANT_ENUM_CAST( Viewport::MSAA ); #endif diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 1c2620ec9a..26b5def5b5 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -557,6 +557,7 @@ void register_scene_types() { ObjectTypeDB::register_type(); // ObjectTypeDB::register_type(); ObjectTypeDB::register_type(); + ObjectTypeDB::register_type(); ObjectTypeDB::add_compatibility_type("Shader","MaterialShader"); ObjectTypeDB::add_compatibility_type("ParticleSystemMaterial","FixedSpatialMaterial"); ObjectTypeDB::add_compatibility_type("UnshadedMaterial","FixedSpatialMaterial"); diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 8889d1b6f8..fd64bfe8fa 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -133,7 +133,7 @@ void Shader::_bind_methods() { BIND_CONSTANT( MODE_SPATIAL); BIND_CONSTANT( MODE_CANVAS_ITEM ); - BIND_CONSTANT( MODE_POST_PROCESS ); + BIND_CONSTANT( MODE_PARTICLES ); } diff --git a/scene/resources/shader.h b/scene/resources/shader.h index eddb98333d..4ed50fd61e 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -44,7 +44,7 @@ public: MODE_SPATIAL, MODE_CANVAS_ITEM, - MODE_POST_PROCESS, + MODE_PARTICLES, MODE_MAX }; private: @@ -119,6 +119,14 @@ public: }; +class ParticlesShader : public Shader { + + OBJ_TYPE(ParticlesShader,Shader); + +public: + + ParticlesShader() : Shader(MODE_PARTICLES) {}; +}; #endif // SHADER_H diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 7452985522..7c6f6111c2 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -484,6 +484,7 @@ public: RENDER_TARGET_TRANSPARENT, RENDER_TARGET_NO_3D, RENDER_TARGET_NO_SAMPLING, + RENDER_TARGET_HDR, RENDER_TARGET_FLAG_MAX }; @@ -492,6 +493,7 @@ public: virtual RID render_target_get_texture(RID p_render_target) const=0; virtual void render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value)=0; virtual bool render_target_renedered_in_frame(RID p_render_target)=0; + virtual void render_target_set_msaa(RID p_render_target,VS::ViewportMSAA p_msaa)=0; /* CANVAS SHADOW */ diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 4872135e2a..0eb3e0fc5a 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -156,7 +156,25 @@ ShaderTypes::ShaderTypes() shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("light_only"); - + /************ PARTICLES **************************/ + + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["COLOR"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["VELOCITY"]=ShaderLanguage::TYPE_VEC3; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["MASS"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["ACTIVE"]=ShaderLanguage::TYPE_BOOL; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["RESTART"]=ShaderLanguage::TYPE_BOOL; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["CUSTOM"]=ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TRANSFORM"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TIME"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["LIFETIME"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["DELTA"]=ShaderLanguage::TYPE_FLOAT; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["SEED"]=ShaderLanguage::TYPE_BOOL; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["ORIGIN"]=ShaderLanguage::TYPE_MAT4; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["INDEX"]=ShaderLanguage::TYPE_INT; + + shader_modes[VS::SHADER_PARTICLES].modes.insert("billboard"); + shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_force"); + shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_velocity"); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index e67c140b2d..300924e3b2 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -919,6 +919,9 @@ public: BIND3(viewport_set_canvas_layer,RID ,RID ,int ) BIND2(viewport_set_shadow_atlas_size,RID ,int ) BIND3(viewport_set_shadow_atlas_quadrant_subdivision,RID ,int, int ) + BIND2(viewport_set_msaa,RID ,ViewportMSAA ) + BIND2(viewport_set_hdr,RID ,bool ) + /* ENVIRONMENT API */ diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index fa2c461f36..558a3e4c23 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -517,6 +517,22 @@ void VisualServerViewport::viewport_set_shadow_atlas_quadrant_subdivision(RID p_ } +void VisualServerViewport::viewport_set_msaa(RID p_viewport,VS::ViewportMSAA p_msaa) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VSG::storage->render_target_set_msaa(viewport->render_target,p_msaa); +} + +void VisualServerViewport::viewport_set_hdr(RID p_viewport,bool p_enabled) { + + Viewport * viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + VSG::storage->render_target_set_flag(viewport->render_target,RasterizerStorage::RENDER_TARGET_HDR,p_enabled); + +} bool VisualServerViewport::free(RID p_rid) { diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index 2eb0ea4679..3b14ee2b1c 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -137,6 +137,9 @@ public: void viewport_set_shadow_atlas_size(RID p_viewport,int p_size); void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport,int p_quadrant,int p_subdiv); + void viewport_set_msaa(RID p_viewport,VS::ViewportMSAA p_msaa); + void viewport_set_hdr(RID p_viewport,bool p_enabled); + void draw_viewports(); bool free(RID p_rid); diff --git a/servers/visual_server.h b/servers/visual_server.h index f4848ff34e..4f7d0e2ac6 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -152,7 +152,7 @@ public: SHADER_SPATIAL, SHADER_CANVAS_ITEM, - SHADER_LIGHT, + SHADER_PARTICLES, SHADER_MAX }; @@ -593,6 +593,16 @@ public: virtual void viewport_set_shadow_atlas_size(RID p_viewport,int p_size)=0; virtual void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport,int p_quadrant,int p_subdiv)=0; + enum ViewportMSAA { + VIEWPORT_MSAA_DISABLED, + VIEWPORT_MSAA_2X, + VIEWPORT_MSAA_4X, + VIEWPORT_MSAA_8X, + VIEWPORT_MSAA_16X, + }; + + virtual void viewport_set_msaa(RID p_viewport,ViewportMSAA p_msaa)=0; + virtual void viewport_set_hdr(RID p_viewport,bool p_enabled)=0; /* ENVIRONMENT API */ diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e5e8668df6..282a2748da 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1823,6 +1823,7 @@ void SpatialEditorViewport::_notification(int p_what) { surface->update(); } + //update shadow atlas if changed int shadowmap_size = Globals::get_singleton()->get("rendering/shadow_atlas/size"); int atlas_q0 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); @@ -1830,12 +1831,22 @@ void SpatialEditorViewport::_notification(int p_what) { int atlas_q2 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); int atlas_q3 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); + viewport->set_shadow_atlas_size(shadowmap_size); viewport->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0)); viewport->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1)); viewport->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2)); viewport->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3)); + //update msaa if changed + + int msaa_mode = Globals::get_singleton()->get("rendering/antialias/msaa"); + viewport->set_msaa(Viewport::MSAA(msaa_mode)); + + bool hdr = Globals::get_singleton()->get("rendering/dynamic_range/hdr"); + viewport->set_hdr(hdr); + + } if (p_what==NOTIFICATION_ENTER_TREE) { -- cgit v1.2.3 From 741e0386717ccfecbd67ae66775699bdf4db3bb0 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 2 Jan 2017 00:01:55 -0300 Subject: Add a metallic mode --- scene/resources/material.cpp | 68 +++++++++++++++++++++++++++++++++++++++++--- scene/resources/material.h | 19 ++++++++++++- 2 files changed, 82 insertions(+), 5 deletions(-) diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 70afd68113..d21e1794d7 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -63,6 +63,7 @@ void FixedSpatialMaterial::init_shaders() { shader_names->albedo="albedo"; shader_names->specular="specular"; shader_names->roughness="roughness"; + shader_names->metalness="metalness"; shader_names->emission="emission"; shader_names->emission_energy="emission_energy"; shader_names->normal_scale="normal_scale"; @@ -173,7 +174,12 @@ void FixedSpatialMaterial::_update_shader() { code+="uniform vec4 albedo : hint_color;\n"; code+="uniform sampler2D texture_albedo : hint_albedo;\n"; - code+="uniform vec4 specular : hint_color;\n"; + if (specular_mode==SPECULAR_MODE_SPECULAR) { + code+="uniform vec4 specular : hint_color;\n"; + } else { + code+="uniform float metalness;\n"; + } + code+="uniform float roughness : hint_range(0,1);\n"; code+="uniform float point_size : hint_range(0,128);\n"; code+="uniform sampler2D texture_specular : hint_white;\n"; @@ -326,9 +332,17 @@ void FixedSpatialMaterial::_update_shader() { code+="\tALBEDO.rgb = mix(ALBEDO.rgb,detail,detail_mask_tex.r);\n"; } - code+="\tvec4 specular_tex = texture(texture_specular,UV);\n"; - code+="\tSPECULAR = specular.rgb * specular_tex.rgb;\n"; - code+="\tROUGHNESS = specular.a * roughness;\n"; + if (specular_mode==SPECULAR_MODE_SPECULAR) { + + code+="\tvec4 specular_tex = texture(texture_specular,UV);\n"; + code+="\tSPECULAR = specular.rgb * specular_tex.rgb;\n"; + code+="\tROUGHNESS = specular_tex.a * roughness;\n"; + } else { + code+="\tvec4 specular_tex = texture(texture_specular,UV);\n"; + code+="\tSPECULAR = vec3(metalness * specular_tex.r);\n"; + code+="\tROUGHNESS = specular_tex.a * roughness;\n"; + } + code+="}\n"; ShaderData shader_data; @@ -398,6 +412,17 @@ Color FixedSpatialMaterial::get_albedo() const{ return albedo; } +void FixedSpatialMaterial::set_specular_mode(SpecularMode p_mode) { + specular_mode=p_mode; + _change_notify(); + _queue_shader_change(); +} + +FixedSpatialMaterial::SpecularMode FixedSpatialMaterial::get_specular_mode() const { + + return specular_mode; +} + void FixedSpatialMaterial::set_specular(const Color& p_specular){ specular=p_specular; @@ -415,11 +440,25 @@ void FixedSpatialMaterial::set_roughness(float p_roughness){ VS::get_singleton()->material_set_param(_get_material(),shader_names->roughness,p_roughness); } + + float FixedSpatialMaterial::get_roughness() const{ return roughness; } +void FixedSpatialMaterial::set_metalness(float p_metalness){ + + metalness=p_metalness; + VS::get_singleton()->material_set_param(_get_material(),shader_names->metalness,p_metalness); +} + + +float FixedSpatialMaterial::get_metalness() const{ + + return metalness; +} + void FixedSpatialMaterial::set_emission(const Color& p_emission){ emission=p_emission; @@ -711,6 +750,13 @@ void FixedSpatialMaterial::_validate_property(PropertyInfo& property) const { _validate_feature("refraction",FEATURE_REFRACTION,property); _validate_feature("detail",FEATURE_DETAIL,property); + if (property.name=="specular/color" && specular_mode==SPECULAR_MODE_METALLIC) { + property.usage=0; + } + if (property.name=="specular/metalness" && specular_mode==SPECULAR_MODE_SPECULAR) { + property.usage=0; + } + } void FixedSpatialMaterial::set_line_width(float p_line_width) { @@ -788,9 +834,15 @@ void FixedSpatialMaterial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_albedo","albedo"),&FixedSpatialMaterial::set_albedo); ObjectTypeDB::bind_method(_MD("get_albedo"),&FixedSpatialMaterial::get_albedo); + ObjectTypeDB::bind_method(_MD("set_specular_mode","specular_mode"),&FixedSpatialMaterial::set_specular_mode); + ObjectTypeDB::bind_method(_MD("get_specular_mode"),&FixedSpatialMaterial::get_specular_mode); + ObjectTypeDB::bind_method(_MD("set_specular","specular"),&FixedSpatialMaterial::set_specular); ObjectTypeDB::bind_method(_MD("get_specular"),&FixedSpatialMaterial::get_specular); + ObjectTypeDB::bind_method(_MD("set_metalness","metalness"),&FixedSpatialMaterial::set_metalness); + ObjectTypeDB::bind_method(_MD("get_metalness"),&FixedSpatialMaterial::get_metalness); + ObjectTypeDB::bind_method(_MD("set_roughness","roughness"),&FixedSpatialMaterial::set_roughness); ObjectTypeDB::bind_method(_MD("get_roughness"),&FixedSpatialMaterial::get_roughness); @@ -892,7 +944,9 @@ void FixedSpatialMaterial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR,"albedo/color"),_SCS("set_albedo"),_SCS("get_albedo")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"albedo/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_ALBEDO); + ADD_PROPERTY(PropertyInfo(Variant::INT,"specular/mode",PROPERTY_HINT_ENUM,"Metallic,Specular"),_SCS("set_specular_mode"),_SCS("get_specular_mode")); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"specular/color",PROPERTY_HINT_COLOR_NO_ALPHA),_SCS("set_specular"),_SCS("get_specular")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/metalness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_metalness"),_SCS("get_metalness")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"specular/roughness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_roughness"),_SCS("get_roughness")); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT,"specular/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"),TEXTURE_SPECULAR); @@ -1008,15 +1062,21 @@ void FixedSpatialMaterial::_bind_methods() { BIND_CONSTANT( DIFFUSE_LAMBERT_WRAP ); BIND_CONSTANT( DIFFUSE_OREN_NAYAR ); BIND_CONSTANT( DIFFUSE_BURLEY ); + + BIND_CONSTANT( SPECULAR_MODE_METALLIC ); + BIND_CONSTANT( SPECULAR_MODE_SPECULAR ); + } FixedSpatialMaterial::FixedSpatialMaterial() : element(this) { //initialize to right values + specular_mode=SPECULAR_MODE_METALLIC; set_albedo(Color(0.7,0.7,0.7,1.0)); set_specular(Color(0.1,0.1,0.1)); set_roughness(0.0); + set_metalness(0.1); set_emission(Color(0,0,0)); set_emission_energy(1.0); set_normal_scale(1); diff --git a/scene/resources/material.h b/scene/resources/material.h index 9b80b67691..c336bc3705 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -144,11 +144,16 @@ public: DIFFUSE_BURLEY, }; + enum SpecularMode { + SPECULAR_MODE_METALLIC, + SPECULAR_MODE_SPECULAR, + }; + private: union MaterialKey { struct { - uint32_t feature_mask : 15; + uint32_t feature_mask : 14; uint32_t detail_uv : 1; uint32_t blend_mode : 2; uint32_t depth_draw_mode : 2; @@ -157,6 +162,7 @@ private: uint32_t detail_blend_mode : 2; uint32_t diffuse_mode : 2; uint32_t invalid_key : 1; + uint32_t specular_mode : 1; }; uint32_t key; @@ -196,6 +202,7 @@ private: } mk.detail_blend_mode=detail_blend_mode; mk.diffuse_mode=diffuse_mode; + mk.specular_mode=specular_mode; return mk; } @@ -203,6 +210,7 @@ private: struct ShaderNames { StringName albedo; StringName specular; + StringName metalness; StringName roughness; StringName emission; StringName emission_energy; @@ -237,6 +245,7 @@ private: Color albedo; Color specular; + float metalness; float roughness; Color emission; float emission_energy; @@ -267,6 +276,7 @@ private: CullMode cull_mode; bool flags[FLAG_MAX]; DiffuseMode diffuse_mode; + SpecularMode specular_mode; bool features[FEATURE_MAX]; @@ -285,9 +295,15 @@ public: void set_albedo(const Color& p_albedo); Color get_albedo() const; + void set_specular_mode(SpecularMode p_mode); + SpecularMode get_specular_mode() const; + void set_specular(const Color& p_specular); Color get_specular() const; + void set_metalness(float p_metalness); + float get_metalness() const; + void set_roughness(float p_roughness); float get_roughness() const; @@ -388,6 +404,7 @@ VARIANT_ENUM_CAST( FixedSpatialMaterial::DepthDrawMode ) VARIANT_ENUM_CAST( FixedSpatialMaterial::CullMode ) VARIANT_ENUM_CAST( FixedSpatialMaterial::Flags ) VARIANT_ENUM_CAST( FixedSpatialMaterial::DiffuseMode ) +VARIANT_ENUM_CAST( FixedSpatialMaterial::SpecularMode ) ////////////////////// -- cgit v1.2.3 From 2820b2d82b2ed747011e37c543aefc6d4d4edee9 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 2 Jan 2017 14:09:42 -0300 Subject: fix stupid bug in light downscaling for GI Probe --- servers/visual/visual_server_scene.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 6b170d3797..91694c3e12 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2917,6 +2917,8 @@ void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const G p_local_data[p_idx].energy[1]=0; p_local_data[p_idx].energy[2]=0; + int divisor=0; + for(int i=0;i<8;i++) { uint32_t child = p_cells[p_idx].children[i]; @@ -2931,13 +2933,14 @@ void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const G p_local_data[p_idx].energy[0]+=p_local_data[child].energy[0]; p_local_data[p_idx].energy[1]+=p_local_data[child].energy[1]; p_local_data[p_idx].energy[2]+=p_local_data[child].energy[2]; + divisor++; } //divide by eight for average - p_local_data[p_idx].energy[0]>>=3; - p_local_data[p_idx].energy[1]>>=3; - p_local_data[p_idx].energy[2]>>=3; + p_local_data[p_idx].energy[0]/=divisor; + p_local_data[p_idx].energy[1]/=divisor; + p_local_data[p_idx].energy[2]/=divisor; } -- cgit v1.2.3