├── .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 6 | 7 | #include "DelaunayTriangulation.h" 8 | #include "Structure.h" 9 | #include "QuadTree.h" 10 | 11 | // Forward Declaration 12 | class Vector2; 13 | namespace noise 14 | { 15 | namespace module 16 | { 17 | class Perlin; 18 | } 19 | } 20 | 21 | class Map 22 | { 23 | public: 24 | Map() = default; 25 | Map(int width, int height, double pointSpread, std::string seed); 26 | 27 | ~Map() = default; 28 | 29 | Map(const Map& map) = delete; 30 | Map(Map&& map) = delete; 31 | 32 | Map& operator=(const Map& map) = delete; 33 | Map& operator=(Map&& map) = delete; 34 | 35 | void Generate(); 36 | 37 | void GeneratePolygons(); 38 | void GenerateLand(); 39 | 40 | std::vector GetEdges() const; 41 | std::vector GetCorners() const; 42 | std::vector GetCenters() const; 43 | 44 | Center* GetCenterAt(Vector2 pos); 45 | 46 | private: 47 | int m_mapWidth; 48 | int m_mapHeight; 49 | double m_pointSpread; 50 | double m_zCoord; 51 | noise::module::Perlin* m_noiseMap; 52 | std::string m_seed; 53 | QuadTree m_centersQuadTree; 54 | 55 | std::vector m_points; 56 | 57 | std::map> m_posCenterMap; 58 | std::vector m_edges; 59 | std::vector m_corners; 60 | std::vector m_centers; 61 | 62 | static const std::vector> m_elevationMoistureMatrix; 63 | static std::vector> MakeBiomeMatrix(); 64 | 65 | bool IsIsland(Vector2 position) const; 66 | void CalculateDownslopes(); 67 | void GenerateRivers(); 68 | void AssignOceanCoastLand(); 69 | void RedistributeElevations(); 70 | void AssignCornerElevations(); 71 | void AssignPolygonElevations(); 72 | void RedistributeMoisture(); 73 | void AssignCornerMoisture(); 74 | void AssignPolygonMoisture(); 75 | void AssignBiomes(); 76 | 77 | void GeneratePoints(); 78 | void Triangulate(std::vector points); 79 | void FinishInfo(); 80 | void AddCenter(Center* c); 81 | Center* GetCenter(Vector2 position); 82 | 83 | std::vector GetLandCorners(); 84 | std::vector GetLakeCorners(); 85 | void LloydRelaxation(); 86 | std::string CreateSeed(int length) const; 87 | 88 | static unsigned int HashString(std::string seed); 89 | }; 90 | 91 | #endif -------------------------------------------------------------------------------- /Libraries/PolygonalMapGenerator/include/PolygonalMapGenerator/Math/LineEquation.h: -------------------------------------------------------------------------------- 1 | #ifndef LINE_EQUATION_H 2 | #define LINE_EQUATION_H 3 | 4 | #include "Vector2.h" 5 | 6 | class LineEquation 7 | { 8 | public: 9 | LineEquation(); 10 | LineEquation(Vector2 p1, Vector2 p2); 11 | LineEquation(Vector2 p, double _m); 12 | 13 | ~LineEquation(); 14 | 15 | LineEquation(const LineEquation& e); 16 | LineEquation(LineEquation&& e); 17 | 18 | LineEquation& operator=(const LineEquation& e); 19 | LineEquation& operator=(LineEquation&& e); 20 | 21 | double operator()(const double x) const; 22 | 23 | void Move(const Vector2 v); 24 | Vector2 Intersection(LineEquation& e) const; 25 | bool IsHorizontal() const; 26 | bool IsVertical() const; 27 | 28 | double m; 29 | double b; 30 | bool vertical; 31 | }; 32 | 33 | #endif -------------------------------------------------------------------------------- /Libraries/PolygonalMapGenerator/include/PolygonalMapGenerator/Math/Vector2.h: -------------------------------------------------------------------------------- 1 | #ifndef VECTOR2_H 2 | #define VECTOR2_H 3 | 4 | class Vector2 5 | { 6 | public: 7 | Vector2(); 8 | Vector2(double angle); 9 | Vector2(double _x, double _y); 10 | Vector2(const Vector2& v1, const Vector2& v2); 11 | 12 | ~Vector2(); 13 | 14 | Vector2(const Vector2& v); 15 | Vector2(Vector2&& v); 16 | 17 | Vector2& operator=(const Vector2& v); 18 | Vector2& operator=(Vector2&& v); 19 | 20 | Vector2& operator+=(const Vector2& v); 21 | Vector2& operator+=(const double f); 22 | 23 | Vector2& operator-=(const Vector2& v); 24 | Vector2& operator-=(const double f); 25 | 26 | Vector2& operator*=(const double f); 27 | 28 | Vector2& operator/=(const double f); 29 | 30 | bool operator==(const Vector2& v) const; 31 | bool operator!=(const Vector2& v) const; 32 | 33 | void Normalize(); 34 | void Reflect(const Vector2& v); 35 | void Reverse(); 36 | void Truncate(double maxLength); 37 | 38 | void RotateByDegree(double degree); 39 | void RotateByRadian(double radian); 40 | 41 | double DotProduct(const Vector2& v) const; 42 | double CrossProduct(const Vector2& v) const; 43 | 44 | double Length() const; 45 | double LengthSqrt() const; 46 | 47 | double Distance(const Vector2& v) const; 48 | double DistanceSqrt(const Vector2& v) const; 49 | 50 | double GetAngleByDegree() const; 51 | double GetAngleByDegree(const Vector2& v) const; 52 | double GetAngleByRadian() const; 53 | double GetAngleByRadian(const Vector2& v) const; 54 | 55 | bool Sign(const Vector2& v) const; 56 | bool IsZero() const; 57 | 58 | double x, y; 59 | }; 60 | 61 | Vector2 operator+(const Vector2& lhs, const Vector2& rhs); 62 | Vector2 operator-(const Vector2& lhs, const Vector2& rhs); 63 | Vector2 operator*(const double fac, const Vector2& rhs); 64 | Vector2 operator*(const Vector2& lhs, const double fac); 65 | Vector2 operator/(const Vector2& lhs, const double fac); 66 | 67 | Vector2 Normalize(const Vector2& v); 68 | Vector2 Reflect(const Vector2& v1, const Vector2& v2); 69 | Vector2 Reverse(const Vector2& v); 70 | Vector2 Truncate(const Vector2& v, double maxLength); 71 | 72 | Vector2 RotateByDegree(const Vector2& v, double degree); 73 | Vector2 RotateByRadian(const Vector2& v, double radian); 74 | 75 | double Distance(const Vector2& v1, const Vector2& v2); 76 | 77 | #endif -------------------------------------------------------------------------------- /Libraries/PolygonalMapGenerator/include/PolygonalMapGenerator/Structure.h: -------------------------------------------------------------------------------- 1 | #ifndef STRUCTURE_H 2 | #define STRUCTURE_H 3 | 4 | #include 5 | 6 | #include "Math/Vector2.h" 7 | 8 | enum class BiomeType 9 | { 10 | Snow, 11 | Tundra, 12 | Mountain, 13 | Taiga, 14 | Shrubland, 15 | TemprateDesert, 16 | TemprateRainForest, 17 | TemprateDeciduousForest, 18 | Grassland, 19 | TropicalRainForest, 20 | TropicalSeasonalForest, 21 | SubtropicalDesert, 22 | Ocean, 23 | Lake, 24 | Beach, 25 | 26 | Size, 27 | None 28 | }; 29 | 30 | // Forward Declaration 31 | struct Edge; 32 | struct Corner; 33 | 34 | struct Center 35 | { 36 | Center() : 37 | m_index(0), m_position(0, 0), m_water(false), m_ocean(false), m_coast(false), m_border(false), 38 | m_biome(BiomeType::None), m_elevation(0.0), m_moisture(0.0) { } 39 | Center(unsigned int index, Vector2 position) : 40 | m_index(index), m_position(position), m_water(false), m_ocean(false), m_coast(false), m_border(false), 41 | m_biome(BiomeType::None), m_elevation(0.0), m_moisture(0.0) { } 42 | 43 | ~Center() = default; 44 | 45 | Center(const Center& center) = default; 46 | Center(Center&& center) = default; 47 | 48 | Center& operator=(const Center& center) = default; 49 | Center& operator=(Center&& center) = default; 50 | 51 | bool RemoveEdge(Edge* e); 52 | bool RemoveCorner(Corner* c); 53 | Edge* GetEdgeWith(Center* c); 54 | void MakeBorder(); 55 | bool IsInsideBoundingBox(int width, int height) const; 56 | bool IsContain(Vector2 pos); 57 | std::pair GetBoundingBox(); 58 | void SortCorners(); 59 | bool IsGoesBefore(Vector2 a, Vector2 b) const; 60 | 61 | unsigned int m_index; 62 | Vector2 m_position; 63 | 64 | bool m_water; 65 | bool m_ocean; 66 | bool m_coast; 67 | bool m_border; 68 | BiomeType m_biome; 69 | double m_elevation; 70 | double m_moisture; 71 | 72 | std::vector m_edges; 73 | std::vector m_corners; 74 | std::vector m_centers; 75 | 76 | using CenterIterator = std::vector::iterator; 77 | }; 78 | 79 | struct Edge 80 | { 81 | Edge() : m_index(0), m_d0(nullptr), m_d1(nullptr), m_v0(nullptr), m_v1(nullptr), m_riverVolume(0.0) { } 82 | Edge(unsigned int index, Center* center1, Center* center2, Corner* corner1, Corner* corner2); 83 | 84 | ~Edge() = default; 85 | 86 | Edge(const Edge& center) = default; 87 | Edge(Edge&& center) = default; 88 | 89 | Edge& operator=(const Edge& center) = default; 90 | Edge& operator=(Edge&& center) = default; 91 | 92 | bool Legalize(); 93 | bool Flip(); 94 | void SwitchCorner(Corner* oldCorner, Corner* newCorner); 95 | Corner* GetOppositeCorner(Corner* c) const; 96 | Center* GetOppositeCenter(Center* c) const; 97 | 98 | unsigned int m_index; 99 | 100 | Center* m_d0; 101 | Center* m_d1; 102 | Corner* m_v0; 103 | Corner* m_v1; 104 | 105 | Vector2 m_voronoiMidpoint; 106 | double m_riverVolume; 107 | 108 | using EdgeIterator = std::vector::iterator; 109 | }; 110 | 111 | struct Corner 112 | { 113 | Corner() : 114 | m_index(0), m_position(0, 0), m_water(false), m_ocean(false), m_coast(false), m_border(false), 115 | m_elevation(0.0), m_moisture(0.0), m_riverVolume(0.0), m_downslope(nullptr) { } 116 | Corner(unsigned int index, Vector2 position) : 117 | m_index(index), m_position(position), m_water(false), m_ocean(false), m_coast(false), m_border(false), 118 | m_elevation(0.0), m_moisture(0.0), m_riverVolume(0.0), m_downslope(nullptr) { } 119 | 120 | bool IsPointInCircumstanceCircle(Vector2 p); 121 | Vector2 CalculateCircumstanceCenter(); 122 | Center* GetOppositeCenter(Center* c0, Center* c1); 123 | Center* GetOppositeCenter(Edge* e); 124 | bool TouchesCenter(Center* c); 125 | Edge* GetEdgeConnecting(Center* c0, Center* c1); 126 | bool IsInsideBoundingBox(int width, int height) const; 127 | Edge* GetEdgeWith(Corner* c); 128 | 129 | static bool SortByElevation(Corner* c1, Corner* c2); 130 | static bool SortByMoisture(Corner* c1, Corner* c2); 131 | 132 | unsigned int m_index; 133 | Vector2 m_position; 134 | 135 | bool m_water; 136 | bool m_ocean; 137 | bool m_coast; 138 | bool m_border; 139 | double m_elevation; 140 | double m_moisture; 141 | double m_riverVolume; 142 | Corner* m_downslope; 143 | 144 | std::vector m_edges; 145 | std::vector m_corners; 146 | std::vector m_centers; 147 | 148 | using CornerIterator = std::vector::iterator; 149 | }; 150 | 151 | #endif -------------------------------------------------------------------------------- /Libraries/PolygonalMapGenerator/lib/PolyMapGenerator.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/PolygonalMapGenerator/lib/PolyMapGenerator.lib -------------------------------------------------------------------------------- /Libraries/SFML/bin/openal32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/openal32.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-audio-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-audio-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-audio-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-audio-d-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-graphics-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-graphics-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-graphics-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-graphics-d-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-network-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-network-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-network-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-network-d-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-system-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-system-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-system-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-system-d-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-window-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-window-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/bin/sfml-window-d-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/bin/sfml-window-d-2.dll -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Audio.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_HPP 26 | #define SFML_AUDIO_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | 48 | #endif // SFML_AUDIO_HPP 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \defgroup audio Audio module 52 | /// 53 | /// Sounds, streaming (musics or custom sources), recording, 54 | /// spatialization. 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Audio/AlResource.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_ALRESOURCE_HPP 26 | #define SFML_ALRESOURCE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | namespace sf 35 | { 36 | //////////////////////////////////////////////////////////// 37 | /// \brief Base class for classes that require an OpenAL context 38 | /// 39 | //////////////////////////////////////////////////////////// 40 | class SFML_AUDIO_API AlResource 41 | { 42 | protected: 43 | 44 | //////////////////////////////////////////////////////////// 45 | /// \brief Default constructor 46 | /// 47 | //////////////////////////////////////////////////////////// 48 | AlResource(); 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \brief Destructor 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | ~AlResource(); 55 | }; 56 | 57 | } // namespace sf 58 | 59 | 60 | #endif // SFML_ALRESOURCE_HPP 61 | 62 | //////////////////////////////////////////////////////////// 63 | /// \class sf::AlResource 64 | /// \ingroup audio 65 | /// 66 | /// This class is for internal use only, it must be the base 67 | /// of every class that requires a valid OpenAL context in 68 | /// order to work. 69 | /// 70 | //////////////////////////////////////////////////////////// 71 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Audio/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_AUDIO_EXPORT_HPP 26 | #define SFML_AUDIO_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_AUDIO_EXPORTS) 38 | 39 | #define SFML_AUDIO_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_AUDIO_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_AUDIO_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Audio/SoundFileFactory.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | //////////////////////////////////////////////////////////// 26 | // Headers 27 | //////////////////////////////////////////////////////////// 28 | 29 | 30 | namespace sf 31 | { 32 | namespace priv 33 | { 34 | template SoundFileReader* createReader() {return new T;} 35 | template SoundFileWriter* createWriter() {return new T;} 36 | } 37 | 38 | //////////////////////////////////////////////////////////// 39 | template 40 | void SoundFileFactory::registerReader() 41 | { 42 | // Make sure the same class won't be registered twice 43 | unregisterReader(); 44 | 45 | // Create a new factory with the functions provided by the class 46 | ReaderFactory factory; 47 | factory.check = &T::check; 48 | factory.create = &priv::createReader; 49 | 50 | // Add it 51 | s_readers.push_back(factory); 52 | } 53 | 54 | 55 | //////////////////////////////////////////////////////////// 56 | template 57 | void SoundFileFactory::unregisterReader() 58 | { 59 | // Remove the instance(s) of the reader from the array of factories 60 | for (ReaderFactoryArray::iterator it = s_readers.begin(); it != s_readers.end(); ) 61 | { 62 | if (it->create == &priv::createReader) 63 | it = s_readers.erase(it); 64 | else 65 | ++it; 66 | } 67 | } 68 | 69 | //////////////////////////////////////////////////////////// 70 | template 71 | void SoundFileFactory::registerWriter() 72 | { 73 | // Make sure the same class won't be registered twice 74 | unregisterWriter(); 75 | 76 | // Create a new factory with the functions provided by the class 77 | WriterFactory factory; 78 | factory.check = &T::check; 79 | factory.create = &priv::createWriter; 80 | 81 | // Add it 82 | s_writers.push_back(factory); 83 | } 84 | 85 | 86 | //////////////////////////////////////////////////////////// 87 | template 88 | void SoundFileFactory::unregisterWriter() 89 | { 90 | // Remove the instance(s) of the writer from the array of factories 91 | for (WriterFactoryArray::iterator it = s_writers.begin(); it != s_writers.end(); ) 92 | { 93 | if (it->create == &priv::createWriter) 94 | it = s_writers.erase(it); 95 | else 96 | ++it; 97 | } 98 | } 99 | 100 | } // namespace sf 101 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Graphics.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GRAPHICS_HPP 26 | #define SFML_GRAPHICS_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | 60 | #endif // SFML_GRAPHICS_HPP 61 | 62 | //////////////////////////////////////////////////////////// 63 | /// \defgroup graphics Graphics module 64 | /// 65 | /// 2D graphics module: sprites, text, shapes, ... 66 | /// 67 | //////////////////////////////////////////////////////////// 68 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Graphics/Drawable.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_DRAWABLE_HPP 26 | #define SFML_DRAWABLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | class RenderTarget; 38 | 39 | //////////////////////////////////////////////////////////// 40 | /// \brief Abstract base class for objects that can be drawn 41 | /// to a render target 42 | /// 43 | //////////////////////////////////////////////////////////// 44 | class SFML_GRAPHICS_API Drawable 45 | { 46 | public: 47 | 48 | //////////////////////////////////////////////////////////// 49 | /// \brief Virtual destructor 50 | /// 51 | //////////////////////////////////////////////////////////// 52 | virtual ~Drawable() {} 53 | 54 | protected: 55 | 56 | friend class RenderTarget; 57 | 58 | //////////////////////////////////////////////////////////// 59 | /// \brief Draw the object to a render target 60 | /// 61 | /// This is a pure virtual function that has to be implemented 62 | /// by the derived class to define how the drawable should be 63 | /// drawn. 64 | /// 65 | /// \param target Render target to draw to 66 | /// \param states Current render states 67 | /// 68 | //////////////////////////////////////////////////////////// 69 | virtual void draw(RenderTarget& target, RenderStates states) const = 0; 70 | }; 71 | 72 | } // namespace sf 73 | 74 | 75 | #endif // SFML_DRAWABLE_HPP 76 | 77 | 78 | //////////////////////////////////////////////////////////// 79 | /// \class sf::Drawable 80 | /// \ingroup graphics 81 | /// 82 | /// sf::Drawable is a very simple base class that allows objects 83 | /// of derived classes to be drawn to a sf::RenderTarget. 84 | /// 85 | /// All you have to do in your derived class is to override the 86 | /// draw virtual function. 87 | /// 88 | /// Note that inheriting from sf::Drawable is not mandatory, 89 | /// but it allows this nice syntax "window.draw(object)" rather 90 | /// than "object.draw(window)", which is more consistent with other 91 | /// SFML classes. 92 | /// 93 | /// Example: 94 | /// \code 95 | /// class MyDrawable : public sf::Drawable 96 | /// { 97 | /// public: 98 | /// 99 | /// ... 100 | /// 101 | /// private: 102 | /// 103 | /// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const 104 | /// { 105 | /// // You can draw other high-level objects 106 | /// target.draw(m_sprite, states); 107 | /// 108 | /// // ... or use the low-level API 109 | /// states.texture = &m_texture; 110 | /// target.draw(m_vertices, states); 111 | /// 112 | /// // ... or draw with OpenGL directly 113 | /// glBegin(GL_QUADS); 114 | /// ... 115 | /// glEnd(); 116 | /// } 117 | /// 118 | /// sf::Sprite m_sprite; 119 | /// sf::Texture m_texture; 120 | /// sf::VertexArray m_vertices; 121 | /// }; 122 | /// \endcode 123 | /// 124 | /// \see sf::RenderTarget 125 | /// 126 | //////////////////////////////////////////////////////////// 127 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Graphics/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GRAPHICS_EXPORT_HPP 26 | #define SFML_GRAPHICS_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_GRAPHICS_EXPORTS) 38 | 39 | #define SFML_GRAPHICS_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_GRAPHICS_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_GRAPHICS_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Graphics/Glyph.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GLYPH_HPP 26 | #define SFML_GLYPH_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Structure describing a glyph 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_GRAPHICS_API Glyph 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | //////////////////////////////////////////////////////////// 49 | Glyph() : advance(0) {} 50 | 51 | //////////////////////////////////////////////////////////// 52 | // Member data 53 | //////////////////////////////////////////////////////////// 54 | float advance; ///< Offset to move horizontally to the next character 55 | FloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline 56 | IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture 57 | }; 58 | 59 | } // namespace sf 60 | 61 | 62 | #endif // SFML_GLYPH_HPP 63 | 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \class sf::Glyph 67 | /// \ingroup graphics 68 | /// 69 | /// A glyph is the visual representation of a character. 70 | /// 71 | /// The sf::Glyph structure provides the information needed 72 | /// to handle the glyph: 73 | /// \li its coordinates in the font's texture 74 | /// \li its bounding rectangle 75 | /// \li the offset to apply to get the starting position of the next glyph 76 | /// 77 | /// \see sf::Font 78 | /// 79 | //////////////////////////////////////////////////////////// 80 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Graphics/PrimitiveType.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_PRIMITIVETYPE_HPP 26 | #define SFML_PRIMITIVETYPE_HPP 27 | 28 | namespace sf 29 | { 30 | //////////////////////////////////////////////////////////// 31 | /// \ingroup graphics 32 | /// \brief Types of primitives that a sf::VertexArray can render 33 | /// 34 | /// Points and lines have no area, therefore their thickness 35 | /// will always be 1 pixel, regardless the current transform 36 | /// and view. 37 | /// 38 | //////////////////////////////////////////////////////////// 39 | enum PrimitiveType 40 | { 41 | Points, ///< List of individual points 42 | Lines, ///< List of individual lines 43 | LinesStrip, ///< List of connected lines, a point uses the previous point to form a line 44 | Triangles, ///< List of individual triangles 45 | TrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle 46 | TrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle 47 | Quads ///< List of individual quads (deprecated, don't work with OpenGL ES) 48 | }; 49 | 50 | } // namespace sf 51 | 52 | 53 | #endif // SFML_PRIMITIVETYPE_HPP 54 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Main.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_MAIN_HPP 26 | #define SFML_MAIN_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | #if defined(SFML_SYSTEM_IOS) 35 | 36 | // On iOS, we have no choice but to have our own main, 37 | // so we need to rename the user one and call it later 38 | #define main sfmlMain 39 | 40 | #endif 41 | 42 | 43 | #endif // SFML_MAIN_HPP 44 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Network.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_HPP 26 | #define SFML_NETWORK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | 45 | #endif // SFML_NETWORK_HPP 46 | 47 | //////////////////////////////////////////////////////////// 48 | /// \defgroup network Network module 49 | /// 50 | /// Socket-based communication, utilities and higher-level 51 | /// network protocols (HTTP, FTP). 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Network/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NETWORK_EXPORT_HPP 26 | #define SFML_NETWORK_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_NETWORK_EXPORTS) 38 | 39 | #define SFML_NETWORK_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_NETWORK_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_NETWORK_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Network/SocketHandle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SOCKETHANDLE_HPP 26 | #define SFML_SOCKETHANDLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | #if defined(SFML_SYSTEM_WINDOWS) 34 | #include 35 | #endif 36 | 37 | 38 | namespace sf 39 | { 40 | //////////////////////////////////////////////////////////// 41 | // Define the low-level socket handle type, specific to 42 | // each platform 43 | //////////////////////////////////////////////////////////// 44 | #if defined(SFML_SYSTEM_WINDOWS) 45 | 46 | typedef UINT_PTR SocketHandle; 47 | 48 | #else 49 | 50 | typedef int SocketHandle; 51 | 52 | #endif 53 | 54 | } // namespace sf 55 | 56 | 57 | #endif // SFML_SOCKETHANDLE_HPP 58 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/OpenGL.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_OPENGL_HPP 26 | #define SFML_OPENGL_HPP 27 | 28 | 29 | //////////////////////////////////////////////////////////// 30 | /// Headers 31 | //////////////////////////////////////////////////////////// 32 | #include 33 | 34 | 35 | //////////////////////////////////////////////////////////// 36 | /// This file just includes the OpenGL headers, 37 | /// which have actually different paths on each system 38 | //////////////////////////////////////////////////////////// 39 | #if defined(SFML_SYSTEM_WINDOWS) 40 | 41 | // The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them 42 | #ifdef _MSC_VER 43 | #include 44 | #endif 45 | 46 | #include 47 | 48 | #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) 49 | 50 | #if defined(SFML_OPENGL_ES) 51 | #include 52 | #include 53 | #else 54 | #include 55 | #endif 56 | 57 | #elif defined(SFML_SYSTEM_MACOS) 58 | 59 | #include 60 | 61 | #elif defined (SFML_SYSTEM_IOS) 62 | 63 | #include 64 | #include 65 | 66 | #elif defined (SFML_SYSTEM_ANDROID) 67 | 68 | #include 69 | #include 70 | 71 | #endif 72 | 73 | 74 | #endif // SFML_OPENGL_HPP 75 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SYSTEM_HPP 26 | #define SFML_SYSTEM_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #endif // SFML_SYSTEM_HPP 52 | 53 | //////////////////////////////////////////////////////////// 54 | /// \defgroup system System module 55 | /// 56 | /// Base module of SFML, defining various utilities. It provides 57 | /// vector classes, Unicode strings and conversion functions, 58 | /// threads and mutexes, timing classes. 59 | /// 60 | //////////////////////////////////////////////////////////// 61 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Clock.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_CLOCK_HPP 26 | #define SFML_CLOCK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Utility class that measures the elapsed time 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_SYSTEM_API Clock 42 | { 43 | public: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | /// The clock starts automatically after being constructed. 49 | /// 50 | //////////////////////////////////////////////////////////// 51 | Clock(); 52 | 53 | //////////////////////////////////////////////////////////// 54 | /// \brief Get the elapsed time 55 | /// 56 | /// This function returns the time elapsed since the last call 57 | /// to restart() (or the construction of the instance if restart() 58 | /// has not been called). 59 | /// 60 | /// \return Time elapsed 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | Time getElapsedTime() const; 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \brief Restart the clock 67 | /// 68 | /// This function puts the time counter back to zero. 69 | /// It also returns the time elapsed since the clock was started. 70 | /// 71 | /// \return Time elapsed 72 | /// 73 | //////////////////////////////////////////////////////////// 74 | Time restart(); 75 | 76 | private: 77 | 78 | //////////////////////////////////////////////////////////// 79 | // Member data 80 | //////////////////////////////////////////////////////////// 81 | Time m_startTime; ///< Time of last reset, in microseconds 82 | }; 83 | 84 | } // namespace sf 85 | 86 | 87 | #endif // SFML_CLOCK_HPP 88 | 89 | 90 | //////////////////////////////////////////////////////////// 91 | /// \class sf::Clock 92 | /// \ingroup system 93 | /// 94 | /// sf::Clock is a lightweight class for measuring time. 95 | /// 96 | /// Its provides the most precise time that the underlying 97 | /// OS can achieve (generally microseconds or nanoseconds). 98 | /// It also ensures monotonicity, which means that the returned 99 | /// time can never go backward, even if the system time is 100 | /// changed. 101 | /// 102 | /// Usage example: 103 | /// \code 104 | /// sf::Clock clock; 105 | /// ... 106 | /// Time time1 = clock.getElapsedTime(); 107 | /// ... 108 | /// Time time2 = clock.restart(); 109 | /// \endcode 110 | /// 111 | /// The sf::Time value returned by the clock can then be 112 | /// converted to a number of seconds, milliseconds or even 113 | /// microseconds. 114 | /// 115 | /// \see sf::Time 116 | /// 117 | //////////////////////////////////////////////////////////// 118 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Err.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_ERR_HPP 26 | #define SFML_ERR_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \brief Standard stream used by SFML to output warnings and errors 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | SFML_SYSTEM_API std::ostream& err(); 42 | 43 | } // namespace sf 44 | 45 | 46 | #endif // SFML_ERR_HPP 47 | 48 | 49 | //////////////////////////////////////////////////////////// 50 | /// \fn sf::err 51 | /// \ingroup system 52 | /// 53 | /// By default, sf::err() outputs to the same location as std::cerr, 54 | /// (-> the stderr descriptor) which is the console if there's 55 | /// one available. 56 | /// 57 | /// It is a standard std::ostream instance, so it supports all the 58 | /// insertion operations defined by the STL 59 | /// (operator <<, manipulators, etc.). 60 | /// 61 | /// sf::err() can be redirected to write to another output, independently 62 | /// of std::cerr, by using the rdbuf() function provided by the 63 | /// std::ostream class. 64 | /// 65 | /// Example: 66 | /// \code 67 | /// // Redirect to a file 68 | /// std::ofstream file("sfml-log.txt"); 69 | /// std::streambuf* previous = sf::err().rdbuf(file.rdbuf()); 70 | /// 71 | /// // Redirect to nothing 72 | /// sf::err().rdbuf(NULL); 73 | /// 74 | /// // Restore the original output 75 | /// sf::err().rdbuf(previous); 76 | /// \endcode 77 | /// 78 | /// \return Reference to std::ostream representing the SFML error stream 79 | /// 80 | //////////////////////////////////////////////////////////// 81 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SYSTEM_EXPORT_HPP 26 | #define SFML_SYSTEM_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_SYSTEM_EXPORTS) 38 | 39 | #define SFML_SYSTEM_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_SYSTEM_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_SYSTEM_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Lock.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_LOCK_HPP 26 | #define SFML_LOCK_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | class Mutex; 38 | 39 | //////////////////////////////////////////////////////////// 40 | /// \brief Automatic wrapper for locking and unlocking mutexes 41 | /// 42 | //////////////////////////////////////////////////////////// 43 | class SFML_SYSTEM_API Lock : NonCopyable 44 | { 45 | public: 46 | 47 | //////////////////////////////////////////////////////////// 48 | /// \brief Construct the lock with a target mutex 49 | /// 50 | /// The mutex passed to sf::Lock is automatically locked. 51 | /// 52 | /// \param mutex Mutex to lock 53 | /// 54 | //////////////////////////////////////////////////////////// 55 | explicit Lock(Mutex& mutex); 56 | 57 | //////////////////////////////////////////////////////////// 58 | /// \brief Destructor 59 | /// 60 | /// The destructor of sf::Lock automatically unlocks its mutex. 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | ~Lock(); 64 | 65 | private: 66 | 67 | //////////////////////////////////////////////////////////// 68 | // Member data 69 | //////////////////////////////////////////////////////////// 70 | Mutex& m_mutex; ///< Mutex to lock / unlock 71 | }; 72 | 73 | } // namespace sf 74 | 75 | 76 | #endif // SFML_LOCK_HPP 77 | 78 | 79 | //////////////////////////////////////////////////////////// 80 | /// \class sf::Lock 81 | /// \ingroup system 82 | /// 83 | /// sf::Lock is a RAII wrapper for sf::Mutex. By unlocking 84 | /// it in its destructor, it ensures that the mutex will 85 | /// always be released when the current scope (most likely 86 | /// a function) ends. 87 | /// This is even more important when an exception or an early 88 | /// return statement can interrupt the execution flow of the 89 | /// function. 90 | /// 91 | /// For maximum robustness, sf::Lock should always be used 92 | /// to lock/unlock a mutex. 93 | /// 94 | /// Usage example: 95 | /// \code 96 | /// sf::Mutex mutex; 97 | /// 98 | /// void function() 99 | /// { 100 | /// sf::Lock lock(mutex); // mutex is now locked 101 | /// 102 | /// functionThatMayThrowAnException(); // mutex is unlocked if this function throws 103 | /// 104 | /// if (someCondition) 105 | /// return; // mutex is unlocked 106 | /// 107 | /// } // mutex is unlocked 108 | /// \endcode 109 | /// 110 | /// Because the mutex is not explicitly unlocked in the code, 111 | /// it may remain locked longer than needed. If the region 112 | /// of the code that needs to be protected by the mutex is 113 | /// not the entire function, a good practice is to create a 114 | /// smaller, inner scope so that the lock is limited to this 115 | /// part of the code. 116 | /// 117 | /// \code 118 | /// sf::Mutex mutex; 119 | /// 120 | /// void function() 121 | /// { 122 | /// { 123 | /// sf::Lock lock(mutex); 124 | /// codeThatRequiresProtection(); 125 | /// 126 | /// } // mutex is unlocked here 127 | /// 128 | /// codeThatDoesntCareAboutTheMutex(); 129 | /// } 130 | /// \endcode 131 | /// 132 | /// Having a mutex locked longer than required is a bad practice 133 | /// which can lead to bad performances. Don't forget that when 134 | /// a mutex is locked, other threads may be waiting doing nothing 135 | /// until it is released. 136 | /// 137 | /// \see sf::Mutex 138 | /// 139 | //////////////////////////////////////////////////////////// 140 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/NonCopyable.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_NONCOPYABLE_HPP 26 | #define SFML_NONCOPYABLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | namespace sf 35 | { 36 | //////////////////////////////////////////////////////////// 37 | /// \brief Utility class that makes any derived 38 | /// class non-copyable 39 | /// 40 | //////////////////////////////////////////////////////////// 41 | class SFML_SYSTEM_API NonCopyable 42 | { 43 | protected: 44 | 45 | //////////////////////////////////////////////////////////// 46 | /// \brief Default constructor 47 | /// 48 | /// Because this class has a copy constructor, the compiler 49 | /// will not automatically generate the default constructor. 50 | /// That's why we must define it explicitly. 51 | /// 52 | //////////////////////////////////////////////////////////// 53 | NonCopyable() {} 54 | 55 | private: 56 | 57 | //////////////////////////////////////////////////////////// 58 | /// \brief Disabled copy constructor 59 | /// 60 | /// By making the copy constructor private, the compiler will 61 | /// trigger an error if anyone outside tries to use it. 62 | /// To prevent NonCopyable or friend classes from using it, 63 | /// we also give no definition, so that the linker will 64 | /// produce an error if the first protection was inefficient. 65 | /// 66 | //////////////////////////////////////////////////////////// 67 | NonCopyable(const NonCopyable&); 68 | 69 | //////////////////////////////////////////////////////////// 70 | /// \brief Disabled assignment operator 71 | /// 72 | /// By making the assignment operator private, the compiler will 73 | /// trigger an error if anyone outside tries to use it. 74 | /// To prevent NonCopyable or friend classes from using it, 75 | /// we also give no definition, so that the linker will 76 | /// produce an error if the first protection was inefficient. 77 | /// 78 | //////////////////////////////////////////////////////////// 79 | NonCopyable& operator =(const NonCopyable&); 80 | }; 81 | 82 | } // namespace sf 83 | 84 | 85 | #endif // SFML_NONCOPYABLE_HPP 86 | 87 | 88 | //////////////////////////////////////////////////////////// 89 | /// \class sf::NonCopyable 90 | /// \ingroup system 91 | /// 92 | /// This class makes its instances non-copyable, by explicitly 93 | /// disabling its copy constructor and its assignment operator. 94 | /// 95 | /// To create a non-copyable class, simply inherit from 96 | /// sf::NonCopyable. 97 | /// 98 | /// The type of inheritance (public or private) doesn't matter, 99 | /// the copy constructor and assignment operator are declared private 100 | /// in sf::NonCopyable so they will end up being inaccessible in both 101 | /// cases. Thus you can use a shorter syntax for inheriting from it 102 | /// (see below). 103 | /// 104 | /// Usage example: 105 | /// \code 106 | /// class MyNonCopyableClass : sf::NonCopyable 107 | /// { 108 | /// ... 109 | /// }; 110 | /// \endcode 111 | /// 112 | /// Deciding whether the instances of a class can be copied 113 | /// or not is a very important design choice. You are strongly 114 | /// encouraged to think about it before writing a class, 115 | /// and to use sf::NonCopyable when necessary to prevent 116 | /// many potential future errors when using it. This is also 117 | /// a very important indication to users of your class. 118 | /// 119 | //////////////////////////////////////////////////////////// 120 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Sleep.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SLEEP_HPP 26 | #define SFML_SLEEP_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | 34 | 35 | namespace sf 36 | { 37 | //////////////////////////////////////////////////////////// 38 | /// \ingroup system 39 | /// \brief Make the current thread sleep for a given duration 40 | /// 41 | /// sf::sleep is the best way to block a program or one of its 42 | /// threads, as it doesn't consume any CPU power. 43 | /// 44 | /// \param duration Time to sleep 45 | /// 46 | //////////////////////////////////////////////////////////// 47 | void SFML_SYSTEM_API sleep(Time duration); 48 | 49 | } // namespace sf 50 | 51 | 52 | #endif // SFML_SLEEP_HPP 53 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/String.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | //////////////////////////////////////////////////////////// 27 | template 28 | String String::fromUtf8(T begin, T end) 29 | { 30 | String string; 31 | Utf8::toUtf32(begin, end, std::back_inserter(string.m_string)); 32 | return string; 33 | } 34 | 35 | 36 | //////////////////////////////////////////////////////////// 37 | template 38 | String String::fromUtf16(T begin, T end) 39 | { 40 | String string; 41 | Utf16::toUtf32(begin, end, std::back_inserter(string.m_string)); 42 | return string; 43 | } 44 | 45 | 46 | //////////////////////////////////////////////////////////// 47 | template 48 | String String::fromUtf32(T begin, T end) 49 | { 50 | String string; 51 | string.m_string.assign(begin, end); 52 | return string; 53 | } 54 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/Thread.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | namespace priv 26 | { 27 | // Base class for abstract thread functions 28 | struct ThreadFunc 29 | { 30 | virtual ~ThreadFunc() {} 31 | virtual void run() = 0; 32 | }; 33 | 34 | // Specialization using a functor (including free functions) with no argument 35 | template 36 | struct ThreadFunctor : ThreadFunc 37 | { 38 | ThreadFunctor(T functor) : m_functor(functor) {} 39 | virtual void run() {m_functor();} 40 | T m_functor; 41 | }; 42 | 43 | // Specialization using a functor (including free functions) with one argument 44 | template 45 | struct ThreadFunctorWithArg : ThreadFunc 46 | { 47 | ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {} 48 | virtual void run() {m_function(m_arg);} 49 | F m_function; 50 | A m_arg; 51 | }; 52 | 53 | // Specialization using a member function 54 | template 55 | struct ThreadMemberFunc : ThreadFunc 56 | { 57 | ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {} 58 | virtual void run() {(m_object->*m_function)();} 59 | void(C::*m_function)(); 60 | C* m_object; 61 | }; 62 | 63 | } // namespace priv 64 | 65 | 66 | //////////////////////////////////////////////////////////// 67 | template 68 | Thread::Thread(F functor) : 69 | m_impl (NULL), 70 | m_entryPoint(new priv::ThreadFunctor(functor)) 71 | { 72 | } 73 | 74 | 75 | //////////////////////////////////////////////////////////// 76 | template 77 | Thread::Thread(F function, A argument) : 78 | m_impl (NULL), 79 | m_entryPoint(new priv::ThreadFunctorWithArg(function, argument)) 80 | { 81 | } 82 | 83 | 84 | //////////////////////////////////////////////////////////// 85 | template 86 | Thread::Thread(void(C::*function)(), C* object) : 87 | m_impl (NULL), 88 | m_entryPoint(new priv::ThreadMemberFunc(function, object)) 89 | { 90 | } 91 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/ThreadLocal.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_THREADLOCAL_HPP 26 | #define SFML_THREADLOCAL_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | namespace sf 37 | { 38 | namespace priv 39 | { 40 | class ThreadLocalImpl; 41 | } 42 | 43 | //////////////////////////////////////////////////////////// 44 | /// \brief Defines variables with thread-local storage 45 | /// 46 | //////////////////////////////////////////////////////////// 47 | class SFML_SYSTEM_API ThreadLocal : NonCopyable 48 | { 49 | public: 50 | 51 | //////////////////////////////////////////////////////////// 52 | /// \brief Default constructor 53 | /// 54 | /// \param value Optional value to initialize the variable 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | ThreadLocal(void* value = NULL); 58 | 59 | //////////////////////////////////////////////////////////// 60 | /// \brief Destructor 61 | /// 62 | //////////////////////////////////////////////////////////// 63 | ~ThreadLocal(); 64 | 65 | //////////////////////////////////////////////////////////// 66 | /// \brief Set the thread-specific value of the variable 67 | /// 68 | /// \param value Value of the variable for the current thread 69 | /// 70 | //////////////////////////////////////////////////////////// 71 | void setValue(void* value); 72 | 73 | //////////////////////////////////////////////////////////// 74 | /// \brief Retrieve the thread-specific value of the variable 75 | /// 76 | /// \return Value of the variable for the current thread 77 | /// 78 | //////////////////////////////////////////////////////////// 79 | void* getValue() const; 80 | 81 | private: 82 | 83 | //////////////////////////////////////////////////////////// 84 | // Member data 85 | //////////////////////////////////////////////////////////// 86 | priv::ThreadLocalImpl* m_impl; ///< Pointer to the OS specific implementation 87 | }; 88 | 89 | } // namespace sf 90 | 91 | 92 | #endif // SFML_THREADLOCAL_HPP 93 | 94 | 95 | //////////////////////////////////////////////////////////// 96 | /// \class sf::ThreadLocal 97 | /// \ingroup system 98 | /// 99 | /// This class manipulates void* parameters and thus is not 100 | /// appropriate for strongly-typed variables. You should rather 101 | /// use the sf::ThreadLocalPtr template class. 102 | /// 103 | //////////////////////////////////////////////////////////// 104 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/System/ThreadLocalPtr.inl: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | 26 | namespace sf 27 | { 28 | //////////////////////////////////////////////////////////// 29 | template 30 | ThreadLocalPtr::ThreadLocalPtr(T* value) : 31 | ThreadLocal(value) 32 | { 33 | } 34 | 35 | 36 | //////////////////////////////////////////////////////////// 37 | template 38 | T& ThreadLocalPtr::operator *() const 39 | { 40 | return *static_cast(getValue()); 41 | } 42 | 43 | 44 | //////////////////////////////////////////////////////////// 45 | template 46 | T* ThreadLocalPtr::operator ->() const 47 | { 48 | return static_cast(getValue()); 49 | } 50 | 51 | 52 | //////////////////////////////////////////////////////////// 53 | template 54 | ThreadLocalPtr::operator T*() const 55 | { 56 | return static_cast(getValue()); 57 | } 58 | 59 | 60 | //////////////////////////////////////////////////////////// 61 | template 62 | ThreadLocalPtr& ThreadLocalPtr::operator =(T* value) 63 | { 64 | setValue(value); 65 | return *this; 66 | } 67 | 68 | 69 | //////////////////////////////////////////////////////////// 70 | template 71 | ThreadLocalPtr& ThreadLocalPtr::operator =(const ThreadLocalPtr& right) 72 | { 73 | setValue(right.getValue()); 74 | return *this; 75 | } 76 | 77 | } // namespace sf 78 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Window.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_SFML_WINDOW_HPP 26 | #define SFML_SFML_WINDOW_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | 47 | 48 | #endif // SFML_SFML_WINDOW_HPP 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \defgroup window Window module 52 | /// 53 | /// Provides OpenGL-based windows, and abstractions for 54 | /// events and input handling. 55 | /// 56 | //////////////////////////////////////////////////////////// 57 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Window/Export.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOW_EXPORT_HPP 26 | #define SFML_WINDOW_EXPORT_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Define portable import / export macros 36 | //////////////////////////////////////////////////////////// 37 | #if defined(SFML_WINDOW_EXPORTS) 38 | 39 | #define SFML_WINDOW_API SFML_API_EXPORT 40 | 41 | #else 42 | 43 | #define SFML_WINDOW_API SFML_API_IMPORT 44 | 45 | #endif 46 | 47 | 48 | #endif // SFML_WINDOW_EXPORT_HPP 49 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Window/GlResource.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_GLRESOURCE_HPP 26 | #define SFML_GLRESOURCE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | 34 | namespace sf 35 | { 36 | //////////////////////////////////////////////////////////// 37 | /// \brief Base class for classes that require an OpenGL context 38 | /// 39 | //////////////////////////////////////////////////////////// 40 | class SFML_WINDOW_API GlResource 41 | { 42 | protected: 43 | 44 | //////////////////////////////////////////////////////////// 45 | /// \brief Default constructor 46 | /// 47 | //////////////////////////////////////////////////////////// 48 | GlResource(); 49 | 50 | //////////////////////////////////////////////////////////// 51 | /// \brief Destructor 52 | /// 53 | //////////////////////////////////////////////////////////// 54 | ~GlResource(); 55 | 56 | //////////////////////////////////////////////////////////// 57 | /// \brief Make sure that a valid OpenGL context exists in the current thread 58 | /// 59 | //////////////////////////////////////////////////////////// 60 | static void ensureGlContext(); 61 | }; 62 | 63 | } // namespace sf 64 | 65 | 66 | #endif // SFML_GLRESOURCE_HPP 67 | 68 | //////////////////////////////////////////////////////////// 69 | /// \class sf::GlResource 70 | /// \ingroup window 71 | /// 72 | /// This class is for internal use only, it must be the base 73 | /// of every class that requires a valid OpenGL context in 74 | /// order to work. 75 | /// 76 | //////////////////////////////////////////////////////////// 77 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Window/WindowHandle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOWHANDLE_HPP 26 | #define SFML_WINDOWHANDLE_HPP 27 | 28 | //////////////////////////////////////////////////////////// 29 | // Headers 30 | //////////////////////////////////////////////////////////// 31 | #include 32 | 33 | // Windows' HWND is a typedef on struct HWND__* 34 | #if defined(SFML_SYSTEM_WINDOWS) 35 | struct HWND__; 36 | #endif 37 | 38 | namespace sf 39 | { 40 | //////////////////////////////////////////////////////////// 41 | /// Define a low-level window handle type, specific to 42 | /// each platform 43 | //////////////////////////////////////////////////////////// 44 | #if defined(SFML_SYSTEM_WINDOWS) 45 | 46 | // Window handle is HWND (HWND__*) on Windows 47 | typedef HWND__* WindowHandle; 48 | 49 | #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) 50 | 51 | // Window handle is Window (unsigned long) on Unix - X11 52 | typedef unsigned long WindowHandle; 53 | 54 | #elif defined(SFML_SYSTEM_MACOS) 55 | 56 | // Window handle is NSWindow (void*) on Mac OS X - Cocoa 57 | typedef void* WindowHandle; 58 | 59 | #elif defined(SFML_SYSTEM_IOS) 60 | 61 | // Window handle is UIWindow (void*) on iOS - UIKit 62 | typedef void* WindowHandle; 63 | 64 | #elif defined(SFML_SYSTEM_ANDROID) 65 | 66 | // Window handle is ANativeWindow (void*) on Android 67 | typedef void* WindowHandle; 68 | 69 | #endif 70 | 71 | } // namespace sf 72 | 73 | 74 | #endif // SFML_WINDOWHANDLE_HPP 75 | -------------------------------------------------------------------------------- /Libraries/SFML/include/SFML/Window/WindowStyle.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // SFML - Simple and Fast Multimedia Library 4 | // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) 5 | // 6 | // This software is provided 'as-is', without any express or implied warranty. 7 | // In no event will the authors be held liable for any damages arising from the use of this software. 8 | // 9 | // Permission is granted to anyone to use this software for any purpose, 10 | // including commercial applications, and to alter it and redistribute it freely, 11 | // subject to the following restrictions: 12 | // 13 | // 1. The origin of this software must not be misrepresented; 14 | // you must not claim that you wrote the original software. 15 | // If you use this software in a product, an acknowledgment 16 | // in the product documentation would be appreciated but is not required. 17 | // 18 | // 2. Altered source versions must be plainly marked as such, 19 | // and must not be misrepresented as being the original software. 20 | // 21 | // 3. This notice may not be removed or altered from any source distribution. 22 | // 23 | //////////////////////////////////////////////////////////// 24 | 25 | #ifndef SFML_WINDOWSTYLE_HPP 26 | #define SFML_WINDOWSTYLE_HPP 27 | 28 | 29 | namespace sf 30 | { 31 | namespace Style 32 | { 33 | //////////////////////////////////////////////////////////// 34 | /// \ingroup window 35 | /// \brief Enumeration of the window styles 36 | /// 37 | //////////////////////////////////////////////////////////// 38 | enum 39 | { 40 | None = 0, ///< No border / title bar (this flag and all others are mutually exclusive) 41 | Titlebar = 1 << 0, ///< Title bar + fixed border 42 | Resize = 1 << 1, ///< Title bar + resizable border + maximize button 43 | Close = 1 << 2, ///< Title bar + close button 44 | Fullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive) 45 | 46 | Default = Titlebar | Resize | Close ///< Default window style 47 | }; 48 | } 49 | 50 | } // namespace sf 51 | 52 | 53 | #endif // SFML_WINDOWSTYLE_HPP 54 | -------------------------------------------------------------------------------- /Libraries/SFML/lib/flac.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/flac.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/freetype.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/freetype.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/jpeg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/jpeg.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/ogg.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/ogg.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/openal32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/openal32.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-audio-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-audio-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-audio-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-audio-s-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-audio-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-audio-s.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-audio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-audio.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-graphics-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-graphics-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-graphics-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-graphics-s-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-graphics-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-graphics-s.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-graphics.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-graphics.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-main-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-main-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-main.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-network-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-network-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-network-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-network-s-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-network-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-network-s.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-network.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-network.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-system-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-system-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-system-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-system-s-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-system-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-system-s.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-system.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-system.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-window-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-window-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-window-s-d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-window-s-d.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-window-s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-window-s.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/sfml-window.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/sfml-window.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/vorbis.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/vorbis.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/vorbisenc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/vorbisenc.lib -------------------------------------------------------------------------------- /Libraries/SFML/lib/vorbisfile.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Libraries/SFML/lib/vorbisfile.lib -------------------------------------------------------------------------------- /Libraries/SFML/license.txt: -------------------------------------------------------------------------------- 1 | SFML 2 | ---- 3 | 4 | SFML - Copyright (C) 2007-2015 Laurent Gomila - laurent@sfml-dev.org 5 | 6 | This software is provided 'as-is', without any express or 7 | implied warranty. In no event will the authors be held 8 | liable for any damages arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute 12 | it freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; 15 | you must not claim that you wrote the original software. 16 | If you use this software in a product, an acknowledgment 17 | in the product documentation would be appreciated but 18 | is not required. 19 | 20 | 2. Altered source versions must be plainly marked as such, 21 | and must not be misrepresented as being the original software. 22 | 23 | 3. This notice may not be removed or altered from any 24 | source distribution. 25 | 26 | 27 | 28 | External libraries used by SFML 29 | ------------------------------- 30 | 31 | * OpenAL-Soft is under the LGPL license 32 | * libjpeg is public domain 33 | * stb_image and stb_image_write are public domain 34 | * freetype is under the FreeType license or the GPL license 35 | * libogg is under the BSD license 36 | * libvorbis is under the BSD license 37 | * libflac is under the BSD license 38 | -------------------------------------------------------------------------------- /Libraries/SFML/readme.txt: -------------------------------------------------------------------------------- 1 | SFML - Simple and Fast Multimedia Library 2 | ========================================= 3 | 4 | SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. 5 | It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. 6 | 7 | Authors 8 | ------- 9 | 10 | Laurent Gomila - main developer (laurent@sfml-dev.org) 11 | Marco Antognini - OS X developer (hiura@sfml-dev.org) 12 | Jonathan De Wachter - Android developer (dewachter.jonathan@gmail.com) 13 | Jan Haller (bromeon@sfml-dev.org) 14 | Stefan Schindler (tank@sfml-dev.org) 15 | Lukas Dürrenberger (eXpl0it3r@sfml-dev.org) 16 | binary1248 (binary1248@hotmail.com) 17 | Artur Moreira (artturmoreira@gmail.com) 18 | Mario Liebisch (mario@sfml-dev.org) 19 | 20 | Download 21 | -------- 22 | 23 | You can get the latest official release on SFML website (http://www.sfml-dev.org/download.php). 24 | You can also get the current development version from the git repository (https://github.com/SFML/SFML). 25 | 26 | Install 27 | ------- 28 | 29 | Follow the instructions of the tutorials (http://www.sfml-dev.org/tutorials/), there is one for each platform/compiler that SFML supports. 30 | 31 | Learn 32 | ----- 33 | 34 | There are several places to learn SFML: 35 | * The official tutorials (http://www.sfml-dev.org/tutorials/) 36 | * The online API documentation (http://www.sfml-dev.org/documentation/) 37 | * The community wiki (https://github.com/SFML/SFML/wiki/) 38 | * The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for French people) 39 | 40 | Contribute 41 | ---------- 42 | 43 | SFML is an open-source project, and it needs your help to go on growing and improving. 44 | If you want to get involved and suggest some additional features, file a bug report or submit a patch, please have a look at the contribution guidelines (http://www.sfml-dev.org/contribute.php). 45 | -------------------------------------------------------------------------------- /PolyMapGenerator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25115.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PolyMapGenerator", "PolyMapGenerator\PolyMapGenerator.vcxproj", "{755489A7-45DF-4A95-93F0-A2320B23A041}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PolyMapGeneratorTest", "PolyMapGeneratorTest\PolyMapGeneratorTest.vcxproj", "{400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiskSampling", "DiskSampling\DiskSampling.vcxproj", "{4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Debug|x64.ActiveCfg = Debug|x64 21 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Debug|x64.Build.0 = Debug|x64 22 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Debug|x86.ActiveCfg = Debug|Win32 23 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Debug|x86.Build.0 = Debug|Win32 24 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Release|x64.ActiveCfg = Release|x64 25 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Release|x64.Build.0 = Release|x64 26 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Release|x86.ActiveCfg = Release|Win32 27 | {755489A7-45DF-4A95-93F0-A2320B23A041}.Release|x86.Build.0 = Release|Win32 28 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Debug|x64.ActiveCfg = Debug|x64 29 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Debug|x64.Build.0 = Debug|x64 30 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Debug|x86.ActiveCfg = Debug|Win32 31 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Debug|x86.Build.0 = Debug|Win32 32 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Release|x64.ActiveCfg = Release|x64 33 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Release|x64.Build.0 = Release|x64 34 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Release|x86.ActiveCfg = Release|Win32 35 | {400114E7-3B34-4820-A7D9-E5FB4FB0DFB4}.Release|x86.Build.0 = Release|Win32 36 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Debug|x64.ActiveCfg = Debug|x64 37 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Debug|x64.Build.0 = Debug|x64 38 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Debug|x86.ActiveCfg = Debug|Win32 39 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Debug|x86.Build.0 = Debug|Win32 40 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Release|x64.ActiveCfg = Release|x64 41 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Release|x64.Build.0 = Release|x64 42 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Release|x86.ActiveCfg = Release|Win32 43 | {4B68AB8B-6B01-4EB1-9279-3BDBA6EAA551}.Release|x86.Build.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /PolyMapGenerator/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 -------------------------------------------------------------------------------- /PolyMapGenerator/Map.h: -------------------------------------------------------------------------------- 1 | #ifndef MAP_H 2 | #define MAP_H 3 | 4 | #include 5 | #include 6 | 7 | #include "DelaunayTriangulation.h" 8 | #include "Structure.h" 9 | #include "QuadTree.h" 10 | 11 | // Forward Declaration 12 | class Vector2; 13 | namespace noise 14 | { 15 | namespace module 16 | { 17 | class Perlin; 18 | } 19 | } 20 | 21 | class Map 22 | { 23 | public: 24 | Map() = default; 25 | Map(int width, int height, double pointSpread, std::string seed); 26 | 27 | ~Map() = default; 28 | 29 | Map(const Map& map) = delete; 30 | Map(Map&& map) = delete; 31 | 32 | Map& operator=(const Map& map) = delete; 33 | Map& operator=(Map&& map) = delete; 34 | 35 | void Generate(); 36 | 37 | void GeneratePolygons(); 38 | void GenerateLand(); 39 | 40 | std::vector GetEdges() const; 41 | std::vector GetCorners() const; 42 | std::vector GetCenters() const; 43 | 44 | Center* GetCenterAt(Vector2 pos); 45 | 46 | private: 47 | int m_mapWidth; 48 | int m_mapHeight; 49 | double m_pointSpread; 50 | double m_zCoord; 51 | noise::module::Perlin* m_noiseMap; 52 | std::string m_seed; 53 | QuadTree m_centersQuadTree; 54 | 55 | std::vector m_points; 56 | 57 | std::map> m_posCenterMap; 58 | std::vector m_edges; 59 | std::vector m_corners; 60 | std::vector m_centers; 61 | 62 | static const std::vector> m_elevationMoistureMatrix; 63 | static std::vector> MakeBiomeMatrix(); 64 | 65 | bool IsIsland(Vector2 position) const; 66 | void CalculateDownslopes(); 67 | void GenerateRivers(); 68 | void AssignOceanCoastLand(); 69 | void RedistributeElevations(); 70 | void AssignCornerElevations(); 71 | void AssignPolygonElevations(); 72 | void RedistributeMoisture(); 73 | void AssignCornerMoisture(); 74 | void AssignPolygonMoisture(); 75 | void AssignBiomes(); 76 | 77 | void GeneratePoints(); 78 | void Triangulate(std::vector points); 79 | void FinishInfo(); 80 | void AddCenter(Center* c); 81 | Center* GetCenter(Vector2 position); 82 | 83 | std::vector GetLandCorners(); 84 | std::vector GetLakeCorners(); 85 | void LloydRelaxation(); 86 | std::string CreateSeed(int length) const; 87 | 88 | static unsigned int HashString(std::string seed); 89 | }; 90 | 91 | #endif -------------------------------------------------------------------------------- /PolyMapGenerator/Math/LineEquation.cpp: -------------------------------------------------------------------------------- 1 | #include "LineEquation.h" 2 | 3 | LineEquation::LineEquation() : 4 | m(0.0), 5 | b(0.0), 6 | vertical(false) 7 | { 8 | 9 | } 10 | 11 | LineEquation::LineEquation(Vector2 p1, Vector2 p2) 12 | { 13 | if (p1.x != p2.x) 14 | { 15 | m = (p2.y - p1.y) / (p2.x - p1.x); 16 | b = p1.y - p1.y * m; 17 | vertical = false; 18 | } 19 | else 20 | { 21 | m = 0.0; 22 | b = p1.x; 23 | vertical = true; 24 | } 25 | } 26 | 27 | LineEquation::LineEquation(Vector2 p, double _m) : 28 | m(_m) 29 | { 30 | if (m != 0) 31 | { 32 | b = p.y - p.x * m; 33 | vertical = false; 34 | } 35 | else 36 | { 37 | b = p.x; 38 | vertical = true; 39 | } 40 | } 41 | 42 | LineEquation::~LineEquation() 43 | { 44 | m = 0.0; 45 | b = 0.0; 46 | vertical = false; 47 | } 48 | 49 | LineEquation::LineEquation(const LineEquation& e) : 50 | m(e.m), 51 | b(e.b), 52 | vertical(e.vertical) 53 | { 54 | 55 | } 56 | 57 | LineEquation::LineEquation(LineEquation&& e) : 58 | m(e.m), 59 | b(e.b), 60 | vertical(e.vertical) 61 | { 62 | 63 | } 64 | 65 | LineEquation& LineEquation::operator=(const LineEquation& e) 66 | { 67 | if (&e == this) 68 | { 69 | return *this; 70 | } 71 | 72 | m = e.m; 73 | b = e.b; 74 | vertical = e.vertical; 75 | 76 | return *this; 77 | } 78 | 79 | LineEquation& LineEquation::operator=(LineEquation&& e) 80 | { 81 | if (&e == this) 82 | { 83 | return *this; 84 | } 85 | 86 | m = e.m; 87 | b = e.b; 88 | vertical = e.vertical; 89 | 90 | return *this; 91 | } 92 | 93 | double LineEquation::operator()(const double x) const 94 | { 95 | return x * m + b; 96 | } 97 | 98 | void LineEquation::Move(const Vector2 v) 99 | { 100 | Vector2 p0, p1; 101 | 102 | if (vertical) 103 | { 104 | p0 = Vector2(b, 0); 105 | p1 = Vector2(b, 1); 106 | } 107 | else 108 | { 109 | p0 = Vector2(0, b); 110 | p1 = Vector2(1, m + b); 111 | } 112 | 113 | p0 += Vector2(v.x, v.y); 114 | p1 += Vector2(v.x, v.y); 115 | 116 | *this = LineEquation(p0, p1); 117 | } 118 | 119 | Vector2 LineEquation::Intersection(LineEquation& e) const 120 | { 121 | double x, y; 122 | 123 | if (m != e.m) 124 | { 125 | if (vertical) 126 | { 127 | x = b; 128 | y = e(x); 129 | } 130 | else if (e.vertical) 131 | { 132 | x = e.b; 133 | y = x * m + b; 134 | } 135 | else 136 | { 137 | x = (e.b - b) / (m - e.m); 138 | y = e(x); 139 | } 140 | } 141 | else 142 | { 143 | if (vertical == e.vertical) 144 | { 145 | x = 0.0; 146 | y = 0.0; 147 | } 148 | else 149 | { 150 | if (vertical) 151 | { 152 | x = b; 153 | y = e.b; 154 | } 155 | else 156 | { 157 | x = e.b; 158 | y = b; 159 | } 160 | } 161 | } 162 | 163 | return Vector2(x, y); 164 | } 165 | 166 | bool LineEquation::IsHorizontal() const 167 | { 168 | return !vertical && m == 0; 169 | } 170 | 171 | bool LineEquation::IsVertical() const 172 | { 173 | return vertical; 174 | } 175 | -------------------------------------------------------------------------------- /PolyMapGenerator/Math/LineEquation.h: -------------------------------------------------------------------------------- 1 | #ifndef LINE_EQUATION_H 2 | #define LINE_EQUATION_H 3 | 4 | #include "Vector2.h" 5 | 6 | class LineEquation 7 | { 8 | public: 9 | LineEquation(); 10 | LineEquation(Vector2 p1, Vector2 p2); 11 | LineEquation(Vector2 p, double _m); 12 | 13 | ~LineEquation(); 14 | 15 | LineEquation(const LineEquation& e); 16 | LineEquation(LineEquation&& e); 17 | 18 | LineEquation& operator=(const LineEquation& e); 19 | LineEquation& operator=(LineEquation&& e); 20 | 21 | double operator()(const double x) const; 22 | 23 | void Move(const Vector2 v); 24 | Vector2 Intersection(LineEquation& e) const; 25 | bool IsHorizontal() const; 26 | bool IsVertical() const; 27 | 28 | double m; 29 | double b; 30 | bool vertical; 31 | }; 32 | 33 | #endif -------------------------------------------------------------------------------- /PolyMapGenerator/Math/Vector2.h: -------------------------------------------------------------------------------- 1 | #ifndef VECTOR2_H 2 | #define VECTOR2_H 3 | 4 | class Vector2 5 | { 6 | public: 7 | Vector2(); 8 | Vector2(double angle); 9 | Vector2(double _x, double _y); 10 | Vector2(const Vector2& v1, const Vector2& v2); 11 | 12 | ~Vector2(); 13 | 14 | Vector2(const Vector2& v); 15 | Vector2(Vector2&& v); 16 | 17 | Vector2& operator=(const Vector2& v); 18 | Vector2& operator=(Vector2&& v); 19 | 20 | Vector2& operator+=(const Vector2& v); 21 | Vector2& operator+=(const double f); 22 | 23 | Vector2& operator-=(const Vector2& v); 24 | Vector2& operator-=(const double f); 25 | 26 | Vector2& operator*=(const double f); 27 | 28 | Vector2& operator/=(const double f); 29 | 30 | bool operator==(const Vector2& v) const; 31 | bool operator!=(const Vector2& v) const; 32 | 33 | void Normalize(); 34 | void Reflect(const Vector2& v); 35 | void Reverse(); 36 | void Truncate(double maxLength); 37 | 38 | void RotateByDegree(double degree); 39 | void RotateByRadian(double radian); 40 | 41 | double DotProduct(const Vector2& v) const; 42 | double CrossProduct(const Vector2& v) const; 43 | 44 | double Length() const; 45 | double LengthSqrt() const; 46 | 47 | double Distance(const Vector2& v) const; 48 | double DistanceSqrt(const Vector2& v) const; 49 | 50 | double GetAngleByDegree() const; 51 | double GetAngleByDegree(const Vector2& v) const; 52 | double GetAngleByRadian() const; 53 | double GetAngleByRadian(const Vector2& v) const; 54 | 55 | bool Sign(const Vector2& v) const; 56 | bool IsZero() const; 57 | 58 | double x, y; 59 | }; 60 | 61 | Vector2 operator+(const Vector2& lhs, const Vector2& rhs); 62 | Vector2 operator-(const Vector2& lhs, const Vector2& rhs); 63 | Vector2 operator*(const double fac, const Vector2& rhs); 64 | Vector2 operator*(const Vector2& lhs, const double fac); 65 | Vector2 operator/(const Vector2& lhs, const double fac); 66 | 67 | Vector2 Normalize(const Vector2& v); 68 | Vector2 Reflect(const Vector2& v1, const Vector2& v2); 69 | Vector2 Reverse(const Vector2& v); 70 | Vector2 Truncate(const Vector2& v, double maxLength); 71 | 72 | Vector2 RotateByDegree(const Vector2& v, double degree); 73 | Vector2 RotateByRadian(const Vector2& v, double radian); 74 | 75 | double Distance(const Vector2& v1, const Vector2& v2); 76 | 77 | #endif -------------------------------------------------------------------------------- /PolyMapGenerator/PolyMapGenerator.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 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | -------------------------------------------------------------------------------- /PolyMapGenerator/Structure.h: -------------------------------------------------------------------------------- 1 | #ifndef STRUCTURE_H 2 | #define STRUCTURE_H 3 | 4 | #include 5 | 6 | #include "Math/Vector2.h" 7 | 8 | enum class BiomeType 9 | { 10 | Snow, 11 | Tundra, 12 | Mountain, 13 | Taiga, 14 | Shrubland, 15 | TemprateDesert, 16 | TemprateRainForest, 17 | TemprateDeciduousForest, 18 | Grassland, 19 | TropicalRainForest, 20 | TropicalSeasonalForest, 21 | SubtropicalDesert, 22 | Ocean, 23 | Lake, 24 | Beach, 25 | 26 | Size, 27 | None 28 | }; 29 | 30 | // Forward Declaration 31 | struct Edge; 32 | struct Corner; 33 | 34 | struct Center 35 | { 36 | Center() : 37 | m_index(0), m_position(0, 0), m_water(false), m_ocean(false), m_coast(false), m_border(false), 38 | m_biome(BiomeType::None), m_elevation(0.0), m_moisture(0.0) { } 39 | Center(unsigned int index, Vector2 position) : 40 | m_index(index), m_position(position), m_water(false), m_ocean(false), m_coast(false), m_border(false), 41 | m_biome(BiomeType::None), m_elevation(0.0), m_moisture(0.0) { } 42 | 43 | ~Center() = default; 44 | 45 | Center(const Center& center) = default; 46 | Center(Center&& center) = default; 47 | 48 | Center& operator=(const Center& center) = default; 49 | Center& operator=(Center&& center) = default; 50 | 51 | bool RemoveEdge(Edge* e); 52 | bool RemoveCorner(Corner* c); 53 | Edge* GetEdgeWith(Center* c); 54 | void MakeBorder(); 55 | bool IsInsideBoundingBox(int width, int height) const; 56 | bool IsContain(Vector2 pos); 57 | std::pair GetBoundingBox(); 58 | void SortCorners(); 59 | bool IsGoesBefore(Vector2 a, Vector2 b) const; 60 | 61 | unsigned int m_index; 62 | Vector2 m_position; 63 | 64 | bool m_water; 65 | bool m_ocean; 66 | bool m_coast; 67 | bool m_border; 68 | BiomeType m_biome; 69 | double m_elevation; 70 | double m_moisture; 71 | 72 | std::vector m_edges; 73 | std::vector m_corners; 74 | std::vector m_centers; 75 | 76 | using CenterIterator = std::vector::iterator; 77 | }; 78 | 79 | struct Edge 80 | { 81 | Edge() : m_index(0), m_d0(nullptr), m_d1(nullptr), m_v0(nullptr), m_v1(nullptr), m_riverVolume(0.0) { } 82 | Edge(unsigned int index, Center* center1, Center* center2, Corner* corner1, Corner* corner2); 83 | 84 | ~Edge() = default; 85 | 86 | Edge(const Edge& center) = default; 87 | Edge(Edge&& center) = default; 88 | 89 | Edge& operator=(const Edge& center) = default; 90 | Edge& operator=(Edge&& center) = default; 91 | 92 | bool Legalize(); 93 | bool Flip(); 94 | void SwitchCorner(Corner* oldCorner, Corner* newCorner); 95 | Corner* GetOppositeCorner(Corner* c) const; 96 | Center* GetOppositeCenter(Center* c) const; 97 | 98 | unsigned int m_index; 99 | 100 | Center* m_d0; 101 | Center* m_d1; 102 | Corner* m_v0; 103 | Corner* m_v1; 104 | 105 | Vector2 m_voronoiMidpoint; 106 | double m_riverVolume; 107 | 108 | using EdgeIterator = std::vector::iterator; 109 | }; 110 | 111 | struct Corner 112 | { 113 | Corner() : 114 | m_index(0), m_position(0, 0), m_water(false), m_ocean(false), m_coast(false), m_border(false), 115 | m_elevation(0.0), m_moisture(0.0), m_riverVolume(0.0), m_downslope(nullptr) { } 116 | Corner(unsigned int index, Vector2 position) : 117 | m_index(index), m_position(position), m_water(false), m_ocean(false), m_coast(false), m_border(false), 118 | m_elevation(0.0), m_moisture(0.0), m_riverVolume(0.0), m_downslope(nullptr) { } 119 | 120 | bool IsPointInCircumstanceCircle(Vector2 p); 121 | Vector2 CalculateCircumstanceCenter(); 122 | Center* GetOppositeCenter(Center* c0, Center* c1); 123 | Center* GetOppositeCenter(Edge* e); 124 | bool TouchesCenter(Center* c); 125 | Edge* GetEdgeConnecting(Center* c0, Center* c1); 126 | bool IsInsideBoundingBox(int width, int height) const; 127 | Edge* GetEdgeWith(Corner* c); 128 | 129 | static bool SortByElevation(Corner* c1, Corner* c2); 130 | static bool SortByMoisture(Corner* c1, Corner* c2); 131 | 132 | unsigned int m_index; 133 | Vector2 m_position; 134 | 135 | bool m_water; 136 | bool m_ocean; 137 | bool m_coast; 138 | bool m_border; 139 | double m_elevation; 140 | double m_moisture; 141 | double m_riverVolume; 142 | Corner* m_downslope; 143 | 144 | std::vector m_edges; 145 | std::vector m_corners; 146 | std::vector m_centers; 147 | 148 | using CornerIterator = std::vector::iterator; 149 | }; 150 | 151 | #endif -------------------------------------------------------------------------------- /PolyMapGeneratorTest/PolyMapGeneratorTest.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 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Polygonal Map Generator 2 | 3 | ###### Polygonal map generator for games. Generates island maps with a focus on mountains, rivers, coastlines. 4 | 5 | ## About 6 | 7 | Procedural Content Generation for Polygonal Maps. 8 | 9 | The main idea behind the algorithm is taken from [Amit's Polygonal Map Generation for Games](http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/). 10 | 11 | The main code of this repository is based on [Rellikiox's Map Generator](https://github.com/Rellikiox/MapGenerator). 12 | 13 | ## Features 14 | 15 | ### To-do 16 | 17 | #### Part 3 18 | 19 | * Using OpenGL or DirectX to represent 3D terrain (and remove dependency on SFML). 20 | * Implement math library for Vector3 to structure 3-dimensional points. 21 | * Create graphics tool to control parameters. 22 | 23 | #### Part 4 24 | 25 | * Add polygonal map generator for basement (e.g. lava, mineral, cave, ground water, and so on). 26 | 27 | ### Doing 28 | 29 | #### Part 2 30 | 31 | * Add parameters to control map generation (e.g. the number of islands, maximum heights of map, and so on). 32 | * Seed 33 | * The number of points 34 | * The size of map 35 | * The number of islands 36 | * The size of island 37 | * The number of rivers 38 | * The size of river 39 | * Noise 40 | * Biome ratio 41 | * Land ratio 42 | * Output data options 43 | * Etc 44 | * Create console tool to control these parameters. 45 | 46 | ### Done 47 | 48 | #### Part 1 49 | 50 | * Place a number of random but uniformly distributed points (using Poisson Disk Sampling). 51 | * Calculate the Voronoi diagram of the points (using Lloyd's algorithm). 52 | * Using Perlin Noise determine which cells are land and which are water. 53 | * Calculate the elevation of each point as its distance to the sea. Normalize all the heights. 54 | * Place river sources in random spots and let them flow downwards. 55 | * Calculate the moisture od each point given its distance to the sea (less moisture) and rivers (more moisture). 56 | * Using Conex Hull algorithm determine the order of points (for sf::ConvexShape). 57 | * Code refactoring - No warning messages at warning level 4. 58 | 59 | ## Screenshots 60 | 61 | ### Biomes 62 | 63 | 64 | 65 | ### Moistures 66 | 67 | 68 | 69 | ### Elevations 70 | 71 | 72 | 73 | ## Dependencies 74 | 75 | * libnoise 76 | * SFML 77 | 78 | ## License 79 | 80 | 81 | 82 | The class is licensed under the [MIT License](http://opensource.org/licenses/MIT): 83 | 84 | Copyright © 2016 [Chris Ohk](http://www.github.com/utiLForever) 85 | 86 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 87 | 88 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 89 | 90 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Screenshots/Biome - Version 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Screenshots/Biome - Version 1.jpg -------------------------------------------------------------------------------- /Screenshots/Elevation - Version 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Screenshots/Elevation - Version 1.jpg -------------------------------------------------------------------------------- /Screenshots/Moisture - Version 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/utilForever/PolyMapGenerator/0c442945c4f7c7f15b3628d6705d91a1c4b533d6/Screenshots/Moisture - Version 1.jpg --------------------------------------------------------------------------------