Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | Friends | List of all members
G3D::_BSPMAP::Map Class Reference


A BSP Map loaded from Quake 3. More...

Inherits G3D::ReferenceCountedObject.

Public Member Functions

 ~Map ()
 
const AABoxbounds () const
 Returns a bounding box on the whole map. More...
 
void checkCollision (Vector3 &pos, Vector3 &vel, const Vector3 &extent)
 
More...
 
const Array< BSPEntity > & getEntityList () const
 
const Array< BSPModel > & getModelList () const
 
Vector3 getStartingPosition () const
 
void getTriangles (Array< Vector3 > &outVertexArray, Array< Vector3 > &outNormalArray, Array< int > &outIndexArray, Array< Vector2 > &outTexCoordArray, Array< int > &outTextureMapIndexArray, Array< Vector2 > &outLightCoordArray, Array< int > &outLightMapIndexArray, Array< shared_ptr< Texture > > &outTextureMapArray, Array< shared_ptr< Texture > > &outLightMapArray) const
 Returns the triangles in the map for use outside of this class. More...
 
void setDefaultTexture (const shared_ptr< Texture > &txt)
 
void slideCollision (Vector3 &pos, Vector3 &vel, const Vector3 &extent)
 
Move an object, sliding where it collides with walls (as is done in Quake and most FPS games). More...
 

Static Public Member Functions

static MapRef fromFile (const String &path, const String &fileName, float scale=1.0f, String altLoad="", const String &defaultTextureFile="")
 
Returns nullptr if an error occurs while loading. More...
 

Public Attributes

Array< BSPEntityentityArray
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Friends

class Billboard
 
class FaceSet
 
class Mesh
 
class Patch
 

Detailed Description


A BSP Map loaded from Quake 3.

Constructor & Destructor Documentation

◆ ~Map()

G3D::_BSPMAP::Map::~Map ( )

Member Function Documentation

◆ bounds()

const AABox& G3D::_BSPMAP::Map::bounds ( ) const
inline

Returns a bounding box on the whole map.

◆ checkCollision()

void G3D::_BSPMAP::Map::checkCollision ( Vector3 pos,
Vector3 vel,
const Vector3 extent 
)


See also
slideCollision

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ fromFile()

static MapRef G3D::_BSPMAP::Map::fromFile ( const String path,
const String fileName,
float  scale = 1.0f,
String  altLoad = "",
const String defaultTextureFile = "" 
)
static


Returns nullptr if an error occurs while loading.

Parameters
pathto the Quake 3 resource directory (i.e., the directory that contains the "maps" subdir. This is the .pk3 file if working from a compressed map file.
fileNameName of the .bsp file; include the extension
scaleMultiply all vertices by this scale factor on load.
altLoadThe root of a directory to search for missing textures. When loading Quake3 maps that use default textures, this should be the pak0.pk3 file that comes with Quake3 Arena. Note that this file is copyrighted by id software and is not redistributable. It is not part of G3D. If set to "<none>", avoids the (slow) process of looking in the pk3 file for textures. If set to "", the system looks in the root of drives (on Windows) and in System::findDataFile locations for pak0.pk3 or mini-pak0.pk3.

You can obtain a limited version of this file by downloading the Q3A demo from: http://www.idsoftware.com/games/quake/quake3-arena/index.php?game_section=demo On Windows, the relevant file is at C:\Q3Ademo\demoq3\pak0.pk3

Parameters
defaultTextureFileIf a texture is missing, load this texture. if "", use the default texture specified at runtime.

◆ getEntityList()

const Array<BSPEntity>& G3D::_BSPMAP::Map::getEntityList ( ) const
inline

◆ getModelList()

const Array<BSPModel>& G3D::_BSPMAP::Map::getModelList ( ) const
inline

◆ getStartingPosition()

Vector3 G3D::_BSPMAP::Map::getStartingPosition ( ) const
inline

◆ getTriangles()

void G3D::_BSPMAP::Map::getTriangles ( Array< Vector3 > &  outVertexArray,
Array< Vector3 > &  outNormalArray,
Array< int > &  outIndexArray,
Array< Vector2 > &  outTexCoordArray,
Array< int > &  outTextureMapIndexArray,
Array< Vector2 > &  outLightCoordArray,
Array< int > &  outLightMapIndexArray,
Array< shared_ptr< Texture > > &  outTextureMapArray,
Array< shared_ptr< Texture > > &  outLightMapArray 
) const

Returns the triangles in the map for use outside of this class.

The outVertexArray, outNormalArray, outTexCoordArray, and outLightCoordArray are parallel arrays that are the source data for an indexed triangle list. Every three sequential values in outIndexArray are the indices into those

textureMapIndexArray has length outIndexArray.size()/3. It specifies the index of the texture in outTextureMapArray to use for each triangle. outLightMapIndexArray is a parallel array to textureMapIndexArray that specifies the index of the light map.

◆ setDefaultTexture()

void G3D::_BSPMAP::Map::setDefaultTexture ( const shared_ptr< Texture > &  txt)
inline

◆ slideCollision()

void G3D::_BSPMAP::Map::slideCollision ( Vector3 pos,
Vector3 vel,
const Vector3 extent 
)


Move an object, sliding where it collides with walls (as is done in Quake and most FPS games).

Parameters
posInitial pos, which is updated to the new position.
extentWorld-space axis aligned extents of the object.
velMovement step size. This is updated based on the actual step taken.
See also
checkCollision

Friends And Related Function Documentation

◆ Billboard

friend class Billboard
friend

◆ FaceSet

friend class FaceSet
friend

◆ Mesh

friend class Mesh
friend

◆ Patch

friend class Patch
friend

Member Data Documentation

◆ entityArray

Array<BSPEntity> G3D::_BSPMAP::Map::entityArray

Referenced by getEntityList().


documentation generated on Wed Nov 24 2021 08:02:03 using doxygen 1.8.15