|
@ -185,8 +185,8 @@ 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.8f, 0.8f, 0.8f, 1.0f }; |
|
|
float diffuseMaterial[] = { 0.8f, 0.8f, 0.8f, 1.0f }; |
|
|
float lightPos[] = { 0.0f,1.0f, 0.0f,0.0f }; |
|
|
|
|
|
float diffuseIntensity = 1.0f; |
|
|
|
|
|
|
|
|
float lightPos[] = { 1.0f, 3.0f, -0.8f,1.0f }; |
|
|
|
|
|
float diffuseIntensity = 2.0f; |
|
|
|
|
|
|
|
|
float spotLightDirection[] = { 0.0f, -1.0f, 0.0f, 128.0f };//°Ñ×îºóһλ¸Ä³É......
|
|
|
float spotLightDirection[] = { 0.0f, -1.0f, 0.0f, 128.0f };//°Ñ×îºóһλ¸Ä³É......
|
|
|
float spotLightCutoff = 0.0f; |
|
|
float spotLightCutoff = 0.0f; |
|
@ -197,21 +197,21 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
float eyePos[] = { 0.0f, 0.0f, 0.0f }; |
|
|
float eyePos[] = { 0.0f, 0.0f, 0.0f }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glm::mat4 model = glm::translate<float>(0.0f, 0.0f, -2.0f) * glm::rotate(-60.0f, 1.0f, 1.0f, 1.0f); |
|
|
|
|
|
|
|
|
glm::mat4 model = glm::translate<float>(1.0f, 0.0f, 0.0f) * glm::rotate(-60.0f, 1.0f, 1.0f, 1.0f); |
|
|
glm::mat4 normalMatrix = glm::inverseTranspose(model); |
|
|
glm::mat4 normalMatrix = glm::inverseTranspose(model); |
|
|
|
|
|
|
|
|
glm::mat4 quadModel = glm::translate<float>(0.0f, -1.5f, -2.0f) * glm::rotate(-90.0f, 1.0f, 0.0f, 0.0f) * glm::scale(8.0f, 8.0f, 8.0f); |
|
|
|
|
|
|
|
|
glm::mat4 quadModel = glm::translate<float>(0.0f, -1.5f, 0.0f) * glm::rotate(-90.0f, 1.0f, 0.0f, 0.0f) * glm::scale(8.0f, 8.0f, 8.0f); |
|
|
glm::mat4 quadNormalMatrix = glm::inverseTranspose(quadModel); |
|
|
glm::mat4 quadNormalMatrix = glm::inverseTranspose(quadModel); |
|
|
|
|
|
|
|
|
glm::mat4 sphereModel = glm::translate<float>(0.1f, 3.0f, -2.2f) * glm::scale(0.3f, 0.3f, 0.3f); |
|
|
|
|
|
|
|
|
glm::mat4 sphereModel = glm::translate<float>(lightPos[0], lightPos[1], lightPos[2]) * glm::scale(0.3f, 0.3f, 0.3f); |
|
|
glm::mat4 sphereNormalMatrix = glm::inverseTranspose(sphereModel); |
|
|
glm::mat4 sphereNormalMatrix = glm::inverseTranspose(sphereModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glm::mat4 viewMatrix = glm::lookAt(glm::vec3(1.0f, 0.5f, -10.0f), glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, 1.0f, 0.0f)); |
|
|
|
|
|
glm::mat4 projectionMatrix = glm::perspective(50.0f, 800.0f / 600.0f, 0.1f, 1000.0f); |
|
|
|
|
|
|
|
|
glm::mat4 viewMatrix = glm::lookAt(glm::vec3(0.5f, 1.9f, -8.0f), glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, 1.0f, 0.0f)); |
|
|
|
|
|
glm::mat4 projectionMatrix = glm::perspective(50.0f, (float)viewportWidth / (float)viewportHeight, 0.1f, 1000.0f); |
|
|
|
|
|
|
|
|
glm::mat4 lightMatrix = glm::lookAt(glm::vec3(0.0f, 10.0f, 0.0f), glm::vec3(0.0f, 0.0f, -2.0f), glm::vec3(0.0f, 0.0f, -1.0f)); |
|
|
|
|
|
glm::mat4 lightprojectionMatrix = glm::ortho(-5.0f, 5.0f, -5.0f, 5.0f, 0.1f, 15.0f); |
|
|
|
|
|
|
|
|
glm::mat4 lightMatrix = glm::lookAt(glm::vec3(lightPos[0], lightPos[1], lightPos[2]), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)); |
|
|
|
|
|
glm::mat4 lightprojectionMatrix = glm::perspective(90.0f, (float)viewportWidth / (float)viewportHeight, 0.1f, 1000.0f);;//glm::ortho(-5.0f, 5.0f, -5.0f, 5.0f, 0.1f, 15.0f);
|
|
|
|
|
|
|
|
|
//³õʼ»¯fsq
|
|
|
//³õʼ»¯fsq
|
|
|
FullScreenQuad fsq; |
|
|
FullScreenQuad fsq; |
|
@ -240,7 +240,7 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
ShowWindow(hwnd, SW_SHOW); |
|
|
ShowWindow(hwnd, SW_SHOW); |
|
|
UpdateWindow(hwnd); |
|
|
UpdateWindow(hwnd); |
|
|
|
|
|
|
|
|
glClearColor(0.1f, 0.1f, 0.1f, 1.0f); |
|
|
|
|
|
|
|
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); |
|
|
glEnable(GL_DEPTH_TEST); |
|
|
glEnable(GL_DEPTH_TEST); |
|
|
|
|
|
|
|
|
depthfbo.Bind(); |
|
|
depthfbo.Bind(); |
|
|