summaryrefslogtreecommitdiffstats
path: root/Tools/GrownBiomeGenVisualiser
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/GrownBiomeGenVisualiser')
-rw-r--r--Tools/GrownBiomeGenVisualiser/Globals.cpp4
-rw-r--r--Tools/GrownBiomeGenVisualiser/Globals.h119
-rw-r--r--Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp475
3 files changed, 409 insertions, 189 deletions
diff --git a/Tools/GrownBiomeGenVisualiser/Globals.cpp b/Tools/GrownBiomeGenVisualiser/Globals.cpp
index 13c6ae709..680afbf75 100644
--- a/Tools/GrownBiomeGenVisualiser/Globals.cpp
+++ b/Tools/GrownBiomeGenVisualiser/Globals.cpp
@@ -4,7 +4,3 @@
// This file is used for precompiled header generation in MSVC environments
#include "Globals.h"
-
-
-
-
diff --git a/Tools/GrownBiomeGenVisualiser/Globals.h b/Tools/GrownBiomeGenVisualiser/Globals.h
index 2c5d090f5..cdaecdba3 100644
--- a/Tools/GrownBiomeGenVisualiser/Globals.h
+++ b/Tools/GrownBiomeGenVisualiser/Globals.h
@@ -10,20 +10,20 @@
// Compiler-dependent stuff:
#if defined(_MSC_VER)
- // MSVC produces warning C4481 on the override keyword usage, so disable the warning altogether
- #pragma warning(disable:4481)
+// MSVC produces warning C4481 on the override keyword usage, so disable the warning altogether
+#pragma warning(disable : 4481)
- // Disable some warnings that we don't care about:
- #pragma warning(disable:4100)
+// Disable some warnings that we don't care about:
+#pragma warning(disable : 4100)
#elif defined(__GNUC__)
- // TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
- #define abstract
+// TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
+#define abstract
#else
- #error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"
+#error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"
#endif
@@ -32,7 +32,7 @@
#ifndef TOLUA_TEMPLATE_BIND
- #define TOLUA_TEMPLATE_BIND(x)
+#define TOLUA_TEMPLATE_BIND(x)
#endif
@@ -41,12 +41,12 @@
// Integral types with predefined sizes:
typedef long long Int64;
-typedef int Int32;
-typedef short Int16;
+typedef int Int32;
+typedef short Int16;
typedef unsigned long long UInt64;
-typedef unsigned int UInt32;
-typedef unsigned short UInt16;
+typedef unsigned int UInt32;
+typedef unsigned short UInt16;
typedef unsigned char Byte;
@@ -57,57 +57,57 @@ typedef unsigned char Byte;
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for any class that shouldn't allow copying itself
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName &); \
+ TypeName(const TypeName &); \
void operator=(const TypeName &)
// A macro that is used to mark unused function parameters, to avoid pedantic warnings in gcc
-#define UNUSED(X) (void)(X)
+#define UNUSED(X) (void) (X)
// OS-dependent stuff:
#ifdef _WIN32
- #define WIN32_LEAN_AND_MEAN
- #include <Windows.h>
- #include <winsock2.h>
- #include <ws2tcpip.h>
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
- // Windows SDK defines min and max macros, messing up with our std::min and std::max usage
- #undef min
- #undef max
+// Windows SDK defines min and max macros, messing up with our std::min and std::max usage
+#undef min
+#undef max
- // Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
- #ifdef GetFreeSpace
- #undef GetFreeSpace
- #endif // GetFreeSpace
+// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
+#ifdef GetFreeSpace
+#undef GetFreeSpace
+#endif // GetFreeSpace
- #define SocketError WSAGetLastError()
+#define SocketError WSAGetLastError()
#else
- #include <sys/types.h>
- #include <sys/stat.h> // for mkdir
- #include <sys/time.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- #include <dirent.h>
- #include <iostream>
- #include <unistd.h>
-
- #include <cstring>
- #include <pthread.h>
- #include <semaphore.h>
- #include <cerrno>
- #include <fcntl.h>
-
- typedef int SOCKET;
- enum
- {
- INVALID_SOCKET = -1,
- };
- #define closesocket close
- #define SocketError errno
+#include <sys/types.h>
+#include <sys/stat.h> // for mkdir
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <dirent.h>
+#include <iostream>
+#include <unistd.h>
+
+#include <cstring>
+#include <pthread.h>
+#include <semaphore.h>
+#include <cerrno>
+#include <fcntl.h>
+
+typedef int SOCKET;
+enum
+{
+ INVALID_SOCKET = -1,
+};
+#define closesocket close
+#define SocketError errno
#endif
@@ -156,17 +156,17 @@ typedef unsigned char Byte;
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
-#define KiB * 1024
-#define MiB * 1024 * 1024
+#define KiB *1024
+#define MiB *1024 * 1024
/** Faster than (int)floorf((float)x / (float)div) */
-#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int)x / div) - 1) : ((int)x / div))
+#define FAST_FLOOR_DIV(x, div) ((x) < 0 ? (((int) x / div) - 1) : ((int) x / div))
/** Own version of assert() that writes failed assertions to the log for review */
-#ifdef NDEBUG
- #define ASSERT(x) ((void)0)
+#ifdef NDEBUG
+#define ASSERT(x) ((void) 0)
#else
- #define ASSERT assert
+#define ASSERT assert
#endif
// Pretty much the same as ASSERT() but stays in Release builds
@@ -177,16 +177,13 @@ typedef unsigned char Byte;
/** Clamp X to the specified range. */
-template <typename T>
-T Clamp(T a_Value, T a_Min, T a_Max)
+template <typename T> T Clamp(T a_Value, T a_Min, T a_Max)
{
return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
}
-template <typename T>
-auto ToUnsigned(T a_Val)
+template <typename T> auto ToUnsigned(T a_Val)
{
ASSERT(a_Val >= 0);
return static_cast<std::make_unsigned_t<T>>(a_Val);
}
-
diff --git a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
index 5201c28bf..665016b96 100644
--- a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
+++ b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
@@ -23,9 +23,11 @@ typedef int Color[3]; // Color is an array of 3 ints
// Forward declarations, needed for GCC and Clang:
void outputBitmapFile(
const AString & a_FileName,
- unsigned a_ImageSizeX, unsigned a_ImageSizeY,
+ unsigned a_ImageSizeX,
+ unsigned a_ImageSizeY,
const int * a_ColorIndices,
- unsigned a_IndicesSizeX, unsigned a_IndicesSizeY,
+ unsigned a_IndicesSizeX,
+ unsigned a_IndicesSizeY,
const Color * a_Colors,
size_t a_NumColors
);
@@ -40,8 +42,7 @@ void generateExamples(int a_Seed);
/** Color palette used for algorithm examples.
No relevance to biomes whatsoever. */
-static const Color spectrumColors[] =
-{
+static const Color spectrumColors[] = {
{0, 0, 0},
{255, 0, 0},
{0, 255, 0},
@@ -56,13 +57,12 @@ static const Color spectrumColors[] =
/** Color palette used for displaying biome groups. */
-static const Color biomeGroupColors[] =
-{
- /* bgOcean */ {0x00, 0x00, 0x70},
- /* bgDesert */ {0xfa, 0x94, 0x18},
- /* bgTemperate */ {0x05, 0x66, 0x21},
- /* bgMountains */ {0x60, 0x60, 0x60},
- /* bgIce */ {0xa0, 0xa0, 0xff},
+static const Color biomeGroupColors[] = {
+ /* bgOcean */ {0x00, 0x00, 0x70},
+ /* bgDesert */ {0xfa, 0x94, 0x18},
+ /* bgTemperate */ {0x05, 0x66, 0x21},
+ /* bgMountains */ {0x60, 0x60, 0x60},
+ /* bgIce */ {0xa0, 0xa0, 0xff},
};
@@ -81,80 +81,261 @@ static const struct
{
EMCSBiome biome;
Color color;
-} biomeColorMap[] =
-{
- { biOcean, { 0x00, 0x00, 0x70 }, },
- { biPlains, { 0x8d, 0xb3, 0x60 }, },
- { biDesert, { 0xfa, 0x94, 0x18 }, },
- { biExtremeHills, { 0x60, 0x60, 0x60 }, },
- { biForest, { 0x05, 0x66, 0x21 }, },
- { biTaiga, { 0x0b, 0x66, 0x59 }, },
- { biSwampland, { 0x2f, 0xff, 0xda }, },
- { biRiver, { 0x30, 0x30, 0xaf }, },
- { biHell, { 0x7f, 0x00, 0x00 }, },
- { biSky, { 0x00, 0x7f, 0xff }, },
- { biFrozenOcean, { 0xa0, 0xa0, 0xdf }, },
- { biFrozenRiver, { 0xa0, 0xa0, 0xff }, },
- { biIcePlains, { 0xff, 0xff, 0xff }, },
- { biIceMountains, { 0xa0, 0xa0, 0xa0 }, },
- { biMushroomIsland, { 0xff, 0x00, 0xff }, },
- { biMushroomShore, { 0xa0, 0x00, 0xff }, },
- { biBeach, { 0xfa, 0xde, 0x55 }, },
- { biDesertHills, { 0xd2, 0x5f, 0x12 }, },
- { biForestHills, { 0x22, 0x55, 0x1c }, },
- { biTaigaHills, { 0x16, 0x39, 0x33 }, },
- { biExtremeHillsEdge, { 0x7f, 0x8f, 0x7f }, },
- { biJungle, { 0x53, 0x7b, 0x09 }, },
- { biJungleHills, { 0x2c, 0x42, 0x05 }, },
-
- { biJungleEdge, { 0x62, 0x8b, 0x17 }, },
- { biDeepOcean, { 0x00, 0x00, 0x30 }, },
- { biStoneBeach, { 0xa2, 0xa2, 0x84 }, },
- { biColdBeach, { 0xfa, 0xf0, 0xc0 }, },
- { biBirchForest, { 0x30, 0x74, 0x44 }, },
- { biBirchForestHills, { 0x1f, 0x5f, 0x32 }, },
- { biRoofedForest, { 0x40, 0x51, 0x1a }, },
- { biColdTaiga, { 0x31, 0x55, 0x4a }, },
- { biColdTaigaHills, { 0x59, 0x7d, 0x72 }, },
- { biMegaTaiga, { 0x59, 0x66, 0x51 }, },
- { biMegaTaigaHills, { 0x59, 0x66, 0x59 }, },
- { biExtremeHillsPlus, { 0x50, 0x70, 0x50 }, },
- { biSavanna, { 0xbd, 0xb2, 0x5f }, },
- { biSavannaPlateau, { 0xa7, 0x9d, 0x64 }, },
- { biMesa, { 0xd9, 0x45, 0x15 }, },
- { biMesaPlateauF, { 0xb0, 0x97, 0x65 }, },
- { biMesaPlateau, { 0xca, 0x8c, 0x65 }, },
+} biomeColorMap[] = {
+ {
+ biOcean,
+ {0x00, 0x00, 0x70},
+ },
+ {
+ biPlains,
+ {0x8d, 0xb3, 0x60},
+ },
+ {
+ biDesert,
+ {0xfa, 0x94, 0x18},
+ },
+ {
+ biExtremeHills,
+ {0x60, 0x60, 0x60},
+ },
+ {
+ biForest,
+ {0x05, 0x66, 0x21},
+ },
+ {
+ biTaiga,
+ {0x0b, 0x66, 0x59},
+ },
+ {
+ biSwampland,
+ {0x2f, 0xff, 0xda},
+ },
+ {
+ biRiver,
+ {0x30, 0x30, 0xaf},
+ },
+ {
+ biHell,
+ {0x7f, 0x00, 0x00},
+ },
+ {
+ biSky,
+ {0x00, 0x7f, 0xff},
+ },
+ {
+ biFrozenOcean,
+ {0xa0, 0xa0, 0xdf},
+ },
+ {
+ biFrozenRiver,
+ {0xa0, 0xa0, 0xff},
+ },
+ {
+ biIcePlains,
+ {0xff, 0xff, 0xff},
+ },
+ {
+ biIceMountains,
+ {0xa0, 0xa0, 0xa0},
+ },
+ {
+ biMushroomIsland,
+ {0xff, 0x00, 0xff},
+ },
+ {
+ biMushroomShore,
+ {0xa0, 0x00, 0xff},
+ },
+ {
+ biBeach,
+ {0xfa, 0xde, 0x55},
+ },
+ {
+ biDesertHills,
+ {0xd2, 0x5f, 0x12},
+ },
+ {
+ biForestHills,
+ {0x22, 0x55, 0x1c},
+ },
+ {
+ biTaigaHills,
+ {0x16, 0x39, 0x33},
+ },
+ {
+ biExtremeHillsEdge,
+ {0x7f, 0x8f, 0x7f},
+ },
+ {
+ biJungle,
+ {0x53, 0x7b, 0x09},
+ },
+ {
+ biJungleHills,
+ {0x2c, 0x42, 0x05},
+ },
+
+ {
+ biJungleEdge,
+ {0x62, 0x8b, 0x17},
+ },
+ {
+ biDeepOcean,
+ {0x00, 0x00, 0x30},
+ },
+ {
+ biStoneBeach,
+ {0xa2, 0xa2, 0x84},
+ },
+ {
+ biColdBeach,
+ {0xfa, 0xf0, 0xc0},
+ },
+ {
+ biBirchForest,
+ {0x30, 0x74, 0x44},
+ },
+ {
+ biBirchForestHills,
+ {0x1f, 0x5f, 0x32},
+ },
+ {
+ biRoofedForest,
+ {0x40, 0x51, 0x1a},
+ },
+ {
+ biColdTaiga,
+ {0x31, 0x55, 0x4a},
+ },
+ {
+ biColdTaigaHills,
+ {0x59, 0x7d, 0x72},
+ },
+ {
+ biMegaTaiga,
+ {0x59, 0x66, 0x51},
+ },
+ {
+ biMegaTaigaHills,
+ {0x59, 0x66, 0x59},
+ },
+ {
+ biExtremeHillsPlus,
+ {0x50, 0x70, 0x50},
+ },
+ {
+ biSavanna,
+ {0xbd, 0xb2, 0x5f},
+ },
+ {
+ biSavannaPlateau,
+ {0xa7, 0x9d, 0x64},
+ },
+ {
+ biMesa,
+ {0xd9, 0x45, 0x15},
+ },
+ {
+ biMesaPlateauF,
+ {0xb0, 0x97, 0x65},
+ },
+ {
+ biMesaPlateau,
+ {0xca, 0x8c, 0x65},
+ },
// M variants:
- { biSunflowerPlains, { 0xb5, 0xdb, 0x88 }, },
- { biDesertM, { 0xff, 0xbc, 0x40 }, },
- { biExtremeHillsM, { 0x88, 0x88, 0x88 }, },
- { biFlowerForest, { 0x2d, 0x8e, 0x49 }, },
- { biTaigaM, { 0x33, 0x8e, 0x81 }, },
- { biSwamplandM, { 0x07, 0xf9, 0xb2 }, },
- { biIcePlainsSpikes, { 0xb4, 0xdc, 0xdc }, },
- { biJungleM, { 0x7b, 0xa3, 0x31 }, },
- { biJungleEdgeM, { 0x62, 0x8b, 0x17 }, },
- { biBirchForestM, { 0x58, 0x9c, 0x6c }, },
- { biBirchForestHillsM, { 0x47, 0x87, 0x5a }, },
- { biRoofedForestM, { 0x68, 0x79, 0x42 }, },
- { biColdTaigaM, { 0x24, 0x3f, 0x36 }, },
- { biMegaSpruceTaiga, { 0x45, 0x4f, 0x3e }, },
- { biMegaSpruceTaigaHills, { 0x45, 0x4f, 0x4e }, },
- { biExtremeHillsPlusM, { 0x78, 0x98, 0x78 }, },
- { biSavannaM, { 0xe5, 0xda, 0x87 }, },
- { biSavannaPlateauM, { 0xa7, 0x9d, 0x74 }, },
- { biMesaBryce, { 0xff, 0x6d, 0x3d }, },
- { biMesaPlateauFM, { 0xd8, 0xbf, 0x8d }, },
- { biMesaPlateauM, { 0xf2, 0xb4, 0x8d }, },
+ {
+ biSunflowerPlains,
+ {0xb5, 0xdb, 0x88},
+ },
+ {
+ biDesertM,
+ {0xff, 0xbc, 0x40},
+ },
+ {
+ biExtremeHillsM,
+ {0x88, 0x88, 0x88},
+ },
+ {
+ biFlowerForest,
+ {0x2d, 0x8e, 0x49},
+ },
+ {
+ biTaigaM,
+ {0x33, 0x8e, 0x81},
+ },
+ {
+ biSwamplandM,
+ {0x07, 0xf9, 0xb2},
+ },
+ {
+ biIcePlainsSpikes,
+ {0xb4, 0xdc, 0xdc},
+ },
+ {
+ biJungleM,
+ {0x7b, 0xa3, 0x31},
+ },
+ {
+ biJungleEdgeM,
+ {0x62, 0x8b, 0x17},
+ },
+ {
+ biBirchForestM,
+ {0x58, 0x9c, 0x6c},
+ },
+ {
+ biBirchForestHillsM,
+ {0x47, 0x87, 0x5a},
+ },
+ {
+ biRoofedForestM,
+ {0x68, 0x79, 0x42},
+ },
+ {
+ biColdTaigaM,
+ {0x24, 0x3f, 0x36},
+ },
+ {
+ biMegaSpruceTaiga,
+ {0x45, 0x4f, 0x3e},
+ },
+ {
+ biMegaSpruceTaigaHills,
+ {0x45, 0x4f, 0x4e},
+ },
+ {
+ biExtremeHillsPlusM,
+ {0x78, 0x98, 0x78},
+ },
+ {
+ biSavannaM,
+ {0xe5, 0xda, 0x87},
+ },
+ {
+ biSavannaPlateauM,
+ {0xa7, 0x9d, 0x74},
+ },
+ {
+ biMesaBryce,
+ {0xff, 0x6d, 0x3d},
+ },
+ {
+ biMesaPlateauFM,
+ {0xd8, 0xbf, 0x8d},
+ },
+ {
+ biMesaPlateauM,
+ {0xf2, 0xb4, 0x8d},
+ },
};
-template <typename ... Args>
-void log(const char * a_Fmt, const Args & ... a_Args)
+template <typename... Args> void log(const char * a_Fmt, const Args &... a_Args)
{
fmt::printf(a_Fmt, a_Args...);
putchar('\n');
@@ -167,9 +348,11 @@ void log(const char * a_Fmt, const Args & ... a_Args)
void outputBitmapFile(
const AString & a_FileName,
- unsigned a_ImageSizeX, unsigned a_ImageSizeY,
+ unsigned a_ImageSizeX,
+ unsigned a_ImageSizeY,
const int * a_ColorIndices,
- unsigned a_IndicesSizeX, unsigned a_IndicesSizeY,
+ unsigned a_IndicesSizeX,
+ unsigned a_IndicesSizeY,
const Color * a_Colors,
size_t a_NumColors
)
@@ -261,7 +444,8 @@ void generateZoomLevels(int a_Seed)
int workspace[maxArrSize * maxArrSize]; // Workspace for the generated array
// Chain the zoom operation as many times as the image number:
- std::shared_ptr<cProtIntGen> gen = std::make_shared<cProtIntGenChoice>(a_Seed, static_cast<int>(ARRAYCOUNT(spectrumColors) + 1));
+ std::shared_ptr<cProtIntGen> gen =
+ std::make_shared<cProtIntGenChoice>(a_Seed, static_cast<int>(ARRAYCOUNT(spectrumColors) + 1));
for (unsigned j = 1; j < i; j++)
{
gen = std::make_shared<cProtIntGenZoom>(a_Seed + static_cast<int>(j), gen);
@@ -286,7 +470,8 @@ void generateSmoothLevels(int a_Seed)
const unsigned maxArrSize = 65; ///< Size of the underlying generated array
// Initialize the underlying generator:
- std::shared_ptr<cProtIntGen> underlyingGen = std::make_shared<cProtIntGenChoice>(a_Seed, static_cast<int>(ARRAYCOUNT(spectrumColors) + 1));
+ std::shared_ptr<cProtIntGen> underlyingGen =
+ std::make_shared<cProtIntGenChoice>(a_Seed, static_cast<int>(ARRAYCOUNT(spectrumColors) + 1));
for (int j = 1; j < 4; j++)
{
underlyingGen = std::make_shared<cProtIntGenZoom>(a_Seed + j, underlyingGen);
@@ -326,42 +511,86 @@ void generateExamples(int a_Seed)
const int imgSize = 256;
// Create the inputs:
- auto in1 =
- std::make_shared<cProtIntGenZoom >(a_Seed + 1,
- std::make_shared<cProtIntGenAddIslands >(a_Seed + 2000, 200,
- std::make_shared<cProtIntGenSetRandomly >(a_Seed + 9, 300, bgOcean,
- std::make_shared<cProtIntGenZoom >(a_Seed + 2,
- std::make_shared<cProtIntGenLandOcean >(a_Seed + 1, 30
- )))));
- auto in2 =
- std::make_shared<cProtIntGenZoom >(a_Seed + 1,
- std::make_shared<cProtIntGenBiomeGroupEdges>(in1
- ));
- auto in3 =
- std::make_shared<cProtIntGenZoom >(a_Seed + 1,
- std::make_shared<cProtIntGenZoom >(a_Seed + 2,
- std::make_shared<cProtIntGenBiomes >(a_Seed + 3000, in2
- )));
- auto inAlt =
- std::make_shared<cProtIntGenZoom >(a_Seed,
- std::make_shared<cProtIntGenLandOcean >(a_Seed, 30
- ));
+ auto in1 = std::make_shared<cProtIntGenZoom>(
+ a_Seed + 1,
+ std::make_shared<cProtIntGenAddIslands>(
+ a_Seed + 2000,
+ 200,
+ std::make_shared<cProtIntGenSetRandomly>(
+ a_Seed + 9,
+ 300,
+ bgOcean,
+ std::make_shared<cProtIntGenZoom>(a_Seed + 2, std::make_shared<cProtIntGenLandOcean>(a_Seed + 1, 30))
+ )
+ )
+ );
+ auto in2 = std::make_shared<cProtIntGenZoom>(a_Seed + 1, std::make_shared<cProtIntGenBiomeGroupEdges>(in1));
+ auto in3 = std::make_shared<cProtIntGenZoom>(
+ a_Seed + 1,
+ std::make_shared<cProtIntGenZoom>(a_Seed + 2, std::make_shared<cProtIntGenBiomes>(a_Seed + 3000, in2))
+ );
+ auto inAlt = std::make_shared<cProtIntGenZoom>(a_Seed, std::make_shared<cProtIntGenLandOcean>(a_Seed, 30));
auto inRiver = std::make_shared<cProtIntGenRiver>(a_Seed, in2);
int workspace[maxArrSize * maxArrSize];
in1->GetInts(0, 0, inArrSize, inArrSize, workspace);
- outputBitmapFile("grownexample_in1.ppm", imgSize, imgSize, workspace, inArrSize, inArrSize, biomeGroupColors, ARRAYCOUNT(biomeGroupColors));
+ outputBitmapFile(
+ "grownexample_in1.ppm",
+ imgSize,
+ imgSize,
+ workspace,
+ inArrSize,
+ inArrSize,
+ biomeGroupColors,
+ ARRAYCOUNT(biomeGroupColors)
+ );
log(" Created example input 1");
in2->GetInts(0, 0, inArrSize, inArrSize, workspace);
- outputBitmapFile("grownexample_in2.ppm", imgSize, imgSize, workspace, inArrSize, inArrSize, biomeGroupColors, ARRAYCOUNT(biomeGroupColors));
+ outputBitmapFile(
+ "grownexample_in2.ppm",
+ imgSize,
+ imgSize,
+ workspace,
+ inArrSize,
+ inArrSize,
+ biomeGroupColors,
+ ARRAYCOUNT(biomeGroupColors)
+ );
log(" Created example input 2");
in3->GetInts(0, 0, inArrSize, inArrSize, workspace);
- outputBitmapFile("grownexample_in3.ppm", imgSize, imgSize, workspace, inArrSize, inArrSize, biomeColors, ARRAYCOUNT(biomeColors));
+ outputBitmapFile(
+ "grownexample_in3.ppm",
+ imgSize,
+ imgSize,
+ workspace,
+ inArrSize,
+ inArrSize,
+ biomeColors,
+ ARRAYCOUNT(biomeColors)
+ );
log(" Created example input 3");
inAlt->GetInts(0, 0, inArrSize, inArrSize, workspace);
- outputBitmapFile("grownexample_in_alt.ppm", imgSize, imgSize, workspace, inArrSize, inArrSize, biomeGroupColors, ARRAYCOUNT(biomeGroupColors));
+ outputBitmapFile(
+ "grownexample_in_alt.ppm",
+ imgSize,
+ imgSize,
+ workspace,
+ inArrSize,
+ inArrSize,
+ biomeGroupColors,
+ ARRAYCOUNT(biomeGroupColors)
+ );
log(" Created example input alt");
inRiver->GetInts(0, 0, inArrSize, inArrSize, workspace);
- outputBitmapFile("grownexample_in_river.ppm", imgSize, imgSize, workspace, inArrSize, inArrSize, biomeColors, ARRAYCOUNT(biomeColors));
+ outputBitmapFile(
+ "grownexample_in_river.ppm",
+ imgSize,
+ imgSize,
+ workspace,
+ inArrSize,
+ inArrSize,
+ biomeColors,
+ ARRAYCOUNT(biomeColors)
+ );
log(" Created example input river");
// Shortcuts for colormaps used for the outputs:
@@ -370,8 +599,8 @@ void generateExamples(int a_Seed)
const Color * colors;
size_t count;
};
- static const ColorMap cmGroups = { biomeGroupColors, ARRAYCOUNT(biomeGroupColors) };
- static const ColorMap cmBiomes = { biomeColors, ARRAYCOUNT(biomeColors) };
+ static const ColorMap cmGroups = {biomeGroupColors, ARRAYCOUNT(biomeGroupColors)};
+ static const ColorMap cmBiomes = {biomeColors, ARRAYCOUNT(biomeColors)};
// Create the result generators:
struct
@@ -381,25 +610,23 @@ void generateExamples(int a_Seed)
int offset;
const ColorMap & colormap;
std::shared_ptr<cProtIntGen> gen;
- }
- gens[] =
- {
- {"add_islands", inArrSize, 0, cmGroups, std::make_shared<cProtIntGenAddIslands> (a_Seed, 400, in1)},
- {"alt_biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenAlternateBiomes>(a_Seed, inAlt, in3)},
- {"beaches", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenBeaches> (in3)},
- {"biome_edges", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenBiomeEdges> (a_Seed, in3)},
- {"biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenBiomes> (a_Seed, in2)},
- {"grp_edges", inArrSize - 2, 0, cmGroups, std::make_shared<cProtIntGenBiomeGroupEdges>(in1)},
- {"m_biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenMBiomes> (a_Seed, inAlt, in3)},
- {"mix_river", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenMixRivers> (in3, inRiver)},
- {"river", inArrSize - 2, 1, cmBiomes, inRiver},
- {"set_rnd", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenSetRandomly> (a_Seed, 500, bgOcean, in3)},
- {"smooth", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenSmooth> (a_Seed, in3)},
- {"zoom", inArrSize * 2 - 1, 0, cmBiomes, std::make_shared<cProtIntGenZoom> (a_Seed, in3)},
+ } gens[] = {
+ {"add_islands", inArrSize, 0, cmGroups, std::make_shared<cProtIntGenAddIslands>(a_Seed, 400, in1)},
+ {"alt_biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenAlternateBiomes>(a_Seed, inAlt, in3)},
+ {"beaches", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenBeaches>(in3)},
+ {"biome_edges", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenBiomeEdges>(a_Seed, in3)},
+ {"biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenBiomes>(a_Seed, in2)},
+ {"grp_edges", inArrSize - 2, 0, cmGroups, std::make_shared<cProtIntGenBiomeGroupEdges>(in1)},
+ {"m_biomes", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenMBiomes>(a_Seed, inAlt, in3)},
+ {"mix_river", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenMixRivers>(in3, inRiver)},
+ {"river", inArrSize - 2, 1, cmBiomes, inRiver},
+ {"set_rnd", inArrSize, 0, cmBiomes, std::make_shared<cProtIntGenSetRandomly>(a_Seed, 500, bgOcean, in3)},
+ {"smooth", inArrSize - 2, 1, cmBiomes, std::make_shared<cProtIntGenSmooth>(a_Seed, in3)},
+ {"zoom", inArrSize * 2 - 1, 0, cmBiomes, std::make_shared<cProtIntGenZoom>(a_Seed, in3)},
};
// Create the outputs:
- for (const auto & gen: gens)
+ for (const auto & gen : gens)
{
gen.gen->GetInts(gen.offset, gen.offset, gen.size, gen.size, workspace);
AString fnam = fmt::format(FMT_STRING("grownexample_{}.ppm"), gen.name);