- Timestamp:
- 07/17/08 17:21:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r2842 r2844 10 10 #include "Transform3.h" 11 11 #include "Shape.h" 12 #include "LODInfo.h" 12 13 13 14 … … 33 34 SceneEntity *ResourceManager::LoadSceneEntity(igzstream &str) 34 35 { 35 // shape36 int shapeId;37 str.read(reinterpret_cast<char *>(&shapeId), sizeof(int));38 39 Geometry *geom = mGeometryTable[shapeId];40 Material *mat = mMaterialTable[shapeId];41 42 43 36 bool hasTrafo; 44 37 str.read(reinterpret_cast<char *>(&hasTrafo), sizeof(bool)); … … 60 53 Transform3 *trafo = new Transform3(m); 61 54 mTrafos.push_back(trafo); 62 63 // use instancing 55 64 56 sceneGeom = new SceneEntity(trafo); 65 57 66 // create shape 67 Shape *shape = new Shape(geom, mat, sceneGeom); 68 mShapes.push_back(shape); 69 70 sceneGeom->AddShape(shape); 58 /////////////// 59 //-- load lod levels 60 61 int numLODs; 62 str.read(reinterpret_cast<char *>(&numLODs), sizeof(int)); 63 64 //if (numLODs > 1) cout << "numlods: " << numLODs << endl; 65 for (int i = 0; i < numLODs; ++ i) 66 { 67 float distance; 68 str.read(reinterpret_cast<char *>(&distance), sizeof(float)); 69 70 int numShapes; 71 str.read(reinterpret_cast<char *>(&numShapes), sizeof(int)); 72 73 //if (numLODs > 1) cout << "dist: " << distance << " shapes: " << numShapes; 74 75 LODLevel *lodLevel = new LODLevel(distance); 76 77 for (int j = 0; j < numShapes; ++ j) 78 { 79 int shapeId; 80 str.read(reinterpret_cast<char *>(&shapeId), sizeof(int)); 81 82 //if (numLODs > 1) cout << " id " << shapeId; 83 84 Geometry *geom = mGeometryTable[shapeId]; 85 Material *mat = mMaterialTable[shapeId]; 86 87 // create shape 88 Shape *shape = new Shape(geom, mat, sceneGeom); 89 90 mShapes.push_back(shape); 91 92 sceneGeom->AddShape(shape); 93 lodLevel->mShapes.push_back(shape); 94 } 95 96 //if (numLODs > 1) cout << endl; 97 98 sceneGeom->AddLODLevel(lodLevel); 99 } 71 100 72 101 return sceneGeom; … … 90 119 str.read(texname, sizeof(char) * texnameSize); 91 120 92 //cout << "loading texture " << texname << " with len " << texnameSize << " id: " << id << endl;93 121 Texture *tex = new Texture(model_path + texname); 94 122 … … 135 163 136 164 str.read(reinterpret_cast<char *>(&mat->mAlphaTestEnabled), sizeof(bool)); 165 166 //str.read(reinterpret_cast<char *>(&mat->mCullFaceEnabled), sizeof(bool)); 137 167 138 168 // material
Note: See TracChangeset
for help on using the changeset viewer.