NL3D::CPSAttribMakerBinOp< T > Class Template Reference

#include <ps_attrib_maker_bin_op.h>

Inheritance diagram for NL3D::CPSAttribMakerBinOp< T >:

NL3D::CPSAttribMaker< T > NL3D::CPSAttribMakerBase NLMISC::IStreamable NLMISC::IClassable NL3D::CPSColorBinOp

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.

Input properties of the attribute maker

virtual bool getClamping (void) const
virtual CPSInputType getInput (void) const
float getNbCycles (void) const
virtual bool hasCustomInput (void)
 tells wether one may choose one attribute from a CPSLocated to use as an input. If false, the input(s) is fixed

virtual bool isClampingSupported (void) const
virtual void setClamping (bool enable=true)
virtual void setInput (const CPSInputType &input)
void setNbCycles (float nbCycles)

Public Member Functions

virtual CPSAttribMakerBaseclone () const=0
virtual std::string getClassName ()=0
virtual T getMaxValue (void) const
 get the min value, or an evalution that is guaranteed to be < to it (meaningful for ordered set only)

virtual T getMinValue (void) const
 get the max value, or an evalution that is guaranteed to be > to it (meaningful for ordered set only)

Object
 CPSAttribMakerBinOp (const CPSAttribMakerBinOp &other)
 copy ctor

 CPSAttribMakerBinOp ()
virtual ~CPSAttribMakerBinOp ()
 dtor


Protected Member Functions

void clean (void)
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 * makePrivate (T *buf1, T *buf2, CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, bool allowNoCopy=false, uint32 srcStep=(1<< 16)) const

Protected Attributes

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


Constructor & Destructor Documentation

template<class T>
NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp  )  [inline]
 

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 299 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg.

00299                                                    : _Op(CPSBinOp::selectArg1), _Size(0), _MaxSize(0)
00300 {
00301         _Arg[0] = _Arg[1] = NULL;
00302         _HasMemory  = true; 
00303 }

template<class T>
NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp const CPSAttribMakerBinOp< T > &  other  )  [inline]
 

copy ctor

Definition at line 286 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, NL3D::CPSAttribMakerBinOp< T >::_MaxSize, NL3D::CPSAttribMakerBinOp< T >::_Op, and NL3D::CPSAttribMakerBinOp< T >::_Size.

00286                                                                                    : CPSAttribMaker<T>(other) // parent copy ctor
00287 {       
00288         std::auto_ptr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone()))
00289                                                                         , a1(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[1]->clone()));   
00290         this->_Op =             other._Op;
00291         this->_Size =   other._Size;
00292         this->_MaxSize =  other._MaxSize;
00293         this->_Arg[0] = a0.release();
00294         this->_Arg[1] = a1.release();   
00295 }

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

dtor

Definition at line 315 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::clean().

00316 {
00317         clean();
00318 }


Member Function Documentation

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

Definition at line 307 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg.

Referenced by NL3D::CPSAttribMakerBinOp< T >::~CPSAttribMakerBinOp().

00308 {
00309         delete _Arg[0];
00310         delete _Arg[1];
00311 }

virtual CPSAttribMakerBase* NL3D::CPSAttribMakerBase::clone  )  const [pure virtual, inherited]
 

Implemented in NL3D::CPSColorBlenderExact, NL3D::CPSColorBlender, NL3D::CPSColorGradient, NL3D::CPSColorMemory, NL3D::CPSColorBinOp, NL3D::CPSFloatBlender, NL3D::CPSFloatGradient, NL3D::CPSFloatMemory, NL3D::CPSFloatBinOp, NL3D::CPSFloatCurve, NL3D::CPSIntBlender, NL3D::CPSUIntBlender, NL3D::CPSIntGradient, NL3D::CPSUIntGradient, NL3D::CPSIntMemory, NL3D::CPSUIntMemory, NL3D::CPSIntBinOp, NL3D::CPSUIntBinOp, NL3D::CPSPlaneBasisBlender, NL3D::CPSPlaneBasisGradient, NL3D::CPSPlaneBasisFollowSpeed, NL3D::CPSPlaneBasisMemory, NL3D::CPSPlaneBasisBinOp, and NL3D::CPSBasisSpinner.

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

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

