#include <ps_plane_basis_maker.h>
Inheritance diagram for NL3D::CPSPlaneBasisFollowSpeed:
Definition at line 86 of file ps_plane_basis_maker.h.
Public Types | |
enum | TProjectionPlane { NoProjection = 0, XY, XZ, YZ, ProjectionPlaneLast } |
Public Member Functions | |
CPSAttribMakerBase * | clone () const |
CPSPlaneBasisFollowSpeed () | |
virtual void | deleteElement (uint32 index) |
delete an element, given its index. this must be called only if memory management is used. | |
virtual CPlaneBasis | get (float input) |
virtual CPlaneBasis | get (CPSLocated *loc, uint32 index) |
============================================================================ | |
virtual bool | getClamping (void) const |
virtual std::string | getClassName ()=0 |
virtual CPSInputType | getInput (void) const |
virtual CPlaneBasis | getMaxValue (void) const |
get the min value, or an evalution that is guaranteed to be < to it (meaningful for ordered set only) | |
virtual CPlaneBasis | getMinValue (void) const |
get the max value, or an evalution that is guaranteed to be > to it (meaningful for ordered set only) | |
float | getNbCycles (void) const |
TProjectionPlane | getProjectionPlane () const |
virtual const char * | getType () |
inherited from CPSAttribMakerBase. Template specialization will do the job | |
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 | |
bool | hasMemory (void) const |
virtual bool | isClampingSupported (void) const |
virtual void * | make (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, bool enableNoCopy=false, uint32 srcStep=(1<< 16)) const |
============================================================================ | |
virtual void | make4 (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 srcStep=(1<< 16)) const |
============================================================================ | |
virtual void | makeN (CPSLocated *loc, uint32 startIndex, void *tab, uint32 stride, uint32 numAttrib, uint32 nbReplicate, uint32 srcStep=(1<< 16)) const |
============================================================================ | |
virtual void | newElement (CPSLocated *emitterLocated, uint32 emitterIndex) |
NLMISC_DECLARE_CLASS (CPSPlaneBasisFollowSpeed) | |
virtual void | resize (uint32 capacity, uint32 nbPresentElements) |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
serialization | |
virtual void | setClamping (bool enable=true) |
virtual void | setInput (const CPSInputType &input) |
void | setNbCycles (float nbCycles) |
void | setProjectionPlane (TProjectionPlane pp) |
Protected Attributes | |
bool | _HasMemory |
float | _NbCycles |
Private Attributes | |
TProjectionPlane | _ProjectionPlane |
|
Definition at line 89 of file ps_plane_basis_maker.h.
00089 { NoProjection = 0, XY, XZ, YZ, ProjectionPlaneLast /* enum counter */ }; |
|
Definition at line 91 of file ps_plane_basis_maker.h.
00091 : CPSAttribMaker<CPlaneBasis>(1), _ProjectionPlane(NoProjection) {} |
|
Implements NL3D::CPSAttribMakerBase. Definition at line 151 of file ps_plane_basis_maker.h.
00151 { return new CPSPlaneBasisFollowSpeed(*this); } |
|
delete an element, given its index. this must be called only if memory management is used.
Reimplemented in NL3D::CPSAttribMakerBinOp< CPlaneBasis >, and NL3D::CPSAttribMakerMemoryBase< CPlaneBasis >. Definition at line 285 of file ps_attrib_maker.h. Referenced by NL3D::CPSRotated3DPlaneParticle::deletePlaneBasisElement().
00285 { nlassert(false) ; } |
|
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< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 161 of file ps_attrib_maker.h.
00161 { nlassert(0); return T(); /* not supported by default */ } |
|
============================================================================
Implements NL3D::CPSAttribMaker< CPlaneBasis >. Definition at line 43 of file ps_plane_basis_maker.cpp. References NL3D::CPSLocated::getSpeed(), index, and uint32.
00044 { 00045 return (CPlaneBasis(loc->getSpeed()[index])); 00046 } |
|
Test if the clamping is enabled. The default is false (clamping unsupported)
Reimplemented in NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 272 of file ps_attrib_maker.h.
00272 { return false ; } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
get the type of input (if supported). The default return attrDate
Reimplemented in NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 251 of file ps_attrib_maker.h.
00251 { return CPSInputType() ; }
|
|
get the min value, or an evalution that is guaranteed to be < to it (meaningful for ordered set only)
Reimplemented in NL3D::CPSAttribMakerBinOp< CPlaneBasis >, NL3D::CPSValueBlender< CPlaneBasis >, and NL3D::CPSValueGradient< CPlaneBasis >. Definition at line 217 of file ps_attrib_maker.h.
00217 { return T() ; /* no mean by default */ } |
|
get the max value, or an evalution that is guaranteed to be > to it (meaningful for ordered set only)
Reimplemented in NL3D::CPSAttribMakerBinOp< CPlaneBasis >, NL3D::CPSValueBlender< CPlaneBasis >, and NL3D::CPSValueGradient< CPlaneBasis >. Definition at line 215 of file ps_attrib_maker.h.
00215 { return T() ; /* no mean by default */ } |
|
Retrieve the number of cycles
Definition at line 236 of file ps_attrib_maker.h.
00236 { return _NbCycles ; } |
|
Definition at line 153 of file ps_plane_basis_maker.h.
00153 { return _ProjectionPlane; } |
|
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"; } |
|
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< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 239 of file ps_attrib_maker.h.
00239 { return false ; } |
|
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::CPSRotated3DPlaneParticle::deletePlaneBasisElement(), NL3D::CPSRotated3DPlaneParticle::newPlaneBasisElement(), and NL3D::CPSRotated3DPlaneParticle::resizePlaneBasis().
00282 { return _HasMemory ; } |
|
tells wether clamping is supported for the input (value can't go above MaxInputValue) The default is false Reimplemented in NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 258 of file ps_attrib_maker.h.
00258 { return false ; } |
|
============================================================================ Fill tab with an attribute by using the given stride. It fills numAttrib attributes.
Implements NL3D::CPSAttribMaker< CPlaneBasis >. Definition at line 49 of file ps_plane_basis_maker.cpp. References _ProjectionPlane, NL3D::CPSAttrib< T >::begin(), NL3D::CPSLocated::getSpeed(), nlassert, NoProjection, NLMISC::CVector::set(), stride, uint32, uint8, NLMISC::CVector::x, NL3D::CPlaneBasis::X, XY, XZ, NLMISC::CVector::y, NL3D::CPlaneBasis::Y, YZ, and NLMISC::CVector::z.
00056 { 00057 nlassert(numAttrib); 00058 if (srcStep == (1 << 16)) 00059 { 00060 TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin() + startIndex 00061 , endSpeedIt = loc->getSpeed().begin() + startIndex + numAttrib; 00062 uint8 *ptDat = (uint8 *) tab; 00063 switch(_ProjectionPlane) 00064 { 00065 case NoProjection: 00066 do 00067 { 00068 *(CPlaneBasis *) ptDat = CPlaneBasis(*speedIt); 00069 ++ speedIt; 00070 ptDat += stride; 00071 } 00072 while (speedIt != endSpeedIt); 00073 break; 00074 case XY: 00075 do 00076 { 00077 float norm = sqrtf(speedIt->x * speedIt->x + speedIt->y * speedIt->y); 00078 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00079 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00080 pb.X.set(invNorm * speedIt->x, invNorm * speedIt->y, 0.f); 00081 pb.Y.set(- pb.X.y, pb.X.x, 0.f); 00082 ++ speedIt; 00083 ptDat += stride; 00084 } 00085 while (speedIt != endSpeedIt); 00086 break; 00087 case XZ: 00088 do 00089 { 00090 float norm = sqrtf(speedIt->x * speedIt->x + speedIt->z * speedIt->z); 00091 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00092 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00093 pb.X.set(invNorm * speedIt->x, 0.f, invNorm * speedIt->z); 00094 pb.Y.set(- pb.X.z, 0.f, pb.X.x); 00095 ++ speedIt; 00096 ptDat += stride; 00097 } 00098 while (speedIt != endSpeedIt); 00099 break; 00100 case YZ: 00101 do 00102 { 00103 float norm = sqrtf(speedIt->y * speedIt->y + speedIt->z * speedIt->z); 00104 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00105 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00106 pb.X.set(0.f, invNorm * speedIt->y, invNorm * speedIt->z); 00107 pb.Y.set(0.f, - pb.X.z, pb.X.y); 00108 ++ speedIt; 00109 ptDat += stride; 00110 } 00111 while (speedIt != endSpeedIt); 00112 break; 00113 default: 00114 nlassert(0); // unknow projection mode 00115 break; 00116 } 00117 return tab; 00118 } 00119 else 00120 { 00121 uint32 fpIndex = startIndex * srcStep; 00122 const TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin(); 00123 uint8 *ptDat = (uint8 *) tab; 00124 switch(_ProjectionPlane) 00125 { 00126 case NoProjection: 00127 while (numAttrib --) 00128 { 00129 *(CPlaneBasis *) ptDat = CPlaneBasis(*(speedIt + (fpIndex >> 16))); 00130 ptDat += stride; 00131 fpIndex += srcStep; 00132 } 00133 break; 00134 case XY: 00135 while (numAttrib --) 00136 { 00137 const CVector *speedVect = &(*(speedIt + (fpIndex >> 16))); 00138 float norm = sqrtf(speedVect->x * speedVect->x + speedVect->y * speedVect->y); 00139 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00140 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00141 pb.X.set(invNorm * speedVect->x, invNorm * speedVect->y, 0.f); 00142 pb.Y.set(- pb.X.y, pb.X.x, 0.f); 00143 ptDat += stride; 00144 fpIndex += srcStep; 00145 } 00146 break; 00147 case XZ: 00148 while (numAttrib --); 00149 { 00150 const CVector *speedVect = &(*(speedIt + (fpIndex >> 16))); 00151 float norm = sqrtf(speedVect->x * speedVect->x + speedVect->z * speedVect->z); 00152 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00153 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00154 pb.X.set(invNorm * speedVect->x, 0.f, invNorm * speedVect->z); 00155 pb.Y.set(- pb.X.z, 0.f, pb.X.x); 00156 ptDat += stride; 00157 fpIndex += srcStep; 00158 } 00159 break; 00160 case YZ: 00161 while (numAttrib --); 00162 { 00163 const CVector *speedVect = &(*(speedIt + (fpIndex >> 16))); 00164 float norm = sqrtf(speedVect->y * speedVect->y + speedVect->z * speedVect->z); 00165 float invNorm = (norm != 0.f) ? 1.f / norm : 0.f; 00166 CPlaneBasis &pb = *(CPlaneBasis *) ptDat; 00167 pb.X.set(0.f, invNorm * speedVect->y, invNorm * speedVect->z); 00168 pb.Y.set(0.f, - pb.X.z, pb.X.y); 00169 ptDat += stride; 00170 fpIndex += srcStep; 00171 } 00172 break; 00173 default: 00174 nlassert(0); // unknow projection mode 00175 break; 00176 } 00177 return tab; 00178 } 00179 } |
|
============================================================================ The same as make, but it replicate each attribute 4 times, thus filling 4*numAttrib. Useful for facelookat and the like
Implements NL3D::CPSAttribMaker< CPlaneBasis >. Definition at line 182 of file ps_plane_basis_maker.cpp. References NL3D::CPSAttrib< T >::begin(), NL3D::CPSLocated::getSpeed(), nlassert, stride, uint32, and uint8.
00189 { 00190 nlassert(numAttrib); 00191 if (srcStep == (1 << 16)) 00192 { 00193 TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin() + startIndex 00194 , endSpeedIt = loc->getSpeed().begin() + startIndex + numAttrib; 00195 uint8 *ptDat = (uint8 *) tab; 00196 do 00197 { 00198 *(CPlaneBasis *) ptDat = CPlaneBasis(*speedIt); 00199 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00200 ptDat += stride; 00201 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00202 ptDat += stride; 00203 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00204 ptDat += stride << 1; 00205 ++ speedIt; 00206 } 00207 while (speedIt != endSpeedIt); 00208 } 00209 else 00210 { 00211 uint32 fpIndex = startIndex * srcStep; 00212 const TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin(); 00213 uint8 *ptDat = (uint8 *) tab; 00214 while (numAttrib --) 00215 { 00216 *(CPlaneBasis *) ptDat = CPlaneBasis(*(speedIt + (fpIndex >> 16))); 00217 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00218 ptDat += stride; 00219 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00220 ptDat += stride; 00221 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00222 ptDat += stride << 1; 00223 fpIndex += srcStep; 00224 } 00225 } 00226 } |
|
============================================================================ the same as make4, but with nbReplicate replication isntead of 4
Implements NL3D::CPSAttribMaker< CPlaneBasis >. Definition at line 229 of file ps_plane_basis_maker.cpp. References NL3D::CPSAttrib< T >::begin(), NL3D::CPSLocated::getSpeed(), nlassert, stride, uint, uint32, and uint8.
00237 { 00238 nlassert(numAttrib); 00239 if (srcStep == (1 << 16)) 00240 { 00241 nlassert(nbReplicate > 1); 00242 TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin() + startIndex 00243 , endSpeedIt = loc->getSpeed().begin() + startIndex + numAttrib; 00244 uint8 *ptDat = (uint8 *) tab; 00245 uint k; 00246 do 00247 { 00248 *(CPlaneBasis *) ptDat = CPlaneBasis(*speedIt); 00249 00250 k = nbReplicate - 1; 00251 00252 do 00253 { 00254 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00255 ptDat += stride; 00256 } 00257 while (--k); 00258 ptDat += stride; 00259 00260 ++ speedIt; 00261 } 00262 while (speedIt != endSpeedIt); 00263 } 00264 else 00265 { 00266 uint32 fpIndex = startIndex * srcStep; 00267 nlassert(nbReplicate > 1); 00268 const TPSAttribVector::const_iterator speedIt = loc->getSpeed().begin(); 00269 uint8 *ptDat = (uint8 *) tab; 00270 uint k; 00271 while (numAttrib --) 00272 { 00273 *(CPlaneBasis *) ptDat = CPlaneBasis(*(speedIt + (fpIndex >> 16))); 00274 00275 k = nbReplicate - 1; 00276 00277 do 00278 { 00279 *(CPlaneBasis *) (ptDat + stride) = *(CPlaneBasis *) ptDat; 00280 ptDat += stride; 00281 } 00282 while (--k); 00283 ptDat += stride; 00284 00285 fpIndex += srcStep; 00286 } 00287 } 00288 } |
|
create a new element, and provides the emitter, this must be called only if this attribute maker has its own memory Reimplemented in NL3D::CPSAttribMakerBinOp< CPlaneBasis >, and NL3D::CPSAttribMakerMemoryBase< CPlaneBasis >. Definition at line 290 of file ps_attrib_maker.h. Referenced by NL3D::CPSRotated3DPlaneParticle::newPlaneBasisElement().
00290 { nlassert(false) ; } |
|
|
|
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 in NL3D::CPSAttribMakerBinOp< CPlaneBasis >, and NL3D::CPSAttribMakerMemoryBase< CPlaneBasis >. Definition at line 296 of file ps_attrib_maker.h. Referenced by NL3D::CPSRotated3DPlaneParticle::resizePlaneBasis().
00296 { nlassert(false) ; } |
|
serialization
Reimplemented from NL3D::CPSAttribMaker< CPlaneBasis >. Definition at line 137 of file ps_plane_basis_maker.h. References sint.
00138 { 00139 // version 2 : added projection plane 00140 // version 1 : nothing to save here 00141 sint ver = f.serialVersion(2); 00142 if (ver >= 2) 00143 { 00144 f.serialEnum(_ProjectionPlane); 00145 } 00146 else 00147 { 00148 _ProjectionPlane = NoProjection; 00149 } 00150 } |
|
Enable, disable the clamping of input values. The default does nothing (clamping unsupported)
Reimplemented in NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 265 of file ps_attrib_maker.h.
00265 {} ; |
|
set a new input type (if supported). The default does nothing
Reimplemented in NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueBlendFunc< CPlaneBasis > >, NL3D::CPSAttribMakerT< CPlaneBasis, CPSValueGradientFunc< CPlaneBasis > >, and NL3D::CPSAttribMakerT< CPlaneBasis, CSpinnerFunctor >. Definition at line 245 of file ps_attrib_maker.h.
00245 {} |
|
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.
|
|
Definition at line 154 of file ps_plane_basis_maker.h.
00154 { _ProjectionPlane = pp; } |
|
Definition at line 304 of file ps_attrib_maker.h. |
|
Definition at line 301 of file ps_attrib_maker.h. |
|
Definition at line 156 of file ps_plane_basis_maker.h. Referenced by make(). |