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

This template generate an attrib maker by defining the methods of the CPSCAttribMaker class. More...

#include <ps_attrib_maker_helper.h>

Inheritance diagram for NL3D::CPSAttribMakerT:

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

Public Types

typedef T value_type
 the type of the attribute to be produced. More...

typedef F functor_type
 the type of the functor object. More...


Public Methods

virtual T get (CPSLocated *loc, uint32 index)
 compute one value of the attribute for the given index. More...

virtual T get (float input)
 Direct lookup of the result value from a float input (if it makes sense). More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serialisation of the object. More...

 CPSAttribMakerT (float nbCycles)
 construct the attrib maker specifying the number of cycles to do. More...

virtual ~CPSAttribMakerT ()
 dtor. More...

virtual bool hasCustomInput (void)
 tells wether one may choose one attribute from a CPSLocated to use as an input. More...

virtual void setInput (const CPSInputType &input)
 set a new input type. More...

virtual CPSInputType getInput (void) const
 get the type of input (if supported). More...

bool isClampingSupported (void) const
 tells wether clamping is supported for the input (value can't go above MaxInputValue). More...

virtual void setClamping (bool enable=true)
 Enable, disable the clamping of input values. More...

virtual bool getClamping (void) const
 Test if the clamping is enabled. More...


Public Attributes

_F
 the functor object. More...


Private Methods

template<typename It> void makeByIterator (It it, void *tab, uint32 stride, uint32 numAttrib, bool canOverlapOne) const
 generate an attribute by using the given iterator. More...

template<typename It> void make4ByIterator (It it, void *tab, uint32 stride, uint32 numAttrib, bool canOverlapOne) const
 The same as make, but it replicate each attribute 4 times, thus filling 4*numAttrib. More...

template<typename It> void makeNByIterator (It it, void *tab, uint32 stride, uint32 numAttrib, uint32 nbReplicate, bool canOverlapOne) const
 The same as make4, but with n replication instead of 4. More...

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

void make4 (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 srcStep) 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) const
 The same as make4, but with n replication instead of 4. More...


Private Attributes

CPSInputType _InputType
bool _Clamp

Detailed Description

template<typename T, class F>
class NL3D::CPSAttribMakerT< T, F >

This template generate an attrib maker by defining the methods of the CPSCAttribMaker class.

You can derive your own class but it is a shortcut to do the job

Parameters:
T  : the type to produce
F  : a class that override the () operator, the input is chosen by the user (age, speed ...) , and the output is the same type as T. Inline is preferable, as it will be called a lot It can stores info that indicate how to build it

Definition at line 51 of file ps_attrib_maker_helper.h.


Member Typedef Documentation

template<typename T, class F>
typedef F NL3D::CPSAttribMakerT::functor_type
 

the type of the functor object.

Definition at line 174 of file ps_attrib_maker_helper.h.

template<typename T, class F>
typedef T NL3D::CPSAttribMakerT::value_type
 

the type of the attribute to be produced.

Definition at line 171 of file ps_attrib_maker_helper.h.


Constructor & Destructor Documentation

template<typename T, class F>
NL3D::CPSAttribMakerT< T, F >::CPSAttribMakerT float    nbCycles [inline]
 

construct the attrib maker specifying the number of cycles to do.

See also:
setNbCycles()

Definition at line 128 of file ps_attrib_maker_helper.h.

template<typename T, class F>
virtual NL3D::CPSAttribMakerT< T, F >::~CPSAttribMakerT   [inline, virtual]
 

dtor.

Definition at line 133 of file ps_attrib_maker_helper.h.


Member Function Documentation

template<typename T, class F>
virtual T NL3D::CPSAttribMakerT< T, F >::get float    input [inline, virtual]
 

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 from NL3D::CPSAttribMaker.

Definition at line 60 of file ps_attrib_maker_helper.h.

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

compute one value of the attribute for the given index.

Implements NL3D::CPSAttribMaker.

Definition at line 1172 of file ps_attrib_maker_helper.h.

References _F, _InputType, NL3D::CPSAttribMaker::_NbCycles, index, NL3D::MaxInputValue, nlassert, NL3D::OptFastFloorBegin, NL3D::OptFastFloorEnd, NL3D::OptFastFractionnalPart, r, uint32, and v.

template<typename T, class F>
virtual bool NL3D::CPSAttribMakerT< T, F >::getClamping void    const [inline, virtual]
 

Test if the clamping is enabled.

See also:
isClampingSupported()

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 167 of file ps_attrib_maker_helper.h.

