- Timestamp:
- 09/17/08 11:11:48 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r2951 r2953 276 276 </File> 277 277 <File 278 RelativePath=".\src\ObjConverter.cpp" 279 > 280 </File> 281 <File 282 RelativePath=".\src\ObjConverter.h" 283 > 284 </File> 285 <File 278 286 RelativePath=".\src\PerformanceGraph.cpp" 279 287 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r2952 r2953 11 11 camPosition=483.398f 242.364f 186.078f 12 12 camDirection=1 0 0 13 lightDir=-0.8f 1.0f -0.7f 13 #lightDirection=-0.8f 1.0f -0.7f 14 lightDirection=0.2f -1.0f -.5f 14 15 useFullScreen=0 15 16 useLODs=1 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
r2951 r2953 19 19 20 20 public: 21 /** Constructor taking an array of triangles. 21 /** Constructs a geometry from the given data. 22 The vertices are interpreted as triangles. 23 22 24 If delData is true, the vertex / normal / texture is deleted when 23 25 after it was transferred into a vbo -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp
r2944 r2953 580 580 { 581 581 Vector3 ret; 582 float denom; 583 582 584 583 ret.x = v.x * x[0][0] + v.y * x[1][0] + v.z * x[2][0] + h * x[3][0]; 585 584 ret.y = v.x * x[0][1] + v.y * x[1][1] + v.z * x[2][1] + h * x[3][1]; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/MotionPath.cpp
r2951 r2953 19 19 Vector3 MotionPath::GetCurrentPosition() const 20 20 { 21 return mT * mVertices[mCurrentVertexIdx] + (1.0f - mT) * mVertices[(mCurrentVertexIdx + 1) % mVertices.size()]; 21 22 } 22 23 … … 24 25 Vector3 MotionPath::GetCurrentDirection() const 25 26 { 27 return Vector3(1, 0, 0); 26 28 } 27 29 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
r2951 r2953 149 149 mMaxVisibleDistance = .0f; 150 150 151 glEnableClientState(GL_VERTEX_ARRAY);152 if (!mUseDepthPass) glEnableClientState(GL_NORMAL_ARRAY);153 154 151 ++ mFrameId; 155 152 … … 158 155 mStats.Reset(); 159 156 mQueryHandler.ResetQueries(); 157 160 158 // add root node to queue 161 159 EnqueueNode(mBvh->GetRoot()); … … 172 170 // reset the render state 173 171 mRenderState->Reset(); 174 175 glDisableClientState(GL_VERTEX_ARRAY);176 glDisableClientState(GL_NORMAL_ARRAY);177 178 //cout << "rq overhead: " << 1e3f * mRenderQueue->rTimer.TotalTime() << " ms" << endl;179 172 } 180 173 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r2889 r2953 69 69 str.read(reinterpret_cast<char *>(&dist), sizeof(float)); 70 70 71 //if (i>=3) dist=2e20;72 71 int numShapes; 73 72 str.read(reinterpret_cast<char *>(&numShapes), sizeof(int)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp
r2951 r2953 21 21 box.Triangulate(triangles); 22 22 23 Vector3 *vertices = new Vector3[ 12];24 Vector3 *normals = new Vector3[ 12];23 Vector3 *vertices = new Vector3[36]; 24 Vector3 *normals = new Vector3[36]; 25 25 26 26 for (size_t i = 0; i < triangles.size(); ++ i) … … 39 39 } 40 40 41 cout<<"number of triangles in box: " << triangles.size() << endl; 41 42 42 Geometry *geom = new Geometry(vertices, normals, NULL, 12, true);43 Geometry *geom = new Geometry(vertices, normals, NULL, 36, false); 43 44 44 45 Shape *shape = new Shape(geom, mat, ent); 45 46 ent->AddShape(shape); 47 48 LODLevel *lodLevel = new LODLevel(0); 49 50 lodLevel->AddShape(shape); 51 ent->AddLODLevel(lodLevel); 46 52 47 53 return ent; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.h
r2946 r2953 22 22 /** Creates a scene entity. 23 23 */ 24 SceneEntityConverter() ;24 SceneEntityConverter() {}; 25 25 26 ~SceneEntityConverter();26 //~SceneEntityConverter(); 27 27 28 28 /** Converts this box to a scene entity -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2899 r2953 179 179 renderer->SetCamera(orthoCam); 180 180 181 glEnableClientState(GL_VERTEX_ARRAY); 182 glEnableClientState(GL_NORMAL_ARRAY); 183 181 184 renderer->RenderScene(); 185 186 glDisableClientState(GL_VERTEX_ARRAY); 187 glDisableClientState(GL_NORMAL_ARRAY); 182 188 183 189 renderer->SetCamera(oldCam); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r2952 r2953 700 700 701 701 702 703 702 glMatrixMode(GL_PROJECTION); 704 703 glPopMatrix(); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2952 r2953 36 36 #include "ShadowMapping.h" 37 37 #include "Light.h" 38 #include "SceneEntityConverter.h" 38 39 39 40 … … 187 188 DeferredRenderer *ssaoShader = NULL; 188 189 189 190 SceneEntity *cube = NULL; 191 192 bool altKeyPressed = false; 190 193 191 194 // function forward declarations … … 627 630 else 628 631 cout << "successfully created font" << endl; 632 633 Vector3 cubeCenter(470.398f, 240.364f, 182.5f); 634 635 AxisAlignedBox3 box(cubeCenter - Vector3(2.0f), cubeCenter + Vector3(2.0f)); 636 637 Material *mat = new Material(RgbaColor(1, 0.4, 0.4, 0)); 638 Transform3 *tf = new Transform3(NULL); 639 cube = SceneEntityConverter().ConvertBox(box, mat, tf); 629 640 } 630 641 … … 918 929 renderType = RenderState::FIXED; 919 930 931 glEnableClientState(GL_VERTEX_ARRAY); 932 920 933 921 934 // render with the specified method (forward rendering, forward + depth, deferred) … … 934 947 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 935 948 949 glEnableClientState(GL_NORMAL_ARRAY); 950 936 951 break; 937 952 … … 957 972 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 958 973 974 959 975 break; 960 976 … … 974 990 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 975 991 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 992 976 993 977 994 break; … … 990 1007 glDrawBuffers(3, mrt); 991 1008 992 break; 993 } 994 1009 glEnableClientState(GL_NORMAL_ARRAY); 1010 1011 break; 1012 } 995 1013 996 1014 glDepthFunc(GL_LESS); … … 1023 1041 else 1024 1042 { 1043 //glEnable(GL_CULL_FACE); 1044 //cube->Render(&state); 1045 1025 1046 // actually render the scene geometry using the specified algorithm 1026 1047 traverser->RenderScene(); … … 1030 1051 ///////// 1031 1052 //-- do the rest of the rendering 1032 1033 glEnableClientState(GL_VERTEX_ARRAY);1034 glEnableClientState(GL_NORMAL_ARRAY);1035 1053 1036 1054 … … 1282 1300 downKeyPressed = false; 1283 1301 break; 1302 case GLUT_ACTIVE_ALT: 1303 altKeyPressed = false; 1304 break; 1284 1305 default: 1285 1306 return; 1286 1307 } 1287 //glutPostRedisplay();1288 1308 } 1289 1309 … … 1385 1405 } 1386 1406 break; 1407 case GLUT_ACTIVE_ALT: 1408 altKeyPressed = true; 1409 break; 1387 1410 default: 1388 1411 return; … … 1420 1443 void Mouse(int button, int state, int x, int y) 1421 1444 { 1445 int specialKey = glutGetModifiers(); 1446 1422 1447 if ((button == GLUT_LEFT_BUTTON) && (state == GLUT_DOWN)) 1423 1448 { … … 1829 1854 int i = 4; 1830 1855 1831 sprintf(msg[i ++], "rendered: %s of %s objects, %s of %s triangles", 1832 objStr.c_str(), totalObjStr.c_str(), triStr.c_str(), totalTriStr.c_str()); 1833 1834 //sprintf(msg[i ++], "rendered: %6d of %6d nodes, %s of %s triangles", 1835 // renderedNodes, bvh->GetNumVirtualNodes(), triStr.c_str(), totalTriStr.c_str()); 1856 if (0) 1857 { 1858 sprintf(msg[i ++], "rendered: %s of %s objects, %s of %s triangles", 1859 objStr.c_str(), totalObjStr.c_str(), triStr.c_str(), totalTriStr.c_str()); 1860 } 1861 else 1862 { 1863 sprintf(msg[i ++], "rendered: %6d of %6d nodes, %s of %s triangles", 1864 renderedNodes, bvh->GetNumVirtualNodes(), triStr.c_str(), totalTriStr.c_str()); 1865 } 1836 1866 1837 1867 sprintf(msg[i ++], "traversed: %5d, frustum culled: %5d, query culled: %5d", … … 1888 1918 float minVisibleDist = min(camera->GetFar(), traverser->GetMaxVisibleDistance()); 1889 1919 RenderShadowMap(minVisibleDist); 1890 //cout << "far: " << camera->GetFar() << " min: " << traverser->GetMaxVisibleDistance() << endl;1891 1920 } 1892 glEnableClientState(GL_VERTEX_ARRAY);1893 glEnableClientState(GL_NORMAL_ARRAY);1894 1921 1895 1922 glDisable(GL_LIGHTING); … … 1910 1937 } 1911 1938 1939 1940 glEnableClientState(GL_NORMAL_ARRAY); 1941 1912 1942 // draw all objects that have exactly the same depth as the current sample 1913 1943 glDepthFunc(GL_LEQUAL); … … 1953 1983 cgGLDisableProfile(RenderState::sCgFragmentProfile); 1954 1984 cgGLDisableProfile(RenderState::sCgVertexProfile); 1985 1986 glDisableClientState(GL_NORMAL_ARRAY); 1955 1987 1956 1988 state.SetRenderType(RenderState::DEPTH_PASS); … … 1971 2003 state.SetUseAlphaToCoverage(true); 1972 2004 2005 glEnableClientState(GL_NORMAL_ARRAY); 2006 1973 2007 // change back state 1974 2008 BvhNode::SetCurrentState(0);
Note: See TracChangeset
for help on using the changeset viewer.