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

An attribute maker that compute an attribute in a particle system. More...

#include <ps_attrib_maker_bin_op.h>

Inheritance diagram for NL3D::CPSAttribMakerBinOp:

NL3D::CPSAttribMaker NL3D::CPSAttribMakerBase NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

Object
 CPSAttribMakerBinOp ()
 default ctor It construct an selectArg1 operator. More...

 CPSAttribMakerBinOp (const CPSAttribMakerBinOp &other)
 copy ctor. More...

virtual ~CPSAttribMakerBinOp ()
 dtor. More...

inherited from CPSAttribMaker
virtual T get (CPSLocated *loc, uint32 index)
 compute one value of the attribute from the given located at the given index. More...

virtual void * make (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, bool allowNoCopy=false, uint32 srcStep=(1<< 16)) const
 Fill tab with an attribute by using the given stride. More...

virtual void make4 (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 srcStep=(1<< 16)) const
 The same as make, but it replicate each attribute 4 times, thus filling 4*numAttrib. More...

virtual void makeN (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 nbReplicate, uint32 srcStep=(1<< 16)) const
 The same as make4, but with n replication instead of 4. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 init the tab used for computations. More...

virtual void deleteElement (uint32 index)
 delete an element, given its index. this must be called only if memory management is used. More...

virtual void newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
 create a new element, and provides the emitter, this must be called only if this attribute maker has its own memory. More...

virtual void resize (uint32 capacity, uint32 nbPresentElements)
 set a new capacity for the memorized attribute, and a number of used element. More...

Input argument of the operator
void setArg (uint argNb, CPSAttribMaker< T > *arg)
 set an argument for the operator. More...

CPSAttribMaker< T > * getArg (uint argNb)
 get an argument. More...

const CPSAttribMaker< T > * getArg (uint argNb) const
 get an argument, const version. More...

Operator that is performed
void setOp (CPSBinOp::BinOp op)
 Set the operator to use An assertion is thrown when no available. More...

bool supportOp (CPSBinOp::BinOp op)
 return true if an operation is supported. The default support all ops. More...

CPSBinOp::BinOp getOp (void) const
 get the current operator. More...


Protected Methods

void * makePrivate (T *buf1, T *buf2, CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, bool allowNoCopy=false, uint32 srcStep=(1<< 16)) const
void make4Private (T *buf1, T *buf2, CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 srcStep=(1<< 16)) const
void makeNPrivate (T *buf1, T *buf2, CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 nbReplicate, uint32 srcStep=(1<< 16)) const
void clean (void)

Protected Attributes

CPSBinOp::BinOp _Op
CPSAttribMaker< T > * _Arg [2]
uint32 _Size
uint32 _MaxSize

Detailed Description

template<class T>
class NL3D::CPSAttribMakerBinOp< T >

An attribute maker that compute an attribute in a particle system.

It takes 2 other attributes makers and perform a binary operation on them to get the result This allow to have more complex behaviour with particles : random initial size that change with time and so on ...

Author:
Nicolas Vizerie , Nevrax France
Date:
2001

Definition at line 63 of file ps_attrib_maker_bin_op.h.


Constructor & Destructor Documentation

template<class T>
NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp  
 

default ctor It construct an selectArg1 operator.

The 2 argument are set to NULL, Which mean that an assertion will happen if get, make ... are called before setArg is called

Definition at line 133 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, and NL3D::CPSAttribMaker::_HasMemory.

template<class T>
NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp const CPSAttribMakerBinOp< T > &    other
 

copy ctor.

Definition at line 120 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _MaxSize, _Op, and _Size.

template<class T>
NL3D::CPSAttribMakerBinOp< T >::~CPSAttribMakerBinOp   [virtual]
 

dtor.

Definition at line 149 of file ps_attrib_maker_bin_op_inline.h.

References clean.


Member Function Documentation

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::clean void    [protected]
 

Definition at line 141 of file ps_attrib_maker_bin_op_inline.h.

References _Arg.

Referenced by ~CPSAttribMakerBinOp.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::deleteElement uint32    index [virtual]
 

delete an element, given its index. this must be called only if memory management is used.

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 553 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _Size, index, and nlassert.

template<class T>
T NL3D::CPSAttribMakerBinOp< T >::get CPSLocated   loc,
uint32    index
[virtual]
 

compute one value of the attribute from the given located at the given index.

Implements NL3D::CPSAttribMaker.

Definition at line 164 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, index, nlstop, NL3D::PSBinOpAdd, NL3D::PSBinOpModulate, and NL3D::PSBinOpSubtract.

template<class T>
const CPSAttribMaker<T>* NL3D::CPSAttribMakerBinOp< T >::getArg uint    argNb const [inline]
 

get an argument, const version.

See also:
setArg

Definition at line 148 of file ps_attrib_maker_bin_op.h.

template<class T>
CPSAttribMaker<T>* NL3D::CPSAttribMakerBinOp< T >::getArg uint    argNb [inline]
 

get an argument.

See also:
setArg

Definition at line 139 of file ps_attrib_maker_bin_op.h.

template<class T>
CPSBinOp::BinOp NL3D::CPSAttribMakerBinOp< T >::getOp void    const [inline]
 

get the current operator.

Definition at line 170 of file ps_attrib_maker_bin_op.h.

template<class T>
void * NL3D::CPSAttribMakerBinOp< T >::make CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
bool    allowNoCopy = false,
uint32    srcStep = (1<< 16)
const [virtual]
 

Fill tab with an attribute by using the given stride.

It fills numAttrib attributes.

