Giter Site home page Giter Site logo

auburn / fastnoiselite Goto Github PK

View Code? Open in Web Editor NEW
2.6K 2.6K 311.0 1.77 MB

Fast Portable Noise Library - C# C++ C Java HLSL GLSL JavaScript Rust Go

Home Page: http://auburn.github.io/FastNoiseLite/

License: MIT License

C++ 13.14% C# 10.80% HLSL 9.95% Java 11.27% C 10.18% JavaScript 13.18% GLSL 9.85% Go 8.10% Rust 13.27% CMake 0.21% PowerShell 0.06%
cellular-noise cubic-noise fractal-algorithms hacktoberfest noise noise-2d noise-3d noise-algorithms noise-generator noise-library perlin perlin-noise procedural procedural-generation shader simplex simplex-algorithm terrain-generation voronoi

fastnoiselite's People

Contributors

arash28134 avatar auburn avatar dotlogix avatar foreverzer0 avatar grind086 avatar johypark avatar kdotjpg avatar keavon avatar maggen-hub avatar mgrussell avatar mpfrancis avatar nlguillemot avatar reveriejake avatar rover656 avatar sayyoungman avatar snowfoxsh avatar valadaptive avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastnoiselite's Issues

No such thing as position warp?

I wanted to use position warp but there is no function in the code. I think the documentation meant to say gradient perturb instead of position warp. Is that right?

Weird artifacts in noise

Sorry don't know where else to ask. Can't find the solution in the Wiki.

See this screenshot:
https://i.gyazo.com/142f9f83cf4b5fe35d5c28800edc4a37.jpg
If you look closely you see weird loose artifacts all over.

Code used for generation of Noise


            _fastNoise.SetSeed((int) seed);
            _fastNoise.SetNoiseType(FastNoise.NoiseType.PerlinFractal);
            _fastNoise.SetFractalLacunarity(0.9f);
            _fastNoise.SetFractalGain(0f);
            _fastNoise.SetFractalOctaves(30);

Preview Tool Source Code

Thanks for making this great library! Is the source code for the preview tool available anywhere?

I was hoping to poke around in it to help me understand how the settings for Gradient Perturb work.

Range 0 - 1

How might I keep the ranges at 0 - 1, trying to utilize this with Marching Cubes. I didnt want to clamp the value 0 - 1 .

range of distances for cellular noise

I am updating fastnoise from eb126aa to 0cedc66 and I have noticed that the range of values returned for distance of cellular noise has changed.
It used to return non-negative values, typically in range (0 .. 1). But I see values mostly in (-1 .. 0) now.
Is this change intentional? Can you, please, comment what is the expected range now?
Thanks

Segmentation fault when using Domain Warp in multi-threaded environment.

Hi,

I want to generate a 4K noise image as quick as possible and decided to use multi-threading.
FastNoise works perfectly fine using the standard GetNoise() function in a multi-threaded environment.
But once I try calling the DomainWarp() function my program segfaults.

Is multi-threading not supported with domain warp in the C++ version?

Thanks in advance.

Long Seed

You can add 'long' seed for generate noise ?

Preview Tool 3D Up/Down button - invalid format of string

The application is crashing if clicked an Up/Down button in 3D mode. Tested on default settings (only changed 3D option).

System.FormatException: Input string was not in a correct format.
   at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.Convert.ToSingle(String value)
   at Project1.MyForm.downButton_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Generating noises on torus-shaped coordinate.

Sorry don't know where else to ask. Can't find the solution in the Wiki and search results of issues with following keywords.

  • 'loop'
  • 'repeat'
  • 'torus'

I want to a function like this issue's title.

Do someone have any idea to settable to any values with as few modifications as possible?

Although limited values(2^N*) can be configured only(, and many noise/fractal/3D functions not work),
I'm trying to implement the function written on forked repo in my repos.

  • ^ : exponent

Please give me some advise or some comments.

Compilation Issue in VS 2017

Attempts at compiling in VS 2017 lead to error C3640, stating:

Error C3640 'main::FastNoise::CalculateFractalBounding': a referenced or virtual member function of a local class must be defined [redacted]fastnoise.h 242
Error C3640 'main::FastNoise::SetSeed': a referenced or virtual member function of a local class must be defined [redacted]fastnoise.h 60

Which leads me to: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3640?view=vs-2017

A virtually useless link. Anybody have any ideas?

Documentation does not correspond with C++ header file source

Enum names do not correspond and function names do not correspond. For example, the function float GetGradientFractal(float x, float y{, float z}) as defined here does not exist in the library. I believe the direct functions don't even exist in the library (or they are private to FastNoiseLite class)

The documentation also provides information on direct simplex with 4th dimension float GetSimplex(float x, float y{, float z}{, float w}) though this is not available in the C++ library at all.

Why is this? The different function names are not a big problem but I think it is a same that the 4 dimension Simplex does not exist in this version.

PreviewApp: Initializing Value in NumericStepper causes NullReferenceException

