# 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::CSegRemanenceShape Class Reference

Shape for the remanence of a segment (sword stroke ..). More...

#include <seg_remanence_shape.h>

Inheritance diagram for NL3D::CSegRemanenceShape:

NL3D::IShape NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

void setMaterial (const CMaterial &mat)
 Set material. More...

const CMaterialgetMaterial () const
 Get material. More...

void setNumSlices (uint32 numSlices)
 Set the number of slices used to draw the remanence Should be >= 2. More...

uint32 getNumSlices () const
float getSliceTime () const
void setSliceTime (float sliceTime)
void setNumCorners (uint numCorners)
 Set the number of corners. More...

uint32 getNumCorners () const
void setCorner (uint corner, const NLMISC::CVector &value)
NLMISC::CVector getCorner (uint corner) const
void setBBox (const NLMISC::CAABBox &bbox)
 Set this shape bounding box NB: ideally the bbox should be computed per model, but practically, a fixed bbox suffice. More...

void setTextureShifting (bool on=true)
 Enable texture shifting on the u coordinates at the start of the animation, so that the texture will 'unroll' until it is completly visible NB this apply on all texture stages, and clamps the U coordinates. More...

bool getTextureShifting () const
 Test whether there is texture shifting at the start of the animation. More...

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 from IShape. More...

void setAnimatedMaterial (const std::string &name)
 Force animated material. This can be called only once. More...

CMaterialBasegetAnimatedMaterial () const
 Get animated material or NULL if none. More...

void setRollupRatio (float ratio)
 When stop() is called, the fx doesn't disappear, it must rollup (a texture shifting is performed). More...

float getRollupRatio () const
 CSegRemanenceShape ()
 default ctor : a seg from (0, 0, 0) to (0, 0, 1) A default bbox is set (from (-3, -3, -3) to (3, 3, 3)). More...

 ~CSegRemanenceShape ()
 CSegRemanenceShape (const CSegRemanenceShape &other)
CSegRemanenceShape & operator= (const CSegRemanenceShape &other)
virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 NLMISC_DECLARE_CLASS (CSegRemanenceShape)

Protected Methods

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

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

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

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


Private Types

typedef std::vector< CVector > TCornerVect

Private Methods

void setupVBnPB ()
void setupMaterial ()
void copyFromOther (const CSegRemanenceShape &other)

Private Attributes

bool _GeomTouched
bool _MatTouched
bool _TextureShifting
uint32 _NumSlices
float _SliceTime
float _RollUpRatio
TCornerVect _Corners
CMaterial _Mat
CVertexBuffer _VB
CPrimitiveBlock _PB
NLMISC::CAABBox _BBox
CMaterialBase_AnimatedMat

Detailed Description

Shape for the remanence of a segment (sword stroke ..).

NB this doesn't support texture animation (used for enrolling)

Author:
Nicolas Vizerie , Nevrax France
Date:
2002

Definition at line 65 of file seg_remanence_shape.h.


Member Typedef Documentation

typedef std::vector<CVector> NL3D::CSegRemanenceShape::TCornerVect [private]
 

Definition at line 157 of file seg_remanence_shape.h.


Constructor & Destructor Documentation

NL3D::CSegRemanenceShape::CSegRemanenceShape  
 

default ctor : a seg from (0, 0, 0) to (0, 0, 1) A default bbox is set (from (-3, -3, -3) to (3, 3, 3)).

Definition at line 40 of file seg_remanence_shape.cpp.

References _BBox, NLMISC::CVector::Null, NLMISC::CAABBox::setCenter, NLMISC::CAABBox::setHalfSize, and setNumCorners.

NL3D::CSegRemanenceShape::~CSegRemanenceShape  
 

Definition at line 264 of file seg_remanence_shape.cpp.

References _AnimatedMat.

NL3D::CSegRemanenceShape::CSegRemanenceShape const CSegRemanenceShape &    other
 

Definition at line 247 of file seg_remanence_shape.cpp.

References copyFromOther.


Member Function Documentation

void NL3D::CSegRemanenceShape::copyFromOther const CSegRemanenceShape &    other [private]
 

Definition at line 270 of file seg_remanence_shape.cpp.

References _AnimatedMat, _BBox, _Corners, _GeomTouched, _Mat, _MatTouched, _NumSlices, _PB, _RollUpRatio, _SliceTime, _TextureShifting, and _VB.

Referenced by CSegRemanenceShape, and operator=.

