mirror of
https://github.com/godotengine/godot
synced 2024-09-06 03:03:33 +00:00
Fix sidedness check in material. Also remove SIDE built-in.
This commit is contained in:
parent
4a2eef4ad8
commit
2b31155baa
|
@ -806,7 +806,6 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||
actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
|
||||
actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
|
||||
actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer";
|
||||
actions[VS::SHADER_SPATIAL].renames["SIDE"] = "side";
|
||||
actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
|
||||
|
||||
//for light
|
||||
|
@ -847,6 +846,8 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
|
||||
|
|
|
@ -1615,7 +1615,7 @@ void main() {
|
|||
|
||||
float alpha = 1.0;
|
||||
|
||||
#ifdef METERIAL_DOUBLESIDED
|
||||
#if defined(DO_SIDE_CHECK)
|
||||
float side=float(gl_FrontFacing)*2.0-1.0;
|
||||
#else
|
||||
float side=1.0;
|
||||
|
|
|
@ -753,7 +753,7 @@ void SpatialMaterial::_update_shader() {
|
|||
if (features[FEATURE_REFRACTION] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //refraction not supported with triplanar
|
||||
|
||||
if (features[FEATURE_NORMAL_MAPPING]) {
|
||||
code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) ) * SIDE;\n";
|
||||
code += "\tvec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) );\n";
|
||||
} else {
|
||||
code += "\tvec3 ref_normal = NORMAL;\n";
|
||||
}
|
||||
|
|
|
@ -109,7 +109,6 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SIDE"] = constt(ShaderLanguage::TYPE_FLOAT);
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA_SCISSOR"] = ShaderLanguage::TYPE_FLOAT;
|
||||
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
|
||||
|
|
Loading…
Reference in a new issue