Running the PreviewApp on Linux causes the following exception:

> dotnet run               
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Gtk.SpinButton.OutputSignalCallback(IntPtr inst, IntPtr gch)
   at GLib.ExceptionManager.RaiseUnhandledException(Exception e, Boolean is_terminal)
   at Gtk.SpinButton.OutputSignalCallback(IntPtr inst, IntPtr gch)
   at Gtk.SpinButton.set_Value(Double value)
   at Eto.GtkSharp.Forms.Controls.NumericStepperHandler.set_Value(Double value)
   at Eto.Forms.NumericStepper.set_Value(Double value)
   at FastNoiseLiteGUI..ctor() in /path/to/FastNoiseLite/PreviewApp/FastNoiseLiteGUI.cs:line 144
   at Program.Main(String[] args) in /path/to/FastNoiseLite/PreviewApp/FastNoiseLiteGUI.cs:line 17

The issue seems to be related to the assignment of the Value field for each NumericStepper. Removing the value assignment avoids the exception:

// before
PreviewWidth = new NumericStepper { Value = previewStartSize.Width, Increment = 128 };

// after
PreviewWidth = new NumericStepper { Increment = 128 };

FNL_FRACTAL_DOMAIN_WARP_INDEPENDENT

I would like to set the Domain Warp Fractal to "Domain Warp Independent".

Is this the correct way?

  fnl_state noise = fnlCreateState();
  noise.fractal_type = FNL_FRACTAL_DOMAIN_WARP_INDEPENDENT;
  noise.domain_warp_type = FNL_DOMAIN_WARP_OPENSIMPLEX2;

Thanks in advance! :)

Ability to forward declare FastNoise enum types

Hey ! First thanks for the great lean library which I intend to use without moderation :)
I just hit an issue though. For reasons related to an engine I develop, and generating reflection data around the types I use, I need to forward declares the types I'm using.
This means, I also need to forward declare the FastNoise types I'm using.

However for two reasons it is impossible to forward declare the NoiseType, FractalType, etc.. enums :

  • the underlying type is not specified
  • they are defined inside the FastNoise class, making it impossible to forward declare them

So I'm wondering if you would be willing to consider changing this ?
That would mean, defining these enums outside of the FastNoise class, probably making them scoped enums so that the names don't cause any name clashes with user code, and giving them an underlying type like unsigned int or short int or whatever you see fit.

Something like :

enum class NoiseType : unsigned int { Value, ValueFractal, Perlin, PerlinFractal, Simplex, SimplexFractal, Cellular, WhiteNoise, Cubic, CubicFractal };

class FastNoise
{
    //...

This would allow me to interface my reflection 100% with your noise library ! Cheers

Kaspersky detecting .dll of live app as a virus.

The FastNoiseLite.dll files of both releases "FastNoiseLite-1.0.1.zip" and "FastNoiseLite-1.0.2.zip" are being detected as "VHO:Trojan-Banker.MSIL.Convagent.gen" by the heuristic analysis of Kaspersky.

Here's a link to VirusTotal, it seems Kaspersky didn't detect it there: https://www.virustotal.com/gui/file/40467b29a97d2167f793a0541c1737232e5aa9eaa65d3d3332a0ec6f21abdce1/detection

Capture

I'm pretty sure it's a false positive, but it would be nice if this could be fixed to avoid future worries. Although I'm a little bit confused because a few days ago I downloaded the 1.0.1 release and I couldn't find it anymore. But as I said, the .dll of the 1.0.2 version is still being detected as a virus either way.

Thanks! =)

FastNoise C# and C++ produces a different value

When I build fast noise in c# and c++, whenever i try to get value by .GetNoise(3, 8) the return value have different value even though when i set the same seed.
Is this suppose to be normal?

Tiling Noise

The noise methods don't accept any tiling parameters and most noises aren't 4D capable so the library doesn't appear useful for generating tiling noise without distortion (toroid). Correct me if I've made a mistake/missing-something or that's not part of the library's intent.

Question: Gradient Perturbation Usage

So, I'm not sure how the GradientPerturb and GradientPerturbFractal functions work. I do want to run perturbation on my noise maps, but how do I use these for that? I'm using this in a C++ project, so code would be helpful. Just as the screenshots on the main page show is perfect (minus the colors, just using this for grayscale)

Thanks ahead of time! Awesome library

Implementation of multifractal noise

Based on my understanding of ridge/multifractal noise, the different frequencies are combined by weighing each point based on the (shifted) values at a lower frequency - I cannot see that happening in FastNoise:

https://github.com/Auburns/FastNoise/blob/faba4443efcd85ad55bf5dd85c8ee458d427d6aa/FastNoise.cpp#L579-L596

Is this my lack of understanding of the implementation, a bug, or a different interpretation of multifractal noise?

For reference, a description of multifractal noise in line with my understanding can be found here: http://chaoscultgames.com/products/CN/CoherentNoiseManual.pdf p. 25

