Override GL_position
This commit is contained in:
parent
404f394226
commit
9f266cf7e5
|
@ -824,6 +824,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
|
|||
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||
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["UV2"] = "uv2_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["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["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||
|
|
|
@ -354,6 +354,10 @@ void main() {
|
|||
uv2_interp = uv2_attrib;
|
||||
#endif
|
||||
|
||||
#ifdef OVERRIDE_POSITION
|
||||
highp vec4 position;
|
||||
#endif
|
||||
|
||||
#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
|
||||
vertex = world_matrix * vertex;
|
||||
normal = normalize((world_matrix * vec4(normal, 0.0)).xyz);
|
||||
|
@ -641,7 +645,12 @@ VERTEX_SHADER_CODE
|
|||
#endif //fog
|
||||
|
||||
#endif //use vertex lighting
|
||||
|
||||
#ifdef OVERRIDE_POSITION
|
||||
gl_Position = position;
|
||||
#else
|
||||
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
|
|
|
@ -838,6 +838,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||
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["UV2"] = "uv2_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["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["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||
|
|
|
@ -306,6 +306,10 @@ void main() {
|
|||
uv2_interp = uv2_attrib;
|
||||
#endif
|
||||
|
||||
#ifdef OVERRIDE_POSITION
|
||||
highp vec4 position;
|
||||
#endif
|
||||
|
||||
#if defined(USE_INSTANCING) && defined(ENABLE_INSTANCE_CUSTOM)
|
||||
vec4 instance_custom = instance_custom_data;
|
||||
#else
|
||||
|
@ -461,7 +465,11 @@ VERTEX_SHADER_CODE
|
|||
|
||||
#endif //RENDER_DEPTH
|
||||
|
||||
#ifdef OVERRIDE_POSITION
|
||||
gl_Position = position;
|
||||
#else
|
||||
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
|
||||
#endif
|
||||
|
||||
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["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["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["UV2"] = ShaderLanguage::TYPE_VEC2;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
|
||||
|
|
Loading…
Reference in New Issue