Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

TheOneTrueZandra
Copy link

@TheOneTrueZandra TheOneTrueZandra commented Oct 11, 2021

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 the Generator class. It serves the same purpose as GenTileable2D, but with a few extra parameters.

xStart/yStart, determining the offset in the same manner as GenUniformGrid2D,
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.

@TheOneTrueZandra
Copy link
Author

Of course, I made a typo, so I need to make a tweak. 🤔

Good quality PR here, folks.

Copy link
Owner

@Auburn Auburn left a 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,
Copy link
Owner

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,
Copy link
Owner

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,
Copy link
Owner

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:
Copy link
Owner

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

@Auburn Auburn closed this Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants