# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::IShape Class Reference

The basic interface for shapes. More...

#include <shape.h>

Inheritance diagram for NL3D::IShape:

NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable NL3D::CFlareShape NL3D::CMeshBase NL3D::CParticleSystemShape NL3D::CSegRemanenceShape NL3D::CSkeletonShape NL3D::CWaterShape NL3D::CWaveMakerShape NL3D::CMesh NL3D::CMeshMRM NL3D::CMeshMultiLod List of all members.

Public Methods

 IShape ()
 Constructor. More...

virtual ~IShape ()
 Dtor. More...

virtual CTransformShapecreateInstance (CScene &scene)
 create an instance of this shape. More...

virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
 clip this shape with a pyramid. More...

virtual void render (IDriver *drv, CTransformShape *trans, bool opaquePass)=0
 render() this shape in a driver, with the specified TransformShape information. More...

virtual void flushTextures (IDriver &driver)=0
 flush textures used by this shape. More...

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 return the bounding box of the shape. More...

float getDistMax () const
 return the DistMax where the shape is no more displayed. More...

void setDistMax (float distMax)
 setup the DistMax where the shape is no more displayed. More...

Load balancing methods
virtual float getNumTriangles (float distance)=0
 get an approximation of the number of triangles this instance will render for a fixed distance. More...

Lighting method
virtual bool useLightingLocalAttenuation () const
 tells if the shape wants LocalAttenuation for RealTime lighting. More...

Mesh Block Render Interface
virtual IMeshGeomsupportMeshBlockRendering (CTransformShape *trans, float &polygonCount) const
 return !NULL if this shape can support MeshBlock rendering for a special instance. More...


Protected Attributes

float _DistMax
 Default to -1. More...


Detailed Description

The basic interface for shapes.

A shape is a kind of instanciable mesh. For simplicity, render() and clip() virtual method are provided, so majority of shape could be implemented by just define those methods, and let createInstance() as default. But other complex shapes may be defined, by implement a compatible model which will comunicate with them.

Serialisation of a shape MUST be done with ISTREAM::serialPolyPtr.

DERIVER RULES:

  • simple: just implement clip() and render(). The shape will be movable via CTransform.
  • complex: if special interaction is needed between the instance and the shape:
    • implement a special Model, derived from CTransformShape, adding your instance behavior.
    • implement YourShape::createInstance(), so it create this good model.
    • implement your own communication system between the model and the shape.
Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 70 of file shape.h.


Constructor & Destructor Documentation

NL3D::IShape::IShape  
 

Constructor.

Definition at line 59 of file shape.cpp.

References _DistMax.

Referenced by NL3D::CSegRemanenceShape::operator=.

virtual NL3D::IShape::~IShape   [inline, virtual]
 

Dtor.

Definition at line 77 of file shape.h.


Member Function Documentation

virtual bool NL3D::IShape::clip const std::vector< CPlane > &    pyramid,
const CMatrix &    worldMatrix
[inline, virtual]
 

clip this shape with a pyramid.

the pyramid is given in world space.The world matrix of the object is given.

Parameters:
pyramid  the clipping polytope, planes are normalized.
worldMatrix  the world matrix of the instance.
Returns:
true if the object is visible, false otherwise. The default behavior is to return true (never clipped).

Reimplemented in NL3D::CFlareShape.

Definition at line 92 of file shape.h.

CTransformShape * NL3D::IShape::createInstance CScene   scene [virtual]
 

create an instance of this shape.

The instance may be a CTransformShape, or a specialized version of it. The default behavior is to createModel() a CTransformShape, and just assign to it the Shape.

Parameters:
scene  the scene used to createModel().
Returns:
the specialized instance for this shape.

Reimplemented in NL3D::CFlareShape.

Definition at line 50 of file shape.cpp.

virtual void NL3D::IShape::flushTextures IDriver   driver [pure virtual]
 

flush textures used by this shape.

Implemented in NL3D::CFlareShape.

void NL3D::IShape::getAABBox NLMISC::CAABBox   bbox const [virtual]
 

return the bounding box of the shape.

Default is to return Null bbox.

Reimplemented in NL3D::CFlareShape.

Definition at line 76 of file shape.cpp.

float NL3D::IShape::getDistMax   const [inline]
 

return the DistMax where the shape is no more displayed.

Default is to return -1, meaning DistMax = infinite.

Definition at line 111 of file shape.h.

References _DistMax.

virtual float NL3D::IShape::getNumTriangles float    distance [pure virtual]
 

get an approximation of the number of triangles this instance will render for a fixed distance.

return 0 if do not support degradation.

Implemented in NL3D::CFlareShape.

virtual void NL3D::IShape::render IDriver   drv,
CTransformShape   trans,
bool    opaquePass
[pure virtual]
 

render() this shape in a driver, with the specified TransformShape information.

CTransfromShape call this method in the render traversal. if opaquePass render the opaque materials else render the transparent materials.

Implemented in NL3D::CFlareShape.

void NL3D::IShape::setDistMax float    distMax
 

setup the DistMax where the shape is no more displayed.

Take effect only for the next created instances. setting <0 means -1 and so means DistMax = infinite.

Definition at line 66 of file shape.cpp.

References _DistMax.

Referenced by NL3D::CFlareShape::CFlareShape.

virtual IMeshGeom* NL3D::IShape::supportMeshBlockRendering CTransformShape   trans,
float &    polygonCount
const [inline, virtual]
 

return !NULL if this shape can support MeshBlock rendering for a special instance.

NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.

Parameters:
trans  the instance to take into account (meshMultiLod may return NULL in blend transition).
polygonCount  the number of polygons to render for the meshGeom returned
Returns:
the meshgeom to render per block if OK, else NULL (default)

Reimplemented in NL3D::CMesh.

Definition at line 152 of file shape.h.

virtual bool NL3D::IShape::useLightingLocalAttenuation   const [inline, virtual]
 

tells if the shape wants LocalAttenuation for RealTime lighting.

Default is false

Reimplemented in NL3D::CMeshBase.

Definition at line 136 of file shape.h.


Member Data Documentation

float NL3D::IShape::_DistMax [protected]
 

Default to -1.

Definition at line 159 of file shape.h.

Referenced by getDistMax, IShape, NL3D::CMeshBase::serialMeshBase, and setDistMax.


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