Parameters:
loc  the 'located' that hold the 'located bindable' that need an attribute to be filled
startIndex  usually 0, it gives the index of the first element in the located (is it multiplied by the step)
tab  where the data will be written
stride  the stride, in byte, between each value to write
numAttrib  the number of attributes to compute
allowNoCopy  data may be already present in memory, and may not need computation. When set to true, this allow no computation to be made the return parameter is then le location of the datas. this may be tab (if recomputation where needed), or another value for this to work, the stride must most of the time be sizeof(T). This is intended to be used with derivers of CPSAttribMaker that store values that do not depend on the input. The make method then just copy the data, we is sometime useless
srcStep  A fixed-point 16:16 value that gives the step for the source iterator
Returns:
where the data have been copied, this is always tab, unless allowNoCopy is set to true, in which case this may be different

Implements NL3D::CPSAttribMaker.

Definition at line 273 of file ps_attrib_maker_bin_op_inline.h.

References makePrivate, NL3D::PSBinOpBufSize, and stride.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::make4 CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    srcStep = (1<< 16)
const [virtual]
 

The same as make, but it replicate each attribute 4 times, thus filling 4*numAttrib.

Useful for facelookat and the like

See also:
make()

Implements NL3D::CPSAttribMaker.

Definition at line 386 of file ps_attrib_maker_bin_op_inline.h.

References make4Private, NL3D::PSBinOpBufSize, and stride.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::make4Private T *    buf1,
T *    buf2,
CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    srcStep = (1<< 16)
const [inline, protected]
 

Definition at line 346 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _Op, NL3D::Make4Private, nlassert, NL3D::PSBinOpBufSize, and stride.

Referenced by make4.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::makeN CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    nbReplicate,
uint32    srcStep = (1<< 16)
const [virtual]
 

The same as make4, but with n replication instead of 4.

See also:
make4

Implements NL3D::CPSAttribMaker.

Definition at line 516 of file ps_attrib_maker_bin_op_inline.h.

References makeNPrivate, NL3D::PSBinOpBufSize, and stride.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::makeNPrivate T *    buf1,
T *    buf2,
CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    nbReplicate,
uint32    srcStep = (1<< 16)
const [inline, protected]
 

Definition at line 476 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _Op, NL3D::MakeNPrivate, nlassert, NL3D::PSBinOpBufSize, and stride.

Referenced by makeN.

template<class T>
void * NL3D::CPSAttribMakerBinOp< T >::makePrivate T *    buf1,
T *    buf2,
CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
bool    allowNoCopy = false,
uint32    srcStep = (1<< 16)
const [inline, protected]
 

Definition at line 232 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _Op, NL3D::MakePrivate, nlassert, NL3D::PSBinOpBufSize, and stride.

Referenced by make.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::newElement CPSLocated   emitterLocated,
uint32    emitterIndex
[virtual]
 

create a new element, and provides the emitter, this must be called only if this attribute maker has its own memory.

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 563 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _MaxSize, and _Size.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::resize uint32    capacity,
uint32    nbPresentElements
[virtual]
 

set a new capacity for the memorized attribute, and a number of used element.

This usually is 0 , but during edition, this may not be ... so new element are created. this must be called only if this attribute maker has its own memory

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 575 of file ps_attrib_maker_bin_op_inline.h.

References _Arg, _MaxSize, _Size, and nlassert.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

init the tab used for computations.

we use a trick to avoid ctor calls, but they may be used for some types in the future , so a specilization of this method could be added in these case.

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 537 of file ps_attrib_maker_bin_op_inline.h.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::setArg uint    argNb,
CPSAttribMaker< T > *    arg
[inline]
 

set an argument for the operator.

Parameters:
argNb  must be 0 or 1 for the first and second argument
arg  The argument. Must have been allocated by new, and is then owned by this object

Definition at line 125 of file ps_attrib_maker_bin_op.h.

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::setOp CPSBinOp::BinOp    op [inline]
 

Set the operator to use An assertion is thrown when no available.

Definition at line 160 of file ps_attrib_maker_bin_op.h.

template<class T>
bool NL3D::CPSAttribMakerBinOp< T >::supportOp CPSBinOp::BinOp    op [inline]
 

return true if an operation is supported. The default support all ops.

Definition at line 167 of file ps_attrib_maker_bin_op.h.

Referenced by NL3D::CPSAttribMakerBinOp< sint32 >::setOp.


Member Data Documentation

template<class T>
CPSAttribMaker<T>* NL3D::CPSAttribMakerBinOp::_Arg[2] [protected]
 

Definition at line 207 of file ps_attrib_maker_bin_op.h.

Referenced by clean, CPSAttribMakerBinOp, deleteElement, get, NL3D::CPSAttribMakerBinOp< sint32 >::getArg, make4Private, makeNPrivate, makePrivate, newElement, resize, and NL3D::CPSAttribMakerBinOp< sint32 >::setArg.

template<class T>
uint32 NL3D::CPSAttribMakerBinOp::_MaxSize [protected]
 

Definition at line 209 of file ps_attrib_maker_bin_op.h.

Referenced by CPSAttribMakerBinOp, newElement, resize, and NL3D::CPSAttribMakerBinOp< sint32 >::setArg.

template<class T>
CPSBinOp::BinOp NL3D::CPSAttribMakerBinOp::_Op [protected]
 

Definition at line 206 of file ps_attrib_maker_bin_op.h.

Referenced by CPSAttribMakerBinOp, NL3D::CPSAttribMakerBinOp< sint32 >::getOp, make4Private, makeNPrivate, makePrivate, and NL3D::CPSAttribMakerBinOp< sint32 >::setOp.

template<class T>
uint32 NL3D::CPSAttribMakerBinOp::_Size [protected]
 

Definition at line 209 of file ps_attrib_maker_bin_op.h.

Referenced by CPSAttribMakerBinOp, deleteElement, newElement, resize, and NL3D::CPSAttribMakerBinOp< sint32 >::setArg.


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