What are the min and max values which can be returned ?

Hello,

I'm playing with noise recently, trying to create biomes, and I ended using your great library.

My only issue is I can't found what is the extrem min and max value ( like 0.0 and 1.0, by example) that the getNoise(...) function returns.

I use the c++ version.

Is it possible to know what it the min and max value we can expect ?

Bump lib version

Can you bump the lib version to cover the fixes 92c5a68 and 2fbd2b4?
I will reference this lib in a project that I'm working and would be nice to have a version number to put as dependency. Instead of commit hash number...

Possibility to generate periodic noise

It would be nice if we could generate periodic (tileable) noise. Of course it does not apply to all noises, but Perlin and Cellular noise are good canditate.

Periodic noise should also work when they are used with the fractal pertubations (FBM or other).

Since not all noise are subject to periodicity, maybe a predicate in the form:
bool CanBePeriodic(NoiseType iNoiseType) const;

and to mimic GetNoise function:

FN_DECIMAL GetPeriodicNoise(FN_DECIMAL x, FN_DECIMAL y);
FN_DECIMAL GetPeriodicNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z);

Patent Issue

You may want to replace the Simplex implementation with OpenSimplex. Simplex noise is encumbered by patents for 3D and higher-dimensional noise (but not 2D noise, curiously). OpenSimplex uses an alternative implementation that isn't covered by the patent.

There is, I should note, a claim floating around that the Simplex patent is expired in 2005. This is untrue, 2005 is the year that Simplex was first published.

Add way to change from int seed to long seed

I'm using FastNoiseLite in Java, and would like to use the same seed for both a Java Random class instance, and for FastNoiseLite. Obviously, I can convert the long to an int, and make overflows a feature, but for the sake of consistency and variety, it would be appreciated if there was a mechanism similar to that which is used for swapping floats and doubles.

*Just realized that this has been asked before, so apologies for that.

Simplex4D doesn't work anymore

Line 1350, for the constant G4 when you have done the commit about "Added compile switch to use doubles" the constant has been changed from 20 to 2.

Standalone FastNoiseLite Preview app

Is it possible to make the preview application to run in a self-contained mode without requiring to have the dotnet runtime previously installed ?

Question: Exact bounds on output?

According to the wiki, all outputs are approximately bounded from -1.0 to 1.0, except for distance functions on cellular noise. Are there any exact bounds (even larger ones) on the outputs?

Compilation warning

