Colobot
|
Manager for static models. More...
#include <modelmanager.h>
Classes | |
struct | FileInfo |
struct | ModelInfo |
Public Member Functions | |
CModelManager (CEngine *engine) | |
bool | LoadModel (const std::string &fileName, bool mirrored) |
Loads a model from given file. | |
bool | AddModelReference (const std::string &fileName, bool mirrored, int objRank) |
Adds an instance of model to the given object rank as a reference to base object. | |
bool | AddModelCopy (const std::string &fileName, bool mirrored, int objRank) |
Adds an instance of model to the given object rank as a copy (copied base object) | |
bool | IsModelLoaded (const std::string &fileName, bool mirrored) |
Returns true if given model is loaded. | |
int | GetModelBaseObjRank (const std::string &fileName, bool mirrored) |
Returns the rank of base engine object of given loaded model. | |
void | DeleteAllModelCopies () |
Deletes all copied objects. | |
void | UnloadModel (const std::string &fileName, bool mirrored) |
Unloads the given model. | |
void | UnloadAllModels () |
Unloads all models. |
Protected Member Functions | |
float | GetHeight (std::vector< ModelTriangle > &triangles, Math::Vector pos) |
Returns the height of model – closest point to X and Z coords of pos. | |
void | Mirror (std::vector< ModelTriangle > &triangles) |
Mirrors the model along the Z axis. |
Additional Inherited Members | |
![]() | |
static CModelManager & | GetInstance () |
static CModelManager * | GetInstancePointer () |
static bool | IsCreated () |
![]() | |
static CModelManager * | m_instance |
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.