Reimplemented from NL3D::CPSAttribMaker< T >.

Definition at line 719 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, index, nlassert, and uint32.

00720 {
00721         if (_Arg[0]->hasMemory())       _Arg[0]->deleteElement(index);
00722         if (_Arg[1]->hasMemory())       _Arg[1]->deleteElement(index);
00723         nlassert(_Size != 0);
00724         --_Size;
00725 }

template<typename T>
virtual T NL3D::CPSAttribMaker< T >::get float  input  )  [inline, virtual, inherited]
 

Direct lookup of the result value from a float input (if it makes sense). This bypass what was set with setInput The input must be in [0, 1[

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 161 of file ps_attrib_maker.h.

00161 { nlassert(0); return T(); /* not supported by default */ }

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

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

Implements NL3D::CPSAttribMaker< T >.

Definition at line 330 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, NL3D::CPSAttribMakerBinOp< T >::_Op, index, nlstop, NL3D::PSBinOpAdd(), NL3D::PSBinOpModulate(), NL3D::PSBinOpSubtract(), and uint32.

00331 {
00332         switch (_Op)
00333         {
00334                 case CPSBinOp::selectArg1:
00335                         return _Arg[0]->get(loc, index);
00336                 break;
00337                 case CPSBinOp::selectArg2:
00338                         return _Arg[1]->get(loc, index);
00339                 break;
00340                 case CPSBinOp::modulate:
00341                         return PSBinOpModulate(_Arg[0]->get(loc, index), _Arg[1]->get(loc, index));
00342                 break;
00343                 case CPSBinOp::add:
00344                         return PSBinOpAdd(_Arg[0]->get(loc, index), _Arg[1]->get(loc, index));
00345                 break;
00346                 case CPSBinOp::subtract:
00347                         return PSBinOpSubtract(_Arg[0]->get(loc, index), _Arg[1]->get(loc, index));
00348                 break;
00349                 default: break;
00350         }
00351 
00352         nlstop;
00353         return T();
00354 }

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.

00149                 {
00150                         nlassert(argNb < 2);
00151                         return _Arg[argNb];
00152                 }

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.

00140                 {
00141                         nlassert(argNb < 2);
00142                         return _Arg[argNb];
00143                 }

template<typename T>
virtual bool NL3D::CPSAttribMaker< T >::getClamping void   )  const [inline, virtual, inherited]
 

Test if the clamping is enabled. The default is false (clamping unsupported)

See also:
isClampingSupported()

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 272 of file ps_attrib_maker.h.

00272 { return false  ; }

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().

template<typename T>
virtual CPSInputType NL3D::CPSAttribMaker< T >::getInput void   )  const [inline, virtual, inherited]
 

get the type of input (if supported). The default return attrDate

See also:
hasCustomInput()

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 251 of file ps_attrib_maker.h.

00251 { return CPSInputType() ; }

template<class T>
virtual T NL3D::CPSAttribMakerBinOp< T >::getMaxValue void   )  const [inline, virtual]
 

get the min value, or an evalution that is guaranteed to be < to it (meaningful for ordered set only)

Reimplemented from NL3D::CPSAttribMaker< T >.

Definition at line 175 of file ps_attrib_maker_bin_op.h.

00175 { return T() ; /* no mean by default */ }

template<class T>
virtual T NL3D::CPSAttribMakerBinOp< T >::getMinValue void   )  const [inline, virtual]
 

get the max value, or an evalution that is guaranteed to be > to it (meaningful for ordered set only)

Reimplemented from NL3D::CPSAttribMaker< T >.

Definition at line 174 of file ps_attrib_maker_bin_op.h.

00174 { return T() ; /* no mean by default */ }       

template<typename T>
float NL3D::CPSAttribMaker< T >::getNbCycles void   )  const [inline, inherited]
 

Retrieve the number of cycles

See also:
setNbCycles()

Definition at line 236 of file ps_attrib_maker.h.

00236 { return _NbCycles ; }

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.

00170 { return _Op; }

template<typename T>
virtual const char* NL3D::CPSAttribMaker< T >::getType  )  [inline, virtual, inherited]
 

inherited from CPSAttribMakerBase. Template specialization will do the job

