mirror of
https://github.com/godotengine/godot.git
synced 2025-01-18 20:40:57 +08:00
Merge pull request #24539 from BastiaanOlij/override_gl_position
Override GL_position
This commit is contained in:
commit
1504c96112
@ -824,6 +824,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
|
|||||||
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||||
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||||
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
||||||
|
actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
|
||||||
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
||||||
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
||||||
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
||||||
@ -889,6 +890,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
|
|||||||
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
||||||
|
actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||||
|
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||||
|
@ -354,6 +354,10 @@ void main() {
|
|||||||
uv2_interp = uv2_attrib;
|
uv2_interp = uv2_attrib;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OVERRIDE_POSITION
|
||||||
|
highp vec4 position;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
|
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
|
||||||
vertex = world_matrix * vertex;
|
vertex = world_matrix * vertex;
|
||||||
normal = normalize((world_matrix * vec4(normal, 0.0)).xyz);
|
normal = normalize((world_matrix * vec4(normal, 0.0)).xyz);
|
||||||
@ -641,7 +645,12 @@ VERTEX_SHADER_CODE
|
|||||||
#endif //fog
|
#endif //fog
|
||||||
|
|
||||||
#endif //use vertex lighting
|
#endif //use vertex lighting
|
||||||
|
|
||||||
|
#ifdef OVERRIDE_POSITION
|
||||||
|
gl_Position = position;
|
||||||
|
#else
|
||||||
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
@ -838,6 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||||||
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||||
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||||
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
||||||
|
actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
|
||||||
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
||||||
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
||||||
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
||||||
@ -903,6 +904,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||||||
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
||||||
|
actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||||
|
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||||
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||||
|
@ -306,6 +306,10 @@ void main() {
|
|||||||
uv2_interp = uv2_attrib;
|
uv2_interp = uv2_attrib;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OVERRIDE_POSITION
|
||||||
|
highp vec4 position;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_INSTANCING) && defined(ENABLE_INSTANCE_CUSTOM)
|
#if defined(USE_INSTANCING) && defined(ENABLE_INSTANCE_CUSTOM)
|
||||||
vec4 instance_custom = instance_custom_data;
|
vec4 instance_custom = instance_custom_data;
|
||||||
#else
|
#else
|
||||||
@ -461,7 +465,11 @@ VERTEX_SHADER_CODE
|
|||||||
|
|
||||||
#endif //RENDER_DEPTH
|
#endif //RENDER_DEPTH
|
||||||
|
|
||||||
|
#ifdef OVERRIDE_POSITION
|
||||||
|
gl_Position = position;
|
||||||
|
#else
|
||||||
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
position_interp = gl_Position;
|
position_interp = gl_Position;
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ ShaderTypes::ShaderTypes() {
|
|||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
|
||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||||
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC4;
|
||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
|
||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2;
|
||||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
|
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
|
||||||
|
Loading…
Reference in New Issue
Block a user