#include <noisef.h>
Inheritance diagram for NoiseFractalFill:
Public Member Functions | |
NoiseFractalFill () | |
A noise based fill. Really simply defined as the projection of a 3d noise function onto a surface. For documentation, see Docs Spec v1,2 and 3 .doc. | |
BOOL | DoFill (double scale, UINT32 seed, KernelBitmap *pBitmap) const |
A noise based fill. Really simply defined as the projection of a 3d noise function on a torus of given swept radius and tube radius.A noise based fill. This version uses 2d noise built from an array of random numbers which are spline interpolated and wrapped at the edges. This is dirtier and quicker than the 3d version and is less succeptable to warping yet still manages to tile. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (NoiseFractalFill) |
Definition at line 114 of file noisef.h.
|
A noise based fill. Really simply defined as the projection of a 3d noise function onto a surface. For documentation, see Docs Spec v1,2 and 3 .doc. NoiseFractalFill::NoiseFractalFill()
Definition at line 123 of file noisef.cpp.
|
|
|
|
A noise based fill. Really simply defined as the projection of a 3d noise function on a torus of given swept radius and tube radius.A noise based fill. This version uses 2d noise built from an array of random numbers which are spline interpolated and wrapped at the edges. This is dirtier and quicker than the 3d version and is less succeptable to warping yet still manages to tile.
Definition at line 272 of file noisef.cpp. 00275 { 00276 double ustep,vstep,ustart,vstart; 00277 double n; 00278 Vector3D p; 00279 BYTE cn; 00280 BitmapInfo Info; 00281 INT32 Width,Height,i,j; 00282 00283 // go get the noise manager 00284 NoiseMan* pNoiseMan = GetApplication()->GetNoiseManager(); 00285 if (pNoiseMan==NULL) 00286 return FALSE; 00287 00288 // set the random number generator. 00289 pNoiseMan->SEEDTABLE(seed); 00290 00291 pBitmap->ActualBitmap->GetInfo(&Info); 00292 00293 Width = Info.PixelWidth; 00294 Height = Info.PixelHeight; 00295 00296 ustep = 1.0/(double)Width; 00297 vstep = 1.0/(double)Height; 00298 vstart = vstep/2.0; 00299 00300 p.z = 0.0; 00301 for (j=0; j<Height; j++) 00302 { 00303 p.y = vstart; 00304 ustart = ustep/2.0; 00305 for (i=0; i<Width; i++) 00306 { 00307 p.x = ustart; 00308 // find the noise value at this position 00309 n = pNoiseMan->NOISE1D(p, scale); 00310 // turn this into a grey scale 00311 cn = (BYTE)(n*255.0+0.5); 00312 // and place it in the bitmap 00313 pBitmap->PlotPixel(i,j,cn); 00314 ustart += ustep; 00315 } 00316 vstart += vstep; 00317 } 00318 00319 /* double ng2 = ustep/2.0; 00320 double ng1 = 1.0 - ng2; 00321 00322 double n0,n1; 00323 double t; 00324 00325 vstart = vstep + vstep/2.0; 00326 for (j=1; j<Height-1; j++) 00327 { 00328 p.y = vstart; 00329 p.x = ng1; 00330 n0 = pNoiseMan->NOISE1D(p); 00331 p.x = ng2; 00332 n1 = pNoiseMan->NOISE1D(p); 00333 00334 t = 1.0/3.0; 00335 n = n0 + t*(n1-n0); 00336 cn = (BYTE)(n*255.0+0.5); 00337 pBitmap->PlotPixel(Width-1,j,cn); 00338 00339 t = 2.0/3.0; 00340 n = n0 + t*(n1-n0); 00341 cn = (BYTE)(n*255.0+0.5); 00342 pBitmap->PlotPixel(0,j,cn); 00343 00344 vstart += vstep; 00345 } 00346 */ 00347 return TRUE; 00348 }
|