NL3D::IShape Class Reference

#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::CMeshMRMSkinned NL3D::CMeshMultiLod

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:

Author:
Lionel Berenguier

Nevrax France

Date:
2000

Definition at line 71 of file shape.h.

Public Member Functions

virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
virtual CTransformShapecreateInstance (CScene &scene)
virtual void flushTextures (IDriver &driver, uint selectedTexture)=0
virtual void getAABBox (NLMISC::CAABBox &bbox) const
virtual std::string getClassName ()=0
float getDistMax () const
const sintgetRefCount () const
 IShape ()
 Constructor.

virtual void profileSceneRender (CRenderTrav *rdrTrav, CTransformShape *trans, bool opaquePass)
virtual void render (IDriver *drv, CTransformShape *trans, bool opaquePass)=0
virtual void serial (IStream &f)=0
void setDistMax (float distMax)
virtual ~IShape ()
 Dtor.


Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Protected Attributes

float _DistMax
 Default to -1.


Friends

struct CPtrInfo


Constructor & Destructor Documentation

NL3D::IShape::IShape  ) 
 

Constructor.

Definition at line 59 of file shape.cpp.

00060 {
00061         _DistMax= -1;
00062 }

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

Dtor.

Definition at line 78 of file shape.h.

00078 {}


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, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

Definition at line 93 of file shape.h.

00093 {return true;}

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, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CParticleSystemShape, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

Definition at line 50 of file shape.cpp.

References NL3D::CScene::createModel(), and NL3D::CTransformShape::Shape.

Referenced by NL3D::CScene::createInstance(), and NL3D::CScene::updateWaitingInstances().

00051 {
00052         CTransformShape         *mo= (CTransformShape*)scene.createModel(NL3D::TransformShapeId);
00053         mo->Shape= this;
00054         return mo;
00055 }

virtual void NL3D::IShape::flushTextures IDriver driver,
uint  selectedTexture
[pure virtual]
 

flush textures used by this shape.

Implemented in NL3D::CFlareShape, NL3D::CMeshBase, NL3D::CParticleSystemShape, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

Referenced by NL3D::CShapeBank::preLoadShapes().

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, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CParticleSystemShape, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

Definition at line 76 of file shape.cpp.

References NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setHalfSize().

00077 {
00078         bbox.setCenter(CVector::Null);
00079         bbox.setHalfSize(CVector::Null);
00080 }

virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
 

Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc.

Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

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 112 of file shape.h.

00112 {return _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, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CParticleSystemShape, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
 

Definition at line 70 of file smart_ptr.h.

References NLMISC::CRefCount::crefs, and sint.

00071         {
00072                 return  crefs;
00073         }

virtual void NL3D::IShape::profileSceneRender CRenderTrav rdrTrav,
CTransformShape trans,
bool  opaquePass
[inline, virtual]
 

Profiling. Called in RenderPass if Current Frame profiled. No-Op by default Informations must be added in rdrTrav->Scene

Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod.

Definition at line 123 of file shape.h.

00123 {}

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, NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CParticleSystemShape, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::CWaterShape, and NL3D::CWaveMakerShape.

virtual void NLMISC::IStreamable::serial IStream f  )  [pure virtual, inherited]
 

