- Timestamp:
- 09/29/08 10:33:56 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r2975 r2980 609 609 </File> 610 610 <File 611 RelativePath=".\src\EntityMerger.cpp" 612 > 613 </File> 614 <File 615 RelativePath=".\src\EntityMerger.h" 616 > 617 </File> 618 <File 611 619 RelativePath=".\src\FrameBufferObject.cpp" 612 620 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r2795 r2980 10 10 Geometry::Geometry(Vector3 *vertices, 11 11 Vector3 *normals, 12 float*texcoords,12 Texcoord2 *texcoords, 13 13 int numVertices, 14 14 bool delData): … … 62 62 if (mTexCoords) 63 63 { 64 for (int i = 0; i < mNumVertices * 2; ++ i)65 data[mNumVertices * 6+ i] = mTexCoords[i];64 for (int i = 0; i < mNumVertices; ++ i) 65 ((Texcoord2 *)data)[mNumVertices * 3 + i] = mTexCoords[i]; 66 66 } 67 67 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
r2953 r2980 12 12 class RenderState; 13 13 14 /** Represents drawable geometry consisting of triangles 14 15 /** Represents drawable geometry consisting of triangles. 15 16 */ 16 17 class Geometry 17 18 { 18 friend class ResourceManager; 19 friend class ResourceManager; 20 friend class EntityMerger; 19 21 20 22 public: … … 27 29 Geometry(Vector3 *vertices, 28 30 Vector3 *normals, 29 float*texcoords,31 Texcoord2 *texcoords, 30 32 int numVertices, 31 33 bool delData); … … 56 58 Vector3 *mNormals; 57 59 58 float*mTexCoords;60 Texcoord2 *mTexCoords; 59 61 60 62 unsigned int mVboId; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r2963 r2980 192 192 Vector3 *vertices; 193 193 Vector3 *normals; 194 float*texcoords;194 Texcoord2 *texcoords; 195 195 196 196 … … 217 217 if (texCoordCount) 218 218 { 219 texcoords = new float[texCoordCount * 2];220 str.read(reinterpret_cast<char *>(texcoords), sizeof( float) * texCoordCount * 2);219 texcoords = new Texcoord2[texCoordCount]; 220 str.read(reinterpret_cast<char *>(texcoords), sizeof(Texcoord2) * texCoordCount); 221 221 } 222 222 else … … 224 224 texcoords = NULL; 225 225 } 226 227 228 return new Geometry(vertices, normals, texcoords, vertexCount, true);226 227 // return new Geometry(vertices, normals, texcoords, vertexCount, true); 228 return new Geometry(vertices, normals, texcoords, vertexCount, false); 229 229 } 230 230 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
r2865 r2980 27 27 { 28 28 friend class RenderQueue; 29 friend class EntityMerger; 29 30 30 31 public: -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2978 r2980 40 40 #include "SkyPreetham.h" 41 41 #include "Texture.h" 42 #include "EntityMerger.h" 42 43 43 44 … … 58 59 /// the renderable scene geometry 59 60 SceneEntityContainer sceneEntities; 61 SceneEntityContainer sceneEntities2; 60 62 // traverses and renders the hierarchy 61 63 RenderTraverser *traverser = NULL; … … 262 264 263 265 264 265 266 ///////// 266 267 //-- cg stuff … … 449 450 } 450 451 451 452 452 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 453 454 int merged = 0; 455 456 SceneEntity *oldEnt = NULL; 457 458 cout << "merging entities .. " << endl; 459 460 for (sit = sceneEntities.begin(); sit < sit_end; ++ sit) 461 { 462 SceneEntity *newEnt = (*sit); 463 464 if (!newEnt->GetTransform()->IsIdentity()) 465 { 466 sceneEntities2.push_back(newEnt); 467 continue; 468 } 469 470 if (oldEnt) 471 { 472 EntityMerger merger(newEnt, oldEnt); 473 SceneEntity *ent = merger.Merge(); 474 475 sceneEntities2.push_back(ent); 476 477 oldEnt = NULL; 478 479 ++ merged; 480 } 481 else 482 { 483 oldEnt = newEnt; 484 } 485 } 486 487 if (oldEnt && oldEnt->GetTransform()->IsIdentity()) 488 sceneEntities2.push_back(oldEnt); 489 490 cout << "merged " << merged << " of " << (int)sceneEntities.size() << " entities " << endl; 491 453 492 // set far plane based on scene extent 454 493 farDist = 10.0f * Magnitude(bvh->GetBox().Diagonal()); … … 611 650 { 612 651 PrintGLerror("fbo start"); 652 613 653 // this fbo basicly stores the scene information we get from standard rendering of a frame 614 654 // we store colors, normals, positions (for the ssao) … … 1096 1136 { 1097 1137 // actually render the scene geometry using the specified algorithm 1098 traverser->RenderScene(); 1138 //traverser->RenderScene(); 1139 1099 1140 /* 1100 1141 state.Reset(); 1101 1142 aeroplane->Render(&state); 1102 1103 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 1143 */ 1144 1145 #if 0 1146 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end(); 1104 1147 1105 1148 for (sit = sceneEntities.begin(); sit != sit_end; ++ sit) 1106 {1107 1149 renderQueue->Enqueue(*sit); 1108 } 1109 1150 #else 1151 1152 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities2.end(); 1153 1154 for (sit = sceneEntities2.begin(); sit != sit_end; ++ sit) 1155 renderQueue->Enqueue(*sit); 1156 #endif 1110 1157 renderQueue->Apply(); 1111 */1112 1158 } 1113 1159 … … 1115 1161 ///////// 1116 1162 //-- do the rest of the rendering 1117 1118 1163 1119 1164 // reset depth pass and render visible objects … … 1772 1817 DEL_PTR(fbo); 1773 1818 DEL_PTR(ssaoShader); 1819 1820 CLEAR_CONTAINER(sceneEntities2); 1774 1821 1775 1822 if (sCgMrtVertexProgram) … … 2085 2132 state.SetUseAlphaToCoverage(false); 2086 2133 2087 // change CHC++ set of state variables (must be done for each change of camera because 2134 // change CHC++ set of state variables 2135 // this must be done for each change of camera because 2088 2136 // otherwise the temporal coherency is broken 2089 2137 BvhNode::SetCurrentState(1); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/common.h
r2966 r2980 31 31 class Polygon3; 32 32 class Vector3; 33 33 class Geometry; 34 34 35 35 … … 492 492 493 493 typedef std::vector<Shape *> ShapeContainer; 494 typedef std::vector<Geometry *> GeometryContainer; 494 495 typedef std::vector<LODLevel *> LODLevelContainer; 495 496 typedef std::vector<Polygon3 *> PolygonContainer; … … 497 498 typedef std::vector<Vector3> VertexArray; 498 499 500 typedef std::pair<float, float> Texcoord2; 501 499 502 500 503 static std::ofstream Debug("debug.log");
Note: See TracChangeset
for help on using the changeset viewer.