1
0
Fork 0

Moved all Noise-related files into a separate folder.

This commit is contained in:
Mattes D 2014-11-18 12:07:08 +01:00
parent f683872f54
commit 2467d29a4e
26 changed files with 55 additions and 79 deletions

View File

@ -9,6 +9,7 @@ include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/polarssl/include
set(FOLDERS
OSSupport HTTPServer Items Blocks Protocol Generating PolarSSL++ Bindings
WorldStorage Mobs Entities Simulator UI BlockEntities Generating/Prefabs
Noise
)
SET (SRCS
@ -50,7 +51,6 @@ SET (SRCS
MobProximityCounter.cpp
MobSpawner.cpp
MonsterConfig.cpp
Noise.cpp
ProbabDistrib.cpp
RankManager.cpp
RCONServer.cpp
@ -65,7 +65,8 @@ SET (SRCS
VoronoiMap.cpp
WebAdmin.cpp
World.cpp
main.cpp)
main.cpp
)
SET (HDRS
AllocationPool.h
@ -120,11 +121,8 @@ SET (HDRS
MobProximityCounter.h
MobSpawner.h
MonsterConfig.h
Noise.h
OctavedNoise.h
ProbabDistrib.h
RankManager.h
RidgedNoise.h
RCONServer.h
Root.h
Scoreboard.h
@ -139,7 +137,8 @@ SET (HDRS
VoronoiMap.h
WebAdmin.h
World.h
XMLParser.h)
XMLParser.h
)
include_directories(".")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
@ -316,7 +315,7 @@ endif ()
if (NOT MSVC)
target_link_libraries(${EXECUTABLE}
OSSupport HTTPServer Bindings Items Blocks
OSSupport HTTPServer Bindings Items Blocks Noise
Protocol Generating Generating_Prefabs WorldStorage
Mobs Entities Simulator UI BlockEntities PolarSSL++
)

View File

@ -25,7 +25,7 @@
#include "BlockEntities/FlowerPotEntity.h"
#include "Entities/Pickup.h"
#include "Item.h"
#include "Noise.h"
#include "Noise/Noise.h"
#include "Root.h"
#include "MersenneTwister.h"
#include "Entities/Player.h"

View File

@ -6,7 +6,7 @@
#include "Enchantments.h"
#include "WorldStorage/FastNBT.h"
#include "FastRandom.h"
#include "Noise.h"
#include "Noise/Noise.h"

View File

@ -15,7 +15,7 @@ Interfaces to the various biome generators:
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"
#include "../VoronoiMap.h"

View File

@ -13,7 +13,6 @@
#pragma once
#include "GridStructGen.h"
#include "../Noise.h"

View File

@ -7,7 +7,7 @@
#include "ChunkDesc.h"
#include "../BlockArea.h"
#include "../Cuboid.h"
#include "../Noise.h"
#include "../Noise/Noise.h"
#include "../BlockEntities/BlockEntity.h"

View File

@ -17,7 +17,7 @@
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -11,7 +11,6 @@
#include "ComposableGenerator.h"
#include "HeiGen.h"
#include "../Noise.h"

View File

@ -10,7 +10,7 @@
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -10,7 +10,6 @@
#include "Globals.h"
#include "FinishGen.h"
#include "../Noise.h"
#include "../BlockID.h"
#include "../Simulator/FluidSimulator.h" // for cFluidSimulator::CanWashAway()
#include "../Simulator/FireSimulator.h"

View File

@ -16,7 +16,7 @@
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"
#include "../ProbabDistrib.h"

View File

@ -10,7 +10,7 @@
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -15,7 +15,7 @@ Interfaces to the various height generators:
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -10,7 +10,6 @@
#pragma once
#include "GridStructGen.h"
#include "../Noise.h"

View File

@ -13,7 +13,7 @@
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -20,7 +20,7 @@ Each uses a slightly different approach to generating:
#include "../Defines.h"
#include "../Cuboid.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -10,7 +10,6 @@
#pragma once
#include "GridStructGen.h"
#include "../Noise.h"

View File

@ -14,7 +14,7 @@
#pragma once
#include "ComposableGenerator.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -18,7 +18,7 @@ logs can overwrite others(leaves), but others shouldn't overwrite logs. This is
#pragma once
#include "../ChunkDef.h"
#include "../Noise.h"
#include "../Noise/Noise.h"

View File

@ -6,7 +6,7 @@
#include "Globals.h"
#include "ItemGrid.h"
#include "Items/ItemHandler.h"
#include "Noise.h"
#include "Noise/Noise.h"

21
src/Noise/CMakeLists.txt Normal file
View 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()

View File

@ -695,13 +695,6 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
////////////////////////////////////////////////////////////////////////////////
// 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) :
m_Noise(a_Seed)
{
@ -740,23 +733,6 @@ void cCubicNoise::Generate2D(
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:
int FromY = 0;
for (int y = 0; y < NumSameY; y++)

View File

@ -65,19 +65,15 @@ private:
class cCubicNoise
{
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);
void Generate1D(
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;
/** Fills a 2D array with the values of the noise. */
void Generate2D(
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
@ -86,6 +82,7 @@ public:
) const;
/** Fills a 3D array with the values of the noise. */
void Generate3D(
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
@ -95,34 +92,22 @@ public:
) const;
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(
int a_Size,
NOISE_DATATYPE a_Start, NOISE_DATATYPE a_End,
int * a_Floor, NOISE_DATATYPE * a_Frac,
int * a_Same, int & a_NumSame
) const;
void UpdateWorkRnds2DX(
Workspace2D & a_WorkRnds,
Workspace1D & a_Interps,
int a_LastFloorX, int a_NewFloorX,
int a_FloorY,
NOISE_DATATYPE a_FractionY
) const;
} ;

View File

@ -9,7 +9,7 @@
#pragma once
#include "Noise.h"
#include "Noise/Noise.h"