Implements NL3D::CPSAttribMakerBase.

Definition at line 147 of file ps_attrib_maker.h.

00147 { return "UNKNOWN"; }

template<typename T>
virtual bool NL3D::CPSAttribMaker< T >::hasCustomInput void   )  [inline, virtual, inherited]
 

tells wether one may choose one attribute from a CPSLocated to use as an input. If false, the input(s) is fixed

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 239 of file ps_attrib_maker.h.

00239 { return false ; }

template<typename T>
bool NL3D::CPSAttribMaker< T >::hasMemory void   )  const [inline, inherited]
 

Some attribute makers may hold memory. this return true when this is the case. This also mean that you must call newElement, deleteElement, and resize, when it is called for the owning object (which is likely to be a CPSLocatedBindable)

Definition at line 282 of file ps_attrib_maker.h.

Referenced by NL3D::CPSLocated::setLifeScheme(), and NL3D::CPSLocated::setMassScheme().

00282 { return _HasMemory ; }

template<typename T>
virtual bool NL3D::CPSAttribMaker< T >::isClampingSupported void   )  const [inline, virtual, inherited]
 

tells wether clamping is supported for the input (value can't go above MaxInputValue) The default is false

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 258 of file ps_attrib_maker.h.

00258 { return false ; }

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 [inline, 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< T >.

Definition at line 439 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::makePrivate(), NL3D::PSBinOpBufSize, stride, uint32, and uint8.

00447 {
00452         uint8 tab1[PSBinOpBufSize * sizeof(T)];
00453         uint8 tab2[PSBinOpBufSize * sizeof(T)];
00454         return makePrivate((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, stride, numAttrib, allowNoCopy, srcStep);
00455 }

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::make4 CPSLocated loc,
uint32  startIndex,
void *  tab,
uint32  stride,
uint32  numAttrib,
uint32  srcStep = (1<< 16)
const [inline, 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< T >.

Definition at line 552 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::make4Private(), NL3D::PSBinOpBufSize, stride, uint32, and uint8.

00560 {
00565         uint8 tab1[PSBinOpBufSize * sizeof(T)];
00566         uint8 tab2[PSBinOpBufSize * sizeof(T)];
00567         make4Private((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, stride, numAttrib, srcStep);
00568 }

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 512 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, NL3D::CPSAttribMakerBinOp< T >::_Op, NL3D::Make4Private(), nlassert, NL3D::PSBinOpBufSize, stride, uint, uint32, and uint8.

Referenced by NL3D::CPSAttribMakerBinOp< T >::make4().

00521 {       
00522         uint8 *dest = (uint8 *) tab;
00523         uint leftToDo = numAttrib, toProcess;
00524         nlassert(_Arg[0] && _Arg[1]);   
00525         switch (_Op)
00526         {
00527                 case CPSBinOp::selectArg1:
00528                         _Arg[0]->make4(loc, startIndex, tab, stride, numAttrib, srcStep);
00529                         return;
00530                         break;
00531                 case CPSBinOp::selectArg2:
00532                         _Arg[1]->make4(loc, startIndex, tab, stride, numAttrib, srcStep);
00533                         return;
00534                         break;          
00535                 default: break;
00536         }
00537 
00538         while (leftToDo)
00539         {
00540                 toProcess = leftToDo > PSBinOpBufSize ? PSBinOpBufSize : leftToDo;
00541                 T *src1 = (T *) _Arg[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], sizeof(T), toProcess, true, srcStep);
00542                 T *src2 = (T *) _Arg[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], sizeof(T), toProcess, true, srcStep);
00543                 
00544                 Make4Private(dest, src1, src2, stride, toProcess, _Op);
00545                 leftToDo -= toProcess;
00546         }
00547 }

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 [inline, virtual]
 

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

See also:
make4

Implements NL3D::CPSAttribMaker< T >.

Definition at line 682 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::makeNPrivate(), NL3D::PSBinOpBufSize, stride, uint32, and uint8.

00691 {
00696         uint8 tab1[PSBinOpBufSize * sizeof(T)];
00697         uint8 tab2[PSBinOpBufSize * sizeof(T)];
00698         makeNPrivate((T *) &tab1[0], (T *) &tab2[0], loc, startIndex, tab, stride, numAttrib, nbReplicate);
00699 }

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 642 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, NL3D::CPSAttribMakerBinOp< T >::_Op, NL3D::MakeNPrivate(), nlassert, NL3D::PSBinOpBufSize, stride, uint, uint32, and uint8.

Referenced by NL3D::CPSAttribMakerBinOp< T >::makeN().

00652 {               
00653         uint8 *dest = (uint8 *) tab;
00654         uint leftToDo = numAttrib, toProcess;
00655         nlassert(_Arg[0] && _Arg[1]);   
00656         switch (_Op)
00657         {
00658                 case CPSBinOp::selectArg1:
00659                         _Arg[0]->makeN(loc, startIndex, tab, stride, numAttrib, nbReplicate, srcStep);
00660                         return;
00661                         break;
00662                 case CPSBinOp::selectArg2:
00663                         _Arg[1]->makeN(loc, startIndex, tab, stride, numAttrib, nbReplicate, srcStep);
00664                         return;
00665                         break;          
00666                 default: break;
00667         }
00668         
00669         while (leftToDo)
00670         {
00671                 toProcess = leftToDo > PSBinOpBufSize ? PSBinOpBufSize : leftToDo;
00672                 T *src1 = (T *) _Arg[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], sizeof(T), toProcess, true, srcStep);
00673                 T *src2 = (T *) _Arg[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], sizeof(T), toProcess, true, srcStep);
00674                 
00675                 MakeNPrivate(dest, src1, src2, stride, toProcess, _Op, nbReplicate);
00676                 leftToDo -= toProcess;
00677         }
00678 }

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 398 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, NL3D::CPSAttribMakerBinOp< T >::_Op, NL3D::MakePrivate(), nlassert, NL3D::PSBinOpBufSize, stride, uint, uint32, and uint8.

Referenced by NL3D::CPSAttribMakerBinOp< T >::make().

00408 {
00409         uint8 *dest = (uint8 *) tab;
00410         uint leftToDo = numAttrib, toProcess;
00411         nlassert(_Arg[0] && _Arg[1]);   
00412         switch (_Op)
00413         {
00414                 case CPSBinOp::selectArg1:
00415                         return _Arg[0]->make(loc, startIndex, tab, stride, numAttrib, allowNoCopy, srcStep);
00416                         break;
00417                 case CPSBinOp::selectArg2:
00418                         return _Arg[1]->make(loc, startIndex, tab, stride, numAttrib, allowNoCopy, srcStep);
00419                         break;          
00420                 default: break;
00421         }
00422 
00423 
00424 
00425         while (leftToDo)
00426         {
00427                 toProcess = leftToDo > PSBinOpBufSize ? PSBinOpBufSize : leftToDo;
00428                 T *src1 = (T *) _Arg[0]->make(loc, startIndex + (numAttrib - leftToDo), &buf1[0], sizeof(T), toProcess, true, srcStep);
00429                 T *src2 = (T *) _Arg[1]->make(loc, startIndex + (numAttrib - leftToDo), &buf2[0], sizeof(T), toProcess, true, srcStep);
00430                 MakePrivate(dest, src1, src2, stride, toProcess, _Op);          
00431                 leftToDo -= toProcess;
00432         }
00433 
00434         return tab;
00435 }

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::newElement CPSLocated emitterLocated,
uint32  emitterIndex
[inline, 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< T >.

Definition at line 729 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, and uint32.

00730 {
00731         if (_Arg[0]->hasMemory())       _Arg[0]->newElement(emitterLocated, emitterIndex);
00732         if (_Arg[1]->hasMemory())       _Arg[1]->newElement(emitterLocated, emitterIndex);
00733         if (_Size != _MaxSize)
00734         {
00735                 ++_Size;
00736         }
00737 }

template<class T>
void NL3D::CPSAttribMakerBinOp< T >::resize uint32  capacity,
uint32  nbPresentElements
[inline, 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< T >.

Definition at line 741 of file ps_attrib_maker_bin_op_inline.h.

References NL3D::CPSAttribMakerBinOp< T >::_Arg, nlassert, and uint32.

00742 {
00743         nlassert(capacity < (1 << 16));
00744         _MaxSize = capacity;
00745         _Size = nbPresentElements;
00746         if (_Arg[0]->hasMemory())       _Arg[0]->resize(capacity, nbPresentElements);
00747         if (_Arg[1]->hasMemory())       _Arg[1]->resize(capacity, nbPresentElements);
00748 }

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

serialisation of the object. Derivers MUST call this, (if they use the attribute of this class at least)

Reimplemented from NL3D::CPSAttribMaker< T >.

Definition at line 703 of file ps_attrib_maker_bin_op_inline.h.

00704 {
00705         if (f.isReading())
00706         {
00707                 clean();
00708         }
00709         f.serialVersion(1);
00710         f.serialEnum(_Op);
00711         f.serialPolyPtr(_Arg[0]);
00712         f.serialPolyPtr(_Arg[1]);
00713         f.serial(_Size, _MaxSize);
00714         
00715 }

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.

00126                 {
00127                         nlassert(argNb < 2);
00128                         delete _Arg[argNb];
00129                         _Arg[argNb] = arg;
00130                         if (arg->hasMemory())
00131                         {
00132                                 arg->resize(_MaxSize, _Size);
00133                         }               
00134                 }

template<typename T>
virtual void NL3D::CPSAttribMaker< T >::setClamping bool  enable = true  )  [inline, virtual, inherited]
 

Enable, disable the clamping of input values. The default does nothing (clamping unsupported)

See also:
isClampingSupported()

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 265 of file ps_attrib_maker.h.

00265 {} ;

template<typename T>
virtual void NL3D::CPSAttribMaker< T >::setInput const CPSInputType input  )  [inline, virtual, inherited]
 

set a new input type (if supported). The default does nothing

See also:
hasCustomInput()

Reimplemented in NL3D::CPSAttribMakerT< T, F >, 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 > >, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >.

Definition at line 245 of file ps_attrib_maker.h.

00245 {}

template<typename T>
void NL3D::CPSAttribMaker< T >::setNbCycles float  nbCycles  )  [inline, inherited]
 

