#include <noise_value.h>
Nevrax France
Definition at line 49 of file noise_value.h.
Public Member Functions | |
CNoiseValue (float abs, float rand, float freq) | |
CNoiseValue () | |
Default to 0, 1, 1. | |
float | eval (const CVector &posInWorld) const |
float | evalOneLevelRandom (const CVector &posInWorld) const |
void | serial (IStream &f) |
Data Fields | |
float | Abs |
float | Frequency |
float | Rand |
Private Member Functions | |
float | evalRandom (const CVector &pos) const |
float | noise (const CVector &pos) const |
pos scale is in [0..1] |
|
Default to 0, 1, 1.
Definition at line 258 of file noise_value.cpp.
|
|
Definition at line 267 of file noise_value.cpp.
|
|
return Abs + Rand* noise(Pos*Frequency). with noise() E [0..1]. Warning! Use OptFastFloor()! So call must be enclosed with a OptFastFloorBegin()/OptFastFloorEnd(). Definition at line 276 of file noise_value.cpp. References noise(). Referenced by NLMISC::CNoiseColorGradient::eval(), NL3D::CVegetable::generateGroup(), NL3D::CVegetable::generateGroupBiLinear(), and NL3D::CVegetable::generateInstance().
|
|
same as eval, but eval just one random level for noise() => act much more like a random. Warning! Use OptFastFloor()! So call must be enclosed with a OptFastFloorBegin()/OptFastFloorEnd(). Definition at line 285 of file noise_value.cpp. References evalRandom(). Referenced by NL3D::CVegetable::generateGroupBiLinear(), and NL3D::CVegetable::generateGroupEx().
00286 { 00287 // A single cube in the Grid3d correspond to Frequency==1. 00288 // So enlarging size of the grid3d do not affect the frequency aspect. 00289 return Abs + Rand * evalRandom(posInWorld*Frequency); 00290 } |
|
Definition at line 216 of file noise_value.cpp. Referenced by evalOneLevelRandom().
00217 {
00218 return CRandomGrid3D::evalNearest(pos);
00219 }
|
|
pos scale is in [0..1]
Definition at line 223 of file noise_value.cpp. References level, NL3D_NOISE_LEVEL, and uint. Referenced by eval().
00224 { 00225 // eval "fractaly". 00226 float turb; 00227 00228 #if (NL3D_NOISE_LEVEL != 3) 00229 CVector vd= pos; 00230 turb=0; 00231 for(uint level=0;level<NL3D_NOISE_LEVEL;level++) 00232 { 00233 // Add the influence of the ith level. 00234 turb+= CRandomGrid3D::getLevelSize(level) * 00235 CRandomGrid3D::evalBiLinear(vd + CRandomGrid3D::getLevelPhase(level) ); 00236 // Next level at higher frequency 00237 vd*= 2; 00238 } 00239 #else 00240 // special case. unrolled loop. 00241 // level 0 has no phase. 00242 turb= CRandomGrid3D::getLevelSize(0) * 00243 CRandomGrid3D::evalBiLinear(pos); 00244 // level 1 00245 turb+= CRandomGrid3D::getLevelSize(1) * 00246 CRandomGrid3D::evalBiLinear(pos*2 + CRandomGrid3D::getLevelPhase(1) ); 00247 // level 2 00248 turb+= CRandomGrid3D::getLevelSize(2) * 00249 CRandomGrid3D::evalBiLinear(pos*4 + CRandomGrid3D::getLevelPhase(2) ); 00250 #endif 00251 00252 return turb; 00253 } |
|
Definition at line 294 of file noise_value.cpp. References NLMISC::IStream::serial(), and NLMISC::IStream::serialVersion().
00295 {
00296 (void)f.serialVersion(0);
00297 f.serial(Abs);
00298 f.serial(Rand);
00299 f.serial(Frequency);
00300 }
|
|
Definition at line 52 of file noise_value.h. Referenced by NL3D::CVegetable::CVegetable(), and NL3D::CVegetable::generateInstance(). |
|
Definition at line 54 of file noise_value.h. |
|
Definition at line 53 of file noise_value.h. Referenced by NL3D::CVegetable::CVegetable(), and NL3D::CVegetable::generateInstance(). |