In file apps/mazed/me_model.h:

## class mz3DModel : public csBase

> This class encapsulates a 3D model object

## Inheritance:

### Public Fields

csTextureHandle* coating
  For level
int Color
  Model color (one of cs_Color_XXX) or -1 for default
char* Name
  Model name
int sector_ind
  Index into world for sector
int sprite_ind
  Index into world for sprite
int thing_ind
  Index into world for thing
csModelType Type
  Model type: room, thing or sprite

### Public Methods

inline mzSpriteAction& Action(int iAction)
  Return a reference to given action
void Clear(bool iVertices, bool iFaces, bool iLights, bool iFrames, bool iActions)
  Clear model
bool DeleteAction(int iAction)
  Delete a sprite action
void DeleteFrame(int iFrame)
  Delete a frame or clear frame if there are no more frames
bool DeleteLight(int iLight)
  Delete a Light
bool DeletePolygon(int iPolygon)
  Delete a polygon
bool DeleteSector(int iSector)
  Delete a polygon
bool DeleteThing(int iThing)
  Delete a polygon
bool DeleteVertex(int iVertex)
  Delete a vertex
void DelSelectedPolygons()
  Delete all selected polygons
void DelSelectedVertices()
  Delete all selected vertices
virtual void Draw(mzCameraView *Canvas)
  Draw the model in 3D view
virtual void Draw(mzDraftEditor *Canvas, bool iActive, bool iModified, bool iCopy)
  Draw the model in draft view
inline int Frames()
  Query total number of frames
void GetBoundingBox(csVector3 &iMin, csVector3 &iMax, bool iOnlySelected)
  Find the minimal and maximal coordinates of model's vertices
void GetBoundingBox(mzDraftEditor *Canvas, csVector3 &iMin, csVector3 &iMax, bool iOnlySelected)
  Find the minimal and maximal coordinates of model's vertices in window space
char* GetFileName()
  Get model file name
int GetFrame()
  Get active frame number
inline char* GetFrameName(int iFrame)
  Get name of given frame
csTextureHandle* GetTexture()
  Get texture (sprites only)
void GetTextures(csStrVector &iTexList)
  Add all textures used in model to a list
bool HasSelection()
  Check if model has any selected elements
bool InsertAction(mzSpriteAction *iAction, int *iNum = NULL)
  Insert a sprite action
bool InsertLight(mz3DLight *iLight, int *iNum = NULL)
  Insert a Light and return its number
bool InsertPolygon(mz3DPolygon *iPolygon, int *iNum = NULL)
  Insert a polygon and return its number
bool InsertSector(csSector *iSector, int *iNum = NULL)
  Insert a sector and return its number
bool InsertThing(csThing *iThing, int *iNum = NULL)
  Insert a thing and return its number
bool InsertVertex(mz3DVertex *iVertex, int *iNum = NULL)
  Insert a vertex and return its number
bool Join(csSector *iSector, bool iForce = false)
  Join a sector to this model (if it is a room)
bool Join(csSpriteTemplate *iSprite)
  Join a sprite to this model (if it is a sprite)
bool Join(csLight *iSector)
  Join a light to this model
bool Join(csThingTemplate *iThing)
  Join a thing to this model (if it is a thing)
inline mz3DLight& Light(int iLight)
  Return a reference to given light
inline int Lights()
  Query total number of lights
bool Load(csSector *iSector)
  Load model from a sector object
bool Load(csThingTemplate *iThing)
  Load model from a thing template object
bool Load(char *iBuffer)
  Load the model from a text buffer
bool Load(csSpriteTemplate *iSprite)
  Load model from a sprite object
bool Load(csLight *iSprite)
  Load model from a light object
void Modify(mzDraftEditor *Canvas, bool iCopy)
  Modify selected model vertices/polys using Canvas's modification parameters
mz3DModel(csModelType iType, char *iFileName)
  Create the 3D model object, optionaly read from text buffer
inline mz3DPolygon& Polygon(int iPolygon)
  Return a reference to given polygon
inline int Polygons()
  Query total number of polygons
bool Save(bool (*Put) (Archive *ar, void *iStream, char *iData, int iSize), Archive *ar, void *iStream)
  Save this model into a stream
inline csSector Sector(int iSector)
  Return a reference to given sector
inline int Sectors()
  Query total number of sectors
