glsl shader syntax fehler bei if?

coolian

Bekanntes Mitglied
habe ein glsl fragment shader bei dem ich grade ein syntax fehler bekommen der anscheinend vom if statement redet finde den fehler aber nicht siet für mich alles richtig aus shader code:
C-ähnlich:
#version 130

in vec2 pass_textureCoordinates;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;

out vec4 out_Color;

uniform sampler2D modelTexture;
uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

void main(void){

    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);
    
    float nDot1 = dot(unitNormal, unitLightVector);
    float brightness = max(nDot1, 0.2);
    vec3 diffuse = brightness * lightColour;
    
    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);
    
    float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
    specularFactor = max(specularFactor, 0.0);
    float dampedFactor = pow(specularFactor, shineDamper);
    vec3 finalSpecular = dampedFactor * reflectivity * lightColour;
    
    vec4 textureColour = texture(modelTexture,pass_textureCoordinates)
    if (textureColour.a < 0.5) {
        discard;
    }
    
    out_Color = vec4(diffuse, 1.0) * textureColour + vec4(finalSpecular, 1.0);

}

der fehler kommt auf linie 34 das ist die mit dem if statement
ich bin mir nicht sicher ob die frage genau hierhin passt weil ich mit java das mache aber der code shader code ist und die ganze frage nichts mit java zutun hat wusste aber auch sonst nicht wo die Frage hin passen könnte

Lg coolian
 

httpdigest

Top Contributor
Code:
vec4 textureColour = texture(modelTexture,pass_textureCoordinates) <---- !!!!Semikolon fehlt!!!!!
if (textureColour.a < 0.5) {
   ...
 

Ähnliche Java Themen

Neue Themen


Oben