Set the number of cycles that must be done during the life of a particle, or the number of cycle per second for a particle that has no life limit. It is used to multiply the input used by this attribute maker It must be >= 0

Definition at line 227 of file ps_attrib_maker.h.

00228                 { 
00229                         nlassert(nbCycles >= 0) ;
00230                         _NbCycles = nbCycles ; 
00231                 }

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.

00161                 {
00162                         nlassert(supportOp(op));
00163                         _Op = op;
00164                 }

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().

00167 { return true; }


Field Documentation

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

Definition at line 211 of file ps_attrib_maker_bin_op.h.

Referenced by NL3D::CPSAttribMakerBinOp< T >::clean(), NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp(), NL3D::CPSAttribMakerBinOp< T >::deleteElement(), NL3D::CPSAttribMakerBinOp< T >::get(), NL3D::CPSAttribMakerBinOp< T >::make4Private(), NL3D::CPSAttribMakerBinOp< T >::makeNPrivate(), NL3D::CPSAttribMakerBinOp< T >::makePrivate(), NL3D::CPSAttribMakerBinOp< T >::newElement(), and NL3D::CPSAttribMakerBinOp< T >::resize().

template<typename T>
bool NL3D::CPSAttribMaker< T >::_HasMemory [protected, inherited]
 

Definition at line 304 of file ps_attrib_maker.h.

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

Definition at line 213 of file ps_attrib_maker_bin_op.h.

Referenced by NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp().

template<typename T>
float NL3D::CPSAttribMaker< T >::_NbCycles [protected, inherited]
 

Definition at line 301 of file ps_attrib_maker.h.

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

Definition at line 210 of file ps_attrib_maker_bin_op.h.

Referenced by NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp(), NL3D::CPSAttribMakerBinOp< T >::get(), NL3D::CPSAttribMakerBinOp< T >::make4Private(), NL3D::CPSAttribMakerBinOp< T >::makeNPrivate(), and NL3D::CPSAttribMakerBinOp< T >::makePrivate().

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

Definition at line 213 of file ps_attrib_maker_bin_op.h.

Referenced by NL3D::CPSAttribMakerBinOp< T >::CPSAttribMakerBinOp().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:03:28 2004 for NeL by doxygen 1.3.6