mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #23483 from clayjohn/fragment_camera_view
Make VIEW vector available in fragment shader
This commit is contained in:
commit
37e198c320
@ -1384,6 +1384,7 @@ void main() {
|
||||
discard;
|
||||
#endif
|
||||
highp vec3 vertex = vertex_interp;
|
||||
vec3 view = -normalize(vertex_interp);
|
||||
vec3 albedo = vec3(1.0);
|
||||
vec3 transmission = vec3(0.0);
|
||||
float metallic = 0.0;
|
||||
@ -1457,7 +1458,7 @@ FRAGMENT_SHADER_CODE
|
||||
vec3 diffuse_light = vec3(0.0, 0.0, 0.0);
|
||||
vec3 ambient_light = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
vec3 eye_position = -normalize(vertex_interp);
|
||||
vec3 eye_position = view;
|
||||
|
||||
#if defined(ALPHA_SCISSOR_USED)
|
||||
if (alpha < alpha_scissor) {
|
||||
|
@ -1565,6 +1565,7 @@ void main() {
|
||||
|
||||
//lay out everything, whathever is unused is optimized away anyway
|
||||
highp vec3 vertex = vertex_interp;
|
||||
vec3 view = -normalize(vertex_interp);
|
||||
vec3 albedo = vec3(1.0);
|
||||
vec3 transmission = vec3(0.0);
|
||||
float metallic = 0.0;
|
||||
@ -1699,7 +1700,7 @@ FRAGMENT_SHADER_CODE
|
||||
vec3 ambient_light;
|
||||
vec3 env_reflection_light = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
vec3 eye_vec = -normalize(vertex_interp);
|
||||
vec3 eye_vec = view;
|
||||
|
||||
#ifdef USE_RADIANCE_MAP
|
||||
|
||||
|
@ -86,6 +86,7 @@ ShaderTypes::ShaderTypes() {
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
|
||||
|
Loading…
Reference in New Issue
Block a user