Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | List of all members
LxS::CoreGraphics::Model Class Reference

model! More...

#include <model.hpp>

Inheritance diagram for LxS::CoreGraphics::Model:
Inheritance graph
Collaboration diagram for LxS::CoreGraphics::Model:
Collaboration graph

Classes

class  MeshInfo
 class representing information on mesh (may be shared by many Model class objects). More...
 

Public Types

enum  COLLISION_MODEL { COLLISION_NONE =0, COLLISION_WALKABLE =1, COLLISION_BOX =2, COLLISION_CHECK_CHILDREN =4 }
 enum for representing collision mechanics
 
typedef std::string string
 typedef for C++ string, not to include whole namespace but to simplify notation
 
enum  Rendermode { ForReal, ForCoords3D, ForCoordsGame }
 purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked" More...
 

Public Member Functions

 Model (const Model &base)
 
virtual void SelectFrame (float fno)
 select an animation frame
 
void SetInvertedNormals (bool do_invert)
 set status of normals inversion; default off; affects all models loaded from same mesh
 
void SetCollisionModel (int m)
 set collision model
 
int GetCollisionModel ()
 get collision model
 
void SetDoubleSided (bool v)
 
void SetInvisible (bool i)
 if model is invisible (i.e. used only for collisions and such)
 
void Animate (float dt)
 animate a model
 
void SetColorTexture (string fn)
 set texture for color map
 
void SetAlphaTexture (string fn)
 set texture for alpha map
 
void SetNormalTexture (string fn)
 set texture for normal map
 
void SetTextures (string color, string alpha, string normal)
 set package of three textures
 
void SetMesh (string mesh)
 set mesh
 
float GetFarYNegative ()
 edges of an object
 
float GetFarYPositive ()
 edges of an object
 
virtual void Initialize ()
 set up resources. (this is to facilitate late (delayed) initialization.
 
virtual void RefreshAssets ()
 To facilitate refreshing app after switching OpenGL Context (as in Android lifecycle)
 
virtual void Render (Rendermode mode)
 render something
 
virtual void UnloadResources ()
 free up consumed resources while (possibly temporarily) object is not critical
 
void SetPosition (float x, float y, float z)
 set mesh position (will alter transformation matrix)
 
void SetRotationY (float alpha)
 rotate around axis, that is perpendicular to the ground; must be called AFTER set position, as setposition RESETS model transformation matrix, while SetRotationY alters it;
 
virtual float GetPositionX ()
 get mesh position (extracted from current transformation matric)
 
virtual float GetPositionY ()
 get mesh position (extracted from current transformation matric)
 
virtual float GetPositionZ ()
 get mesh position (extracted from current transformation matric)
 
float GetRotationY ()
 get mesh rotation (extracted from current transformation matric)
 
void AssignMatrix (float *)
 assign predefined matrix
 
void AssignUnityMatrix ()
 cancel all transforms
 
float * GetMatrix ()
 get pointer to model transformation matrix
 
void AssignChild (const std::string &s, p_Model)
 assign child object
 
unsigned long GetTexelsCount ()
 sum of dimensionsxdepths of all textures
 
unsigned long GetFacesCount ()
 all 3D faces
 
bool CollisionDetection (float x, float y, float z, float r)
 true if item of given coordinates and radius, collies with object
 
const
LxS::CoreGraphics::TriangleSet
GetWalkableArea () const
 return triangle set for purposes of collision detection as a walkable area (map)
 
float GetInitializedPercentage ()
 0= uninitialized; 100=ready; other? for progress bars
 

Static Public Member Functions

static void SetUseVBO (bool do_use)
 enable/disable VBOs
 
static bool GetUseVBO ()
 are VBOs used for displaying this particular model
 
static void ReloadAllMeshes ()
 global reinitialization routine
 
static void PrintGlobalStatus ()
 diagnostic routine
 

Protected Types

typedef std::map< std::string,
MeshInfo
MeshManager
 collection of meshes
 

Protected Attributes

float transmtx [16]
 transformation matrix
 
int _f
 currently displayed animation frame
 
boost::shared_ptr< Shaderp_ShaderForReal
 shader used when rendering ForReal
 
boost::shared_ptr< Shaderp_ShaderForCoords3D
 shader used when rendering ForCoords3D
 
bool loading_in_progress
 if loading is in progress, model isn't usable
 
bool inverted_normals
 if true, normals are inverted against what said in binary file (state expected of LxS::Model object)
 
MeshManager::iterator i_MeshInfo
 iterator (smart pointer) to data of current mesh
 
float initialized_percentage
 0-100; 0- just constructed; 100 - redy to render; 0-100 - for progressbar
 

Static Protected Attributes

static MeshManager GlobalMeshManager
 global collection of mesh data files - to accelerate initialization
 
static System::MyMutex GlobalMeshManagerMutex
 sync object
 
static LxS::System::MyMutex InitMutex
 sync object used when loading data
 

Detailed Description

model!

Member Enumeration Documentation

purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked"

Enumerator
ForReal 

proper rendering for display

ForCoords3D 

rendering for coordinate detection

ForCoordsGame 

for detection of ingame coordinate system - unused

Member Function Documentation

void LxS::CoreGraphics::Model::SetDoubleSided ( bool  v)
inline

basically marking model as doublesided turns off face culling. this shouldn't be necessary; is implemented as fix for bad models;


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