Browse Source

spotlight

master
blobt 4 years ago
parent
commit
08864d7a15
  1. BIN
      .vs/shader3/v14/.suo
  2. 6
      main.cpp
  3. 4
      res/shader/test.fs

BIN
.vs/shader3/v14/.suo

6
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 ambientMaterial[] = { 0.2f,0.2f,0.2f,1.0f };
float diffuseLightColor[] = { 1.0f,1.0f,1.0f,1.0f }; float diffuseLightColor[] = { 1.0f,1.0f,1.0f,1.0f };
float diffuseMaterial[] = { 0.6f,0.6f,0.6f,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 specularLightColor[] = { 1.0f,1.0f,1.0f,1.0f };
float specularMaterial[] = { 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 }; float eyePos[] = { 0.0f,0.0f,0.0f };

4
res/shader/test.fs

@ -55,10 +55,10 @@ void main()
float diffuseIntensity = 0.0; float diffuseIntensity = 0.0;
if(currentCosThta > cosThta){ 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; gl_FragColor = ambientColor + diffuseColor;
} }
Loading…
Cancel
Save