|
@ -164,6 +164,9 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
gpuProgram.DetectUniform("U_SpecularLightColor"); |
|
|
gpuProgram.DetectUniform("U_SpecularLightColor"); |
|
|
gpuProgram.DetectUniform("U_SpecularMaterial"); |
|
|
gpuProgram.DetectUniform("U_SpecularMaterial"); |
|
|
gpuProgram.DetectUniform("U_EyePos"); |
|
|
gpuProgram.DetectUniform("U_EyePos"); |
|
|
|
|
|
gpuProgram.DetectUniform("U_LightProjection"); |
|
|
|
|
|
gpuProgram.DetectUniform("U_LightViewMatrix"); |
|
|
|
|
|
gpuProgram.DetectUniform("U_ShadowMap"); |
|
|
|
|
|
|
|
|
//init 3d model
|
|
|
//init 3d model
|
|
|
ObjModel obj, quad, sphere; |
|
|
ObjModel obj, quad, sphere; |
|
@ -256,21 +259,6 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
glUseProgram(0); |
|
|
glUseProgram(0); |
|
|
depthfbo.Unbind(); |
|
|
depthfbo.Unbind(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSG msg; |
|
|
|
|
|
while (true) |
|
|
|
|
|
{ |
|
|
|
|
|
if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)) |
|
|
|
|
|
{ |
|
|
|
|
|
if (msg.message == WM_QUIT) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
TranslateMessage(&msg); |
|
|
|
|
|
DispatchMessage(&msg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HDRfbo.Bind(); |
|
|
HDRfbo.Bind(); |
|
|
glUseProgram(gpuProgram.mProgram); |
|
|
glUseProgram(gpuProgram.mProgram); |
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
@ -289,6 +277,11 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("V"), 1, GL_FALSE, glm::value_ptr(viewMatrix)); |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("V"), 1, GL_FALSE, glm::value_ptr(viewMatrix)); |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("P"), 1, GL_FALSE, glm::value_ptr(projectionMatrix)); |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("P"), 1, GL_FALSE, glm::value_ptr(projectionMatrix)); |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("NM"), 1, GL_FALSE, glm::value_ptr(normalMatrix)); |
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("NM"), 1, GL_FALSE, glm::value_ptr(normalMatrix)); |
|
|
|
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("U_LightProjection"), 1, GL_FALSE, glm::value_ptr(lightprojectionMatrix)); |
|
|
|
|
|
glUniformMatrix4fv(gpuProgram.GetLocation("U_LightViewMatrix"), 1, GL_FALSE, glm::value_ptr(lightMatrix)); |
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, depthfbo.GetBuffer("depth")); |
|
|
|
|
|
glUniform1i(gaussianProgram.GetLocation("U_ShadowMap"), 0); |
|
|
|
|
|
|
|
|
obj.Bind(gpuProgram.GetLocation("pos"), gpuProgram.GetLocation("texcoord"), gpuProgram.GetLocation("normal")); |
|
|
obj.Bind(gpuProgram.GetLocation("pos"), gpuProgram.GetLocation("texcoord"), gpuProgram.GetLocation("normal")); |
|
|
obj.Draw(); |
|
|
obj.Draw(); |
|
|
|
|
|
|
|
@ -346,7 +339,20 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
fbo[1].Unbind(); |
|
|
fbo[1].Unbind(); |
|
|
/* blur end */ |
|
|
/* blur end */ |
|
|
|
|
|
|
|
|
glFlush(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSG msg; |
|
|
|
|
|
while (true) |
|
|
|
|
|
{ |
|
|
|
|
|
if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)) |
|
|
|
|
|
{ |
|
|
|
|
|
if (msg.message == WM_QUIT) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
TranslateMessage(&msg); |
|
|
|
|
|
DispatchMessage(&msg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
glActiveTexture(GL_TEXTURE0); |
|
|
glActiveTexture(GL_TEXTURE0); |
|
|
|
|
|
|
|
@ -374,6 +380,7 @@ INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ |
|
|
glUniform1i(combineProgram.GetLocation("U_HDRTexture"), 1); |
|
|
glUniform1i(combineProgram.GetLocation("U_HDRTexture"), 1); |
|
|
fsq.DrawToRightBottom(combineProgram.GetLocation("pos"), combineProgram.GetLocation("texcoord")); |
|
|
fsq.DrawToRightBottom(combineProgram.GetLocation("pos"), combineProgram.GetLocation("texcoord")); |
|
|
|
|
|
|
|
|
|
|
|
glFlush(); |
|
|
SwapBuffers(dc); |
|
|
SwapBuffers(dc); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
return 0; |