Colobot
Classes | Public Member Functions | Protected Member Functions | List of all members
Gfx::COldModelManager Class Reference

Manager for static models. More...

#include <oldmodelmanager.h>

Public Member Functions

 COldModelManager (CEngine *engine)
 
bool LoadModel (const std::string &fileName, bool mirrored, int variant=0)
 Loads a model from given file. More...
 
bool AddModelReference (const std::string &fileName, bool mirrored, int objRank, int variant=0)
 Adds an instance of model to the given object rank as a reference to base object. More...
 
bool AddModelCopy (const std::string &fileName, bool mirrored, int objRank, int variant=0)
 Adds an instance of model to the given object rank as a copy (copied base object) More...
 
bool IsModelLoaded (const std::string &fileName, bool mirrored, int variant=0)
 Returns true if given model is loaded. More...
 
int GetModelBaseObjRank (const std::string &fileName, bool mirrored, int variant=0)
 Returns the rank of base engine object of given loaded model. More...
 
void DeleteAllModelCopies ()
 Deletes all copied objects. More...
 
void UnloadModel (const std::string &fileName, bool mirrored, int variant=0)
 Unloads the given model. More...
 
void UnloadAllModels ()
 Unloads all models. More...
 

Protected Member Functions

void Mirror (std::vector< ModelTriangle > &triangles)
 Mirrors the model along the Z axis. More...
 
void ChangeVariant (std::vector< ModelTriangle > &triangles, int variant)
 Changes variant. More...
 

Detailed Description

Manager for static models.

The manager allows for loading models as static objects and adding new instances of models to the engine.

The models are loaded from stanard application model directory and they are identified by unique file names.

The models are loaded by creating (if it doesn't exist yet) a base engine object from the model geometry. This base object is then shared among all instances of this model with the instances being engine objects linked to the shared base object.

There is also a possibility of creating a copy of model so it has its own and unique base engine object. This is especially useful for models where the geometry must be altered.

Member Function Documentation

bool Gfx::COldModelManager::LoadModel ( const std::string &  fileName,
bool  mirrored,
int  variant = 0 
)

Loads a model from given file.

bool Gfx::COldModelManager::AddModelReference ( const std::string &  fileName,
bool  mirrored,
int  objRank,
int  variant = 0 
)

Adds an instance of model to the given object rank as a reference to base object.

bool Gfx::COldModelManager::AddModelCopy ( const std::string &  fileName,
bool  mirrored,
int  objRank,
int  variant = 0 
)

Adds an instance of model to the given object rank as a copy (copied base object)

bool Gfx::COldModelManager::IsModelLoaded ( const std::string &  fileName,
bool  mirrored,
int  variant = 0 
)

Returns true if given model is loaded.

int Gfx::COldModelManager::GetModelBaseObjRank ( const std::string &  fileName,
bool  mirrored,
int  variant = 0 
)

Returns the rank of base engine object of given loaded model.

void Gfx::COldModelManager::DeleteAllModelCopies ( )

Deletes all copied objects.

void Gfx::COldModelManager::UnloadModel ( const std::string &  fileName,
bool  mirrored,
int  variant = 0 
)

Unloads the given model.

void Gfx::COldModelManager::UnloadAllModels ( )

Unloads all models.

void Gfx::COldModelManager::Mirror ( std::vector< ModelTriangle > &  triangles)
protected

Mirrors the model along the Z axis.

void Gfx::COldModelManager::ChangeVariant ( std::vector< ModelTriangle > &  triangles,
int  variant 
)
protected

Changes variant.


The documentation for this class was generated from the following files: