summaryrefslogtreecommitdiff
path: root/servers/rendering/shader_compiler.cpp
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2021-08-15 23:37:24 -0700
committerclayjohn <claynjohn@gmail.com>2022-02-22 19:39:41 -0800
commitfe492446111ac9f8ae8186d360cdb2dcebece3da (patch)
tree370fea4feeb2101ae2cb68a596091d7ab8a6b2bd /servers/rendering/shader_compiler.cpp
parent002ab1060862431731cd528a0887ad8362ab404c (diff)
Use Filament specular models and parametrization
Diffstat (limited to 'servers/rendering/shader_compiler.cpp')
-rw-r--r--servers/rendering/shader_compiler.cpp144
1 files changed, 0 insertions, 144 deletions
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp
index a0b0b31a7b..812d636a0b 100644
--- a/servers/rendering/shader_compiler.cpp
+++ b/servers/rendering/shader_compiler.cpp
@@ -1373,148 +1373,4 @@ void ShaderCompiler::initialize(DefaultIdentifierActions p_actions) {
}
ShaderCompiler::ShaderCompiler() {
-#if 0
-
- /** SPATIAL SHADER **/
-
- actions[RS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
- actions[RS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
- actions[RS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
- actions[RS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
- actions[RS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
- actions[RS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
-
- actions[RS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
- actions[RS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
- actions[RS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
- actions[RS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
- actions[RS::SHADER_SPATIAL].renames["POSITION"] = "position";
- actions[RS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
- actions[RS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
- actions[RS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
- actions[RS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
- actions[RS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID";
-
- //builtins
-
- actions[RS::SHADER_SPATIAL].renames["TIME"] = "time";
- actions[RS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
-
- actions[RS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
- actions[RS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
- actions[RS::SHADER_SPATIAL].renames["NORMAL_MAP"] = "normal_map";
- actions[RS::SHADER_SPATIAL].renames["NORMAL_MAP_DEPTH"] = "normal_map_depth";
- actions[RS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
- actions[RS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
- actions[RS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
- actions[RS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
- actions[RS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
- actions[RS::SHADER_SPATIAL].renames["RIM"] = "rim";
- actions[RS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
- actions[RS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
- actions[RS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
- actions[RS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
- actions[RS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
- actions[RS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
- actions[RS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
- actions[RS::SHADER_SPATIAL].renames["AO"] = "ao";
- actions[RS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
- actions[RS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
- actions[RS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
- actions[RS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
- actions[RS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
- actions[RS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
- actions[RS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer";
- actions[RS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
- actions[RS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
- actions[RS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
-
- //for light
- actions[RS::SHADER_SPATIAL].renames["VIEW"] = "view";
- actions[RS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
- actions[RS::SHADER_SPATIAL].renames["LIGHT"] = "light";
- actions[RS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
- actions[RS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
- actions[RS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
-
- actions[RS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
- actions[RS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
- actions[RS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
- actions[RS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
- actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
- actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
- actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
- actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
- actions[RS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
- actions[RS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
- actions[RS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
- actions[RS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
- actions[RS::SHADER_SPATIAL].usage_defines["NORMAL_MAP"] = "#define ENABLE_NORMAL_MAP\n";
- actions[RS::SHADER_SPATIAL].usage_defines["NORMAL_MAP_DEPTH"] = "@NORMAL_MAP";
- actions[RS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
- actions[RS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
- actions[RS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
- actions[RS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
-
- actions[RS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
- actions[RS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
- actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
- actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
-
- actions[RS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
- actions[RS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
-
- actions[RS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
-
- bool force_lambert = GLOBAL_GET("rendering/shading/overrides/force_lambert_over_burley");
-
- if (!force_lambert) {
- actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
- }
-
- actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
-
- bool force_blinn = GLOBAL_GET("rendering/shading/overrides/force_blinn_over_ggx");
-
- if (!force_blinn) {
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
- } else {
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
- }
-
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
- actions[RS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
-
- /* PARTICLES SHADER */
-
- actions[RS::SHADER_PARTICLES].renames["COLOR"] = "out_color";
- actions[RS::SHADER_PARTICLES].renames["VELOCITY"] = "out_velocity_active.xyz";
- actions[RS::SHADER_PARTICLES].renames["MASS"] = "mass";
- actions[RS::SHADER_PARTICLES].renames["ACTIVE"] = "shader_active";
- actions[RS::SHADER_PARTICLES].renames["RESTART"] = "restart";
- actions[RS::SHADER_PARTICLES].renames["CUSTOM"] = "out_custom";
- actions[RS::SHADER_PARTICLES].renames["TRANSFORM"] = "xform";
- actions[RS::SHADER_PARTICLES].renames["TIME"] = "time";
- actions[RS::SHADER_PARTICLES].renames["LIFETIME"] = "lifetime";
- actions[RS::SHADER_PARTICLES].renames["DELTA"] = "local_delta";
- actions[RS::SHADER_PARTICLES].renames["NUMBER"] = "particle_number";
- actions[RS::SHADER_PARTICLES].renames["INDEX"] = "index";
- actions[RS::SHADER_PARTICLES].renames["GRAVITY"] = "current_gravity";
- actions[RS::SHADER_PARTICLES].renames["EMISSION_TRANSFORM"] = "emission_transform";
- actions[RS::SHADER_PARTICLES].renames["RANDOM_SEED"] = "random_seed";
-
- actions[RS::SHADER_PARTICLES].render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
- actions[RS::SHADER_PARTICLES].render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
- actions[RS::SHADER_PARTICLES].render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
-#endif
}