Moved all Noise-related files into a separate folder.
This commit is contained in:
parent
f683872f54
commit
2467d29a4e
@ -9,6 +9,7 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include
|
|||||||
set(FOLDERS
|
set(FOLDERS
|
||||||
OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ Bindings
|
OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ Bindings
|
||||||
WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs
|
WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs
|
||||||
|
Noise
|
||||||
)
|
)
|
||||||
|
|
||||||
SET (SRCS
|
SET (SRCS
|
||||||
@ -50,7 +51,6 @@ SET (SRCS
|
|||||||
MobProximityCounter.cpp
|
MobProximityCounter.cpp
|
||||||
MobSpawner.cpp
|
MobSpawner.cpp
|
||||||
MonsterConfig.cpp
|
MonsterConfig.cpp
|
||||||
Noise.cpp
|
|
||||||
ProbabDistrib.cpp
|
ProbabDistrib.cpp
|
||||||
RankManager.cpp
|
RankManager.cpp
|
||||||
RCONServer.cpp
|
RCONServer.cpp
|
||||||
@ -65,7 +65,8 @@ SET (SRCS
|
|||||||
VoronoiMap.cpp
|
VoronoiMap.cpp
|
||||||
WebAdmin.cpp
|
WebAdmin.cpp
|
||||||
World.cpp
|
World.cpp
|
||||||
main.cpp)
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
SET (HDRS
|
SET (HDRS
|
||||||
AllocationPool.h
|
AllocationPool.h
|
||||||
@ -120,11 +121,8 @@ SET (HDRS
|
|||||||
MobProximityCounter.h
|
MobProximityCounter.h
|
||||||
MobSpawner.h
|
MobSpawner.h
|
||||||
MonsterConfig.h
|
MonsterConfig.h
|
||||||
Noise.h
|
|
||||||
OctavedNoise.h
|
|
||||||
ProbabDistrib.h
|
ProbabDistrib.h
|
||||||
RankManager.h
|
RankManager.h
|
||||||
RidgedNoise.h
|
|
||||||
RCONServer.h
|
RCONServer.h
|
||||||
Root.h
|
Root.h
|
||||||
Scoreboard.h
|
Scoreboard.h
|
||||||
@ -139,7 +137,8 @@ SET (HDRS
|
|||||||
VoronoiMap.h
|
VoronoiMap.h
|
||||||
WebAdmin.h
|
WebAdmin.h
|
||||||
World.h
|
World.h
|
||||||
XMLParser.h)
|
XMLParser.h
|
||||||
|
)
|
||||||
|
|
||||||
include_directories(".")
|
include_directories(".")
|
||||||
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
|
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
|
||||||
@ -316,7 +315,7 @@ endif ()
|
|||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
target_link_libraries(${EXECUTABLE}
|
target_link_libraries(${EXECUTABLE}
|
||||||
OSSupport HTTPServer Bindings Items Blocks
|
OSSupport HTTPServer Bindings Items Blocks Noise
|
||||||
Protocol Generating Generating_Prefabs WorldStorage
|
Protocol Generating Generating_Prefabs WorldStorage
|
||||||
Mobs Entities Simulator UI BlockEntities PolarSSL++
|
Mobs Entities Simulator UI BlockEntities PolarSSL++
|
||||||
)
|
)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "BlockEntities/FlowerPotEntity.h"
|
#include "BlockEntities/FlowerPotEntity.h"
|
||||||
#include "Entities/Pickup.h"
|
#include "Entities/Pickup.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "Noise.h"
|
#include "Noise/Noise.h"
|
||||||
#include "Root.h"
|
#include "Root.h"
|
||||||
#include "MersenneTwister.h"
|
#include "MersenneTwister.h"
|
||||||
#include "Entities/Player.h"
|
#include "Entities/Player.h"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "Enchantments.h"
|
#include "Enchantments.h"
|
||||||
#include "WorldStorage/FastNBT.h"
|
#include "WorldStorage/FastNBT.h"
|
||||||
#include "FastRandom.h"
|
#include "FastRandom.h"
|
||||||
#include "Noise.h"
|
#include "Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Interfaces to the various biome generators:
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
#include "../VoronoiMap.h"
|
#include "../VoronoiMap.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GridStructGen.h"
|
#include "GridStructGen.h"
|
||||||
#include "../Noise.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "ChunkDesc.h"
|
#include "ChunkDesc.h"
|
||||||
#include "../BlockArea.h"
|
#include "../BlockArea.h"
|
||||||
#include "../Cuboid.h"
|
#include "../Cuboid.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
#include "../BlockEntities/BlockEntity.h"
|
#include "../BlockEntities/BlockEntity.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "HeiGen.h"
|
#include "HeiGen.h"
|
||||||
#include "../Noise.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
#include "FinishGen.h"
|
#include "FinishGen.h"
|
||||||
#include "../Noise.h"
|
|
||||||
#include "../BlockID.h"
|
#include "../BlockID.h"
|
||||||
#include "../Simulator/FluidSimulator.h" // for cFluidSimulator::CanWashAway()
|
#include "../Simulator/FluidSimulator.h" // for cFluidSimulator::CanWashAway()
|
||||||
#include "../Simulator/FireSimulator.h"
|
#include "../Simulator/FireSimulator.h"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
#include "../ProbabDistrib.h"
|
#include "../ProbabDistrib.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Interfaces to the various height generators:
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GridStructGen.h"
|
#include "GridStructGen.h"
|
||||||
#include "../Noise.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Each uses a slightly different approach to generating:
|
|||||||
|
|
||||||
#include "../Defines.h"
|
#include "../Defines.h"
|
||||||
#include "../Cuboid.h"
|
#include "../Cuboid.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GridStructGen.h"
|
#include "GridStructGen.h"
|
||||||
#include "../Noise.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ logs can overwrite others(leaves), but others shouldn't overwrite logs. This is
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../ChunkDef.h"
|
#include "../ChunkDef.h"
|
||||||
#include "../Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "ItemGrid.h"
|
#include "ItemGrid.h"
|
||||||
#include "Items/ItemHandler.h"
|
#include "Items/ItemHandler.h"
|
||||||
#include "Noise.h"
|
#include "Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
21
src/Noise/CMakeLists.txt
Normal file
21
src/Noise/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
project (MCServer)
|
||||||
|
|
||||||
|
include_directories ("${PROJECT_SOURCE_DIR}/../")
|
||||||
|
|
||||||
|
SET (SRCS
|
||||||
|
Noise.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
SET (HDRS
|
||||||
|
Noise.h
|
||||||
|
OctavedNoise.h
|
||||||
|
RidgedNoise.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
add_library(Noise ${SRCS} ${HDRS})
|
||||||
|
|
||||||
|
target_link_libraries(Noise OSSupport)
|
||||||
|
endif()
|
@ -695,13 +695,6 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cCubicNoise:
|
// cCubicNoise:
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
int cCubicNoise::m_NumSingleX = 0;
|
|
||||||
int cCubicNoise::m_NumSingleXY = 0;
|
|
||||||
int cCubicNoise::m_NumSingleY = 0;
|
|
||||||
int cCubicNoise::m_NumCalls = 0;
|
|
||||||
#endif // _DEBUG
|
|
||||||
|
|
||||||
cCubicNoise::cCubicNoise(int a_Seed) :
|
cCubicNoise::cCubicNoise(int a_Seed) :
|
||||||
m_Noise(a_Seed)
|
m_Noise(a_Seed)
|
||||||
{
|
{
|
||||||
@ -740,23 +733,6 @@ void cCubicNoise::Generate2D(
|
|||||||
|
|
||||||
Cell.InitWorkRnds(FloorX[0], FloorY[0]);
|
Cell.InitWorkRnds(FloorX[0], FloorY[0]);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
// Statistics on the noise-space coords:
|
|
||||||
if (NumSameX == 1)
|
|
||||||
{
|
|
||||||
m_NumSingleX++;
|
|
||||||
if (NumSameY == 1)
|
|
||||||
{
|
|
||||||
m_NumSingleXY++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NumSameY == 1)
|
|
||||||
{
|
|
||||||
m_NumSingleY++;
|
|
||||||
}
|
|
||||||
m_NumCalls++;
|
|
||||||
#endif // _DEBUG
|
|
||||||
|
|
||||||
// Calculate query values using Cell:
|
// Calculate query values using Cell:
|
||||||
int FromY = 0;
|
int FromY = 0;
|
||||||
for (int y = 0; y < NumSameY; y++)
|
for (int y = 0; y < NumSameY; y++)
|
@ -65,19 +65,15 @@ private:
|
|||||||
class cCubicNoise
|
class cCubicNoise
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const int MAX_SIZE = 512; ///< Maximum size of each dimension of the query arrays.
|
/** Maximum size of each dimension of the query arrays. */
|
||||||
|
static const int MAX_SIZE = 512;
|
||||||
|
|
||||||
|
|
||||||
|
/** Creates a new instance with the specified seed. */
|
||||||
cCubicNoise(int a_Seed);
|
cCubicNoise(int a_Seed);
|
||||||
|
|
||||||
|
|
||||||
void Generate1D(
|
/** Fills a 2D array with the values of the noise. */
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into
|
|
||||||
int a_SizeX, ///< Count of the array
|
|
||||||
NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX ///< Noise-space coords of the array
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
void Generate2D(
|
void Generate2D(
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y]
|
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y]
|
||||||
int a_SizeX, int a_SizeY, ///< Count of the array, in each direction
|
int a_SizeX, int a_SizeY, ///< Count of the array, in each direction
|
||||||
@ -86,6 +82,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
/** Fills a 3D array with the values of the noise. */
|
||||||
void Generate3D(
|
void Generate3D(
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
|
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
|
||||||
int a_SizeX, int a_SizeY, int a_SizeZ, ///< Count of the array, in each direction
|
int a_SizeX, int a_SizeY, int a_SizeZ, ///< Count of the array, in each direction
|
||||||
@ -95,34 +92,22 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef NOISE_DATATYPE Workspace1D[4];
|
|
||||||
typedef NOISE_DATATYPE Workspace2D[4][4];
|
|
||||||
|
|
||||||
cNoise m_Noise; // Used for integral rnd values
|
/** Noise used for integral random values. */
|
||||||
|
cNoise m_Noise;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
// Statistics on the noise-space coords:
|
|
||||||
static int m_NumSingleX;
|
|
||||||
static int m_NumSingleXY;
|
|
||||||
static int m_NumSingleY;
|
|
||||||
static int m_NumCalls;
|
|
||||||
#endif // _DEBUG
|
|
||||||
|
|
||||||
/// Calculates the integral and fractional parts along one axis.
|
/** Calculates the integral and fractional parts along one axis.
|
||||||
|
a_Floor will receive the integral parts (array of a_Size ints).
|
||||||
|
a_Frac will receive the fractional parts (array of a_Size floats).
|
||||||
|
a_Same will receive the counts of items that have the same integral parts (array of up to a_Size ints).
|
||||||
|
a_NumSame will receive the count of a_Same elements (total count of different integral parts). */
|
||||||
void CalcFloorFrac(
|
void CalcFloorFrac(
|
||||||
int a_Size,
|
int a_Size,
|
||||||
NOISE_DATATYPE a_Start, NOISE_DATATYPE a_End,
|
NOISE_DATATYPE a_Start, NOISE_DATATYPE a_End,
|
||||||
int * a_Floor, NOISE_DATATYPE * a_Frac,
|
int * a_Floor, NOISE_DATATYPE * a_Frac,
|
||||||
int * a_Same, int & a_NumSame
|
int * a_Same, int & a_NumSame
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void UpdateWorkRnds2DX(
|
|
||||||
Workspace2D & a_WorkRnds,
|
|
||||||
Workspace1D & a_Interps,
|
|
||||||
int a_LastFloorX, int a_NewFloorX,
|
|
||||||
int a_FloorY,
|
|
||||||
NOISE_DATATYPE a_FractionY
|
|
||||||
) const;
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Noise.h"
|
#include "Noise/Noise.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user