Implemented in NL3D::CFlareShape, NL3D::CTextureCross, NL3D::CMesh, NL3D::CMeshGeom, NL3D::CMeshMRMGeom, NL3D::CMeshMRM, NL3D::CMeshMRMSkinnedGeom, NL3D::CMeshMRMSkinned, NL3D::CMeshMultiLod, NL3D::CMeshVPPerPixelLight, NL3D::CMeshVPWindTree, NL3D::CParticleSystemProcess, NL3D::CParticleSystemShape, NL3D::CPSAttribMaker< T >, NL3D::CPSAttribMakerBinOp< T >, NL3D::CPSAttribMakerT< T, F >, NL3D::CPSAttribMakerMemoryBase< T >, NL3D::CPSAttribMakerMemory< uint32 >, NL3D::CPSAttribMakerMemory< sint32 >, NL3D::CPSAttribMakerMemory< float >, NL3D::CPSDot, NL3D::CPSEmitter, NL3D::CPSEmitterDirectionnal, NL3D::CPSRadialEmitter, NL3D::CPSEmitterOmni, NL3D::CPSEmitterRectangle, NL3D::CPSEmitterConic, NL3D::CPSSphericalEmitter, NL3D::CPSFace, NL3D::CPSFaceLookAt, NL3D::CPSFanLight, NL3D::CPSForce, NL3D::CPSForceIntensityHelper, NL3D::CIsotropicForceT< T >, NL3D::CPSDirectionnalForce, NL3D::CPSGravity, NL3D::CPSCentralGravity, NL3D::CPSSpring, NL3D::CPSCylindricVortex, NL3D::CPSMagneticForce, NL3D::CPSLight, NL3D::CPSLocated, NL3D::CPSLocatedBindable, NL3D::CPSTargetLocatedBindable, NL3D::CPSMesh, NL3D::CPSConstraintMesh, NL3D::CPSParticle, NL3D::CPSPlaneBasisFollowSpeed, NL3D::CPSQuad, NL3D::CPSRibbon, NL3D::CPSRibbonBase, NL3D::CPSRibbonLookAt, NL3D::CPSShockWave, NL3D::CPSSound, NL3D::CPSTailDot, NL3D::CPSZone, NL3D::CPSZonePlane, NL3D::CPSZoneSphere, NL3D::CPSZoneDisc, NL3D::CPSZoneCylinder, NL3D::CPSZoneRectangle, NL3D::CSegRemanenceShape, NL3D::CSkeletonShape, NL3D::ITexture, NL3D::CTextureBlend, NL3D::CTextureBump, NL3D::CTextureCube, NL3D::CTextureDLM, NL3D::CTextureEmboss, NL3D::CTextureFar, NL3D::CTextureFile, NL3D::CTextureFont, NL3D::CTextureGrouped, NL3D::CTextureMem, NL3D::CTextureMultiFile, NL3D::CTextureNear, NL3D::CTrackDefaultBlendable< T >, NL3D::CTrackDefaultNotBlendable< T >, NL3D::ITrackKeyFramer< CKeyT >, NL3D::CTrackSampledQuat, NL3D::CTrackSampledVector, NL3D::CWaterShape, NL3D::CWaveMakerShape, NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, NLAIC::IBasicInterface, NLAISCRIPT::COperandVoid, NLAISCRIPT::COperandAnyObject, NLAISCRIPT::COperandSimple, NLAISCRIPT::COperandSimpleListOr, NLAISCRIPT::COperandUnknown, NLAISCRIPT::COperationType, NLAISCRIPT::COperationTypeGD, NLAISCRIPT::COperandListType, CAutomataDesc, NL3D::CPSAttribMaker< float >, NL3D::CPSAttribMaker< CPlaneBasis >, NL3D::CPSAttribMaker< NLMISC::CRGBA >, NL3D::CPSAttribMaker< uint32 >, NL3D::CPSAttribMaker< CRGBA >, NL3D::CPSAttribMaker< sint32 >, NL3D::CPSAttribMakerBinOp< float >, NL3D::CPSAttribMakerBinOp< CPlaneBasis >, NL3D::CPSAttribMakerBinOp< uint32 >, NL3D::CPSAttribMakerBinOp< NLMISC::CRGBA >, NL3D::CPSAttribMakerBinOp< sint32 >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueGradientFunc< NLMISC::CRGBA > >, NL3D::CPSAttribMakerT< sint32, CPSValueBlendFunc< sint32 > >, NL3D::CPSAttribMakerT< T, CPSValueGradientFunc< T > >, NL3D::CPSAttribMakerT< sint32, CPSValueGradientFunc< sint32 > >, NL3D::CPSAttribMakerT< uint32, CPSValueGradientFunc< uint32 > >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueBlendFunc< NLMISC::CRGBA > >, NL3D::CPSAttribMakerT< float, CPSFloatCurveFunctor >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< float, CPSValueGradientFunc< float > >, NL3D::CPSAttribMakerT< float, CPSValueBlendFunc< float > >, NL3D::CPSAttribMakerT< T, CPSValueBlendSampleFunc< T, n > >, NL3D::CPSAttribMakerT< NLMISC::CRGBA, CPSValueBlendSampleFunc< NLMISC::CRGBA, n > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >, NL3D::CPSAttribMakerT< T, CPSValueBlendFunc< T > >, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >, NL3D::CPSAttribMakerMemoryBase< float >, NL3D::CPSAttribMakerMemoryBase< CPlaneBasis >, NL3D::CPSAttribMakerMemoryBase< NLMISC::CRGBA >, NL3D::CPSAttribMakerMemoryBase< uint32 >, NL3D::CPSAttribMakerMemoryBase< sint32 >, NL3D::CIsotropicForceT< CPSTurbulForceFunc >, NL3D::CIsotropicForceT< CPSFluidFrictionFunctor >, NL3D::CTrackDefaultBlendable< float >, NL3D::CTrackDefaultBlendable< NLMISC::CRGBA >, NL3D::CTrackDefaultBlendable< CQuat >, NL3D::CTrackDefaultBlendable< sint32 >, NL3D::CTrackDefaultBlendable< CVector >, NL3D::CTrackDefaultNotBlendable< std::string >, NL3D::CTrackDefaultNotBlendable< bool >, NL3D::ITrackKeyFramer< CKeyBezierVector >, NL3D::ITrackKeyFramer< CKeyTCBVector >, NL3D::ITrackKeyFramer< CKeyVector >, NL3D::ITrackKeyFramer< CKeyTCBQuat >, NL3D::ITrackKeyFramer< CKeyRGBA >, NL3D::ITrackKeyFramer< CKeyInt >, NL3D::ITrackKeyFramer< CKeyBool >, NL3D::ITrackKeyFramer< CKeyFloat >, NL3D::ITrackKeyFramer< CKeyQuat >, NL3D::ITrackKeyFramer< CKeyBezierFloat >, NL3D::ITrackKeyFramer< CKeyTCBFloat >, NL3D::ITrackKeyFramer< CKeyString >, and NL3D::ITrackKeyFramer< CKeyBezierQuat >.

Referenced by NL3D::CMeshMRMGeom::loadHeader().

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.

Referenced by NL3D::CFlareShape::CFlareShape().

00067 {
00068         _DistMax= distMax;
00069         // normalize infinite setup.
00070         if(distMax<0)
00071                 _DistMax= -1;
00072 }

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, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod.

Definition at line 158 of file shape.h.

00158 {return NULL;}

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 142 of file shape.h.

00142 {return false;}


Friends And Related Function Documentation

friend struct CPtrInfo [friend, inherited]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

float NL3D::IShape::_DistMax [protected]
 

Default to -1.

Definition at line 165 of file shape.h.

sint NLMISC::CRefCount::crefs [mutable, inherited]
 

Definition at line 79 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited]
 

Referenced by NLMISC::CRefCount::CRefCount().

CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited]
 

Definition at line 80 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:39:25 2004 for NeL by doxygen 1.3.6