|
| 1 | +#pragma once |
| 2 | +#include "Generator.h" |
| 3 | + |
| 4 | +namespace FastNoise |
| 5 | +{ |
| 6 | + class Constant : public virtual Generator |
| 7 | + { |
| 8 | + public: |
| 9 | + void SetValue( float value ) { mValue = value; } |
| 10 | + |
| 11 | + protected: |
| 12 | + float mValue = 1.0f; |
| 13 | + |
| 14 | + FASTNOISE_METADATA( Generator ) |
| 15 | + |
| 16 | + Metadata( const char* className ) : Generator::Metadata( className ) |
| 17 | + { |
| 18 | + this->AddVariable( "Value", 1.0f, &Constant::SetValue ); |
| 19 | + } |
| 20 | + |
| 21 | + }; |
| 22 | + }; |
| 23 | + |
| 24 | + class PositionOutput : public virtual Generator |
| 25 | + { |
| 26 | + public: |
| 27 | + void SetX( float multiplier, float offset = 0.0f ) { mMultiplierX = multiplier; mOffsetX = offset; } |
| 28 | + void SetY( float multiplier, float offset = 0.0f ) { mMultiplierY = multiplier; mOffsetY = offset; } |
| 29 | + void SetZ( float multiplier, float offset = 0.0f ) { mMultiplierZ = multiplier; mOffsetZ = offset; } |
| 30 | + void SetW( float multiplier, float offset = 0.0f ) { mMultiplierW = multiplier; mOffsetW = offset; } |
| 31 | + |
| 32 | + protected: |
| 33 | + float mMultiplierX = 0.0f; |
| 34 | + float mOffsetX = 0.0f; |
| 35 | + |
| 36 | + float mMultiplierY = 0.0f; |
| 37 | + float mOffsetY = 0.0f; |
| 38 | + |
| 39 | + float mMultiplierZ = 0.0f; |
| 40 | + float mOffsetZ = 0.0f; |
| 41 | + |
| 42 | + float mMultiplierW = 0.0f; |
| 43 | + float mOffsetW = 0.0f; |
| 44 | + |
| 45 | + FASTNOISE_METADATA( Generator ) |
| 46 | + |
| 47 | + Metadata( const char* className ) : Generator::Metadata( className ) |
| 48 | + { |
| 49 | + this->AddVariable( "X Multiplier", 0.0f, []( PositionOutput* p, float f ) { p->mMultiplierX = f; } ); |
| 50 | + this->AddVariable( "X Offset", 0.0f, []( PositionOutput* p, float f ) { p->mOffsetX = f; } ); |
| 51 | + this->AddVariable( "Y Multiplier", 0.0f, []( PositionOutput* p, float f ) { p->mMultiplierY = f; } ); |
| 52 | + this->AddVariable( "Y Offset", 0.0f, []( PositionOutput* p, float f ) { p->mOffsetY = f; } ); |
| 53 | + this->AddVariable( "Z Multiplier", 0.0f, []( PositionOutput* p, float f ) { p->mMultiplierZ = f; } ); |
| 54 | + this->AddVariable( "Z Offset", 0.0f, []( PositionOutput* p, float f ) { p->mOffsetZ = f; } ); |
| 55 | + this->AddVariable( "W Multiplier", 0.0f, []( PositionOutput* p, float f ) { p->mMultiplierW = f; } ); |
| 56 | + this->AddVariable( "W Offset", 0.0f, []( PositionOutput* p, float f ) { p->mOffsetW = f; } ); |
| 57 | + } |
| 58 | + }; |
| 59 | + }; |
| 60 | +} |
0 commit comments