Source

gltut / Tut 17 Spotlight on Textures / Double Projection.cpp

Diff from to

File Tut 17 Spotlight on Textures/Double Projection.cpp

 	nodes.push_back(pScene->FindNode("rightBar"));
 	nodes.push_back(pScene->FindNode("leaningBar"));
 	nodes.push_back(pScene->FindNode("spinBar"));
+//	nodes.push_back(pScene->FindNode("diorama"));
+//	nodes.push_back(pScene->FindNode("floor"));
 
 	AssociateUniformWithNodes(nodes, g_lightNumBinder, "numberOfLights");
 	SetStateBinderWithNodes(nodes, g_lightNumBinder);
 		0, sizeof(ProjectionBlock));
 
 	CreateSamplers();
-	LoadTextures();
+//	LoadTextures();
 
 	try
 	{
 int g_currSampler = 0;
 
 bool g_bDrawCameraPos = false;
+bool g_bDepthClampProj = true;
 
 int g_displayWidth = 700;
 int g_displayHeight = 350;
 	LightBlock lightData;
 	lightData.ambientIntensity = glm::vec4(0.2f, 0.2f, 0.2f, 1.0f);
 	lightData.lightAttenuation = 1.0f / (5.0f * 5.0f);
-	lightData.maxIntensity = 3.0f;
+	lightData.maxIntensity = 4.0f;
 	lightData.lights[0].lightIntensity = glm::vec4(2.0f, 2.0f, 2.5f, 1.0f);
 	lightData.lights[0].cameraSpaceLightPos = camMatrix *
 		glm::normalize(glm::vec4(-0.2f, 0.5f, 0.5f, 0.0f));
 		glutil::PushStack stackPush(modelMatrix);
 		//Draw lookat point.
 		modelMatrix.SetIdentity();
+		modelMatrix.Scale(0.5f);
 		modelMatrix.Translate(glm::vec3(0.0f, 0.0f, -g_viewPole.GetView().radius));
 
 		glDisable(GL_DEPTH_TEST);
 		glBindBuffer(GL_UNIFORM_BUFFER, 0);
 	}
 
+	if(!g_bDepthClampProj)
+		glDisable(GL_DEPTH_CLAMP);
 	glViewport(displaySize.x + (g_displayWidth % 2), 0,
 		(GLsizei)displaySize.x, (GLsizei)displaySize.y);
 	g_pScene->Render(modelMatrix.Top());
+	glEnable(GL_DEPTH_CLAMP);
 
     glutPostRedisplay();
 	glutSwapBuffers();
 	case 32:
 		g_persViewPole.Reset();
 		break;
+	case 't':
+		g_bDrawCameraPos = !g_bDrawCameraPos;
+		break;
 	case 'y':
-		g_bDrawCameraPos = !g_bDrawCameraPos;
+		g_bDepthClampProj = !g_bDepthClampProj;
 		break;
 	case 'p':
 		g_timer.TogglePause();