- Timestamp:
- 07/15/08 16:18:50 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r2837 r2838 10 10 winHeight=768 11 11 camPosition=483.398f 242.364f 186.078f 12 camDirection=1 1 0 12 13 useFullScreen=0 13 numSsaoSamples=8 14 15 ############ 16 # shader stuff 17 expFactor=0.1f 18 #numSsaoSamples=8 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp
r2834 r2838 48 48 */ 49 49 Vector3 up = Vector3(0, 0, 1); 50 Vector3 right = -Normalize(-CrossProd(direction, up));51 up = -Normalize(CrossProd(right, direction));50 Vector3 right = Normalize(CrossProd(up, direction)); 51 up = Normalize(CrossProd(direction, right)); 52 52 53 53 mBaseOrientation = Matrix4x4(right, up, direction); 54 54 mViewOrientation = mBaseOrientation; 55 56 cout << "right: " << right << endl; 57 cout << "up: " << up << endl; 58 cout << "dir: " << direction << endl; 55 59 } 56 60 … … 181 185 const Vector3 fc = mPosition + view * z_far; 182 186 183 const Vector3 up = -GetUpVector(); 184 187 const Vector3 up = GetUpVector(); 185 188 const Vector3 right = GetRightVector(); 186 189 … … 229 232 void Camera::SetDirection(const Vector3 &direction) 230 233 { 231 Vector3 h1 = direction; h1.z = 0; h1.Normalize(); 232 Vector3 h2 = direction; h1.x = 0; h2.Normalize(); 233 234 mYaw = acos(DotProd(h1, Vector3(0, 1, 0))); 235 mPitch = acos(DotProd(h2, Vector3(0, 1, 0))); 236 234 Vector3 h1 = direction; h1.z = 0; 235 236 if (SqrMagnitude(h1) > 0) 237 { 238 h1.Normalize(); 239 mPitch = acos(DotProd(h1, Vector3(0, 1, 0))); 240 } 241 242 Vector3 h2 = direction;// h2.x = 0; 243 244 if (SqrMagnitude(h2) > 0) 245 { 246 h2.Normalize(); 247 mYaw = -acos(DotProd(h2, h1));//Vector3(0, 1, 0))); 248 } 249 250 cout<<"here2 " << DotProd(h1, Vector3(0, 1, 0)) << " " << mPitch << endl; 237 251 CalculateFromPitchAndYaw(); 238 252 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h
r2829 r2838 78 78 float GetPitch() const { return mPitch; } 79 79 float GetYaw() const { return mYaw; } 80 void ResetPitchAndYaw() { mPitch = 0; mYaw = 0; } 80 81 /** Sets the camera direction. 81 82 */ -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2834 r2838 131 131 132 132 orthoCam->SetNear(0.0f); 133 orthoCam->Yaw( M_PI * 0.5f);133 orthoCam->Yaw(-M_PI * 0.5f); 134 134 135 135 Vector3 pos = Vector3(mSceneBox.Center().x, mSceneBox.Center().y, mSceneBox.Max().z); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2837 r2838 315 315 316 316 Vector3 camPos(.0f, .0f, .0f); 317 Vector3 camDir(.0f, 1.0f, .0f); 317 318 318 319 cout << "=== reading environment file === " << endl; … … 336 337 337 338 env.GetBoolParam(string("useFullScreen"), useFullScreen); 339 env.GetFloatParam(string("expFactor"), expFactor); 340 env.GetVectorParam(string("camPosition"), camPos); 341 env.GetVectorParam(string("camDirection"), camDir); 342 338 343 //env.GetIntParam(string("numSssaoSamples"), numSsaoSamples); 339 env.GetFloatParam(string("expFactor"), expFactor);340 341 env.GetVectorParam(string("camPosition"), camPos);342 344 343 345 cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; … … 359 361 camera->SetNear(nearDist); 360 362 361 camera-> Pitch(-M_PI * 0.5);363 camera->SetDirection(camDir); 362 364 camera->SetPosition(camPos); 363 365 … … 457 459 visualization = new Visualization(bvh, camera, NULL, &state); 458 460 459 sceneQuery = new SceneQuery(bvh->GetBox(), traverser);461 //sceneQuery = new SceneQuery(bvh->GetBox(), traverser); 460 462 461 463 … … 656 658 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorsBuffer); 657 659 658 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);660 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 659 661 int samples = 8; 660 662 //glEnable(GL_MULTISAMPLE_ARB); … … 665 667 glBindTexture(GL_TEXTURE_2D, colorsTex); 666 668 667 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);669 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 668 670 //glGenerateMipmapEXT(GL_TEXTURE_2D); 669 671 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorsTex, 0); … … 751 753 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorsBuffer1); 752 754 753 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);755 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 754 756 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, colorsBuffer1); 755 757 … … 757 759 glBindTexture(GL_TEXTURE_2D, colorsTex1); 758 760 759 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);761 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 760 762 //glGenerateMipmapEXT(GL_TEXTURE_2D); 761 763 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorsTex1, 0); … … 786 788 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorsBuffer2); 787 789 788 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA 16F_ARB, texWidth, texHeight);790 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 789 791 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, colorsBuffer2); 790 792 … … 792 794 glBindTexture(GL_TEXTURE_2D, colorsTex2); 793 795 794 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA 16F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL);796 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, texWidth, texHeight, 0, GL_RGBA, GL_FLOAT, NULL); 795 797 //glGenerateMipmapEXT(GL_TEXTURE_2D); 796 798 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorsTex2, 0); … … 798 800 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 799 801 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 802 800 803 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 801 804 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); … … 1678 1681 AxisAlignedBox3 box = bvh->GetBox(); 1679 1682 1680 // set farfor viz1683 // hack: set far plane for viz 1681 1684 camera->SetFar(0.35f * Magnitude(box.Diagonal())); 1682 1685 1683 1686 const float offs = box.Size().x * 0.3f; 1684 1687 1685 Vector3 pos = camera->GetPosition(); 1686 1687 Vector3 vizpos = Vector3(box.Min().x + 20, box.Min().y + 500, box.Min().z + box.Size().z * 50); 1688 //Vector3 vizpos = Vector3(box.Min().x, box.Min().y + box.Size().y * 0.5f, box.Min().z + box.Size().z * 50); 1689 Vector3 vizpos = Vector3(box.Min().x, box.Min().y - box.Size().y * 0.35f, box.Min().z + box.Size().z * 50); 1688 1690 1689 1691 visCamera->SetPosition(vizpos); 1690 1692 visCamera->ResetPitchAndYaw(); 1693 //visCamera->Pitch(M_PI); 1694 1691 1695 glPushAttrib(GL_VIEWPORT_BIT); 1692 1696 glViewport(winWidth - winWidth / 3, winHeight - winHeight / 3, winWidth / 3, winHeight / 3); … … 1704 1708 visCamera->SetupCameraView(); 1705 1709 1710 //Matrix4x4 rotX = RotationXMatrix(camera->GetYaw()); 1711 //glMultMatrixf((float *)rotX.x); 1706 1712 Matrix4x4 rotZ = RotationZMatrix(-camera->GetPitch()); 1707 1713 glMultMatrixf((float *)rotZ.x); 1708 1714 1715 Vector3 pos = camera->GetPosition(); 1709 1716 glTranslatef(-pos.x, -pos.y, -pos.z); 1710 1717 … … 1991 1998 Vector3 playerPos = camera->GetPosition(); 1992 1999 1993 bool validIntersect = sceneQuery->CalcIntersection(playerPos);2000 bool validIntersect = false;//sceneQuery->CalcIntersection(playerPos); 1994 2001 1995 2002 if (validIntersect && -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2837 r2838 253 253 if ((tex.x >= 0.0f) && (tex.x < 1.0f) && 254 254 (tex.y >= 0.0f) && (tex.y < 1.0f) && 255 (abs(depthDif) < 9e-4f))255 (abs(depthDif) < 8e-5f)) 256 256 OUT.color = attenuated_color * expFactor + col1 * float4(1.0f - expFactor); 257 257 else
Note: See TracChangeset
for help on using the changeset viewer.