CTransformShape * NL3D::CSegRemanenceShape::createInstance CScene   scene [protected, 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 from NL3D::IShape.

Definition at line 139 of file seg_remanence_shape.cpp.

References _AnimatedMat, and _Mat.

void NL3D::CSegRemanenceShape::flushTextures IDriver   driver [protected, virtual]
 

flush textures used by this shape.

Implements NL3D::IShape.

Definition at line 133 of file seg_remanence_shape.cpp.

References _Mat.

virtual void NL3D::CSegRemanenceShape::getAABBox NLMISC::CAABBox   bbox const [inline, virtual]
 

from IShape.

Reimplemented from NL3D::IShape.

Definition at line 127 of file seg_remanence_shape.h.

References _BBox.

CMaterialBase* NL3D::CSegRemanenceShape::getAnimatedMaterial   const [inline]
 

Get animated material or NULL if none.

Definition at line 132 of file seg_remanence_shape.h.

References _AnimatedMat.

NLMISC::CVector NL3D::CSegRemanenceShape::getCorner uint    corner const
 

Definition at line 98 of file seg_remanence_shape.cpp.

References _Corners, and nlassert.

const CMaterial& NL3D::CSegRemanenceShape::getMaterial   const [inline]
 

Get material.

Definition at line 90 of file seg_remanence_shape.h.

References _Mat.

uint32 NL3D::CSegRemanenceShape::getNumCorners   const [inline]
 

Definition at line 108 of file seg_remanence_shape.h.

References _Corners.

uint32 NL3D::CSegRemanenceShape::getNumSlices   const [inline]
 

Definition at line 97 of file seg_remanence_shape.h.

References _NumSlices.

float NL3D::CSegRemanenceShape::getNumTriangles float    distance [protected, virtual]
 

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

return 0 if do not support degradation.

Implements NL3D::IShape.

Definition at line 158 of file seg_remanence_shape.cpp.

References _NumSlices.

float NL3D::CSegRemanenceShape::getRollupRatio   const [inline]
 

Definition at line 141 of file seg_remanence_shape.h.

References _RollUpRatio.

float NL3D::CSegRemanenceShape::getSliceTime   const [inline]
 

Definition at line 99 of file seg_remanence_shape.h.

References _SliceTime.

bool NL3D::CSegRemanenceShape::getTextureShifting   const [inline]
 

Test whether there is texture shifting at the start of the animation.

Definition at line 124 of file seg_remanence_shape.h.

References _TextureShifting.

NL3D::CSegRemanenceShape::NLMISC_DECLARE_CLASS CSegRemanenceShape   
 

CSegRemanenceShape & NL3D::CSegRemanenceShape::operator= const CSegRemanenceShape &    other
 

Definition at line 253 of file seg_remanence_shape.cpp.

References copyFromOther, and NL3D::IShape::IShape.

void NL3D::CSegRemanenceShape::render IDriver   drv,
CTransformShape   trans,
bool    opaquePass
[protected, 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.

Implements NL3D::IShape.

Definition at line 114 of file seg_remanence_shape.cpp.

References _Mat, _PB, _VB, NLMISC::CMatrix::Identity, setupMaterial, and setupVBnPB.

void NL3D::CSegRemanenceShape::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

Implements NLMISC::IStreamable.

Definition at line 54 of file seg_remanence_shape.cpp.

void NL3D::CSegRemanenceShape::setAnimatedMaterial const std::string &    name
 

Force animated material. This can be called only once.

Definition at line 236 of file seg_remanence_shape.cpp.

References _AnimatedMat, and nlassert.

void NL3D::CSegRemanenceShape::setBBox const NLMISC::CAABBox   bbox
 

Set this shape bounding box NB: ideally the bbox should be computed per model, but practically, a fixed bbox suffice.

Definition at line 198 of file seg_remanence_shape.cpp.

References _BBox.

void NL3D::CSegRemanenceShape::setCorner uint    corner,
const NLMISC::CVector   value
 

Definition at line 83 of file seg_remanence_shape.cpp.

References _Corners, nlassert, and value.

void NL3D::CSegRemanenceShape::setMaterial const CMaterial   mat
 

Set material.

A double sided material is forced

Definition at line 204 of file seg_remanence_shape.cpp.

References _Mat, and _MatTouched.

void NL3D::CSegRemanenceShape::setNumCorners uint    numCorners
 

Set the number of corners.

By default it is 2 so you get a segment NB this invalidate previous calls to setCorner NB numCorners must be >= 2

Definition at line 105 of file seg_remanence_shape.cpp.

References _Corners, _GeomTouched, nlassert, and NLMISC::CVector::Null.

Referenced by CSegRemanenceShape.

void NL3D::CSegRemanenceShape::setNumSlices uint32    numSlices
 

Set the number of slices used to draw the remanence Should be >= 2.

Definition at line 90 of file seg_remanence_shape.cpp.

References _GeomTouched, _NumSlices, and nlassert.

void NL3D::CSegRemanenceShape::setRollupRatio float    ratio
 

When stop() is called, the fx doesn't disappear, it must rollup (a texture shifting is performed).

This set the speed of rollup. 1 means it takes sliceTime * numSlice to unroll 0.5 means it takes 2 * sliceTime * numSlice to unroll and so on NB ratio must be > 0

Definition at line 218 of file seg_remanence_shape.cpp.

References _RollUpRatio, and nlassert.

void NL3D::CSegRemanenceShape::setSliceTime float    sliceTime
 

Definition at line 76 of file seg_remanence_shape.cpp.

References _SliceTime, and nlassert.

void NL3D::CSegRemanenceShape::setTextureShifting bool    on = true
 

Enable texture shifting on the u coordinates at the start of the animation, so that the texture will 'unroll' until it is completly visible NB this apply on all texture stages, and clamps the U coordinates.

NB the default is on

Definition at line 211 of file seg_remanence_shape.cpp.

References _MatTouched, and _TextureShifting.

void NL3D::CSegRemanenceShape::setupMaterial   [private]
 

Definition at line 225 of file seg_remanence_shape.cpp.

References _Mat, and _MatTouched.

Referenced by render.

void NL3D::CSegRemanenceShape::setupVBnPB   [private]
 

Definition at line 165 of file seg_remanence_shape.cpp.

References _Corners, _GeomTouched, _NumSlices, _PB, _VB, and NLAISCRIPT::l.

Referenced by render.


Member Data Documentation

CMaterialBase* NL3D::CSegRemanenceShape::_AnimatedMat [private]
 

Definition at line 172 of file seg_remanence_shape.h.

Referenced by copyFromOther, createInstance, getAnimatedMaterial, setAnimatedMaterial, and ~CSegRemanenceShape.

NLMISC::CAABBox NL3D::CSegRemanenceShape::_BBox [private]
 

Definition at line 171 of file seg_remanence_shape.h.

Referenced by copyFromOther, CSegRemanenceShape, getAABBox, and setBBox.

TCornerVect NL3D::CSegRemanenceShape::_Corners [private]
 

Definition at line 166 of file seg_remanence_shape.h.

Referenced by copyFromOther, getCorner, getNumCorners, setCorner, setNumCorners, and setupVBnPB.

bool NL3D::CSegRemanenceShape::_GeomTouched [private]
 

Definition at line 159 of file seg_remanence_shape.h.

Referenced by copyFromOther, setNumCorners, setNumSlices, and setupVBnPB.

CMaterial NL3D::CSegRemanenceShape::_Mat [private]
 

Definition at line 168 of file seg_remanence_shape.h.

Referenced by copyFromOther, createInstance, flushTextures, getMaterial, render, setMaterial, and setupMaterial.

bool NL3D::CSegRemanenceShape::_MatTouched [private]
 

Definition at line 160 of file seg_remanence_shape.h.

Referenced by copyFromOther, setMaterial, setTextureShifting, and setupMaterial.

uint32 NL3D::CSegRemanenceShape::_NumSlices [private]
 

Definition at line 163 of file seg_remanence_shape.h.

Referenced by copyFromOther, getNumSlices, getNumTriangles, setNumSlices, and setupVBnPB.

CPrimitiveBlock NL3D::CSegRemanenceShape::_PB [private]
 

Definition at line 170 of file seg_remanence_shape.h.

Referenced by copyFromOther, render, and setupVBnPB.

float NL3D::CSegRemanenceShape::_RollUpRatio [private]
 

Definition at line 165 of file seg_remanence_shape.h.

Referenced by copyFromOther, getRollupRatio, and setRollupRatio.

float NL3D::CSegRemanenceShape::_SliceTime [private]
 

Definition at line 164 of file seg_remanence_shape.h.

Referenced by copyFromOther, getSliceTime, and setSliceTime.

bool NL3D::CSegRemanenceShape::_TextureShifting [private]
 

Definition at line 161 of file seg_remanence_shape.h.

Referenced by copyFromOther, getTextureShifting, and setTextureShifting.

CVertexBuffer NL3D::CSegRemanenceShape::_VB [private]
 

Definition at line 169 of file seg_remanence_shape.h.

Referenced by copyFromOther, render, and setupVBnPB.


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