src/src/gen-noise.cpp||In function ‘FN_DECIMAL FastAbs(FN_DECIMAL)’:|
src/src/gen-noise.cpp|187|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp||In member function ‘void FastNoise::SetSeed(int)’:|
src/src/gen-noise.cpp|204|warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|212|warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In function ‘FN_DECIMAL ValCoord2D(int, int, int)’:|
src/src/gen-noise.cpp|281|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In function ‘FN_DECIMAL ValCoord3D(int, int, int, int)’:|
src/src/gen-noise.cpp|290|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In function ‘FN_DECIMAL ValCoord4D(int, int, int, int, int)’:|
src/src/gen-noise.cpp|300|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::GradCoord4D(unsigned char, int, int, int, int, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|326|warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleSimplex(unsigned char, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1083|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1084|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1085|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1086|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1126|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1127|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1128|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1129|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1130|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1131|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleSimplex(unsigned char, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1281|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1282|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1283|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1337|warning: conversion to ‘FN_DECIMAL {aka float}’ alters ‘double’ constant value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1338|warning: conversion to ‘FN_DECIMAL {aka float}’ alters ‘double’ constant value [-Wfloat-conversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleSimplex(unsigned char, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1348|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1349|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1350|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1351|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1352|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1385|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1386|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1387|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1388|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1389|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1390|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1391|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1392|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1393|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1394|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1395|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1396|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1712|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1713|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1714|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1738|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1739|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1740|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1764|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1765|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1766|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1795|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1795|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1795|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleCellular2Edge(FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1823|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1824|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1825|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1830|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1831|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1845|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1846|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1847|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1852|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1853|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1867|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1868|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1869|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1874|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|1875|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleCellular(FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|1935|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1936|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1956|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1957|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1977|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|1978|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2003|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2003|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp||In member function ‘FN_DECIMAL FastNoise::SingleCellular2Edge(FN_DECIMAL, FN_DECIMAL) const’:|
src/src/gen-noise.cpp|2029|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2030|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2035|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|2036|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|2047|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2048|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2053|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|2054|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|2065|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2066|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘int’ may alter its value [-Wconversion]|
src/src/gen-noise.cpp|2071|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|2072|warning: conversion to ‘FN_DECIMAL {aka float}’ from ‘double’ may alter its value [-Wfloat-conversion]|
src/src/gen-noise.cpp|186|warning: ‘int FastAbs(int)’ defined but not used [-Wunused-function]|

HLSL Domain Warp Algorithms generate error: variable 'xr' used without having been completely initialized

when using fnlDomainWarp2D(state, x, y); on any warp fractal settings, similar errors are generated from the warp fractal functions:
variable 'xr' used without having been completely initialized
variable 'yr' used without having been completely initialized

and other similar ones, depending on the warp fractal algorithm being used.

test code: (compute shader in Unity)

#pragma kernel CSMain
#include "Assets/FastNoiseLite.cginc"

RWStructuredBuffer Result;

[numthreads(64,1,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
fnl_state noiseA = fnlCreateState(1212);
fnl_state noise = fnlCreateState(1212);
noise.fractal_type = 1;
noiseA.fractal_type = 4;

float x = id.x % 256;
float y = id.x / 256;

fnlDomainWarp2D(noiseA, x, y);

float thisnoise = Remap(fnlGetNoise2D(noise,x, y), -1, 1, 0, 1);
Result[id.x] = float4(thisnoise, thisnoise, thisnoise, 1.0f);

}

(FEATURE) Add export option from preview tool

It would be nice to have a save button on the preview tool to export. Being able to specify the size would be very good as well.

The second request is a "make seamless" option. This may not be feasible but sure would be amazing.

3D noise output is zero when Y and Z are the same (Java)

So, I shimmed this into my engine after frustrations with a random noise class I was using, and after generating a small sample of noise (3d, 5x5x5 cube), I noticed that whenever Y and Z are the same value, the noise outputs 0. I'm not sure if this is by design, but it does produce very odd looking noise.

I'm using default settings with OpenSimplex2.

I'm sorry, I don't have a screenshot of visual noise output, so you will have to bear with me and my terminal output.

The code:

    for(int z = 0; z < 5 ; z++) {
            System.out.print("(");
            for(int x = 0; x < 5 ; x++) {
                System.out.print("[");
                for(int y = 0; y < 5 ; y++) {
                    System.out.print(GetNoise(x,y,z)+" ");
                }
                System.out.println("],");
            }
            System.out.println("),");
        }   

Produces:

([0.0 0.042343553 0.08451782 0.12635438 0.16768658 ],
[0.0 0.042315338 0.08446145 0.12627007 0.16757451 ],
[0.0 0.042230725 0.084292516 0.12601727 0.1672386 ],
[0.0 0.04209002 0.08401154 0.12559687 0.16668001 ],
[0.0 0.041893613 0.08361933 0.12501001 0.16590029 ],
),
([-0.042343553 0.0 0.042230725 0.08418004 0.12568088 ],
[-0.042315338 0.0 0.042202566 0.08412384 0.12559691 ],
[-0.042230725 0.0 0.042118132 0.083955415 0.12534513 ],
[-0.04209002 0.0 0.041977707 0.083675295 0.12492633 ],
[-0.041893613 0.0 0.041781712 0.08328422 0.12434182 ],
),
([-0.08451782 -0.042230725 0.0 0.04200577 0.0836193 ],
[-0.08446145 -0.042202566 0.0 0.041977707 0.08356341 ],
[-0.084292516 -0.042118132 0.0 0.041893627 0.08339582 ],
[-0.08401154 -0.041977707 0.0 0.04175375 0.08311708 ],
[-0.08361933 -0.041781697 0.0 0.041558526 0.08272798 ],
),
([-0.12635438 -0.08418004 -0.04200577 0.0 0.041670002 ],
[-0.12627007 -0.08412384 -0.041977707 0.0 0.041642107 ],
[-0.12601727 -0.083955415 -0.041893627 0.0 0.041558526 ],
[-0.12559687 -0.083675295 -0.04175375 0.0 0.041419487 ],
[-0.12501001 -0.08328422 -0.041558526 0.0 0.041225452 ],
),
([-0.16768658 -0.12568088 -0.0836193 -0.041670002 0.0 ],
[-0.16757451 -0.12559691 -0.08356341 -0.041642107 0.0 ],
[-0.1672386 -0.12534513 -0.08339582 -0.041558526 0.0 ],
[-0.16668001 -0.12492633 -0.08311708 -0.041419506 0.0 ],
[-0.16590029 -0.12434182 -0.08272798 -0.041225452 0.0 ],
),

Notice how "slices" of the noise end up as all zero? It may be confusing, since I'm looping z at the top level (for vertical "slices"), but this occurs when Y and Z are equal.

This may be more of an eyesore, but changing the loop to:

    for(int z = 0; z < 5 ; z++) {
            for(int x = 0; x < 5 ; x++) {
                for(int y = 0; y < 5 ; y++) {
                    System.out.println("x:"+x+" y:"+y+" z:"+z+" => w:"+GetNoise(x,y,z));
                }
            }
        }   

makes the issue more obvious.

Above output:

x:0 y:0 z:0 => w:0.0
x:0 y:1 z:0 => w:0.042343553
x:0 y:2 z:0 => w:0.08451782
x:0 y:3 z:0 => w:0.12635438
x:0 y:4 z:0 => w:0.16768658
x:1 y:0 z:0 => w:0.0
x:1 y:1 z:0 => w:0.042315338
x:1 y:2 z:0 => w:0.08446145
x:1 y:3 z:0 => w:0.12627007
x:1 y:4 z:0 => w:0.16757451
x:2 y:0 z:0 => w:0.0
x:2 y:1 z:0 => w:0.042230725
x:2 y:2 z:0 => w:0.084292516
x:2 y:3 z:0 => w:0.12601727
x:2 y:4 z:0 => w:0.1672386
x:3 y:0 z:0 => w:0.0
x:3 y:1 z:0 => w:0.04209002
x:3 y:2 z:0 => w:0.08401154
x:3 y:3 z:0 => w:0.12559687
x:3 y:4 z:0 => w:0.16668001
x:4 y:0 z:0 => w:0.0
x:4 y:1 z:0 => w:0.041893613
x:4 y:2 z:0 => w:0.08361933
x:4 y:3 z:0 => w:0.12501001
x:4 y:4 z:0 => w:0.16590029
x:0 y:0 z:1 => w:-0.042343553
x:0 y:1 z:1 => w:0.0
x:0 y:2 z:1 => w:0.042230725
x:0 y:3 z:1 => w:0.08418004
x:0 y:4 z:1 => w:0.12568088
x:1 y:0 z:1 => w:-0.042315338
x:1 y:1 z:1 => w:0.0
x:1 y:2 z:1 => w:0.042202566
x:1 y:3 z:1 => w:0.08412384
x:1 y:4 z:1 => w:0.12559691
x:2 y:0 z:1 => w:-0.042230725
x:2 y:1 z:1 => w:0.0
x:2 y:2 z:1 => w:0.042118132
x:2 y:3 z:1 => w:0.083955415
x:2 y:4 z:1 => w:0.12534513
x:3 y:0 z:1 => w:-0.04209002
x:3 y:1 z:1 => w:0.0
x:3 y:2 z:1 => w:0.041977707
x:3 y:3 z:1 => w:0.083675295
x:3 y:4 z:1 => w:0.12492633
x:4 y:0 z:1 => w:-0.041893613
x:4 y:1 z:1 => w:0.0
x:4 y:2 z:1 => w:0.041781712
x:4 y:3 z:1 => w:0.08328422
x:4 y:4 z:1 => w:0.12434182
x:0 y:0 z:2 => w:-0.08451782
x:0 y:1 z:2 => w:-0.042230725
x:0 y:2 z:2 => w:0.0
x:0 y:3 z:2 => w:0.04200577
x:0 y:4 z:2 => w:0.0836193
x:1 y:0 z:2 => w:-0.08446145
x:1 y:1 z:2 => w:-0.042202566
x:1 y:2 z:2 => w:0.0
x:1 y:3 z:2 => w:0.041977707
x:1 y:4 z:2 => w:0.08356341
x:2 y:0 z:2 => w:-0.084292516
x:2 y:1 z:2 => w:-0.042118132
x:2 y:2 z:2 => w:0.0
x:2 y:3 z:2 => w:0.041893627
x:2 y:4 z:2 => w:0.08339582
x:3 y:0 z:2 => w:-0.08401154
x:3 y:1 z:2 => w:-0.041977707
x:3 y:2 z:2 => w:0.0
x:3 y:3 z:2 => w:0.04175375
x:3 y:4 z:2 => w:0.08311708
x:4 y:0 z:2 => w:-0.08361933
x:4 y:1 z:2 => w:-0.041781697
x:4 y:2 z:2 => w:0.0
x:4 y:3 z:2 => w:0.041558526
x:4 y:4 z:2 => w:0.08272798
x:0 y:0 z:3 => w:-0.12635438
x:0 y:1 z:3 => w:-0.08418004
x:0 y:2 z:3 => w:-0.04200577
x:0 y:3 z:3 => w:0.0
x:0 y:4 z:3 => w:0.041670002
x:1 y:0 z:3 => w:-0.12627007
x:1 y:1 z:3 => w:-0.08412384
x:1 y:2 z:3 => w:-0.041977707
x:1 y:3 z:3 => w:0.0
x:1 y:4 z:3 => w:0.041642107
x:2 y:0 z:3 => w:-0.12601727
x:2 y:1 z:3 => w:-0.083955415
x:2 y:2 z:3 => w:-0.041893627
x:2 y:3 z:3 => w:0.0
x:2 y:4 z:3 => w:0.041558526
x:3 y:0 z:3 => w:-0.12559687
x:3 y:1 z:3 => w:-0.083675295
x:3 y:2 z:3 => w:-0.04175375
x:3 y:3 z:3 => w:0.0
x:3 y:4 z:3 => w:0.041419487
x:4 y:0 z:3 => w:-0.12501001
x:4 y:1 z:3 => w:-0.08328422
x:4 y:2 z:3 => w:-0.041558526
x:4 y:3 z:3 => w:0.0
x:4 y:4 z:3 => w:0.041225452
x:0 y:0 z:4 => w:-0.16768658
x:0 y:1 z:4 => w:-0.12568088
x:0 y:2 z:4 => w:-0.0836193
x:0 y:3 z:4 => w:-0.041670002
x:0 y:4 z:4 => w:0.0
x:1 y:0 z:4 => w:-0.16757451
x:1 y:1 z:4 => w:-0.12559691
x:1 y:2 z:4 => w:-0.08356341
x:1 y:3 z:4 => w:-0.041642107
x:1 y:4 z:4 => w:0.0
x:2 y:0 z:4 => w:-0.1672386
x:2 y:1 z:4 => w:-0.12534513
x:2 y:2 z:4 => w:-0.08339582
x:2 y:3 z:4 => w:-0.041558526
x:2 y:4 z:4 => w:0.0
x:3 y:0 z:4 => w:-0.16668001
x:3 y:1 z:4 => w:-0.12492633
x:3 y:2 z:4 => w:-0.08311708
x:3 y:3 z:4 => w:-0.041419506
x:3 y:4 z:4 => w:0.0
x:4 y:0 z:4 => w:-0.16590029
x:4 y:1 z:4 => w:-0.12434182
x:4 y:2 z:4 => w:-0.08272798
x:4 y:3 z:4 => w:-0.041225452
x:4 y:4 z:4 => w:0.0

C version assumes a C++ compiler

Some C++ idioms are used in the C version, such as use of bool as type, "true" and "false" as values, the default argument value of fnlCreateState. Fixing those allows compiling with gcc -std=c99.

Compilation warning

clang++ $(pkg-config --cflags sdl2) -Wall -Wextra -march=native -gdwarf-3 -D_GLIBCXX_DEBUG -g -O0 -I.coddle/libs_src -c .coddle/libs_src/fastnoise/FastNoise.cpp -o .coddle/libs_artifacts/fastnoise/FastNoise.cpp.o
.coddle/libs_src/fastnoise/FastNoise.cpp:186:12: warning: unused function 'FastAbs'
      [-Wunused-function]
static int FastAbs(int i) { return abs(i); }
           ^
1 warning generated.

All of the noise types give the same result

I am using the Java version, and after testing it and taking screenshots I noticed that every type of noise gives the same values regardless of what type it is. Seed is -211950573

HLSL file Compilation error

Hi,
I find some compilation errors in hlsl version when using fnlDomainWarp3D(state, x, y, z).
The declaration of the function _fnlSingleDomainWarpBasicGrid3D and _fnlSingleDomainWarpOpenSimplex2Gradient doesn't match the implement. The argument modifier of 'zp' and 'zr' should be 'inout'

The switch statements in function _fnlTransformDomainWarpCoordinate3D(state, x, y, z) missing 'break;' in the default statement.

m_cellularNoiseLookup ownership

FastNoise has a member m_cellularNoiseLookup which is initially a null pointer, and can be set with SetCellularNoiseLookup. The problem is that FastNoise has a destructor defined as follows:

~FastNoise() { delete m_cellularNoiseLookup; }

This leads to a few API design bugs:

  • If you make a copy of a FastNoise object with a cellular noise lookup, it'll call delete twice on the same pointer. This will likely crash the program.
  • If you call SetCellularNoiseLookup twice, it'll leak the memory passed to the first call.
  • Pointer to a FastNoise object allocated on the stack will cause a crash (since it wasn't allocated with new).
  • The user may not expect that FastNoise will delete their pointer, and the user might delete it a second time themselves by accident.

I have recommend two alternative designs to suggest to solve this problem:

Design 1: Use a smart pointer

Change the type of m_cellularNoiseLookup to std::unique_ptr<FastNoise> or std::shared_ptr<FastNoise>. This will solve all the problems with double-deletion and memory leaks, but will effectively force users to allocate the FastNoise object on the heap. It is not idiomatic to create a smart pointer that points to an object on the stack, so users will probably avoid it.

Changes required:

  • Include <memory>
  • Remove the line ~FastNoise() { delete m_cellularNoiseLookup; }
  • Remove the line void SetCellularNoiseLookup(FastNoise* noise) { m_cellularNoiseLookup = noise; }
  • Add the line void SetCellularNoiseLookup(std::unique_ptr<FastNoise> noise) { m_cellularNoiseLookup = move(noise); }
  • Remove the line FastNoise* GetCellularNoiseLookup() const { return m_cellularNoiseLookup; }
  • Add the line FastNoise* GetCellularNoiseLookup() const { return m_cellularNoiseLookup.get(); }

Design 2: Use a non-owning pointer

To implement this design, simply remove the destructor.

This makes the FastNoise object not have ownership of the lifetime of its cellular noise lookup member, so it becomes the API user's responsibility to ensure that the pointer is valid throughout its usage.

I think this would be the simpler solution. It would allow users to pass in a pointer to a stack object. It would also allow FastNoise objects to be copied while retaining the same reference to cellular noise lookup. However, it would break existing code that assumes that FastNoise will automatically delete its cellular noise member.

Improved 4D Simplex Noise

Not actually usable yet, jumped the gun. Visually the noise output is pretty bad, needs a bit of re-adjusting
4d
Looks like I forgot to check y0 against w0

I found a way to improve the speed of the 4D Simplex Noise function by removing the lookup table and replacing it with "ranked counters" as used here, which I happened across when reading through the Simplex noise demystified pdf. From my rather basic tests this does have a noticeable speed increase, around 3ns per value faster.

I've committed the changes to my personal fork here, and if you want to compare the two speed wise you can use this commit which has the two function as GetSimplex and GetSimplexRanked.

Declaration error in myNoise object

Hello people !
I wanted to ask you a question because i have a problem while i'm getting started with
the plug in FastNoise in C++.
I am a beginner so sorry if the issue is simple ^^'
The problem is when i ask to my program
myNoise.SetNoiseType(FastNoise::SymplexFractal);
the error say "This declaration has no storage class or type specified.
Here is my code :

`#include "FastNoise.h"
#include
using namespace std;
FastNoise myNoise; // Create a FastNoise object
myNoise.SetNoiseType(FastNoise::SymplexFractal);
int main() {
float heightMap[32][32];

for (int x = 0; x < 32; x++)
{
	for (int y = 0; y < 32; y++)
	{
		heightMap[x][y] = myNoise.GetNoise(x, y);
	}
}

}`
Thanks for helping i will search on my side ! :)

[0x80004005 - unknown error] 'internal error: no storage type for block output"

hi,
came across this while writing a compute shader on Unity. After extensive testing the error only occurs when using FastNoiseLite.
Initialisation of noise and settings variables with values works, like this:

fnl_state noise = fnlCreateState(1337);
noise.noise_type = 2;
noise.frequency = 0.02f;
noise.fractal_type = 2;
etc etc

no problem, but using variables to set the parameters causes the error, like this:

float myseed = 1212;
float myfrequency = 0.02f;
int mynoisetype = 1;
int myrotationtype = 1;
int myfractaltype = 2;
float mygain = 0.5f;

fnl_state noise = fnlCreateState(myseed);
noise.frequency = myfrequency;
noise.noise_type = mynoisetype;
noise.rotation_type_3d = myrotationtype;
noise.fractal_type = myfractaltype;
noise.gain = mygain;

In reality, im sending the variable paremeters from CPU side, which in Unity is SetFloat("mygain", 0.5f), which generally works fine, but when setting parameters like this and one of them is fractal_type, throws the error. if fractal_type is set with a definate value the error doesnt occur eg: noise.fractal_type = 2;
I originally thought this was an error in Unity in the way it was handling variables, but i wrote something using variables in a similar way, not using the FastNoiseLite HLSL library and i couldnt replicate the error, so im guessing theres something in the library in the way it is utilising gpu memory that is throwing the error, but this really isnt my area, so im only guessing.
I want to be able to send the values for noise parameters from CPU side into the compute shader, so this is really limiting the way i can use it.
many thanks

Fix Previewer GitHub Release download for macOS

It was not possible to find any compatible framework version
The framework 'Microsoft.WindowsDesktop.App', version '3.1.0' was not found.
  - No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=3.1.0&arch=x64&rid=osx.10.15-x64

WinForms is only available on windows (note that .NET 6 will have a cross-platform GUI)

Incorrect class initialization

Dear author.
For successful assemble our code with different compilers, you should do class member initialization inside in the class constructor, or use: class_ini() call. Presently, code have "indian style".

.\Source\Noise_Generator\FastNoise.cpp
".\Source\Noise_Generator\FastNoise.h", line 220: cc0321: error: data member
initializer is not allowed
int m_seed = 1337;
^

".\Source\Noise_Generator\FastNoise.h", line 221: cc0321: error: data member
initializer is not allowed
FN_DECIMAL m_frequency = FN_DECIMAL(0.01);
^

".\Source\Noise_Generator\FastNoise.h", line 222: cc0321: error: data member
initializer is not allowed
Interp m_interp = Quintic;
^

".\Source\Noise_Generator\FastNoise.h", line 223: cc0321: error: data member
initializer is not allowed
NoiseType m_noiseType = Simplex;
^

".\Source\Noise_Generator\FastNoise.h", line 225: cc0321: error: data member
initializer is not allowed
int m_octaves = 3;
^

".\Source\Noise_Generator\FastNoise.h", line 226: cc0321: error: data member
initializer is not allowed
FN_DECIMAL m_lacunarity = FN_DECIMAL(2);
^

".\Source\Noise_Generator\FastNoise.h", line 227: cc0321: error: data member
initializer is not allowed
FN_DECIMAL m_gain = FN_DECIMAL(0.5);
^

".\Source\Noise_Generator\FastNoise.h", line 228: cc0321: error: data member
initializer is not allowed
FractalType m_fractalType = FBM;
^

".\Source\Noise_Generator\FastNoise.h", line 231: cc0321: error: data member
initializer is not allowed
CellularDistanceFunction m_cellularDistanceFunction = Euclidean;
^

".\Source\Noise_Generator\FastNoise.h", line 232: cc0321: error: data member
initializer is not allowed
CellularReturnType m_cellularReturnType = CellValue;
^

".\Source\Noise_Generator\FastNoise.h", line 233: cc0321: error: data member
initializer is not allowed
FastNoise* m_cellularNoiseLookup = nullptr;
^

".\Source\Noise_Generator\FastNoise.h", line 234: cc0321: error: data member
initializer is not allowed
int m_cellularDistanceIndex0 = 0;
^

".\Source\Noise_Generator\FastNoise.h", line 235: cc0321: error: data member
initializer is not allowed
int m_cellularDistanceIndex1 = 1;
^

".\Source\Noise_Generator\FastNoise.h", line 236: cc0321: error: data member
initializer is not allowed
FN_DECIMAL m_cellularJitter = FN_DECIMAL(0.45);
^

".\Source\Noise_Generator\FastNoise.h", line 238: cc0321: error: data member
initializer is not allowed
FN_DECIMAL m_gradientPerturbAmp = FN_DECIMAL(1);
^

15 errors detected in the compilation of ".\Source\Noise_Generator\FastNoise.cpp".
Compilation terminated.
cc3089: fatal error: Compilation failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.

‘zs’ may be used uninitialized in this function

warning: ‘zs’ may be used uninitialized in this function [-Wmaybe-uninitialized]

note: ‘zs’ was declared here
FN_DECIMAL xs, ys, zs;

FN_DECIMAL FastNoise::SingleValue(unsigned char offset, FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z) const
{
    int x0 = FastFloor(x);
    int y0 = FastFloor(y);
    int z0 = FastFloor(z);
    int x1 = x0 + 1;
    int y1 = y0 + 1;
    int z1 = z0 + 1;

    FN_DECIMAL xs, ys, zs; // <-- THIS LINE GIVES WARNING
    switch (m_interp) // BECAUSE THIS SWITCH HAS NO DEFAULT
    {
    case Linear:
        xs = x - (FN_DECIMAL)x0;
        ys = y - (FN_DECIMAL)y0;
        zs = z - (FN_DECIMAL)z0;
        break;
    case Hermite:
        xs = InterpHermiteFunc(x - (FN_DECIMAL)x0);
        ys = InterpHermiteFunc(y - (FN_DECIMAL)y0);
        zs = InterpHermiteFunc(z - (FN_DECIMAL)z0);
        break;
    case Quintic:
        xs = InterpQuinticFunc(x - (FN_DECIMAL)x0);
        ys = InterpQuinticFunc(y - (FN_DECIMAL)y0);
        zs = InterpQuinticFunc(z - (FN_DECIMAL)z0);
        break;
    }

    FN_DECIMAL xf00 = Lerp(ValCoord3DFast(offset, x0, y0, z0), ValCoord3DFast(offset, x1, y0, z0), xs);
    FN_DECIMAL xf10 = Lerp(ValCoord3DFast(offset, x0, y1, z0), ValCoord3DFast(offset, x1, y1, z0), xs);
    FN_DECIMAL xf01 = Lerp(ValCoord3DFast(offset, x0, y0, z1), ValCoord3DFast(offset, x1, y0, z1), xs);
    FN_DECIMAL xf11 = Lerp(ValCoord3DFast(offset, x0, y1, z1), ValCoord3DFast(offset, x1, y1, z1), xs);

    FN_DECIMAL yf0 = Lerp(xf00, xf10, ys);
    FN_DECIMAL yf1 = Lerp(xf01, xf11, ys);

    return Lerp(yf0, yf1, zs);
}

dereferencing type-punned pointer will break strict-aliasing rules

In member function ‘FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL, FN_DECIMAL, FN_DECIMAL, FN_DECIMAL) const’:

warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
reinterpret_cast<int>(&y) ^ (reinterpret_cast<int>(&y) >> 16),

Faulty code:

FN_DECIMAL FastNoise::GetWhiteNoise(FN_DECIMAL x, FN_DECIMAL y, FN_DECIMAL z, FN_DECIMAL w) const
{
	return ValCoord4D(m_seed,
		*reinterpret_cast<int*>(&x) ^ (*reinterpret_cast<int*>(&x) >> 16),
		*reinterpret_cast<int*>(&y) ^ (*reinterpret_cast<int*>(&y) >> 16),
		*reinterpret_cast<int*>(&z) ^ (*reinterpret_cast<int*>(&z) >> 16),
		*reinterpret_cast<int*>(&w) ^ (*reinterpret_cast<int*>(&w) >> 16));
}

Care to explain why are you messing around with pointers in a function that could do perfectly well without them?

Also noticed you're using tabs instead of spaces. Please consider switching to spaces.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.