- Timestamp:
- 08/31/08 17:09:46 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp
r2888 r2889 175 175 float z_far = mFar; 176 176 177 const float w_near = 2.0f * tan(mFovy / 2) * z_near; 177 float fov = 120 * M_PI / 180.0f;//mFovy; 178 179 const float w_near = 2.0f * tan(fov * 0.5f) * z_near; 178 180 const float h_near = w_near / GetAspect(); 179 const float w_far = 2.0f * tan(mFovy / 2) * z_far; 181 182 const float w_far = 2.0f * tan(fov * 0.5f) * z_far; 180 183 const float h_far = w_far / GetAspect(); 181 184 … … 183 186 const Vector3 fc = mPosition + view * z_far; 184 187 185 const Vector3 up = GetUpVector();186 const Vector3 right = GetRightVector();188 const Vector3 up = -GetUpVector(); 189 const Vector3 right = -GetRightVector(); 187 190 188 191 Vector3 t1, t2; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r2862 r2889 226 226 } 227 227 228 #if 0 229 // construct normals 230 for (int i = 0; i < vertexCount; i += 3) 231 { 232 Triangle3 tri(vertices[i], vertices[i + 1], vertices[i + 2]); 233 234 normals[i] = tri.GetNormal(); 235 normals[i+1] = tri.GetNormal(); 236 normals[i+2] = tri.GetNormal(); 237 } 238 #endif 228 239 229 240 return new Geometry(vertices, normals, texcoords, vertexCount, true); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2888 r2889 139 139 orthoCam->SetDirection(Vector3(0, 0, -1)); 140 140 141 cout << orthoCam->GetDirection() << endl;142 141 Vector3 pos = Vector3(mSceneBox.Center().x, mSceneBox.Center().y, mSceneBox.Max().z); 143 142 orthoCam->SetPosition(pos); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2888 r2889 540 540 ComputeViewVectors(tl, tr, bl, br); 541 541 542 glColor3f(1.0f, 1.0f, 1.0f);543 544 542 glBegin(GL_QUADS); 545 543 … … 547 545 //const float new_offs = 0.55f; 548 546 const float new_offs = 0.5f; 549 550 glColor3f(bl.x, bl.y, bl.z); glTexCoord2f(0, 0); glVertex3f(-new_offs, -new_offs, -0.5f); 551 glColor3f(br.x, br.y, br.z); glTexCoord2f(1, 0); glVertex3f( new_offs, -new_offs, -0.5f); 552 glColor3f(tr.x, tr.y, tr.z); glTexCoord2f(1, 1); glVertex3f( new_offs, new_offs, -0.5f); 553 glColor3f(tl.x, tl.y, tl.z); glTexCoord2f(0, 1); glVertex3f(-new_offs, new_offs, -0.5f); 547 /* 548 glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f(-new_offs, -new_offs, -0.5f); 549 glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f( new_offs, -new_offs, -0.5f); 550 glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f( new_offs, new_offs, -0.5f); 551 glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f(-new_offs, new_offs, -0.5f); 552 */ 553 glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f(-new_offs, -new_offs, -0.5f); 554 glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f( new_offs, -new_offs, -0.5f); 555 glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f( new_offs, new_offs, -0.5f); 556 glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f(-new_offs, new_offs, -0.5f); 554 557 555 558 glEnd(); … … 574 577 mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 575 578 576 #if 1 // matT: debug this!!579 #if 1 577 580 578 581 bl = Normalize(nbl - fbl); … … 590 593 #endif 591 594 592 // normalizeto 0 .. 1593 bl = bl * 0.5f + 0.5f;595 // pack into 0 .. 1 596 /*bl = bl * 0.5f + 0.5f; 594 597 br = br * 0.5f + 0.5f; 595 598 tl = tl * 0.5f + 0.5f; 596 tr = tr * 0.5f + 0.5f; 599 tr = tr * 0.5f + 0.5f;*/ 597 600 } 598 601 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
r2887 r2889 65 65 void AntiAliasing(FrameBufferObject *fbo); 66 66 67 /** Helper method that computes the view vectors in the corners of the current view frustum. 68 */ 67 69 void ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br); 68 70 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp
r2864 r2889 164 164 mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 165 165 166 //mCamera->SetF 166 167 glLineWidth(2); 167 168 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h
r2840 r2889 46 46 void SetFrameId(int frameId); 47 47 48 protected: 49 50 /** Renders a camera frustum. 48 /** Renders a camera frustum. 51 49 */ 52 50 void RenderFrustum(); 53 51 52 protected: 54 53 55 54 //////////// -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2888 r2889 332 332 camera->SetFar(1000); 333 333 334 cout << "here2 " << Normalize(camDir) << endl;335 336 334 camera->SetDirection(camDir); 337 338 cout << "here3 " << camera->GetDirection() << endl;339 cout << "here3 " << camera->GetRightVector() << endl;340 cout << "here3 " << camera->GetUpVector() << endl;341 335 342 336 camera->SetPosition(camPos); … … 1570 1564 glMatrixMode(GL_MODELVIEW); 1571 1565 glPopMatrix(); 1566 1567 Vector3 ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr; 1568 1569 camera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 1570 1571 Vector3 bl, br, tl, tr; 1572 1573 bl = Normalize(nbl - fbl) * 100; 1574 br = Normalize(nbr - fbr) * 100; 1575 tl = Normalize(ntl - ftl) * 100; 1576 tr = Normalize(ntr - ftr) * 100; 1577 1578 Vector3 dum = pos + camera->GetDirection() * 20; 1579 1580 // coordinates 1581 glColor3f(0.0f, 1.0f, 0.0f); 1582 1583 glBegin(GL_LINES); 1584 glVertex3d(dum.x, dum.y, dum.z); 1585 glVertex3d(dum.x + bl.x, dum.y + bl.y, dum.z + bl.z); 1586 glEnd(); 1587 1588 /* glColor3f(1.0f, 0.0f, 0.0f); 1589 1590 glBegin(GL_LINES); 1591 glVertex3d(dum.x, dum.y, dum.z); 1592 glVertex3d(dum.x + br.x, dum.y + br.y, dum.z + br.z); 1593 glEnd(); 1594 1595 */ glColor3f(0.0f, 0.0f, 1.0f); 1596 1597 glBegin(GL_LINES); 1598 glVertex3d(dum.x, dum.y, dum.z); 1599 glVertex3d(dum.x + tl.x, dum.y + tl.y, dum.z + tl.z); 1600 glEnd(); 1601 /* 1602 glColor3f(1.0f, 0.0f, 1.0f); 1603 1604 glBegin(GL_LINES); 1605 glVertex3d(dum.x, dum.y, dum.z); 1606 glVertex3d(dum.x + tr.x, dum.y + tr.y, dum.z + tr.z); 1607 glEnd();*/ 1572 1608 } 1573 1609 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2888 r2889 11 11 // normalized screen position 12 12 float4 pos: WPOS; 13 float 4texCoord: TEXCOORD0;14 float3 view: COLOR0;13 float2 texCoord: TEXCOORD0; 14 float3 view: TEXCOORD1; 15 15 }; 16 16 … … 95 95 96 96 //return max(0.0f, 1.0f - total_ao); 97 //return saturate(dot(currentViewDir, currentNormal)); 98 return saturate(dot(currentViewDir, float3(0, -1, 0))); 97 return saturate(dot(currentViewDir, currentNormal)); 99 98 } 100 99 … … 125 124 float3 normal = normalize(norm.xyz); 126 125 /// the current view direction 127 float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f)); 126 //float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f)); 127 float3 viewDir = IN.view; 128 128 129 129 // the current world position … … 166 166 } 167 167 168 //OUT.illum_col.xyz = viewDir; 168 169 OUT.illum_col.w = currentDepth; 169 170
Note: See TracChangeset
for help on using the changeset viewer.