diff --git a/.vs/shader3/v14/.suo b/.vs/shader3/v14/.suo index ff1feca..06bafc7 100644 Binary files a/.vs/shader3/v14/.suo and b/.vs/shader3/v14/.suo differ diff --git a/main.cpp b/main.cpp index 8972606..b06e04c 100644 --- a/main.cpp +++ b/main.cpp @@ -99,9 +99,9 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ float ambientMaterial[] = { 0.2f,0.2f,0.2f,1.0f }; float diffuseLightColor[] = { 1.0f,1.0f,1.0f,1.0f }; float diffuseMaterial[] = { 0.6f,0.6f,0.6f,1.0f }; - float lightPos[] = {0.0f,1.5f,-3.0f,1.0f}; - float spotLightDirection[] = {0.0f, -1.0f, 0.0f, 1.0f}; - float spotLightCutoff = 15.0f; + float lightPos[] = {0.0f,1.5f,-3.0f,0.0f}; + float spotLightDirection[] = {0.0f, -1.0f, 0.0f, 64.0f};//把最后一位改成...... + float spotLightCutoff = 30.0f; float specularLightColor[] = { 1.0f,1.0f,1.0f,1.0f }; float specularMaterial[] = { 1.0f,1.0f,1.0f,1.0f }; float eyePos[] = { 0.0f,0.0f,0.0f }; diff --git a/res/shader/test.fs b/res/shader/test.fs index 6524506..ea1bba1 100644 --- a/res/shader/test.fs +++ b/res/shader/test.fs @@ -55,10 +55,10 @@ void main() float diffuseIntensity = 0.0; if(currentCosThta > cosThta){ - diffuseIntensity = 0.8; + diffuseIntensity = pow(currentCosThta, U_LightDirection.w); } - vec4 diffuseColor = U_DiffuseLightColor * U_DiffuseMaterial * diffuseIntensity * attenuation; + vec4 diffuseColor = U_DiffuseLightColor * U_DiffuseMaterial * diffuseIntensity * attenuation *4.0; gl_FragColor = ambientColor + diffuseColor; } \ No newline at end of file