return tex2D(ColorMapSampler, input.TexCoord)
* DiffuseIntensity * DiffuseColor * Diff + SpecularColor * specular);
That's 1 opening brace and 2 closing braces; one of these should be removed. I'm guessing it's the first one?
문제
My XNA HLSL Compiler keeps telling that I have unexpected ')' at the end of a subtraction. The PixelShader:
float3 lightDir = normalize(LightDirection);
float3 viewDir = normalize(input.View);
float3 normal = input.Normal;
float diff = saturate(dot(input.Normal, lightDir));
float3 reflect = normalize(2 * diff * normal - lightDir);
float specular = pow(saturate(dot(reflect, viewDir)), SpecularIntensity);
return tex2D(ColorMapSampler, input.TexCoord)
* DiffuseIntensity * DiffuseColor * diff + SpecularColor * specular);
Sometimes though it randomly works there after at another spot it "bugs" again.
해결책
return tex2D(ColorMapSampler, input.TexCoord)
* DiffuseIntensity * DiffuseColor * Diff + SpecularColor * specular);
That's 1 opening brace and 2 closing braces; one of these should be removed. I'm guessing it's the first one?
다른 팁
It's because you really have an unexpected )
, at the end of this line
return tex2D(ColorMapSampler, input.TexCoord)
* DiffuseIntensity * DiffuseColor * Diff + SpecularColor * specular);
^
|
Here ------
Either remove it or remove the first one :
return tex2D(ColorMapSampler, input.TexCoord
* DiffuseIntensity * DiffuseColor * Diff + SpecularColor * specular);