Changeset 9417 in orxonox.OLD for branches/terrain/src/lib/graphics
- Timestamp:
- Jul 24, 2006, 1:23:47 PM (18 years ago)
- Location:
- branches/terrain/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/terrain/src/lib/graphics/importer/bsp_file.cc
r9414 r9417 102 102 this->numTextures = lump.length/sizeof(BspTexture); 103 103 this->textures = new char[lump.length]; 104 file.seekg( lump.offset ); 105 file.read( TEXTURE_SEMANTICS, this->numTextures, 104 file.seekg( lump.offset ); 105 file.read( TEXTURE_SEMANTICS, this->numTextures, 106 106 this->textures, slurpedBytes ); 107 107 } 108 108 void BspFile::readPlanes() 109 { 109 { 110 110 size_t slurpedBytes; 111 111 bsp_lump& lump = header.lumps[Planes]; … … 113 113 this->planes = new plane[this->numPlanes]; 114 114 file.seekg( lump.offset ); 115 file.read( PLANE_SEMANTICS, this->numPlanes, 115 file.read( PLANE_SEMANTICS, this->numPlanes, 116 116 this->planes, slurpedBytes ); 117 117 } … … 124 124 this->nodes = new node[this->numNodes]; 125 125 file.seekg( lump.offset ); 126 file.read( NODE_SEMANTICS, this->numNodes, 126 file.read( NODE_SEMANTICS, this->numNodes, 127 127 this->nodes, slurpedBytes ); 128 128 } … … 135 135 this->leaves = new leaf[this->numLeafs]; 136 136 file.seekg( lump.offset ); 137 file.read( LEAF_SEMANTICS, this->numLeafs, 138 this->leaves, slurpedBytes ); 137 file.read( LEAF_SEMANTICS, this->numLeafs, 138 this->leaves, slurpedBytes ); 139 139 } 140 140 … … 146 146 this->leafFaces = (char*)( new int[this->numLeafFaces] ); 147 147 file.seekg( lump.offset ); 148 file.read( "i", this->numLeafFaces, 148 file.read( "i", this->numLeafFaces, 149 149 this->leafFaces, slurpedBytes ); 150 150 } … … 157 157 this->leafBrushes = (char*) ( new int[this->numLeafBrushes] ); 158 158 file.seekg( lump.offset ); 159 file.read( "i", this->numLeafBrushes, 160 this->leafBrushes, slurpedBytes ); 159 file.read( "i", this->numLeafBrushes, 160 this->leafBrushes, slurpedBytes ); 161 161 } 162 162 … … 168 168 this->bspModels = new model[this->numBspModels]; 169 169 file.seekg( lump.offset ); 170 file.read( MODEL_SEMANTICS, this->numBspModels, 170 file.read( MODEL_SEMANTICS, this->numBspModels, 171 171 this->bspModels, slurpedBytes ); 172 172 } … … 179 179 this->brushes = new brush[numBrushes]; 180 180 file.seekg( lump.offset ); 181 file.read( BRUSH_SEMANTICS, numBrushes, 181 file.read( BRUSH_SEMANTICS, numBrushes, 182 182 this->brushes, slurpedBytes ); 183 183 } … … 189 189 this->vertice = (char*)( new BspVertex[this->numVertex] ); 190 190 file.seekg( lump.offset ); 191 file.read( VERTEX_SEMANTICS, this->numVertex, 191 file.read( VERTEX_SEMANTICS, this->numVertex, 192 192 this->vertice, slurpedBytes ); 193 193 } … … 215 215 this->faces = new face[this->numFaces]; 216 216 file.seekg( lump.offset ); 217 file.read( FACE_SEMANTICS, this->numFaces, 217 file.read( FACE_SEMANTICS, this->numFaces, 218 218 this->faces, slurpedBytes ); 219 219 } … … 226 226 this->lightMaps = new lightmap[this->numLightMaps]; 227 227 file.seekg( lump.offset ); 228 file.read( LIGHTMAP_SEMANTICS, this->numLightMaps, 228 file.read( LIGHTMAP_SEMANTICS, this->numLightMaps, 229 229 this->lightMaps, slurpedBytes ); 230 230 } 231 231 void BspFile::readLightvols() 232 232 { 233 /* not loaded atm */ 233 /* not loaded atm */ 234 234 } 235 235 void BspFile::readBrushSides() … … 241 241 this->brushSides = new brushside[this->numBrushSides]; 242 242 file.seekg( lump.offset ); 243 file.read( BRUSHSIDE_SEMANTICS, this->numBrushSides, 243 file.read( BRUSHSIDE_SEMANTICS, this->numBrushSides, 244 244 this->brushSides, slurpedBytes ); 245 245 } … … 251 251 file.seekg( lump.offset ); 252 252 file.read( "i2", 1, this->visData, slurpedBytes ); 253 file.read( "b", lump.length-8, 254 this->visData+8, slurpedBytes ); 253 file.read( "b", lump.length-8, 254 this->visData+8, slurpedBytes ); 255 255 } 256 256 /** … … 267 267 if (file.exists() && file.open( File::ReadOnly ) ) { 268 268 PRINTF(0)("BSP FILE: Datei %s gefunden. \n", name); 269 269 270 270 //BSP-Files have little endian order. 271 271 file.setByteorder( LittleEndian ); 272 272 file.read( HEADER_SEMANTICS, (void*)&header, slurpedBytes ); 273 273 if ( header.version != 46 ) { 274 PRINTF(0)("BSP FILE: Wrong BSPVersion. We only handle 0x2e-files!\n"); 275 //!< now, we should do some error handling 274 PRINTF(0)("BSP FILE: Wrong BSPVersion. We only handle 0x2e-files!\n"); 275 //!< now, we should do some error handling 276 276 return ( -1 ); 277 277 } … … 280 280 readPlanes(); 281 281 readNodes(); 282 readLeafs(); readLeafFaces(); readLeafBrushes(); 283 readModels(); 282 readLeafs(); readLeafFaces(); readLeafBrushes(); 283 readModels(); 284 284 readVertices(); readMeshVerts(); 285 285 readBrushSides(); readBrushes(); … … 287 287 readFaces(); 288 288 readLightmaps(); readLightvols(); 289 readVisdata( 289 readVisdata(); 290 290 file.close(); 291 291 -
branches/terrain/src/lib/graphics/importer/md3/md3_animation_cfg.cc
r9414 r9417 174 174 } 175 175 }*/ 176 */ 176 177 177 } 178 178 -
branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.h
r9414 r9417 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main programmer: Marco Biasini 13 13 14 14 */ 15 15 #ifndef _TERRAIN_QUAD_TREE_H … … 24 24 25 25 typedef enum { TL_CHILD = 0, TR_CHILD = 1, BL_CHILD = 2, BR_CHILD = 3 } TerrainQuadChild; 26 26 27 27 class TerrainQuad { 28 28 public: 29 29 TerrainQuad( Terrain *_owner, int _xOffset, int _zOffset ); 30 30 TerrainQuad( Terrain *_owner, int _x0, int _z0, int _x1, int _z1 ); 31 32 virtual ~TerrainQuad( ) 31 32 virtual ~TerrainQuad( ) 33 33 { 34 34 for ( int i = 0; i < 4; ++i ) { 35 35 if ( !children[i]->isChildless() ) 36 36 SAVE_DELETE( children[i] ); 37 } 37 } 38 38 } 39 39 int cull( ); 40 40 41 41 /** 42 42 * Returns the array containing the children quad-nodes of this node in the following 43 43 * order: top-left, top-right, bottom-left, bottom-right 44 44 */ 45 inline pTerrainQuad* getChildren( ) 46 { 47 return children; 45 inline pTerrainQuad* getChildren( ) 46 { 47 return children; 48 48 } 49 49 50 50 /** 51 51 * Sets the child-nodes to the specified _children elements. … … 56 56 children[i] = _children[i]; 57 57 } 58 58 59 59 inline bool isChildless() { return ( children[0] == NULL ); } 60 60 61 61 /** 62 62 * Returns the child node given by _child. The returned node may be null. 63 63 */ 64 inline pTerrainQuad getChild( TerrainQuadChild _child ) 65 { 66 return children[_child]; 64 inline pTerrainQuad getChild( TerrainQuadChild _child ) 65 { 66 return children[_child]; 67 67 } 68 68 inline void setScale( Vector _scale ) … … 88 88 inline int getWidth() { return width; } 89 89 inline int getHeight() { return height; } 90 90 91 91 protected: 92 92 TerrainQuad( ) {}
Note: See TracChangeset
for help on using the changeset viewer.