void SelectAllPolygons(int iCode)
  Select, deselect or invert all polygons of model
void SelectAllVertices(int iCode)
  Select, deselect or invert all vertices of model
void SetFileName(char *iFileName)
  Set file name and path of this model
bool SetFrame(int iFrame, char *iFrameName = NULL)
  Set active frame number
void SetFrameName(int iFrame, char *iName)
  Set name of given frame
void SetName(const char *iName)
  Set name of this model
void SetTexture(csTextureHandle *iTexture)
  Set texture (sprites only)
inline int Sprites()
  Query total number of sprite templates
inline csSpriteTemplate SpriteTemplate(int iTemplate)
  Return a reference to given sprite template
inline csThing Thing(int iThing)
  Return a reference to given thing
inline int Things()
  Query total number of things
inline mz3DVertex& Vertex(int iVertex, int iFrame = -1)
  Return a reference to given vertex
inline int Vertices(int iFrame = 0)
  Query total number of vertices
virtual ~mz3DModel()
  Destroy the 3D model object

### Public

  the program only deletes the model but not the entry inside world
  This is because we don't want to update the index into world accordingly
  We assumed that during level editing, even if the user delete a sector/sprite/thing

### Private Fields

csObjVector A
  All 3D sprite actions
char* FileName
  Model file pathname
csStrVector FrameName
  Frame names
csObjVector L
  All lights in this model
csObjVector P
  All polygons in this model
csObjVector S
  All sectors in this model
csObjVector Sp
  All 3D sprite templates
csObjVector T
  All 3D thing templates
csTextureHandle* Texture
  Texture (only for sprites)
csObjVector V
  An array of (csVertexVector *): vertices for all frames

### Inherited from csBase:

## Documentation

> This class encapsulates a 3D model object. It contains all routines needed for editing, manipulating, loading and storing an abstract 3D model.

`class csVertexVector: public csVector`
  Private class which defines a private vector used to store 3D vertices. The model can contain very many vertices, so adding a virtual destructor to mz3DVertex is worse than just making a replacement for csObjVector which works exclusively with mz3DVertex.

  `csVertexVector(int iLimit, int iStep)`
    Initialize vertex vector object

  `virtual ~csVertexVector()`
    Delete all vertices before deleting object

  `virtual bool FreeItem(csSome Item)`
    Virtual function which frees a vector element

`csObjVector V`
  An array of (csVertexVector *): vertices for all frames

`csObjVector P`
  All polygons in this model

`csObjVector L`
  All lights in this model

`csObjVector A`
  All 3D sprite actions

`csObjVector Sp`
  All 3D sprite templates

`csObjVector T`
  All 3D thing templates

`csObjVector S`
  All sectors in this model

`char* FileName`
  Model file pathname

`csStrVector FrameName`
  Frame names

`csTextureHandle* Texture`
  Texture (only for sprites)

`csModelType Type`
  Model type: room, thing or sprite

`int Color`
  Model color (one of cs_Color_XXX) or -1 for default

`char* Name`
  Model name

`csTextureHandle* coating`
  For level

``
  We assumed that during level editing, even if the user delete a sector/sprite/thing

``
  the program only deletes the model but not the entry inside world

``
  This is because we don't want to update the index into world accordingly

`int sector_ind`
  Index into world for sector

`int thing_ind`
  Index into world for thing

`int sprite_ind`
  Index into world for sprite

`mz3DModel(csModelType iType, char *iFileName)`
  Create the 3D model object, optionaly read from text buffer

`virtual ~mz3DModel()`
  Destroy the 3D model object

`inline int Vertices(int iFrame = 0)`
  Query total number of vertices

`inline int Polygons()`
  Query total number of polygons

`inline int Sectors()`
  Query total number of sectors

`inline int Things()`
  Query total number of things

`inline int Sprites()`
  Query total number of sprite templates

`inline int Lights()`
  Query total number of lights

`inline int Frames()`
  Query total number of frames

`inline mz3DLight& Light(int iLight)`
  Return a reference to given light

`inline mz3DVertex& Vertex(int iVertex, int iFrame = -1)`
  Return a reference to given vertex

`inline mz3DPolygon& Polygon(int iPolygon)`
  Return a reference to given polygon

`inline csSector Sector(int iSector)`
  Return a reference to given sector