template<typename T, class F>
virtual CPSInputType NL3D::CPSAttribMakerT< T, F >::getInput void    const [inline, virtual]
 

get the type of input (if supported).

The default return attrDate

See also:
hasCustomInput()

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 150 of file ps_attrib_maker_helper.h.

template<typename T, class F>
virtual bool NL3D::CPSAttribMakerT< T, F >::hasCustomInput void    [inline, virtual]
 

tells wether one may choose one attribute from a CPSLocated to use as an input.

If false, the input(s) is fixed For this class, it is supported

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 139 of file ps_attrib_maker_helper.h.

template<typename T, class F>
bool NL3D::CPSAttribMakerT< T, F >::isClampingSupported void    const [inline, virtual]
 

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

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 155 of file ps_attrib_maker_helper.h.

template<typename T, class F>
void* NL3D::CPSAttribMakerT< T, F >::make CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
bool    allowNoCopy,
uint32    srcStep
const [inline, private, 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 596 of file ps_attrib_maker_helper.h.

template<typename T, class F>
void NL3D::CPSAttribMakerT< T, F >::make4 CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    srcStep
const [inline, private, 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 790 of file ps_attrib_maker_helper.h.

template<typename T, class F>
template<typename It>
void NL3D::CPSAttribMakerT< T, F >::make4ByIterator It    it,
void *    tab,
uint32    stride,
uint32    numAttrib,
bool    canOverlapOne
const [inline, private]
 

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

Useful for facelookat and the like

Parameters:
canOverlapOne  must be true if the entry iterator can give values above 1
See also:
makeByIterator()

Definition at line 293 of file ps_attrib_maker_helper.h.

Referenced by NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4.

template<typename T, class F>
template<typename It>
void NL3D::CPSAttribMakerT< T, F >::makeByIterator It    it,
void *    tab,
uint32    stride,
uint32    numAttrib,
bool    canOverlapOne
const [inline, private]
 

generate an attribute by using the given iterator.

this allow to choose the input of tha attribute maker

Parameters:
canOverlapOne  must be true if the entry iterator can give values above 1 the attribute maker with no speed penalty

Definition at line 191 of file ps_attrib_maker_helper.h.

Referenced by NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make.

template<typename T, class F>
virtual void NL3D::CPSAttribMakerT< T, F >::makeN CPSLocated   loc,
uint32    startIndex,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    nbReplicate,
uint32    srcStep
const [inline, private, virtual]
 

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

See also:
make4

Implements NL3D::CPSAttribMaker.

Definition at line 978 of file ps_attrib_maker_helper.h.

template<typename T, class F>
template<typename It>
void NL3D::CPSAttribMakerT< T, F >::makeNByIterator It    it,
void *    tab,
uint32    stride,
uint32    numAttrib,
uint32    nbReplicate,
bool    canOverlapOne
const [inline, private]
 

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

Parameters:
canOverlapOne  must be true if the entry iterator can give values above 1
See also:
make4ByIterator

Definition at line 448 of file ps_attrib_maker_helper.h.

Referenced by NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN.

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

serialisation of the object.

See also:
make4

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 104 of file ps_attrib_maker_helper.h.

template<typename T, class F>
virtual void NL3D::CPSAttribMakerT< T, F >::setClamping bool    enable = true [inline, virtual]
 

Enable, disable the clamping of input values.

See also:
isClampingSupported()

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 161 of file ps_attrib_maker_helper.h.

template<typename T, class F>
virtual void NL3D::CPSAttribMakerT< T, F >::setInput const CPSInputType   input [inline, virtual]
 

set a new input type.

Reimplemented from NL3D::CPSAttribMaker.

Definition at line 144 of file ps_attrib_maker_helper.h.


Member Data Documentation

template<typename T, class F>
bool NL3D::CPSAttribMakerT::_Clamp [private]
 

Definition at line 182 of file ps_attrib_maker_helper.h.

Referenced by NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::CPSAttribMakerT, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::getClamping, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4ByIterator, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeByIterator, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeNByIterator, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::serial, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::setClamping.

template<typename T, class F>
F NL3D::CPSAttribMakerT::_F
 

the functor object.

Definition at line 55 of file ps_attrib_maker_helper.h.

Referenced by get, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::get, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4ByIterator, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeByIterator, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeNByIterator, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::serial.

template<typename T, class F>
CPSInputType NL3D::CPSAttribMakerT::_InputType [private]
 

Definition at line 179 of file ps_attrib_maker_helper.h.

Referenced by get, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::getInput, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN, NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::serial, and NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::setInput.


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