Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Helpers.Computative.Algorithms.CellNoise Class Reference
Inheritance diagram for pluginbase.Helpers.Computative.Algorithms.CellNoise:
pluginbase.Helpers.Computative.ValuePoint3D

Public Member Functions

 CellNoise (int seed, float lambda, float scale, CellNoiseDistance distanceFunc, CellNoiseCombination cominationFunc)
 
 CellNoise (int seed, float lambda, float scale)
 
override unsafe float GetValue (int x, int y)
 Get a value at a given x,y coordinate More...
 
override float GetValue (int x, int y, int z)
 Get number from 0-1 More...
 
- Public Member Functions inherited from pluginbase.Helpers.Computative.ValuePoint3D
ValuePoint3D Mix (ValuePoint3D with, float sourceOpacity)
 Mix this value with another one at a certain ratio More...
 
ValuePoint3D Lighten (ValuePoint3D with)
 Lighten this value by another one More...
 
ValuePoint3D Darken (ValuePoint3D with)
 Darken this value by another one More...
 
ValuePoint3D CustomCombine (ValuePoint3D with, Combiner3D.CombinerOperator func)
 Combine two values using a custom combiner More...
 
ValuePoint3D CustomManipulator (Manip3D.ManipOperator func)
 Manipulate this value with a custom manipulator More...
 
ValuePoint3D Abs ()
 Absolute value More...
 
ValuePoint3D Invert ()
 Invert the value from a 0-1 range More...
 
ValuePoint3D Brightness (float amount)
 Adjust brightness. Takes in -1 to 1f More...
 
ValuePoint3D Contrast (float amount)
 Adjusts contract from -1 to 1 More...
 
ValuePoint3D Scale (float factor)
 Scale the specified factor and clamp More...
 
ValuePoint3D LinearBounds (float min, float max)
 Linearly interpolates to squish between the bounds More...
 
ValuePoint3D Threshold (float threshold)
 Threshold the specified threshold. Returns 0 if below, otherwise 1f More...
 
ValuePoint3D Gamma (float gamma)
 Gamma the specified gamma. Range 0f - 2f More...
 
ValuePoint3D Clamp ()
 Clamp this value between 0 and 1 More...
 
ValuePoint3D Clamp (float min, float max)
 Clamp this value between a min and max More...
 

Additional Inherited Members

- Static Public Member Functions inherited from pluginbase.Helpers.Computative.ValuePoint3D
static ValuePoint3D operator+ (ValuePoint3D a, ValuePoint3D b)
 Add two value points together More...
 
static ValuePoint3D operator- (ValuePoint3D a, ValuePoint3D b)
 Subtract two value points More...
 
static ValuePoint3D operator* (ValuePoint3D a, ValuePoint3D b)
 Multiply two value points More...
 
static ValuePoint3D operator/ (ValuePoint3D a, ValuePoint3D b)
 Divide one value by another More...
 

Constructor & Destructor Documentation

pluginbase.Helpers.Computative.Algorithms.CellNoise.CellNoise ( int  seed,
float  lambda,
float  scale,
CellNoiseDistance  distanceFunc,
CellNoiseCombination  cominationFunc 
)
30  {
31  _seed = seed;
32  _lambda = (float) SysMath.Exp(-lambda);
33  _scale = scale;
34  _combinationFunc = cominationFunc;
35  _distanceFunc = distanceFunc;
36  _random = new PseudoRandom(seed);
37  switch (_combinationFunc)
38  {
39  default:
40  case CellNoiseCombination.D1:
41  _distSize = 1;
42  break;
43  case CellNoiseCombination.D2D1:
44  _distSize = 2;
45  break;
46  case CellNoiseCombination.D3D1:
47  _distSize = 3;
48  break;
49  }
50  }
CellNoiseCombination
Definition: CellNoise.cs:14
A basic implementation of a random number generator
Definition: PseudoRandom.cs:7
pluginbase.Helpers.Computative.Algorithms.CellNoise.CellNoise ( int  seed,
float  lambda,
float  scale 
)
52 : this(seed, lambda, scale, CellNoiseDistance.Euclidian, CellNoiseCombination.D1) { }
CellNoiseDistance
Definition: CellNoise.cs:7
CellNoiseCombination
Definition: CellNoise.cs:14

Member Function Documentation

override unsafe float pluginbase.Helpers.Computative.Algorithms.CellNoise.GetValue ( int  x,
int  y 
)
virtual

Get a value at a given x,y coordinate

Returns
The value.
Parameters
xThe x coordinate.
yThe y coordinate.

Attribute: _distSize

;

Attribute: 0

= float.MaxValue;

Attribute: 1

= float.MaxValue;

Attribute: 2

= float.MaxValue;

Attribute: 0

);

Attribute: 1]) - SysMath.Sqrt(dist[0

));

Attribute: 2]) - SysMath.Sqrt(dist[0

));

Implements pluginbase.Helpers.Computative.ValuePoint3D.

55  {
56  float xF = x / _scale;
57  float yF = y / _scale;
58 
59  int squareX = MExt.FloorInt(xF);
60  int squareY = MExt.FloorInt(yF);
61 
62  float* dist = stackalloc float[_distSize];
63  dist[0] = float.MaxValue;
64  if (_distSize > 1)
65  dist[1] = float.MaxValue;
66  if (_distSize > 2)
67  dist[2] = float.MaxValue;
68 
69  for (int i = -1; i < 2; i++)
70  {
71  for (int j = -1; j < 2; j++)
72  {
73  GetDistancesForSquare(dist, squareX + i, squareY + j, xF, yF);
74  }
75  }
76 
77  float ret;
78 
79  switch (_combinationFunc)
80  {
81  default:
82  case CellNoiseCombination.D1:
83  ret = (float)SysMath.Sqrt(dist[0]);
84  break;
85  case CellNoiseCombination.D2D1:
86  ret = (float)(SysMath.Sqrt(dist[1]) - SysMath.Sqrt(dist[0]));
87  break;
88  case CellNoiseCombination.D3D1:
89  ret = (float)(SysMath.Sqrt(dist[2]) - SysMath.Sqrt(dist[0]));
90  break;
91  }
92  return MExt.Clamp(ret, 0f, 1f);
93  }
CellNoiseCombination
Definition: CellNoise.cs:14
override float pluginbase.Helpers.Computative.Algorithms.CellNoise.GetValue ( int  x,
int  y,
int  z 
)
virtual

Get number from 0-1

Parameters
xA System.Int32
yA System.Int32
zA System.Int32
Returns
A System.Single

Implements pluginbase.Helpers.Computative.ValuePoint3D.

96  {
97  return 0f; //Unsupported
98  }

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