├── .gitignore
├── DiskSampling
├── DiskSampling.vcxproj
├── DiskSampling.vcxproj.filters
├── PoissonDiskSampling.cpp
└── PoissonDiskSampling.h
├── LICENSE
├── Libraries
├── Noise
│ ├── include
│ │ └── Noise
│ │ │ ├── basictypes.h
│ │ │ ├── exception.h
│ │ │ ├── interp.h
│ │ │ ├── latlon.h
│ │ │ ├── mathconsts.h
│ │ │ ├── misc.h
│ │ │ ├── model
│ │ │ ├── cylinder.h
│ │ │ ├── line.h
│ │ │ ├── model.h
│ │ │ ├── plane.h
│ │ │ └── sphere.h
│ │ │ ├── module
│ │ │ ├── abs.h
│ │ │ ├── add.h
│ │ │ ├── billow.h
│ │ │ ├── blend.h
│ │ │ ├── cache.h
│ │ │ ├── checkerboard.h
│ │ │ ├── clamp.h
│ │ │ ├── const.h
│ │ │ ├── curve.h
│ │ │ ├── cylinders.h
│ │ │ ├── displace.h
│ │ │ ├── exponent.h
│ │ │ ├── invert.h
│ │ │ ├── max.h
│ │ │ ├── min.h
│ │ │ ├── module.h
│ │ │ ├── modulebase.h
│ │ │ ├── multiply.h
│ │ │ ├── perlin.h
│ │ │ ├── power.h
│ │ │ ├── ridgedmulti.h
│ │ │ ├── rotatepoint.h
│ │ │ ├── scalebias.h
│ │ │ ├── scalepoint.h
│ │ │ ├── select.h
│ │ │ ├── spheres.h
│ │ │ ├── terrace.h
│ │ │ ├── translatepoint.h
│ │ │ ├── turbulence.h
│ │ │ └── voronoi.h
│ │ │ ├── noise.h
│ │ │ ├── noisegen.h
│ │ │ └── vectortable.h
│ └── lib
│ │ ├── libnoise.dll
│ │ └── libnoise.lib
├── PoissionDiskSampling
│ ├── include
│ │ └── PoissonDiskSampling
│ │ │ └── PoissonDiskSampling.h
│ └── lib
│ │ └── DiskSampling.lib
├── PolygonalMapGenerator
│ ├── include
│ │ └── PolygonalMapGenerator
│ │ │ ├── ConvexHull.h
│ │ │ ├── DelaunayTriangulation.h
│ │ │ ├── Map.h
│ │ │ ├── Math
│ │ │ ├── LineEquation.h
│ │ │ └── Vector2.h
│ │ │ ├── QuadTree.h
│ │ │ └── Structure.h
│ └── lib
│ │ └── PolyMapGenerator.lib
└── SFML
│ ├── bin
│ ├── openal32.dll
│ ├── sfml-audio-2.dll
│ ├── sfml-audio-d-2.dll
│ ├── sfml-graphics-2.dll
│ ├── sfml-graphics-d-2.dll
│ ├── sfml-network-2.dll
│ ├── sfml-network-d-2.dll
│ ├── sfml-system-2.dll
│ ├── sfml-system-d-2.dll
│ ├── sfml-window-2.dll
│ └── sfml-window-d-2.dll
│ ├── include
│ └── SFML
│ │ ├── Audio.hpp
│ │ ├── Audio
│ │ ├── AlResource.hpp
│ │ ├── Export.hpp
│ │ ├── InputSoundFile.hpp
│ │ ├── Listener.hpp
│ │ ├── Music.hpp
│ │ ├── OutputSoundFile.hpp
│ │ ├── Sound.hpp
│ │ ├── SoundBuffer.hpp
│ │ ├── SoundBufferRecorder.hpp
│ │ ├── SoundFileFactory.hpp
│ │ ├── SoundFileFactory.inl
│ │ ├── SoundFileReader.hpp
│ │ ├── SoundFileWriter.hpp
│ │ ├── SoundRecorder.hpp
│ │ ├── SoundSource.hpp
│ │ └── SoundStream.hpp
│ │ ├── Config.hpp
│ │ ├── Graphics.hpp
│ │ ├── Graphics
│ │ ├── BlendMode.hpp
│ │ ├── CircleShape.hpp
│ │ ├── Color.hpp
│ │ ├── ConvexShape.hpp
│ │ ├── Drawable.hpp
│ │ ├── Export.hpp
│ │ ├── Font.hpp
│ │ ├── Glyph.hpp
│ │ ├── Image.hpp
│ │ ├── PrimitiveType.hpp
│ │ ├── Rect.hpp
│ │ ├── Rect.inl
│ │ ├── RectangleShape.hpp
│ │ ├── RenderStates.hpp
│ │ ├── RenderTarget.hpp
│ │ ├── RenderTexture.hpp
│ │ ├── RenderWindow.hpp
│ │ ├── Shader.hpp
│ │ ├── Shape.hpp
│ │ ├── Sprite.hpp
│ │ ├── Text.hpp
│ │ ├── Texture.hpp
│ │ ├── Transform.hpp
│ │ ├── Transformable.hpp
│ │ ├── Vertex.hpp
│ │ ├── VertexArray.hpp
│ │ └── View.hpp
│ │ ├── Main.hpp
│ │ ├── Network.hpp
│ │ ├── Network
│ │ ├── Export.hpp
│ │ ├── Ftp.hpp
│ │ ├── Http.hpp
│ │ ├── IpAddress.hpp
│ │ ├── Packet.hpp
│ │ ├── Socket.hpp
│ │ ├── SocketHandle.hpp
│ │ ├── SocketSelector.hpp
│ │ ├── TcpListener.hpp
│ │ ├── TcpSocket.hpp
│ │ └── UdpSocket.hpp
│ │ ├── OpenGL.hpp
│ │ ├── System.hpp
│ │ ├── System
│ │ ├── Clock.hpp
│ │ ├── Err.hpp
│ │ ├── Export.hpp
│ │ ├── FileInputStream.hpp
│ │ ├── InputStream.hpp
│ │ ├── Lock.hpp
│ │ ├── MemoryInputStream.hpp
│ │ ├── Mutex.hpp
│ │ ├── NonCopyable.hpp
│ │ ├── Sleep.hpp
│ │ ├── String.hpp
│ │ ├── String.inl
│ │ ├── Thread.hpp
│ │ ├── Thread.inl
│ │ ├── ThreadLocal.hpp
│ │ ├── ThreadLocalPtr.hpp
│ │ ├── ThreadLocalPtr.inl
│ │ ├── Time.hpp
│ │ ├── Utf.hpp
│ │ ├── Utf.inl
│ │ ├── Vector2.hpp
│ │ ├── Vector2.inl
│ │ ├── Vector3.hpp
│ │ └── Vector3.inl
│ │ ├── Window.hpp
│ │ └── Window
│ │ ├── Context.hpp
│ │ ├── ContextSettings.hpp
│ │ ├── Event.hpp
│ │ ├── Export.hpp
│ │ ├── GlResource.hpp
│ │ ├── Joystick.hpp
│ │ ├── Keyboard.hpp
│ │ ├── Mouse.hpp
│ │ ├── Sensor.hpp
│ │ ├── Touch.hpp
│ │ ├── VideoMode.hpp
│ │ ├── Window.hpp
│ │ ├── WindowHandle.hpp
│ │ └── WindowStyle.hpp
│ ├── lib
│ ├── flac.lib
│ ├── freetype.lib
│ ├── jpeg.lib
│ ├── ogg.lib
│ ├── openal32.lib
│ ├── sfml-audio-d.lib
│ ├── sfml-audio-s-d.lib
│ ├── sfml-audio-s.lib
│ ├── sfml-audio.lib
│ ├── sfml-graphics-d.lib
│ ├── sfml-graphics-s-d.lib
│ ├── sfml-graphics-s.lib
│ ├── sfml-graphics.lib
│ ├── sfml-main-d.lib
│ ├── sfml-main.lib
│ ├── sfml-network-d.lib
│ ├── sfml-network-s-d.lib
│ ├── sfml-network-s.lib
│ ├── sfml-network.lib
│ ├── sfml-system-d.lib
│ ├── sfml-system-s-d.lib
│ ├── sfml-system-s.lib
│ ├── sfml-system.lib
│ ├── sfml-window-d.lib
│ ├── sfml-window-s-d.lib
│ ├── sfml-window-s.lib
│ ├── sfml-window.lib
│ ├── vorbis.lib
│ ├── vorbisenc.lib
│ └── vorbisfile.lib
│ ├── license.txt
│ └── readme.txt
├── PolyMapGenerator.sln
├── PolyMapGenerator
├── ConvexHull.h
├── DelaunayTriangulation.cpp
├── DelaunayTriangulation.h
├── Map.cpp
├── Map.h
├── Math
│ ├── LineEquation.cpp
│ ├── LineEquation.h
│ ├── Vector2.cpp
│ └── Vector2.h
├── PolyMapGenerator.vcxproj
├── PolyMapGenerator.vcxproj.filters
├── QuadTree.h
├── Structure.cpp
└── Structure.h
├── PolyMapGeneratorTest
├── MapTest.cpp
├── PolyMapGeneratorTest.vcxproj
└── PolyMapGeneratorTest.vcxproj.filters
├── README.md
└── Screenshots
├── Biome - Version 1.jpg
├── Elevation - Version 1.jpg
└── Moisture - Version 1.jpg
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 | # NuGet v3's project.json files produces more ignoreable files
154 | *.nuget.props
155 | *.nuget.targets
156 |
157 | # Microsoft Azure Build Output
158 | csx/
159 | *.build.csdef
160 |
161 | # Microsoft Azure Emulator
162 | ecf/
163 | rcf/
164 |
165 | # Microsoft Azure ApplicationInsights config file
166 | ApplicationInsights.config
167 |
168 | # Windows Store app package directory
169 | AppPackages/
170 | BundleArtifacts/
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # RIA/Silverlight projects
190 | Generated_Code/
191 |
192 | # Backup & report files from converting an old project file
193 | # to a newer Visual Studio version. Backup files are not needed,
194 | # because we have git ;-)
195 | _UpgradeReport_Files/
196 | Backup*/
197 | UpgradeLog*.XML
198 | UpgradeLog*.htm
199 |
200 | # SQL Server files
201 | *.mdf
202 | *.ldf
203 |
204 | # Business Intelligence projects
205 | *.rdl.data
206 | *.bim.layout
207 | *.bim_*.settings
208 |
209 | # Microsoft Fakes
210 | FakesAssemblies/
211 |
212 | # GhostDoc plugin setting file
213 | *.GhostDoc.xml
214 |
215 | # Node.js Tools for Visual Studio
216 | .ntvs_analysis.dat
217 |
218 | # Visual Studio 6 build log
219 | *.plg
220 |
221 | # Visual Studio 6 workspace options file
222 | *.opt
223 |
224 | # Visual Studio LightSwitch build output
225 | **/*.HTMLClient/GeneratedArtifacts
226 | **/*.DesktopClient/GeneratedArtifacts
227 | **/*.DesktopClient/ModelManifest.xml
228 | **/*.Server/GeneratedArtifacts
229 | **/*.Server/ModelManifest.xml
230 | _Pvt_Extensions
231 |
232 | # Paket dependency manager
233 | .paket/paket.exe
234 |
235 | # FAKE - F# Make
236 | .fake/
237 |
--------------------------------------------------------------------------------
/DiskSampling/DiskSampling.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 |
23 |
24 | Source Files
25 |
26 |
27 |
--------------------------------------------------------------------------------
/DiskSampling/PoissonDiskSampling.cpp:
--------------------------------------------------------------------------------
1 | #include "PoissonDiskSampling.h"
2 |
3 | #include
4 | #include
5 |
6 | PoissonDiskSampling::PoissonDiskSampling(int pointWidth, int pointHeight, double pointMinDist, double pointCount) :
7 | m_width(pointWidth),
8 | m_height(pointHeight),
9 | m_minDist(pointMinDist),
10 | m_pointCount(static_cast(pointCount)),
11 | m_cellSize(m_minDist / 1.414214),
12 | m_gridWidth(static_cast(ceil(m_width / m_cellSize))),
13 | m_gridHeight(static_cast(ceil(m_height / m_cellSize)))
14 | {
15 | m_grid = std::vector>(m_gridWidth, std::vector(m_gridHeight, nullptr));
16 | }
17 |
18 | std::vector> PoissonDiskSampling::Generate()
19 | {
20 | std::random_device rd;
21 | std::mt19937 gen(rd());
22 |
23 | Point firstPoint(gen() % m_width, gen() % m_height);
24 |
25 | m_process.push_back(firstPoint);
26 | m_sample.push_back(std::make_pair(firstPoint.x, firstPoint.y));
27 | int firstPointX = static_cast(firstPoint.x / m_cellSize);
28 | int firstPointY = static_cast(firstPoint.y / m_cellSize);
29 | m_grid[firstPointX][firstPointY] = new Point(firstPoint);
30 |
31 | while (!m_process.empty())
32 | {
33 | int newPointIndex = gen() % m_process.size();
34 | Point newPoint = m_process[newPointIndex];
35 | m_process.erase(m_process.begin() + newPointIndex);
36 |
37 | for (int i = 0; i < m_pointCount; ++i)
38 | {
39 | Point newPointAround = GeneratePointAround(newPoint);
40 |
41 | if (IsInRectangle(newPointAround) && !IsInNeighbourhood(newPointAround))
42 | {
43 | m_process.push_back(newPointAround);
44 | m_sample.push_back(std::make_pair(newPointAround.x, newPointAround.y));
45 | int newPointX = static_cast(newPointAround.x / m_cellSize);
46 | int newPointY = static_cast(newPointAround.y / m_cellSize);
47 | m_grid[newPointX][newPointY] = new Point(newPointAround);
48 | }
49 | }
50 | }
51 |
52 | return m_sample;
53 | }
54 |
55 | PoissonDiskSampling::Point PoissonDiskSampling::GeneratePointAround(Point p) const
56 | {
57 | std::random_device rd;
58 | std::mt19937 gen(rd());
59 |
60 | double r1 = static_cast(gen()) / gen.max();
61 | double r2 = static_cast(gen()) / gen.max();
62 |
63 | double radius = m_minDist * (r1 + 1);
64 |
65 | double angle = 2 * 3.14159265 * r2;
66 |
67 | double newX = p.x + radius * cos(angle);
68 | double newY = p.y + radius * sin(angle);
69 |
70 | return Point(newX, newY);
71 | }
72 |
73 | bool PoissonDiskSampling::IsInRectangle(Point p) const
74 | {
75 | return (p.x >= 0 && p.y >= 0 && p.x < m_width && p.y < m_height);
76 | }
77 |
78 | bool PoissonDiskSampling::IsInNeighbourhood(Point p)
79 | {
80 | std::vector cells = GetCellsAround(p);
81 | int size = cells.size();
82 | for (int i = 0; i < size; ++i)
83 | {
84 | if (cells[i]->Distance(p) < m_minDist)
85 | {
86 | return true;
87 | }
88 | }
89 |
90 | return false;
91 | }
92 |
93 | std::vector PoissonDiskSampling::GetCellsAround(Point p)
94 | {
95 | std::vector cells;
96 |
97 | int indexX = static_cast(p.x / m_cellSize);
98 | int indexY = static_cast(p.y / m_cellSize);
99 |
100 | int minX = std::max(0, indexX - 1);
101 | int maxX = std::min(m_gridWidth - 1, indexX + 1);
102 |
103 | int minY = std::max(0, indexY - 1);
104 | int maxY = std::min(m_gridHeight - 1, indexY + 1);
105 |
106 | for (int i = minX; i <= maxX; ++i)
107 | {
108 | for (int j = minY; j <= maxY; ++j)
109 | {
110 | if (m_grid[i][j] != nullptr)
111 | {
112 | cells.push_back(m_grid[i][j]);
113 | }
114 | }
115 | }
116 |
117 | return cells;
118 | }
119 |
--------------------------------------------------------------------------------
/DiskSampling/PoissonDiskSampling.h:
--------------------------------------------------------------------------------
1 | #ifndef POISSON_DISK_SAMPLING_H
2 | #define POISSON_DISK_SAMPLING_H
3 |
4 | #include
5 |
6 | class PoissonDiskSampling
7 | {
8 | public:
9 | PoissonDiskSampling() = default;
10 | PoissonDiskSampling(int pointWidth, int pointHeight, double pointMinDist, double pointCount);
11 |
12 | ~PoissonDiskSampling() = default;
13 |
14 | PoissonDiskSampling(const PoissonDiskSampling& pds) = delete;
15 | PoissonDiskSampling(PoissonDiskSampling&& pds) = delete;
16 |
17 | PoissonDiskSampling& operator=(const PoissonDiskSampling& rhs) = delete;
18 | PoissonDiskSampling& operator=(PoissonDiskSampling&& rhs) = delete;
19 |
20 | std::vector> Generate();
21 |
22 | struct Point
23 | {
24 | Point() : x(0.0), y(0.0) { }
25 | Point(double _x, double _y) : x(_x), y(_y) { }
26 |
27 | ~Point() = default;
28 |
29 | Point(const Point& p) : x(p.x), y(p.y) { }
30 | Point(Point&& p) : x(p.x), y(p.y) { }
31 |
32 | Point& operator=(const Point& rhs)
33 | {
34 | if (this == &rhs)
35 | {
36 | return *this;
37 | }
38 |
39 | x = rhs.x;
40 | y = rhs.y;
41 |
42 | return *this;
43 | }
44 | Point& operator=(Point&& rhs)
45 | {
46 | if (this == &rhs)
47 | {
48 | return *this;
49 | }
50 |
51 | x = rhs.x;
52 | y = rhs.y;
53 |
54 | return *this;
55 | }
56 |
57 | int GetGridIndex(double cellSize, int mapWidth) const
58 | {
59 | int indexX = static_cast(x / cellSize);
60 | int indexY = static_cast(y / cellSize);
61 |
62 | return indexX + indexY * mapWidth;
63 | }
64 |
65 | double Distance(Point p) const
66 | {
67 | return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
68 | }
69 |
70 | double x, y;
71 | };
72 |
73 | private:
74 | std::vector> m_grid;
75 | std::vector m_process;
76 | std::vector> m_sample;
77 |
78 | int m_width;
79 | int m_height;
80 | double m_minDist;
81 | int m_pointCount;
82 | double m_cellSize;
83 | int m_gridWidth;
84 | int m_gridHeight;
85 |
86 | Point GeneratePointAround(Point p) const;
87 | bool IsInRectangle(Point p) const;
88 | bool IsInNeighbourhood(Point p);
89 | std::vector GetCellsAround(Point p);
90 | };
91 |
92 | #endif
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Chris Ohk
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/basictypes.h:
--------------------------------------------------------------------------------
1 | // basictypes.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_BASICTYPES_H
24 | #define NOISE_BASICTYPES_H
25 |
26 | // You may need to modify these constants for your compiler or platform.
27 |
28 | namespace noise
29 | {
30 |
31 | /// @defgroup libnoise libnoise
32 | /// @addtogroup libnoise
33 | /// @{
34 |
35 | /// Unsigned integer type.
36 | typedef unsigned int uint;
37 |
38 | /// 32-bit unsigned integer type.
39 | typedef unsigned int uint32;
40 |
41 | /// 16-bit unsigned integer type.
42 | typedef unsigned short uint16;
43 |
44 | /// 8-bit unsigned integer type.
45 | typedef unsigned char uint8;
46 |
47 | /// 32-bit signed integer type.
48 | typedef int int32;
49 |
50 | /// 16-bit signed integer type.
51 | typedef short int16;
52 |
53 | /// 8-bit signed integer type.
54 | typedef char int8;
55 |
56 | /// @}
57 |
58 | }
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/exception.h:
--------------------------------------------------------------------------------
1 | // exception.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_EXCEPTION_H
24 | #define NOISE_EXCEPTION_H
25 |
26 | namespace noise
27 | {
28 |
29 | /// @addtogroup libnoise
30 | /// @{
31 |
32 | /// Abstract base class for libnoise exceptions
33 | class Exception
34 | {
35 | };
36 |
37 | /// Invalid parameter exception
38 | ///
39 | /// An invalid parameter was passed to a libnoise function or method.
40 | class ExceptionInvalidParam: public Exception
41 | {
42 | };
43 |
44 | /// No module exception
45 | ///
46 | /// Could not retrieve a source module from a noise module.
47 | ///
48 | /// @note If one or more required source modules were not connected to a
49 | /// specific noise module, and its GetValue() method was called, that
50 | /// method will raise a debug assertion instead of this exception. This
51 | /// is done for performance reasons.
52 | class ExceptionNoModule: public Exception
53 | {
54 | };
55 |
56 | /// Out of memory exception
57 | ///
58 | /// There was not enough memory to perform an action.
59 | class ExceptionOutOfMemory: public Exception
60 | {
61 | };
62 |
63 | /// Unknown exception
64 | ///
65 | /// libnoise raised an unknown exception.
66 | class ExceptionUnknown: public Exception
67 | {
68 | };
69 |
70 | /// @}
71 |
72 | }
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/interp.h:
--------------------------------------------------------------------------------
1 | // interp.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_INTERP_H
24 | #define NOISE_INTERP_H
25 |
26 | namespace noise
27 | {
28 |
29 | /// @addtogroup libnoise
30 | /// @{
31 |
32 | /// Performs cubic interpolation between two values bound between two other
33 | /// values.
34 | ///
35 | /// @param n0 The value before the first value.
36 | /// @param n1 The first value.
37 | /// @param n2 The second value.
38 | /// @param n3 The value after the second value.
39 | /// @param a The alpha value.
40 | ///
41 | /// @returns The interpolated value.
42 | ///
43 | /// The alpha value should range from 0.0 to 1.0. If the alpha value is
44 | /// 0.0, this function returns @a n1. If the alpha value is 1.0, this
45 | /// function returns @a n2.
46 | inline double CubicInterp (double n0, double n1, double n2, double n3,
47 | double a)
48 | {
49 | double p = (n3 - n2) - (n0 - n1);
50 | double q = (n0 - n1) - p;
51 | double r = n2 - n0;
52 | double s = n1;
53 | return p * a * a * a + q * a * a + r * a + s;
54 | }
55 |
56 | /// Performs linear interpolation between two values.
57 | ///
58 | /// @param n0 The first value.
59 | /// @param n1 The second value.
60 | /// @param a The alpha value.
61 | ///
62 | /// @returns The interpolated value.
63 | ///
64 | /// The alpha value should range from 0.0 to 1.0. If the alpha value is
65 | /// 0.0, this function returns @a n0. If the alpha value is 1.0, this
66 | /// function returns @a n1.
67 | inline double LinearInterp (double n0, double n1, double a)
68 | {
69 | return ((1.0 - a) * n0) + (a * n1);
70 | }
71 |
72 | /// Maps a value onto a cubic S-curve.
73 | ///
74 | /// @param a The value to map onto a cubic S-curve.
75 | ///
76 | /// @returns The mapped value.
77 | ///
78 | /// @a a should range from 0.0 to 1.0.
79 | ///
80 | /// The derivitive of a cubic S-curve is zero at @a a = 0.0 and @a a =
81 | /// 1.0
82 | inline double SCurve3 (double a)
83 | {
84 | return (a * a * (3.0 - 2.0 * a));
85 | }
86 |
87 | /// Maps a value onto a quintic S-curve.
88 | ///
89 | /// @param a The value to map onto a quintic S-curve.
90 | ///
91 | /// @returns The mapped value.
92 | ///
93 | /// @a a should range from 0.0 to 1.0.
94 | ///
95 | /// The first derivitive of a quintic S-curve is zero at @a a = 0.0 and
96 | /// @a a = 1.0
97 | ///
98 | /// The second derivitive of a quintic S-curve is zero at @a a = 0.0 and
99 | /// @a a = 1.0
100 | inline double SCurve5 (double a)
101 | {
102 | double a3 = a * a * a;
103 | double a4 = a3 * a;
104 | double a5 = a4 * a;
105 | return (6.0 * a5) - (15.0 * a4) + (10.0 * a3);
106 | }
107 |
108 | // @}
109 |
110 | }
111 |
112 | #endif
113 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/latlon.h:
--------------------------------------------------------------------------------
1 | // latlon.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_LATLON_H
24 | #define NOISE_LATLON_H
25 |
26 | #include
27 | #include "mathconsts.h"
28 |
29 | namespace noise
30 | {
31 |
32 | /// @addtogroup libnoise
33 | /// @{
34 |
35 | /// Converts latitude/longitude coordinates on a unit sphere into 3D
36 | /// Cartesian coordinates.
37 | ///
38 | /// @param lat The latitude, in degrees.
39 | /// @param lon The longitude, in degrees.
40 | /// @param x On exit, this parameter contains the @a x coordinate.
41 | /// @param y On exit, this parameter contains the @a y coordinate.
42 | /// @param z On exit, this parameter contains the @a z coordinate.
43 | ///
44 | /// @pre lat must range from @b -90 to @b +90.
45 | /// @pre lon must range from @b -180 to @b +180.
46 | void LatLonToXYZ (double lat, double lon, double& x, double& y, double& z);
47 |
48 | /// @}
49 |
50 | }
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/mathconsts.h:
--------------------------------------------------------------------------------
1 | // mathconsts.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MATHCONSTS_H
24 | #define NOISE_MATHCONSTS_H
25 |
26 | // For whatever reason, I can't find the basic math consts in the MSVC version
27 | // of math.h.
28 |
29 | namespace noise
30 | {
31 |
32 | /// @addtogroup libnoise
33 | /// @{
34 |
35 | /// Pi.
36 | const double PI = 3.1415926535897932385;
37 |
38 | /// Square root of 2.
39 | const double SQRT_2 = 1.4142135623730950488;
40 |
41 | /// Square root of 3.
42 | const double SQRT_3 = 1.7320508075688772935;
43 |
44 | /// Converts an angle from degrees to radians.
45 | const double DEG_TO_RAD = PI / 180.0;
46 |
47 | /// Converts an angle from radians to degrees.
48 | const double RAD_TO_DEG = 1.0 / DEG_TO_RAD;
49 |
50 | /// @}
51 |
52 | }
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/misc.h:
--------------------------------------------------------------------------------
1 | // misc.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MISC_H
24 | #define NOISE_MISC_H
25 |
26 | namespace noise
27 | {
28 |
29 | /// Clamps a value onto a clamping range.
30 | ///
31 | /// @param value The value to clamp.
32 | /// @param lowerBound The lower bound of the clamping range.
33 | /// @param upperBound The upper bound of the clamping range.
34 | ///
35 | /// @returns
36 | /// - @a value if @a value lies between @a lowerBound and @a upperBound.
37 | /// - @a lowerBound if @a value is less than @a lowerBound.
38 | /// - @a upperBound if @a value is greater than @a upperBound.
39 | ///
40 | /// This function does not modify any parameters.
41 | inline int ClampValue (int value, int lowerBound, int upperBound)
42 | {
43 | if (value < lowerBound) {
44 | return lowerBound;
45 | } else if (value > upperBound) {
46 | return upperBound;
47 | } else {
48 | return value;
49 | }
50 | }
51 |
52 | /// @addtogroup libnoise
53 | /// @{
54 |
55 | /// Returns the maximum of two values.
56 | ///
57 | /// @param a The first value.
58 | /// @param b The second value.
59 | ///
60 | /// @returns The maximum of the two values.
61 | template
62 | T GetMax (const T& a, const T& b)
63 | {
64 | return (a > b? a: b);
65 | }
66 |
67 | /// Returns the minimum of two values.
68 | ///
69 | /// @param a The first value.
70 | /// @param b The second value.
71 | ///
72 | /// @returns The minimum of the two values.
73 | template
74 | T GetMin (const T& a, const T& b)
75 | {
76 | return (a < b? a: b);
77 | }
78 |
79 | /// Swaps two values.
80 | ///
81 | /// @param a A variable containing the first value.
82 | /// @param b A variable containing the second value.
83 | ///
84 | /// @post The values within the the two variables are swapped.
85 | template
86 | void SwapValues (T& a, T& b)
87 | {
88 | T c = a;
89 | a = b;
90 | b = c;
91 | }
92 |
93 | /// @}
94 |
95 | }
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/model/cylinder.h:
--------------------------------------------------------------------------------
1 | // cylinder.h
2 | //
3 | // Copyright 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODEL_CYLINDER_H
24 | #define NOISE_MODEL_CYLINDER_H
25 |
26 | #include
27 | #include
28 | #include
29 | #include "../module/modulebase.h"
30 |
31 | namespace noise
32 | {
33 |
34 | namespace model
35 | {
36 |
37 | /// @addtogroup libnoise
38 | /// @{
39 |
40 | /// @defgroup models Models
41 | /// @addtogroup models
42 | /// @{
43 |
44 | /// Model that defines the surface of a cylinder.
45 | ///
46 | /// @image html modelcylinder.png
47 | ///
48 | /// This model returns an output value from a noise module given the
49 | /// coordinates of an input value located on the surface of a cylinder.
50 | ///
51 | /// To generate an output value, pass the (angle, height) coordinates of
52 | /// an input value to the GetValue() method.
53 | ///
54 | /// This model is useful for creating:
55 | /// - seamless textures that can be mapped onto a cylinder
56 | ///
57 | /// This cylinder has a radius of 1.0 unit and has infinite height. It is
58 | /// oriented along the @a y axis. Its center is located at the origin.
59 | class Cylinder
60 | {
61 |
62 | public:
63 |
64 | /// Constructor.
65 | Cylinder ();
66 |
67 | /// Constructor
68 | ///
69 | /// @param module The noise module that is used to generate the output
70 | /// values.
71 | Cylinder (const module::Module& module);
72 |
73 | /// Returns the noise module that is used to generate the output
74 | /// values.
75 | ///
76 | /// @returns A reference to the noise module.
77 | ///
78 | /// @pre A noise module was passed to the SetModule() method.
79 | const module::Module& GetModule () const
80 | {
81 | assert (m_pModule != NULL);
82 | return *m_pModule;
83 | }
84 |
85 | /// Returns the output value from the noise module given the
86 | /// (angle, height) coordinates of the specified input value located
87 | /// on the surface of the cylinder.
88 | ///
89 | /// @param angle The angle around the cylinder's center, in degrees.
90 | /// @param height The height along the @a y axis.
91 | ///
92 | /// @returns The output value from the noise module.
93 | ///
94 | /// @pre A noise module was passed to the SetModule() method.
95 | ///
96 | /// This output value is generated by the noise module passed to the
97 | /// SetModule() method.
98 | ///
99 | /// This cylinder has a radius of 1.0 unit and has infinite height.
100 | /// It is oriented along the @a y axis. Its center is located at the
101 | /// origin.
102 | double GetValue (double angle, double height) const;
103 |
104 | /// Sets the noise module that is used to generate the output values.
105 | ///
106 | /// @param module The noise module that is used to generate the output
107 | /// values.
108 | ///
109 | /// This noise module must exist for the lifetime of this object,
110 | /// until you pass a new noise module to this method.
111 | void SetModule (const module::Module& module)
112 | {
113 | m_pModule = &module;
114 | }
115 |
116 | private:
117 |
118 | /// A pointer to the noise module used to generate the output values.
119 | const module::Module* m_pModule;
120 |
121 | };
122 |
123 | /// @}
124 |
125 | /// @}
126 |
127 | }
128 |
129 | }
130 |
131 | #endif
132 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/model/model.h:
--------------------------------------------------------------------------------
1 | // model.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODEL_H
24 | #define NOISE_MODEL_H
25 |
26 | #include "cylinder.h"
27 | #include "line.h"
28 | #include "plane.h"
29 | #include "sphere.h"
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/model/plane.h:
--------------------------------------------------------------------------------
1 | // plane.h
2 | //
3 | // Copyright (C) 2004 Owen Jacobson
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is ojacobson@lionsanctuary.net
20 | //
21 |
22 | #ifndef NOISE_MODEL_PLANE_H
23 | #define NOISE_MODEL_PLANE_H
24 |
25 | #include
26 | #include "../module/modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace model
32 | {
33 | /// @addtogroup libnoise
34 | /// @{
35 |
36 | /// @addtogroup models
37 | /// @{
38 |
39 | /// Model that defines the surface of a plane.
40 | ///
41 | /// This model returns an output value from a noise module given the
42 | /// coordinates of an input value located on the surface of an ( @a x,
43 | /// @a z ) plane.
44 | ///
45 | /// To generate an output value, pass the ( @a x, @a z ) coordinates of
46 | /// an input value to the GetValue() method.
47 | ///
48 | /// This model is useful for creating:
49 | /// - two-dimensional textures
50 | /// - terrain height maps for local areas
51 | ///
52 | /// This plane extends infinitely in both directions.
53 | class Plane
54 | {
55 |
56 | public:
57 |
58 | /// Constructor.
59 | Plane ();
60 |
61 | /// Constructor
62 | ///
63 | /// @param module The noise module that is used to generate the output
64 | /// values.
65 | Plane (const module::Module& module);
66 |
67 | /// Returns the noise module that is used to generate the output
68 | /// values.
69 | ///
70 | /// @returns A reference to the noise module.
71 | ///
72 | /// @pre A noise module was passed to the SetModule() method.
73 | const module::Module& GetModule () const
74 | {
75 | assert (m_pModule != NULL);
76 | return *m_pModule;
77 | }
78 |
79 | /// Returns the output value from the noise module given the
80 | /// ( @a x, @a z ) coordinates of the specified input value located
81 | /// on the surface of the plane.
82 | ///
83 | /// @param x The @a x coordinate of the input value.
84 | /// @param z The @a z coordinate of the input value.
85 | ///
86 | /// @returns The output value from the noise module.
87 | ///
88 | /// @pre A noise module was passed to the SetModule() method.
89 | ///
90 | /// This output value is generated by the noise module passed to the
91 | /// SetModule() method.
92 | double GetValue (double x, double z) const;
93 |
94 | /// Sets the noise module that is used to generate the output values.
95 | ///
96 | /// @param module The noise module that is used to generate the output
97 | /// values.
98 | ///
99 | /// This noise module must exist for the lifetime of this object,
100 | /// until you pass a new noise module to this method.
101 | void SetModule (const module::Module& module)
102 | {
103 | m_pModule = &module;
104 | }
105 |
106 | private:
107 |
108 | /// A pointer to the noise module used to generate the output values.
109 | const module::Module* m_pModule;
110 |
111 | };
112 |
113 | /// @}
114 |
115 | /// @}
116 |
117 | }
118 |
119 | }
120 |
121 | #endif
122 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/model/sphere.h:
--------------------------------------------------------------------------------
1 | // sphere.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODEL_SPHERE_H
24 | #define NOISE_MODEL_SPHERE_H
25 |
26 | #include
27 | #include "../module/modulebase.h"
28 |
29 | namespace noise
30 | {
31 |
32 | namespace model
33 | {
34 |
35 | /// @addtogroup libnoise
36 | /// @{
37 |
38 | /// @addtogroup models
39 | /// @{
40 |
41 | /// Model that defines the surface of a sphere.
42 | ///
43 | /// @image html modelsphere.png
44 | ///
45 | /// This model returns an output value from a noise module given the
46 | /// coordinates of an input value located on the surface of a sphere.
47 | ///
48 | /// To generate an output value, pass the (latitude, longitude)
49 | /// coordinates of an input value to the GetValue() method.
50 | ///
51 | /// This model is useful for creating:
52 | /// - seamless textures that can be mapped onto a sphere
53 | /// - terrain height maps for entire planets
54 | ///
55 | /// This sphere has a radius of 1.0 unit and its center is located at
56 | /// the origin.
57 | class Sphere
58 | {
59 |
60 | public:
61 |
62 | /// Constructor.
63 | Sphere ();
64 |
65 | /// Constructor
66 | ///
67 | /// @param module The noise module that is used to generate the output
68 | /// values.
69 | Sphere (const module::Module& module);
70 |
71 | /// Returns the noise module that is used to generate the output
72 | /// values.
73 | ///
74 | /// @returns A reference to the noise module.
75 | ///
76 | /// @pre A noise module was passed to the SetModule() method.
77 | const module::Module& GetModule () const
78 | {
79 | assert (m_pModule != NULL);
80 | return *m_pModule;
81 | }
82 |
83 | /// Returns the output value from the noise module given the
84 | /// (latitude, longitude) coordinates of the specified input value
85 | /// located on the surface of the sphere.
86 | ///
87 | /// @param lat The latitude of the input value, in degrees.
88 | /// @param lon The longitude of the input value, in degrees.
89 | ///
90 | /// @returns The output value from the noise module.
91 | ///
92 | /// @pre A noise module was passed to the SetModule() method.
93 | ///
94 | /// This output value is generated by the noise module passed to the
95 | /// SetModule() method.
96 | ///
97 | /// Use a negative latitude if the input value is located on the
98 | /// southern hemisphere.
99 | ///
100 | /// Use a negative longitude if the input value is located on the
101 | /// western hemisphere.
102 | double GetValue (double lat, double lon) const;
103 |
104 | /// Sets the noise module that is used to generate the output values.
105 | ///
106 | /// @param module The noise module that is used to generate the output
107 | /// values.
108 | ///
109 | /// This noise module must exist for the lifetime of this object,
110 | /// until you pass a new noise module to this method.
111 | void SetModule (const module::Module& module)
112 | {
113 | m_pModule = &module;
114 | }
115 |
116 | private:
117 |
118 | /// A pointer to the noise module used to generate the output values.
119 | const module::Module* m_pModule;
120 |
121 | };
122 |
123 | /// @}
124 |
125 | /// @}
126 |
127 | }
128 |
129 | }
130 |
131 | #endif
132 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/abs.h:
--------------------------------------------------------------------------------
1 | // abs.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_ABS_H
24 | #define NOISE_MODULE_ABS_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module {
32 |
33 | /// @addtogroup libnoise
34 | /// @{
35 |
36 | /// @addtogroup modules
37 | /// @{
38 |
39 | /// @defgroup modifiermodules Modifier Modules
40 | /// @addtogroup modifiermodules
41 | /// @{
42 |
43 | /// Noise module that outputs the absolute value of the output value from
44 | /// a source module.
45 | ///
46 | /// @image html moduleabs.png
47 | ///
48 | /// This noise module requires one source module.
49 | class Abs: public Module
50 | {
51 |
52 | public:
53 |
54 | /// Constructor.
55 | Abs ();
56 |
57 | virtual int GetSourceModuleCount () const
58 | {
59 | return 1;
60 | }
61 |
62 | virtual double GetValue (double x, double y, double z) const;
63 |
64 | };
65 |
66 | /// @}
67 |
68 | /// @}
69 |
70 | /// @}
71 |
72 | }
73 |
74 | }
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/add.h:
--------------------------------------------------------------------------------
1 | // add.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_ADD_H
24 | #define NOISE_MODULE_ADD_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @defgroup combinermodules Combiner Modules
41 | /// @addtogroup combinermodules
42 | /// @{
43 |
44 | /// Noise module that outputs the sum of the two output values from two
45 | /// source modules.
46 | ///
47 | /// @image html moduleadd.png
48 | ///
49 | /// This noise module requires two source modules.
50 | class Add: public Module
51 | {
52 |
53 | public:
54 |
55 | /// Constructor.
56 | Add ();
57 |
58 | virtual int GetSourceModuleCount () const
59 | {
60 | return 2;
61 | }
62 |
63 | virtual double GetValue (double x, double y, double z) const;
64 |
65 | };
66 |
67 | /// @}
68 |
69 | /// @}
70 |
71 | /// @}
72 |
73 | }
74 |
75 | }
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/cache.h:
--------------------------------------------------------------------------------
1 | // cache.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_CACHE_H
24 | #define NOISE_MODULE_CACHE_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @defgroup miscmodules Miscellaneous Modules
41 | /// @addtogroup miscmodules
42 | /// @{
43 |
44 | /// Noise module that caches the last output value generated by a source
45 | /// module.
46 | ///
47 | /// If an application passes an input value to the GetValue() method that
48 | /// differs from the previously passed-in input value, this noise module
49 | /// instructs the source module to calculate the output value. This
50 | /// value, as well as the ( @a x, @a y, @a z ) coordinates of the input
51 | /// value, are stored (cached) in this noise module.
52 | ///
53 | /// If the application passes an input value to the GetValue() method
54 | /// that is equal to the previously passed-in input value, this noise
55 | /// module returns the cached output value without having the source
56 | /// module recalculate the output value.
57 | ///
58 | /// If an application passes a new source module to the SetSourceModule()
59 | /// method, the cache is invalidated.
60 | ///
61 | /// Caching a noise module is useful if it is used as a source module for
62 | /// multiple noise modules. If a source module is not cached, the source
63 | /// module will redundantly calculate the same output value once for each
64 | /// noise module in which it is included.
65 | ///
66 | /// This noise module requires one source module.
67 | class Cache: public Module
68 | {
69 |
70 | public:
71 |
72 | /// Constructor.
73 | Cache ();
74 |
75 | virtual int GetSourceModuleCount () const
76 | {
77 | return 1;
78 | }
79 |
80 | virtual double GetValue (double x, double y, double z) const;
81 |
82 | virtual void SetSourceModule (int index, const Module& sourceModule)
83 | {
84 | Module::SetSourceModule (index, sourceModule);
85 | m_isCached = false;
86 | }
87 |
88 | protected:
89 |
90 | /// The cached output value at the cached input value.
91 | mutable double m_cachedValue;
92 |
93 | /// Determines if a cached output value is stored in this noise
94 | /// module.
95 | mutable double m_isCached;
96 |
97 | /// @a x coordinate of the cached input value.
98 | mutable double m_xCache;
99 |
100 | /// @a y coordinate of the cached input value.
101 | mutable double m_yCache;
102 |
103 | /// @a z coordinate of the cached input value.
104 | mutable double m_zCache;
105 |
106 | };
107 |
108 | /// @}
109 |
110 | /// @}
111 |
112 | /// @}
113 |
114 | }
115 |
116 | }
117 |
118 | #endif
119 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/checkerboard.h:
--------------------------------------------------------------------------------
1 | // checkerboard.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_CHECKERBOARD_H
24 | #define NOISE_MODULE_CHECKERBOARD_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup generatormodules
41 | /// @{
42 |
43 | /// Noise module that outputs a checkerboard pattern.
44 | ///
45 | /// @image html modulecheckerboard.png
46 | ///
47 | /// This noise module outputs unit-sized blocks of alternating values.
48 | /// The values of these blocks alternate between -1.0 and +1.0.
49 | ///
50 | /// This noise module is not really useful by itself, but it is often used
51 | /// for debugging purposes.
52 | ///
53 | /// This noise module does not require any source modules.
54 | class Checkerboard: public Module
55 | {
56 |
57 | public:
58 |
59 | /// Constructor.
60 | Checkerboard ();
61 |
62 | virtual int GetSourceModuleCount () const
63 | {
64 | return 0;
65 | }
66 |
67 | virtual double GetValue (double x, double y, double z) const;
68 |
69 | };
70 |
71 | /// @}
72 |
73 | /// @}
74 |
75 | /// @}
76 |
77 | }
78 |
79 | }
80 |
81 | #endif
82 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/const.h:
--------------------------------------------------------------------------------
1 | // const.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_CONST_H
24 | #define NOISE_MODULE_CONST_H
25 |
26 | #pragma warning(disable : 4100)
27 |
28 | #include "modulebase.h"
29 |
30 | namespace noise
31 | {
32 |
33 | namespace module
34 | {
35 |
36 | /// @addtogroup libnoise
37 | /// @{
38 |
39 | /// @addtogroup modules
40 | /// @{
41 |
42 | /// @defgroup generatormodules Generator Modules
43 | /// @addtogroup generatormodules
44 | /// @{
45 |
46 | /// Default constant value for the noise::module::Const noise module.
47 | const double DEFAULT_CONST_VALUE = 0.0;
48 |
49 | /// Noise module that outputs a constant value.
50 | ///
51 | /// @image html moduleconst.png
52 | ///
53 | /// To specify the constant value, call the SetConstValue() method.
54 | ///
55 | /// This noise module is not useful by itself, but it is often used as a
56 | /// source module for other noise modules.
57 | ///
58 | /// This noise module does not require any source modules.
59 | class Const: public Module
60 | {
61 |
62 | public:
63 |
64 | /// Constructor.
65 | ///
66 | /// The default constant value is set to
67 | /// noise::module::DEFAULT_CONST_VALUE.
68 | Const ();
69 |
70 | /// Returns the constant output value for this noise module.
71 | ///
72 | /// @returns The constant output value for this noise module.
73 | double GetConstValue () const
74 | {
75 | return m_constValue;
76 | }
77 |
78 | virtual int GetSourceModuleCount () const
79 | {
80 | return 0;
81 | }
82 |
83 | virtual double GetValue (double x, double y, double z) const
84 | {
85 | return m_constValue;
86 | }
87 |
88 | /// Sets the constant output value for this noise module.
89 | ///
90 | /// @param constValue The constant output value for this noise module.
91 | void SetConstValue (double constValue)
92 | {
93 | m_constValue = constValue;
94 | }
95 |
96 | protected:
97 |
98 | /// Constant value.
99 | double m_constValue;
100 |
101 | };
102 |
103 | /// @}
104 |
105 | /// @}
106 |
107 | /// @}
108 |
109 | }
110 |
111 | }
112 |
113 | #endif
114 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/cylinders.h:
--------------------------------------------------------------------------------
1 | // cylinders.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_CYLINDERS_H
24 | #define NOISE_MODULE_CYLINDERS_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup generatormodules
41 | /// @{
42 |
43 | /// Default frequency value for the noise::module::Cylinders noise module.
44 | const double DEFAULT_CYLINDERS_FREQUENCY = 1.0;
45 |
46 | /// Noise module that outputs concentric cylinders.
47 | ///
48 | /// @image html modulecylinders.png
49 | ///
50 | /// This noise module outputs concentric cylinders centered on the origin.
51 | /// These cylinders are oriented along the @a y axis similar to the
52 | /// concentric rings of a tree. Each cylinder extends infinitely along
53 | /// the @a y axis.
54 | ///
55 | /// The first cylinder has a radius of 1.0. Each subsequent cylinder has
56 | /// a radius that is 1.0 unit larger than the previous cylinder.
57 | ///
58 | /// The output value from this noise module is determined by the distance
59 | /// between the input value and the the nearest cylinder surface. The
60 | /// input values that are located on a cylinder surface are given the
61 | /// output value 1.0 and the input values that are equidistant from two
62 | /// cylinder surfaces are given the output value -1.0.
63 | ///
64 | /// An application can change the frequency of the concentric cylinders.
65 | /// Increasing the frequency reduces the distances between cylinders. To
66 | /// specify the frequency, call the SetFrequency() method.
67 | ///
68 | /// This noise module, modified with some low-frequency, low-power
69 | /// turbulence, is useful for generating wood-like textures.
70 | ///
71 | /// This noise module does not require any source modules.
72 | class Cylinders: public Module
73 | {
74 |
75 | public:
76 |
77 | /// Constructor.
78 | ///
79 | /// The default frequency is set to
80 | /// noise::module::DEFAULT_CYLINDERS_FREQUENCY.
81 | Cylinders ();
82 |
83 | /// Returns the frequency of the concentric cylinders.
84 | ///
85 | /// @returns The frequency of the concentric cylinders.
86 | ///
87 | /// Increasing the frequency increases the density of the concentric
88 | /// cylinders, reducing the distances between them.
89 | double GetFrequency () const
90 | {
91 | return m_frequency;
92 | }
93 |
94 | virtual int GetSourceModuleCount () const
95 | {
96 | return 0;
97 | }
98 |
99 | virtual double GetValue (double x, double y, double z) const;
100 |
101 | /// Sets the frequenct of the concentric cylinders.
102 | ///
103 | /// @param frequency The frequency of the concentric cylinders.
104 | ///
105 | /// Increasing the frequency increases the density of the concentric
106 | /// cylinders, reducing the distances between them.
107 | void SetFrequency (double frequency)
108 | {
109 | m_frequency = frequency;
110 | }
111 |
112 | protected:
113 |
114 | /// Frequency of the concentric cylinders.
115 | double m_frequency;
116 |
117 | };
118 |
119 | /// @}
120 |
121 | /// @}
122 |
123 | /// @}
124 |
125 | }
126 |
127 | }
128 |
129 | #endif
130 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/exponent.h:
--------------------------------------------------------------------------------
1 | // exponent.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_EXPONENT_H
24 | #define NOISE_MODULE_EXPONENT_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup modifiermodules
41 | /// @{
42 |
43 | /// Default exponent for the noise::module::Exponent noise module.
44 | const double DEFAULT_EXPONENT = 1.0;
45 |
46 | /// Noise module that maps the output value from a source module onto an
47 | /// exponential curve.
48 | ///
49 | /// @image html moduleexponent.png
50 | ///
51 | /// Because most noise modules will output values that range from -1.0 to
52 | /// +1.0, this noise module first normalizes this output value (the range
53 | /// becomes 0.0 to 1.0), maps that value onto an exponential curve, then
54 | /// rescales that value back to the original range.
55 | ///
56 | /// This noise module requires one source module.
57 | class Exponent: public Module
58 | {
59 |
60 | public:
61 |
62 | /// Constructor.
63 | ///
64 | /// The default exponent is set to noise::module::DEFAULT_EXPONENT.
65 | Exponent ();
66 |
67 | /// Returns the exponent value to apply to the output value from the
68 | /// source module.
69 | ///
70 | /// @returns The exponent value.
71 | ///
72 | /// Because most noise modules will output values that range from -1.0
73 | /// to +1.0, this noise module first normalizes this output value (the
74 | /// range becomes 0.0 to 1.0), maps that value onto an exponential
75 | /// curve, then rescales that value back to the original range.
76 | double GetExponent () const
77 | {
78 | return m_exponent;
79 | }
80 |
81 | virtual int GetSourceModuleCount () const
82 | {
83 | return 1;
84 | }
85 |
86 | virtual double GetValue (double x, double y, double z) const;
87 |
88 | /// Sets the exponent value to apply to the output value from the
89 | /// source module.
90 | ///
91 | /// @param exponent The exponent value.
92 | ///
93 | /// Because most noise modules will output values that range from -1.0
94 | /// to +1.0, this noise module first normalizes this output value (the
95 | /// range becomes 0.0 to 1.0), maps that value onto an exponential
96 | /// curve, then rescales that value back to the original range.
97 | void SetExponent (double exponent)
98 | {
99 | m_exponent = exponent;
100 | }
101 |
102 | protected:
103 |
104 | /// Exponent to apply to the output value from the source module.
105 | double m_exponent;
106 |
107 | };
108 |
109 | /// @}
110 |
111 | /// @}
112 |
113 | /// @}
114 |
115 | }
116 |
117 | }
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/invert.h:
--------------------------------------------------------------------------------
1 | // invert.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_INVERT_H
24 | #define NOISE_MODULE_INVERT_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup modifiermodules
41 | /// @{
42 |
43 | /// Noise module that inverts the output value from a source module.
44 | ///
45 | /// @image html moduleinvert.png
46 | ///
47 | /// This noise module requires one source module.
48 | class Invert: public Module
49 | {
50 |
51 | public:
52 |
53 | /// Constructor.
54 | Invert ();
55 |
56 | virtual int GetSourceModuleCount () const
57 | {
58 | return 1;
59 | }
60 |
61 | virtual double GetValue (double x, double y, double z) const;
62 |
63 | };
64 |
65 | /// @}
66 |
67 | /// @}
68 |
69 | /// @}
70 |
71 | }
72 |
73 | }
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/max.h:
--------------------------------------------------------------------------------
1 | // max.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_MAX_H
24 | #define NOISE_MODULE_MAX_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup combinermodules
41 | /// @{
42 |
43 | /// Noise module that outputs the larger of the two output values from two
44 | /// source modules.
45 | ///
46 | /// @image html modulemax.png
47 | ///
48 | /// This noise module requires two source modules.
49 | class Max: public Module
50 | {
51 |
52 | public:
53 |
54 | /// Constructor.
55 | Max ();
56 |
57 | virtual int GetSourceModuleCount () const
58 | {
59 | return 2;
60 | }
61 |
62 | virtual double GetValue (double x, double y, double z) const;
63 |
64 | };
65 |
66 | /// @}
67 |
68 | /// @}
69 |
70 | /// @}
71 |
72 | }
73 |
74 | }
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/min.h:
--------------------------------------------------------------------------------
1 | // min.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_MIN_H
24 | #define NOISE_MODULE_MIN_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup combinermodules
41 | /// @{
42 |
43 | /// Noise module that outputs the smaller of the two output values from
44 | /// two source modules.
45 | ///
46 | /// @image html modulemin.png
47 | ///
48 | /// This noise module requires two source modules.
49 | class Min: public Module
50 | {
51 |
52 | public:
53 |
54 | /// Constructor.
55 | Min ();
56 |
57 | virtual int GetSourceModuleCount () const
58 | {
59 | return 2;
60 | }
61 |
62 | virtual double GetValue (double x, double y, double z) const;
63 |
64 | };
65 |
66 | /// @}
67 |
68 | /// @}
69 |
70 | /// @}
71 |
72 | }
73 |
74 | }
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/module.h:
--------------------------------------------------------------------------------
1 | // module.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_H
24 | #define NOISE_MODULE_H
25 |
26 | #include "add.h"
27 | #include "abs.h"
28 | #include "billow.h"
29 | #include "blend.h"
30 | #include "cache.h"
31 | #include "checkerboard.h"
32 | #include "clamp.h"
33 | #include "const.h"
34 | #include "curve.h"
35 | #include "cylinders.h"
36 | #include "displace.h"
37 | #include "exponent.h"
38 | #include "invert.h"
39 | #include "max.h"
40 | #include "min.h"
41 | #include "multiply.h"
42 | #include "perlin.h"
43 | #include "power.h"
44 | #include "ridgedmulti.h"
45 | #include "rotatepoint.h"
46 | #include "scalebias.h"
47 | #include "scalepoint.h"
48 | #include "select.h"
49 | #include "spheres.h"
50 | #include "terrace.h"
51 | #include "translatepoint.h"
52 | #include "turbulence.h"
53 | #include "voronoi.h"
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/multiply.h:
--------------------------------------------------------------------------------
1 | // multiply.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_MULTIPLY_H
24 | #define NOISE_MODULE_MULTIPLY_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup combinermodules
41 | /// @{
42 |
43 | /// Noise module that outputs the product of the two output values from
44 | /// two source modules.
45 | ///
46 | /// @image html modulemultiply.png
47 | ///
48 | /// This noise module requires two source modules.
49 | class Multiply: public Module
50 | {
51 |
52 | public:
53 |
54 | /// Constructor.
55 | Multiply ();
56 |
57 | virtual int GetSourceModuleCount () const
58 | {
59 | return 2;
60 | }
61 |
62 | virtual double GetValue (double x, double y, double z) const;
63 |
64 | };
65 |
66 | /// @}
67 |
68 | /// @}
69 |
70 | /// @}
71 |
72 | }
73 |
74 | }
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/power.h:
--------------------------------------------------------------------------------
1 | // power.h
2 | //
3 | // Copyright (C) 2004 Owen Jacobson
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is angstrom@lionsanctuary.net
20 | //
21 |
22 | #ifndef NOISE_MODULE_POWER_H
23 | #define NOISE_MODULE_POWER_H
24 |
25 | #include "modulebase.h"
26 |
27 | namespace noise
28 | {
29 |
30 | namespace module
31 | {
32 |
33 | /// @addtogroup libnoise
34 | /// @{
35 |
36 | /// @addtogroup modules
37 | /// @{
38 |
39 | /// @defgroup combinermodules Combiner Modules
40 | /// @addtogroup combinermodules
41 | /// @{
42 |
43 | /// Noise module that raises the output value from a first source module
44 | /// to the power of the output value from a second source module.
45 | ///
46 | /// @image html modulepower.png
47 | ///
48 | /// The first source module must have an index value of 0.
49 | ///
50 | /// The second source module must have an index value of 1.
51 | ///
52 | /// This noise module requires two source modules.
53 | class Power: public Module
54 | {
55 |
56 | public:
57 |
58 | /// Constructor.
59 | Power ();
60 |
61 | virtual int GetSourceModuleCount () const
62 | {
63 | return 2;
64 | }
65 |
66 | virtual double GetValue (double x, double y, double z) const;
67 |
68 | };
69 |
70 | /// @}
71 |
72 | /// @}
73 |
74 | /// @}
75 |
76 | }
77 |
78 | }
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/module/spheres.h:
--------------------------------------------------------------------------------
1 | // spheres.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_MODULE_SPHERES_H
24 | #define NOISE_MODULE_SPHERES_H
25 |
26 | #include "modulebase.h"
27 |
28 | namespace noise
29 | {
30 |
31 | namespace module
32 | {
33 |
34 | /// @addtogroup libnoise
35 | /// @{
36 |
37 | /// @addtogroup modules
38 | /// @{
39 |
40 | /// @addtogroup generatormodules
41 | /// @{
42 |
43 | /// Default frequency value for the noise::module::Spheres noise module.
44 | const double DEFAULT_SPHERES_FREQUENCY = 1.0;
45 |
46 | /// Noise module that outputs concentric spheres.
47 | ///
48 | /// @image html modulespheres.png
49 | ///
50 | /// This noise module outputs concentric spheres centered on the origin
51 | /// like the concentric rings of an onion.
52 | ///
53 | /// The first sphere has a radius of 1.0. Each subsequent sphere has a
54 | /// radius that is 1.0 unit larger than the previous sphere.
55 | ///
56 | /// The output value from this noise module is determined by the distance
57 | /// between the input value and the the nearest spherical surface. The
58 | /// input values that are located on a spherical surface are given the
59 | /// output value 1.0 and the input values that are equidistant from two
60 | /// spherical surfaces are given the output value -1.0.
61 | ///
62 | /// An application can change the frequency of the concentric spheres.
63 | /// Increasing the frequency reduces the distances between spheres. To
64 | /// specify the frequency, call the SetFrequency() method.
65 | ///
66 | /// This noise module, modified with some low-frequency, low-power
67 | /// turbulence, is useful for generating agate-like textures.
68 | ///
69 | /// This noise module does not require any source modules.
70 | class Spheres: public Module
71 | {
72 |
73 | public:
74 |
75 | /// Constructor.
76 | ///
77 | /// The default frequency is set to
78 | /// noise::module::DEFAULT_SPHERES_FREQUENCY.
79 | Spheres ();
80 |
81 | /// Returns the frequency of the concentric spheres.
82 | ///
83 | /// @returns The frequency of the concentric spheres.
84 | ///
85 | /// Increasing the frequency increases the density of the concentric
86 | /// spheres, reducing the distances between them.
87 | double GetFrequency () const
88 | {
89 | return m_frequency;
90 | }
91 |
92 | virtual int GetSourceModuleCount () const
93 | {
94 | return 0;
95 | }
96 |
97 | virtual double GetValue (double x, double y, double z) const;
98 |
99 | /// Sets the frequenct of the concentric spheres.
100 | ///
101 | /// @param frequency The frequency of the concentric spheres.
102 | ///
103 | /// Increasing the frequency increases the density of the concentric
104 | /// spheres, reducing the distances between them.
105 | void SetFrequency (double frequency)
106 | {
107 | m_frequency = frequency;
108 | }
109 |
110 | protected:
111 |
112 | /// Frequency of the concentric spheres.
113 | double m_frequency;
114 |
115 | };
116 |
117 | /// @}
118 |
119 | /// @}
120 |
121 | /// @}
122 |
123 | }
124 |
125 | }
126 |
127 | #endif
128 |
--------------------------------------------------------------------------------
/Libraries/Noise/include/Noise/noise.h:
--------------------------------------------------------------------------------
1 | // noise.h
2 | //
3 | // Copyright (C) 2003, 2004 Jason Bevins
4 | //
5 | // This library is free software; you can redistribute it and/or modify it
6 | // under the terms of the GNU Lesser General Public License as published by
7 | // the Free Software Foundation; either version 2.1 of the License, or (at
8 | // your option) any later version.
9 | //
10 | // This library is distributed in the hope that it will be useful, but WITHOUT
11 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 | // License (COPYING.txt) for more details.
14 | //
15 | // You should have received a copy of the GNU Lesser General Public License
16 | // along with this library; if not, write to the Free Software Foundation,
17 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | //
19 | // The developer's email is jlbezigvins@gmzigail.com (for great email, take
20 | // off every 'zig'.)
21 | //
22 |
23 | #ifndef NOISE_H
24 | #define NOISE_H
25 |
26 | /// @mainpage libnoise
27 | ///
28 | /// @section intro Introduction
29 | ///
30 | /// libnoise is a portable C++ library that is used to generate coherent
31 | /// noise, a type of smoothly-changing noise. libnoise can generate Perlin
32 | /// noise, ridged multifractal noise, and other types of coherent noise.
33 | ///
34 | /// Coherent noise is often used by graphics programmers to generate
35 | /// natural-looking textures, planetary terrain, and other things. It can
36 | /// also be used to move critters in a realistic way.
37 | ///
38 | /// libnoise is known to compile using the following compilers on the
39 | /// following platforms:
40 | /// - Microsoft Visual C++ 5.0 under Microsoft Windows 2000 Service Pack 4
41 | /// - gcc 3.3.4 under Gentoo Linux 10.0 (x86)
42 | ///
43 | /// It is not known if libnoise will compile on 64-bit platforms, although
44 | /// there is a good change that it will.
45 | ///
46 | /// @section noise Noise Modules
47 | ///
48 | /// In libnoise, coherent-noise generators are encapsulated in classes called
49 | /// noise modules. There are many different types of noise modules.
50 | /// Some noise modules can combine or modify the outputs of other noise
51 | /// modules in various ways; you can join these modules together to generate
52 | /// very complex coherent noise.
53 | ///
54 | /// A noise module receives a 3-dimensional input value from the application,
55 | /// computes the noise value given that input value, and returns the resulting
56 | /// value back to the application.
57 | ///
58 | /// If the application passes the same input value to a noise module, the
59 | /// noise module returns the same output value.
60 | ///
61 | /// All noise modules are derived from the noise::module::Module abstract
62 | /// base class.
63 | ///
64 | /// @section contact Contact
65 | ///
66 | /// Contact jas for questions about libnoise. The spam-resistant email
67 | /// address is jlbezigvins@gmzigail.com (For great email, take off every
68 | /// zig.)
69 |
70 | #include "module/module.h"
71 | #include "model/model.h"
72 | #include "misc.h"
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/Libraries/Noise/lib/libnoise.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/Noise/lib/libnoise.dll
--------------------------------------------------------------------------------
/Libraries/Noise/lib/libnoise.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/Noise/lib/libnoise.lib
--------------------------------------------------------------------------------
/Libraries/PoissionDiskSampling/include/PoissonDiskSampling/PoissonDiskSampling.h:
--------------------------------------------------------------------------------
1 | #ifndef POISSON_DISK_SAMPLING_H
2 | #define POISSON_DISK_SAMPLING_H
3 |
4 | #include
5 |
6 | class PoissonDiskSampling
7 | {
8 | public:
9 | PoissonDiskSampling() = default;
10 | PoissonDiskSampling(int pointWidth, int pointHeight, double pointMinDist, double pointCount);
11 |
12 | ~PoissonDiskSampling() = default;
13 |
14 | PoissonDiskSampling(const PoissonDiskSampling& pds) = delete;
15 | PoissonDiskSampling(PoissonDiskSampling&& pds) = delete;
16 |
17 | PoissonDiskSampling& operator=(const PoissonDiskSampling& rhs) = delete;
18 | PoissonDiskSampling& operator=(PoissonDiskSampling&& rhs) = delete;
19 |
20 | std::vector> Generate();
21 |
22 | struct Point
23 | {
24 | Point() : x(0.0), y(0.0) { }
25 | Point(double _x, double _y) : x(_x), y(_y) { }
26 |
27 | ~Point() = default;
28 |
29 | Point(const Point& p) : x(p.x), y(p.y) { }
30 | Point(Point&& p) : x(p.x), y(p.y) { }
31 |
32 | Point& operator=(const Point& rhs)
33 | {
34 | if (this == &rhs)
35 | {
36 | return *this;
37 | }
38 |
39 | x = rhs.x;
40 | y = rhs.y;
41 |
42 | return *this;
43 | }
44 | Point& operator=(Point&& rhs)
45 | {
46 | if (this == &rhs)
47 | {
48 | return *this;
49 | }
50 |
51 | x = rhs.x;
52 | y = rhs.y;
53 |
54 | return *this;
55 | }
56 |
57 | int GetGridIndex(double cellSize, int mapWidth) const
58 | {
59 | int indexX = static_cast(x / cellSize);
60 | int indexY = static_cast(y / cellSize);
61 |
62 | return indexX + indexY * mapWidth;
63 | }
64 |
65 | double Distance(Point p) const
66 | {
67 | return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
68 | }
69 |
70 | double x, y;
71 | };
72 |
73 | private:
74 | std::vector> m_grid;
75 | std::vector m_process;
76 | std::vector> m_sample;
77 |
78 | int m_width;
79 | int m_height;
80 | double m_minDist;
81 | int m_pointCount;
82 | double m_cellSize;
83 | int m_gridWidth;
84 | int m_gridHeight;
85 |
86 | Point GeneratePointAround(Point p) const;
87 | bool IsInRectangle(Point p) const;
88 | bool IsInNeighbourhood(Point p);
89 | std::vector GetCellsAround(Point p);
90 | };
91 |
92 | #endif
--------------------------------------------------------------------------------
/Libraries/PoissionDiskSampling/lib/DiskSampling.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/PoissionDiskSampling/lib/DiskSampling.lib
--------------------------------------------------------------------------------
/Libraries/PolygonalMapGenerator/include/PolygonalMapGenerator/ConvexHull.h:
--------------------------------------------------------------------------------
1 | #ifndef CONVEX_HULL_H
2 | #define CONVEX_HULL_H
3 |
4 | #include
5 |
6 | #include "Structure.h"
7 | #include "Math/Vector2.h"
8 |
9 | namespace ConvexHull
10 | {
11 | inline double Cross(const Vector2& O, const Vector2& A, const Vector2& B)
12 | {
13 | return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
14 | }
15 |
16 | inline void CalculateConvexHull(std::vector& P)
17 | {
18 | int n = P.size(), k = 0;
19 | std::vector H(2 * n);
20 |
21 | // Sort points lexicographically
22 | sort(P.begin(), P.end(), [](Corner* c1, Corner* c2)
23 | {
24 | return c1->m_position.x < c2->m_position.x ||
25 | (c1->m_position.x == c2->m_position.x && c1->m_position.y < c2->m_position.y);
26 | });
27 |
28 | // Build lower hull
29 | for (int i = 0; i < n; ++i)
30 | {
31 | while (k >= 2 && Cross(H[k - 2]->m_position, H[k - 1]->m_position, P[i]->m_position) <= 0)
32 | {
33 | k--;
34 | }
35 |
36 | H[k++] = P[i];
37 | }
38 |
39 | // Build upper hull
40 | for (int i = n - 2, t = k + 1; i >= 0; i--)
41 | {
42 | while (k >= t && Cross(H[k - 2]->m_position, H[k - 1]->m_position, P[i]->m_position) <= 0)
43 | {
44 | k--;
45 | }
46 |
47 | H[k++] = P[i];
48 | }
49 |
50 | H.resize(k - 1);
51 |
52 | P = H;
53 | }
54 | };
55 |
56 | #endif
--------------------------------------------------------------------------------
/Libraries/PolygonalMapGenerator/include/PolygonalMapGenerator/Map.h:
--------------------------------------------------------------------------------
1 | #ifndef MAP_H
2 | #define MAP_H
3 |
4 | #include
5 | #include