From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03671.html | 1807 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1807 insertions(+) create mode 100644 docs/doxygen/nel/a03671.html (limited to 'docs/doxygen/nel/a03671.html') diff --git a/docs/doxygen/nel/a03671.html b/docs/doxygen/nel/a03671.html new file mode 100644 index 00000000..74e6aca5 --- /dev/null +++ b/docs/doxygen/nel/a03671.html @@ -0,0 +1,1807 @@ + + +NeL: NL3D::CVegetable class Reference + + + +
+

NL3D::CVegetable Class Reference

#include <vegetable.h> +

+


Detailed Description

+A vegetable descriptor.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 54 of file vegetable.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Density Angle Factor

enum  TAngleType { AngleGround = 0, +AngleCeiling, +AngleWall + }
TAngleType getAngleType () const
float getCosAngleMax () const
float getCosAngleMin () const
void setAngleCeiling (float cosAngleMax)
void setAngleGround (float cosAngleMin)
void setAngleWall (float cosAngleMin, float cosAngleMax)

posInWorldAround 4 position on 4 edges around the center in folowing order:

same as generateGroup, but with smoother density effects on border with desnity==0

+(0,0.5), (1,0.5), (0.5,0), (0.5,1) (in instance UV coordinates space (as returned in "instances").

void generateGroupBiLinear (const CVector &posInWorld, const CVector posInWorldBorder[4], const CVector &surfaceNormal, float area, uint vegetSeed, std::vector< CVector2f > &instances) const
void generateInstance (CVegetableInstanceGroup *ig, const NLMISC::CMatrix &posInWorld, const NLMISC::CRGBAF &modulateAmbientColor, const NLMISC::CRGBAF &modulateDiffuseColor, float blendDistMax, TVegetableWater vegetWaterState, CVegetableUV8 dlmUV) const
void reserveIgAddInstances (CVegetableInstanceGroupReserve &vegetIgReserve, TVegetableWater vegetWaterState, uint numInstances) const
void serial (NLMISC::IStream &f)
void generateGroupEx (float nbInst, const CVector &posInWorld, const CVector &surfaceNormal, uint vegetSeed, std::vector< CVector2f > &instances) const
 Do the generateGroup, but take nbInst unmodulated by normal.

TAngleType _AngleType
 angle type setuped with setAngleMin etc...

float _CosAngleMax
float _CosAngleMiddle
float _CosAngleMin
CVegetableManager_Manager
 the manager

float _OOCosAngleDist
CVegetableShape_VegetableShape
 shape in the manager

float easeInEaseOut (float x)

Public Types

enum  TVegetableWater { AboveWater = 0, +UnderWater, +IntersectWater, +VegetInfoLast + }
 Micro vegetation position against Water. Above water is the default. More...


Public Member Functions

 CVegetable ()
void generateGroup (const CVector &posInWorld, const CVector &surfaceNormal, float area, uint vegetSeed, std::vector< CVector2f > &instances) const
void registerToManager (CVegetableManager *manager)

Data Fields

NLMISC::CNoiseValue BendFactor
 Random Bend factor.

float BendFrequencyFactor
 Fixed Bend FrequencyFactor. NB: rounded during addInstance to the nearest NL3D_VEGETABLE_FREQUENCY_FACTOR_PREC.

NLMISC::CNoiseValue BendPhase
 Random Bend Phase.

NLMISC::CNoiseColorGradient Color
 The color to modulate the instance.

NLMISC::CNoiseValue Density
 Density== Number of instance to create / mē.

uint32 DistType
float MaxDensity
 the maximum density computed. if <0, no maximum. -1 by default.

NLMISC::CNoiseValue Rx
 Random Orientation.

NLMISC::CNoiseValue Ry
 Random Orientation.

NLMISC::CNoiseValue Rz
 Random Orientation.

std::string ShapeName
 Name of the shape to use.

NLMISC::CNoiseValue Sxy
 Random Scale.

NLMISC::CNoiseValue Sz
 Random Scale.

+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NL3D::CVegetable::TAngleType +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + +
AngleGround  +
AngleCeiling  +
AngleWall  +
+
+ +

+Definition at line 90 of file vegetable.h. +

+Referenced by getAngleType(). +

+

+

+ + + + +
+ + +
enum NL3D::CVegetable::TVegetableWater +
+
+ + + + + +
+   + + +

+Micro vegetation position against Water. Above water is the default. +

+

Enumeration values:
+ + + + + +
AboveWater  +
UnderWater  +
IntersectWater  +
VegetInfoLast  +
+
+ +

+Definition at line 58 of file vegetable.h. +

+

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CVegetable::CVegetable  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 48 of file vegetable.cpp. +

+References _Manager, NLMISC::CNoiseValue::Abs, BendFactor, BendFrequencyFactor, DistType, MaxDensity, NLMISC::CNoiseValue::Rand, Rx, Ry, Rz, setAngleGround(), Sxy, and Sz. +

+

00049 {
+00050         // Ground style density.
+00051         setAngleGround(0);
+00052 
+00053         // Density not maximised.
+00054         MaxDensity= -1;
+00055 
+00056         // No scale.
+00057         Sxy.Abs= Sz.Abs= 1;
+00058         Sxy.Rand= Sz.Rand= 0;
+00059         // No rotation.
+00060         Rx.Abs= Ry.Abs= Rz.Abs= 0;
+00061         Rx.Rand= Ry.Rand= Rz.Rand= 0;
+00062         // No BendFactor.
+00063         BendFactor.Abs= 1;
+00064         BendFactor.Rand= 0;
+00065         BendFrequencyFactor= 1;
+00066 
+00067         // Appear at 0.
+00068         DistType= 0;
+00069 
+00070         _Manager= NULL;
+00071 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
float NL3D::CVegetable::easeInEaseOut float  x  )  [inline, static, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 193 of file vegetable.h. +

+References x, and y. +

+Referenced by generateGroupBiLinear(). +

+

00194         {
+00195                 float   y;
+00196                 // cubic such that f(0)=0, f'(0)=0, f(1)=1, f'(1)=0.
+00197                 float   x2=x*x;
+00198                 float   x3=x2*x;
+00199                 y= -2*x3 + 3*x2;
+00200                 return y;
+00201         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::generateGroup const CVector posInWorld,
const CVector surfaceNormal,
float  area,
uint  vegetSeed,
std::vector< CVector2f > &  instances
const
+
+ + + + + +
+   + + +

+generate a list of instance to create on a small ground element, according to density and noise. result is a list of instance to create, with random 2d position. 2d position are in range [0..1]. caller should scale, or use it to compute real world position, and then use generateInstance() to really compute the instances.

+Warning! Use OptFastFloor()! So call must be enclosed with a OptFastFloorBegin()/OptFastFloorEnd().

+

Parameters:
+ + + + + + +
posInWorld center (approx) of the surface which generate group of vegetable
surfaceNormal UNIT up vector of the surface to compare with (0,0,1), to modulate density
area area of the surface, to know number of elements to generate for this surface
vegetSeed "random" value which Should be different for all vegetables in the same area. usefull if lot of different vegetable generated in same area: positions won't be generated at same place.
instances the generated position of instances.
+
+ +

+Definition at line 176 of file vegetable.cpp. +

+References Density, NLMISC::CNoiseValue::eval(), generateGroupEx(), MaxDensity, min, and uint. +

+

00177 {
+00178         // number of instances to generate
+00179         float   dens= Density.eval(posInWorld);
+00180         if(MaxDensity >= 0)
+00181                 dens= min(dens, MaxDensity);
+00182         float   nbInst= area * dens;
+00183 
+00184         // modulate by normal and generate them.
+00185         generateGroupEx(nbInst, posInWorld, surfaceNormal, vegetSeed, instances);
+00186 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::generateGroupBiLinear const CVector posInWorld,
const CVector  posInWorldBorder[4],
const CVector surfaceNormal,
float  area,
uint  vegetSeed,
std::vector< CVector2f > &  instances
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 190 of file vegetable.cpp. +

+References Density, easeInEaseOut(), NLMISC::CNoiseValue::eval(), NLMISC::CNoiseValue::evalOneLevelRandom(), generateGroupEx(), MaxDensity, min, NL3D::RandomGenerator, sint, uint, x, and y. +

+Referenced by NL3D::CPatch::generateTileVegetable(). +

+

00191 {
+00192         sint    i;
+00193         const   float evenDistribFact= 12.25f;          // an arbitrary value to have a higher frequency for random.
+00194 
+00195         // compute how many instances to generate on borders of the patch
+00196         // ==================
+00197         float   edgeDensity[4];
+00198         for(i=0; i<4; i++)
+00199         {
+00200                 // Get number of instances generated on edges
+00201                 edgeDensity[i]= area * Density.eval(posInWorldBorder[i]);
+00202                 if(MaxDensity >= 0)
+00203                         edgeDensity[i]= min(edgeDensity[i], area * MaxDensity);
+00204                 edgeDensity[i]= max(0.f, edgeDensity[i]);
+00205         }
+00206         // Average on center of the patch for each direction.
+00207         float   edgeDensityCenterX;
+00208         float   edgeDensityCenterY;
+00209         edgeDensityCenterX= 0.5f * (edgeDensity[0] + edgeDensity[1]);
+00210         edgeDensityCenterY= 0.5f * (edgeDensity[2] + edgeDensity[3]);
+00211 
+00212         
+00213         // Average for all the patch
+00214         float   nbInstAverage= 0.5f * (edgeDensityCenterX + edgeDensityCenterY);
+00215 
+00216 
+00217         // generate instances on the patch
+00218         // ==================
+00219         generateGroupEx(nbInstAverage, posInWorld, surfaceNormal, vegetSeed, instances);
+00220 
+00221 
+00222 
+00223         // move instances x/y to follow edge repartition
+00224         // ==================
+00225         // If on a direction, both edges are 0 density, then must do a special formula
+00226         bool    middleX= edgeDensityCenterX<=1;
+00227         bool    middleY= edgeDensityCenterY<=1;
+00228         float   OOEdgeDCX=0.0;
+00229         float   OOEdgeDCY=0.0;
+00230         if(!middleX)    OOEdgeDCX= 1.0f / edgeDensityCenterX;
+00231         if(!middleY)    OOEdgeDCY= 1.0f / edgeDensityCenterY;
+00232         // for all instances
+00233         for(i=0; i<(sint)instances.size(); i++)
+00234         {
+00235                 float           x= instances[i].x;
+00236                 float           y= instances[i].y;
+00237                 // a seed for random.
+00238                 CVector         randSeed(x*evenDistribFact, y*evenDistribFact, 0);
+00239 
+00240                 // X change.
+00241                 if(middleX)
+00242                 {
+00243                         // instances are grouped at middle. this is the bijection of easeInEaseOut
+00244                         x= x+x - easeInEaseOut(x);
+00245                         x= x+x - easeInEaseOut(x);
+00246                         instances[i].x= x;
+00247                 }
+00248                 else
+00249                 {
+00250                         // Swap X, randomly. swap more on border
+00251                         // evaluate the density in X direction we have at this point.
+00252                         float   densX= edgeDensity[0]*(1-x) + edgeDensity[1]* x ;
+00253                         // If on the side of the lowest density
+00254                         if(densX < edgeDensityCenterX)
+00255                         {
+00256                                 // may swap the position 
+00257                                 float   rdSwap= (densX * OOEdgeDCX );
+00258                                 // (densX * OOEdgeDCX) E [0..1[. The more it is near 0, the more is has chance to be swapped.
+00259                                 rdSwap+= RandomGenerator.evalOneLevelRandom( randSeed );
+00260                                 if(rdSwap<1)
+00261                                         instances[i].x= 1 - instances[i].x;
+00262                         }
+00263                 }
+00264 
+00265                 // Y change.
+00266                 if(middleY)
+00267                 {
+00268                         // instances are grouped at middle. this is the bijection of easeInEaseOut
+00269                         y= y+y - easeInEaseOut(y);
+00270                         y= y+y - easeInEaseOut(y);
+00271                         instances[i].y= y;
+00272                 }
+00273                 else
+00274                 {
+00275                         // Swap Y, randomly. swap more on border
+00276                         // evaluate the density in Y direction we have at this point.
+00277                         float   densY= edgeDensity[2]*(1-y) + edgeDensity[3]* y ;
+00278                         // If on the side of the lowest density
+00279                         if(densY < edgeDensityCenterY)
+00280                         {
+00281                                 // may swap the position 
+00282                                 float   rdSwap= (densY * OOEdgeDCY);
+00283                                 // (densY * OOEdgeDCY) E [0..1[. The more it is near 0, the more is has chance to be swapped.
+00284                                 rdSwap+= RandomGenerator.evalOneLevelRandom( randSeed );
+00285                                 if(rdSwap<1)
+00286                                         instances[i].y= 1 - instances[i].y;
+00287                         }
+00288                 }
+00289 
+00290         }
+00291 
+00292 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::generateGroupEx float  nbInst,
const CVector posInWorld,
const CVector surfaceNormal,
uint  vegetSeed,
std::vector< CVector2f > &  instances
const [private]
+
+ + + + + +
+   + + +

+Do the generateGroup, but take nbInst unmodulated by normal. +

+ +

+Definition at line 132 of file vegetable.cpp. +

+References _CosAngleMiddle, _OOCosAngleDist, NLMISC::CNoiseValue::evalOneLevelRandom(), NLMISC::OptFastFloor(), NL3D::RandomGenerator, sint, NLMISC::sqr(), uint, NLMISC::CVector2f::x, NLMISC::CVector::x, NLMISC::CVector2f::y, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by generateGroup(), and generateGroupBiLinear(). +

+

00133 {
+00134 
+00135         // Density modulation.
+00136         //===================
+00137 
+00138         // compute cos of angle between surfaceNormal and K(0,0,1).
+00139         float   cosAngle= surfaceNormal.z;
+00140         // compute angleFactor density. Use a quadratic, because f'(_CosAngleMiddle)==0.
+00141         float   angleFact= 1 - sqr((cosAngle - _CosAngleMiddle) * _OOCosAngleDist);
+00142         angleFact= max(0.f, angleFact);
+00143         // modulate density with angleFactor.
+00144         nbInst*= angleFact;
+00145 
+00146         // Now, 0<=nbInst<+oo. If we have 0.1, it means that we have 10% chance to spawn an instance.
+00147         // So add a "random" value (with help of a noise with High frequency)
+00148         // if nbInst==0, we should never have any instance (which may arise if evalOneLevelRandom()==1).
+00149         // hence the 0.99f* which ensure that we do nbInst+= [0..1[.
+00150         nbInst+= 0.99f * RandomGenerator.evalOneLevelRandom(posInWorld);
+00151 
+00152         // and then get only the integral part.
+00153         sint    nbInstances= NLMISC::OptFastFloor(nbInst);
+00154         nbInstances= max(0, nbInstances);
+00155 
+00156         // resize the instances
+00157         instances.resize(nbInstances);
+00158 
+00159         // Position generation.
+00160         //===================
+00161         // For now, generate them randomly.
+00162         static CVector2f        dSeed(0.513f, 0.267f);  // random values.
+00163         CVector                         seed= posInWorld;
+00164         seed.z+= vegetSeed * 0.723f;    // 0.723f is a random value.
+00165         for(sint i=0; i<nbInstances; i++)
+00166         {
+00167                 instances[i].x= RandomGenerator.evalOneLevelRandom(seed);
+00168                 seed.x+= dSeed.x;
+00169                 instances[i].y= RandomGenerator.evalOneLevelRandom(seed);
+00170                 seed.y+= dSeed.y;
+00171         }
+00172 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::generateInstance CVegetableInstanceGroup ig,
const NLMISC::CMatrix posInWorld,
const NLMISC::CRGBAF modulateAmbientColor,
const NLMISC::CRGBAF modulateDiffuseColor,
float  blendDistMax,
TVegetableWater  vegetWaterState,
CVegetableUV8  dlmUV
const
+
+ + + + + +
+   + + +

+posInWorld should be a matrix of position + rotation (typically for surface alignement). FinalPos= posInWorld * noiseMatrix(scale/rot) If shape is Lighted: FinalAmbientColor= vegetManager->Ambient * modulateAmbientColor * randomColor. FinalDiffuseColor= vegetManager->Diffuse * modulateDiffuseColor * randomColor. else FinalAmbientColor= randomColor. FinalDiffuseColor= randomColor. If instance is in AlphaBlend/ZSort, blendDistMax is the distance where the instance is invisible (alpha==0). instance is added to the manager, under the instance group ig. This one must have been generated by the VegetableManager.

Parameters:
+ + +
dlmUV is the dynamic lightmap UV for this vegetable.
+
+ +

+Definition at line 306 of file vegetable.cpp. +

+References _Manager, _VegetableShape, NLMISC::CNoiseValue::Abs, NL3D::CVegetableManager::addInstance(), BendFactor, BendFrequencyFactor, BendPhase, NLMISC::CNoiseColorGradient::eval(), NLMISC::CNoiseValue::eval(), NLMISC::CMatrix::getPos(), NL3D::CVegetableShape::Lighted, nlassert, NLMISC::CNoiseValue::Rand, Rx, Ry, Rz, NLMISC::CMatrix::scale(), NLMISC::CMatrix::setRot(), Sxy, Sz, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by NL3D::CPatch::generateTileVegetable(). +

+

00309 {
+00310         nlassert(_Manager);
+00311 
+00312 
+00313         CVector         seed= posInWorld.getPos();
+00314 
+00315         // Generate Matrix.
+00316         // ===============
+00317 
+00318         // Generate a random Scale / Rotation matrix.
+00319         CMatrix         randomMat;
+00320         // setup rotation
+00321         CVector         rot;
+00322         rot.x= Rx.eval(seed);
+00323         rot.y= Ry.eval(seed);
+00324         rot.z= Rz.eval(seed);
+00325         randomMat.setRot(rot, CMatrix::ZXY);
+00326         // scale.
+00327         if(Sxy.Abs!=0 || Sxy.Rand!=0 || Sz.Abs!=0 || Sz.Rand!=0)
+00328         {
+00329                 CVector         scale;
+00330                 scale.x= scale.y= Sxy.eval(seed);
+00331                 scale.z= Sz.eval(seed);
+00332                 randomMat.scale(scale);
+00333         }
+00334 
+00335         // Final Matrix.
+00336         CMatrix         finalMatrix;
+00337         finalMatrix= posInWorld * randomMat;
+00338 
+00339         // Generate Color and factor
+00340         // ===============
+00341         CRGBAF          materialColor(1,1,1,1);
+00342         // evaluate gradients. If none, color not modified.
+00343         Color.eval(seed, materialColor);
+00344         // modulate with user
+00345         CRGBAF          ambient, diffuse;
+00346         if(_VegetableShape && _VegetableShape->Lighted)
+00347         {
+00348                 ambient= modulateAmbientColor * materialColor;
+00349                 diffuse= modulateDiffuseColor * materialColor;
+00350         }
+00351         else
+00352         {
+00353                 ambient= materialColor;
+00354                 diffuse= materialColor;
+00355         }
+00356 
+00357         // Generate a bendFactor
+00358         float   bendFactor= BendFactor.eval(seed);
+00359         // Generate a bendPhase
+00360         float   bendPhase= BendPhase.eval(seed);
+00361 
+00362 
+00363         // Append to the vegetableManager
+00364         // ===============
+00365         if (_VegetableShape)
+00366         {
+00367                 _Manager->addInstance(ig, _VegetableShape, finalMatrix, ambient, diffuse, 
+00368                         bendFactor, bendPhase, BendFrequencyFactor, blendDistMax, 
+00369                         (CVegetableManager::TVegetableWater)vegetWaterState, dlmUV);
+00370         }
+00371 }
+
+

+ + + + +
+ + + + + + + + + +
TAngleType NL3D::CVegetable::getAngleType  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 109 of file vegetable.h. +

+References _AngleType, and TAngleType. +

+

00109 {return _AngleType;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CVegetable::getCosAngleMax  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file vegetable.h. +

+References _CosAngleMax. +

+

00108 {return _CosAngleMax;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CVegetable::getCosAngleMin  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 107 of file vegetable.h. +

+References _CosAngleMin. +

+

00107 {return _CosAngleMin;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVegetable::registerToManager CVegetableManager manager  ) 
+
+ + + + + +
+   + + +

+register the vegetable to the vegetable manager. do it first. used by generateInstance(). Manager will load the shape needed for this vegetable. +

+Definition at line 123 of file vegetable.cpp. +

+References _Manager, _VegetableShape, NL3D::CVegetableManager::getVegetableShape(), nlassert, and ShapeName. +

+

00124 {
+00125         nlassert(manager);
+00126         _Manager= manager;
+00127         _VegetableShape= _Manager->getVegetableShape(ShapeName);
+00128 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::reserveIgAddInstances CVegetableInstanceGroupReserve vegetIgReserve,
TVegetableWater  vegetWaterState,
uint  numInstances
const
+
+ + + + + +
+   + + +

+Fast allocation reservation: you must call this before generating all your instances in an Ig: Add N instances of Vegetable to the reservation system.

Parameters:
+ + +
numInstances number of instances to generate (as "returned" by generateGroup()).
+
+
See also:
CVegetableManager::reserveIgCompile().
+ +

+Definition at line 296 of file vegetable.cpp. +

+References _Manager, _VegetableShape, nlassert, NL3D::CVegetableManager::reserveIgAddInstances(), and uint. +

+Referenced by NL3D::CPatch::generateTileVegetable(). +

+

00297 {
+00298         nlassert(_Manager);
+00299 
+00300         if (_VegetableShape)
+00301                 _Manager->reserveIgAddInstances(vegetIgReserve, _VegetableShape, (CVegetableManager::TVegetableWater)vegetWaterState, numInstances);
+00302 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVegetable::serial NLMISC::IStream f  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 375 of file vegetable.cpp. +

+References _AngleType, _CosAngleMax, _CosAngleMiddle, _CosAngleMin, _OOCosAngleDist, BendFactor, BendFrequencyFactor, BendPhase, Density, DistType, MaxDensity, Rx, Ry, Rz, NLMISC::IStream::serial(), NLMISC::IStream::serialEnum(), NLMISC::IStream::serialVersion(), ShapeName, sint, Sxy, and Sz. +

+

00376 {
+00377         /*
+00378         Version 1:
+00379                 - add BendFrequencyFactor
+00380         Version 0:
+00381                 - base version
+00382         */
+00383         sint    ver= f.serialVersion(1);
+00384 
+00385         f.serial(ShapeName);
+00386         f.serial(Density);
+00387         f.serial(MaxDensity);
+00388         f.serial(_CosAngleMin, _CosAngleMax, _CosAngleMiddle, _OOCosAngleDist);
+00389         f.serialEnum(_AngleType);
+00390         f.serial(Sxy, Sz);
+00391         f.serial(Rx, Ry, Rz);
+00392         f.serial(BendFactor);
+00393         f.serial(BendPhase);
+00394         f.serial(Color);
+00395         f.serial(DistType);
+00396 
+00397         if(ver>=1)
+00398                 f.serial(BendFrequencyFactor);
+00399         else
+00400                 BendFrequencyFactor= 1;
+00401 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVegetable::setAngleCeiling float  cosAngleMax  ) 
+
+ + + + + +
+   + + +

+set an Angle setup such that max density is when normal= -K, and 0 density is when normalAngle= cosAngleMax.

Parameters:
+ + +
cosAngleMinLimit should be a cosinus angle between -1 and 1.
+
+ +

+Definition at line 91 of file vegetable.cpp. +

+References _AngleType, _CosAngleMax, _CosAngleMiddle, _CosAngleMin, _OOCosAngleDist, and AngleCeiling. +

+

00092 {
+00093         _AngleType= AngleCeiling;
+00094 
+00095         _CosAngleMax= cosAngleMax;
+00096         // We must be at densityFactor==1, when cosAngle==-1, keeping the same formula.
+00097         _CosAngleMin= -1 - (cosAngleMax-(-1));
+00098         
+00099         // precalc
+00100         _CosAngleMiddle= (_CosAngleMin + _CosAngleMax)/2;
+00101         _OOCosAngleDist= _CosAngleMax - _CosAngleMiddle;
+00102         if(_OOCosAngleDist)
+00103                 _OOCosAngleDist= 1.0f / _OOCosAngleDist;
+00104 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVegetable::setAngleGround float  cosAngleMin  ) 
+
+ + + + + +
+   + + +

+set an Angle setup such that max density is when normal== K, and 0 density is when normalAngle= cosAngleMin.

Parameters:
+ + +
cosAngleMinLimit should be a cosinus angle between -1 and 1.
+
+ +

+Definition at line 75 of file vegetable.cpp. +

+References _AngleType, _CosAngleMax, _CosAngleMiddle, _CosAngleMin, _OOCosAngleDist, and AngleGround. +

+Referenced by CVegetable(). +

+

00076 {
+00077         _AngleType= AngleGround;
+00078 
+00079         _CosAngleMin= cosAngleMin;
+00080         // We must be at densityFactor==1, when cosAngle==1, keeping the same formula.
+00081         _CosAngleMax= 1 + (1-cosAngleMin);
+00082 
+00083         // precalc
+00084         _CosAngleMiddle= (_CosAngleMin + _CosAngleMax)/2;
+00085         _OOCosAngleDist= _CosAngleMax - _CosAngleMiddle;
+00086         if(_OOCosAngleDist)
+00087                 _OOCosAngleDist= 1.0f / _OOCosAngleDist;
+00088 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CVegetable::setAngleWall float  cosAngleMin,
float  cosAngleMax
+
+ + + + + +
+   + + +

+set an Angle setup such that max density is when normal is at (cosAngleMin+cosAngleMax)/2, and 0 density is when cosAngle= one of the cosAngleMin or cosAngleMax. +

+Definition at line 107 of file vegetable.cpp. +

+References _AngleType, _CosAngleMax, _CosAngleMiddle, _CosAngleMin, _OOCosAngleDist, and AngleWall. +

+

00108 {
+00109         _AngleType= AngleWall;
+00110 
+00111         _CosAngleMin= cosAngleMin;
+00112         _CosAngleMax= cosAngleMax;
+00113 
+00114         // precalc
+00115         _CosAngleMiddle= (_CosAngleMin + _CosAngleMax)/2;
+00116         _OOCosAngleDist= _CosAngleMax - _CosAngleMiddle;
+00117         if(_OOCosAngleDist)
+00118                 _OOCosAngleDist= 1.0f / _OOCosAngleDist;
+00119 }
+
+


Field Documentation

+

+ + + + +
+ + +
TAngleType NL3D::CVegetable::_AngleType [private] +
+
+ + + + + +
+   + + +

+angle type setuped with setAngleMin etc... +

+ +

+Definition at line 179 of file vegetable.h. +

+Referenced by getAngleType(), serial(), setAngleCeiling(), setAngleGround(), and setAngleWall().

+

+ + + + +
+ + +
float NL3D::CVegetable::_CosAngleMax [private] +
+
+ + + + + +
+   + + +

+density is multiplied by a function f(cos angle with verticalVector), such that f(CosAngleMiddle)==1, and f(CosAngleMin)==f(CosAngleMax)== 0 +

+Definition at line 177 of file vegetable.h. +

+Referenced by getCosAngleMax(), serial(), setAngleCeiling(), setAngleGround(), and setAngleWall().

+

+ + + + +
+ + +
float NL3D::CVegetable::_CosAngleMiddle [private] +
+
+ + + + + +
+   + + +

+density is multiplied by a function f(cos angle with verticalVector), such that f(CosAngleMiddle)==1, and f(CosAngleMin)==f(CosAngleMax)== 0 +

+Definition at line 177 of file vegetable.h. +

+Referenced by generateGroupEx(), serial(), setAngleCeiling(), setAngleGround(), and setAngleWall().

+

+ + + + +
+ + +
float NL3D::CVegetable::_CosAngleMin [private] +
+
+ + + + + +
+   + + +

+density is multiplied by a function f(cos angle with verticalVector), such that f(CosAngleMiddle)==1, and f(CosAngleMin)==f(CosAngleMax)== 0 +

+Definition at line 177 of file vegetable.h. +

+Referenced by getCosAngleMin(), serial(), setAngleCeiling(), setAngleGround(), and setAngleWall().

+

+ + + + +
+ + +
CVegetableManager* NL3D::CVegetable::_Manager [private] +
+
+ + + + + +
+   + + +

+the manager +

+ +

+Definition at line 183 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), registerToManager(), and reserveIgAddInstances().

+

+ + + + +
+ + +
float NL3D::CVegetable::_OOCosAngleDist [private] +
+
+ + + + + +
+   + + +

+density is multiplied by a function f(cos angle with verticalVector), such that f(CosAngleMiddle)==1, and f(CosAngleMin)==f(CosAngleMax)== 0 +

+Definition at line 177 of file vegetable.h. +

+Referenced by generateGroupEx(), serial(), setAngleCeiling(), setAngleGround(), and setAngleWall().

+

+ + + + +
+ + +
CVegetableShape* NL3D::CVegetable::_VegetableShape [private] +
+
+ + + + + +
+   + + +

+shape in the manager +

+ +

+Definition at line 185 of file vegetable.h. +

+Referenced by generateInstance(), registerToManager(), and reserveIgAddInstances().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::BendFactor +
+
+ + + + + +
+   + + +

+Random Bend factor. +

+ +

+Definition at line 72 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
float NL3D::CVegetable::BendFrequencyFactor +
+
+ + + + + +
+   + + +

+Fixed Bend FrequencyFactor. NB: rounded during addInstance to the nearest NL3D_VEGETABLE_FREQUENCY_FACTOR_PREC. +

+ +

+Definition at line 76 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::BendPhase +
+
+ + + + + +
+   + + +

+Random Bend Phase. +

+ +

+Definition at line 74 of file vegetable.h. +

+Referenced by generateInstance(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseColorGradient NL3D::CVegetable::Color +
+
+ + + + + +
+   + + +

+The color to modulate the instance. +

+ +

+Definition at line 78 of file vegetable.h.

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Density +
+
+ + + + + +
+   + + +

+Density== Number of instance to create / mē. +

+ +

+Definition at line 64 of file vegetable.h. +

+Referenced by generateGroup(), generateGroupBiLinear(), and serial().

+

+ + + + +
+ + +
uint32 NL3D::CVegetable::DistType +
+
+ + + + + +
+   + + +

+At which distance this vegetable will be rendered. NB: DistType is not managed by CVegetableManager, but by user (eg CLandscape). +

+Definition at line 82 of file vegetable.h. +

+Referenced by CVegetable(), and serial().

+

+ + + + +
+ + +
float NL3D::CVegetable::MaxDensity +
+
+ + + + + +
+   + + +

+the maximum density computed. if <0, no maximum. -1 by default. +

+ +

+Definition at line 66 of file vegetable.h. +

+Referenced by CVegetable(), generateGroup(), generateGroupBiLinear(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Rx +
+
+ + + + + +
+   + + +

+Random Orientation. +

+ +

+Definition at line 70 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Ry +
+
+ + + + + +
+   + + +

+Random Orientation. +

+ +

+Definition at line 70 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Rz +
+
+ + + + + +
+   + + +

+Random Orientation. +

+ +

+Definition at line 70 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
std::string NL3D::CVegetable::ShapeName +
+
+ + + + + +
+   + + +

+Name of the shape to use. +

+ +

+Definition at line 62 of file vegetable.h. +

+Referenced by registerToManager(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Sxy +
+
+ + + + + +
+   + + +

+Random Scale. +

+ +

+Definition at line 68 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+

+ + + + +
+ + +
NLMISC::CNoiseValue NL3D::CVegetable::Sz +
+
+ + + + + +
+   + + +

+Random Scale. +

+ +

+Definition at line 68 of file vegetable.h. +

+Referenced by CVegetable(), generateInstance(), and serial().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 08:19:28 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1