`inline csThing Thing(int iThing)`
  Return a reference to given thing

`inline csSpriteTemplate SpriteTemplate(int iTemplate)`
  Return a reference to given sprite template

`inline mzSpriteAction& Action(int iAction)`
  Return a reference to given action

`bool InsertLight(mz3DLight *iLight, int *iNum = NULL)`
  Insert a Light and return its number

`bool DeleteLight(int iLight)`
  Delete a Light

`bool InsertVertex(mz3DVertex *iVertex, int *iNum = NULL)`
  Insert a vertex and return its number

`bool DeleteVertex(int iVertex)`
  Delete a vertex

`bool InsertPolygon(mz3DPolygon *iPolygon, int *iNum = NULL)`
  Insert a polygon and return its number

`bool DeletePolygon(int iPolygon)`
  Delete a polygon

`bool InsertSector(csSector *iSector, int *iNum = NULL)`
  Insert a sector and return its number

`bool DeleteSector(int iSector)`
  Delete a polygon

`bool InsertThing(csThing *iThing, int *iNum = NULL)`
  Insert a thing and return its number

`bool DeleteThing(int iThing)`
  Delete a polygon

`bool InsertAction(mzSpriteAction *iAction, int *iNum = NULL)`
  Insert a sprite action

`bool DeleteAction(int iAction)`
  Delete a sprite action

`bool Save(bool (*Put) (Archive *ar, void *iStream, char *iData, int iSize), Archive *ar, void *iStream)`
  Save this model into a stream

`bool Load(char *iBuffer)`
  Load the model from a text buffer

`void SetName(const char *iName)`
  Set name of this model

`char* GetFileName()`
  Get model file name

`void SetFileName(char *iFileName)`
  Set file name and path of this model

`csTextureHandle* GetTexture()`
  Get texture (sprites only)

`void SetTexture(csTextureHandle *iTexture)`
  Set texture (sprites only)

`void SetFrameName(int iFrame, char *iName)`
  Set name of given frame

`inline char* GetFrameName(int iFrame)`
  Get name of given frame

`bool SetFrame(int iFrame, char *iFrameName = NULL)`
  Set active frame number

`int GetFrame()`
  Get active frame number

`void DeleteFrame(int iFrame)`
  Delete a frame or clear frame if there are no more frames

`void Clear(bool iVertices, bool iFaces, bool iLights, bool iFrames, bool iActions)`
  Clear model

`virtual void Draw(mzDraftEditor *Canvas, bool iActive, bool iModified, bool iCopy)`
  Draw the model in draft view

`virtual void Draw(mzCameraView *Canvas)`
  Draw the model in 3D view

`void Modify(mzDraftEditor *Canvas, bool iCopy)`
  Modify selected model vertices/polys using Canvas's modification parameters

`bool Load(csLight *iSprite)`
  Load model from a light object

`bool Load(csSector *iSector)`
  Load model from a sector object

`bool Load(csThingTemplate *iThing)`
  Load model from a thing template object

`bool Load(csSpriteTemplate *iSprite)`
  Load model from a sprite object

`bool Join(csLight *iSector)`
  Join a light to this model

`bool Join(csSector *iSector, bool iForce = false)`
  Join a sector to this model (if it is a room)

`bool Join(csThingTemplate *iThing)`
  Join a thing to this model (if it is a thing)

`bool Join(csSpriteTemplate *iSprite)`
  Join a sprite to this model (if it is a sprite)

`void SelectAllVertices(int iCode)`
  Select, deselect or invert all vertices of model

`void SelectAllPolygons(int iCode)`
  Select, deselect or invert all polygons of model

`void DelSelectedVertices()`
  Delete all selected vertices

`void DelSelectedPolygons()`
  Delete all selected polygons

`bool HasSelection()`
  Check if model has any selected elements

`void GetBoundingBox(csVector3 &iMin, csVector3 &iMax, bool iOnlySelected)`
  Find the minimal and maximal coordinates of model's vertices

`void GetBoundingBox(mzDraftEditor *Canvas, csVector3 &iMin, csVector3 &iMax, bool iOnlySelected)`
  Find the minimal and maximal coordinates of model's vertices in window space

`void GetTextures(csStrVector &iTexList)`
  Add all textures used in model to a list

This class has no child classes.

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de