-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Repeat version of Tileable2D function that accepts custom repeat interval. #72
Conversation
Of course, I made a typo, so I need to make a tweak. 🤔 Good quality PR here, folks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing!
There are a few small changes then I'll merge it
int xSize, int ySize, float frequency, int seed ) const = 0; | ||
int xSize, int ySize, float frequency, int seed ) const = 0; | ||
|
||
virtual FastNoise::OutputMinMax GenTileable2DRepeat(float* noiseOut, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to GenTileable2DRange
virtual FastNoise::OutputMinMax GenTileable2DRepeat(float* noiseOut, | ||
int xStart, int yStart, | ||
int xSize, int ySize, | ||
float xRepeat, float yRepeat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x/yRepeat should be ints and rename to x/yPeriod
@@ -114,7 +114,13 @@ namespace FastNoise | |||
float frequency, int seed ) const = 0; | |||
|
|||
virtual OutputMinMax GenTileable2D( float* out, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this call GenTileable2DRange to avoid code duplication
@@ -1189,6 +1189,12 @@ FastNoise::OutputMinMax FastNoiseNodeEditor::GenerateNodePreviewNoise( FastNoise | |||
Node::NoiseSize, Node::NoiseSize, | |||
mNodeFrequency, mNodeSeed ); | |||
|
|||
case NoiseTexture::GenType_2DTiledRepeat: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave out the NoiseTool preview option, it doesn't have much purpose and is not configurable anyway
I mostly wanted to use this myself for personal projects, but decided to throw it in a PR.
I've added the function
GenTileable2DRepeat
to theGenerator
class. It serves the same purpose asGenTileable2D
, but with a few extra parameters.xStart
/yStart
, determining the offset in the same manner asGenUniformGrid2D
,and
xRepeat
/yRepeat
, which determine how long large the Tileable area is.This allows users to make a large repeating noise period, and sample only parts of it, rather than
GenTileable2D
's behavior, which only tiles as large as the dataset it's generating for.I've made sure this compiles and runs at least on Windows, I've added it to the C file, and I've added an option for it in the texture view mode.