paysages : Big terrain refactoring for future sculpt mode (WIP).

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@476 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-12-10 22:05:53 +00:00 committed by ThunderK
parent 5f22647b1c
commit f82b0f1e02
13 changed files with 178 additions and 259 deletions

View file

@ -13,7 +13,6 @@
#include "../lib_paysages/curve.h"
#include "../lib_paysages/color.h"
#include "../lib_paysages/layers.h"
#include "../lib_paysages/heightmap.h"
#include "../lib_paysages/pack.h"
class BaseForm:public QWidget

View file

@ -13,7 +13,7 @@
#include "widgetheightmap.h"
/**************** Dialog form ****************/
DialogHeightMap::DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* canvas) : DialogWithPreview(parent)
DialogHeightMap::DialogHeightMap(QWidget* parent, TerrainDefinition* terrain) : DialogWithPreview(parent)
{
QWidget* mainarea;
QWidget* buttons;
@ -26,9 +26,9 @@ DialogHeightMap::DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* ca
QPushButton* button;
QComboBox* combobox;
_value_original = heightmap;
_value_modified = heightmapCreate();
heightmapCopy(_value_original, &_value_modified);
_value_original = terrain;
_value_modified = (TerrainDefinition*)TerrainDefinitionClass.create();
TerrainDefinitionClass.copy(_value_original, _value_modified);
setLayout(new QVBoxLayout());
// Dialog layout (main area + buttons)
@ -53,7 +53,7 @@ DialogHeightMap::DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* ca
mainarea->layout()->setAlignment(panel, Qt::AlignTop);
// Viewer layout (3d display + sliders)
_3dview = new WidgetHeightMap(viewer, &_value_modified);
_3dview = new WidgetHeightMap(viewer, _value_modified);
viewer_layout->addWidget(_3dview, 0, 0);
slider = new QSlider(Qt::Horizontal, viewer);
slider->setRange(0, 1000);
@ -65,24 +65,9 @@ DialogHeightMap::DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* ca
viewer_layout->addWidget(slider, 0, 1);
// Panel layout
if (canvas)
{
button = new QPushButton(tr("Reset to terrain height"), panel);
connect(button, SIGNAL(clicked()), this, SLOT(resetToTerrain()));
panel->layout()->addWidget(button);
}
button = new QPushButton(tr("Load from picture file"), panel);
/*button = new QPushButton(tr("Load from picture file"), panel);
connect(button, SIGNAL(clicked()), this, SLOT(loadFromFile()));
panel->layout()->addWidget(button);
button = new QPushButton(tr("Change resolution"), panel);
connect(button, SIGNAL(clicked()), this, SLOT(changeResolution()));
panel->layout()->addWidget(button);
_resolution_label = new QLabel("", panel);
panel->layout()->addWidget(_resolution_label);
updateResolutionLabel();
panel->layout()->addWidget(button);*/
combobox = new QComboBox(panel);
combobox->addItem(tr("Raise / lower"));
@ -136,11 +121,11 @@ DialogHeightMap::DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* ca
setWindowTitle(tr("Paysages 3D - Height map painting"));
}
bool DialogHeightMap::editHeightMap(QWidget* parent, HeightMap* heightmap, void* canvas)
bool DialogHeightMap::editHeightMap(QWidget* parent, TerrainDefinition* terrain)
{
int result;
DialogHeightMap* dialog = new DialogHeightMap(parent, heightmap, canvas);
DialogHeightMap* dialog = new DialogHeightMap(parent, terrain);
result = dialog->exec();
delete dialog;
@ -150,15 +135,14 @@ bool DialogHeightMap::editHeightMap(QWidget* parent, HeightMap* heightmap, void*
void DialogHeightMap::accept()
{
heightmapCopy(&_value_modified, _value_original);
TerrainDefinitionClass.copy(_value_modified, _value_original);
QDialog::accept();
}
void DialogHeightMap::revert()
{
heightmapCopy(_value_original, &_value_modified);
TerrainDefinitionClass.copy(_value_original, _value_modified);
_3dview->revert();
updateResolutionLabel();
}
void DialogHeightMap::angleHChanged(int value)
@ -191,7 +175,7 @@ void DialogHeightMap::brushStrengthChanged(int value)
_3dview->setBrushStrength((double)value / 2000.0);
}
void DialogHeightMap::loadFromFile()
/*void DialogHeightMap::loadFromFile()
{
QString filepath = QFileDialog::getOpenFileName(this, tr("Paysages 3D - Choose a picture to load"), QString(), tr("Images (*.jpg *.jpeg *.bmp *.png)"));
if (!filepath.isNull())
@ -200,76 +184,4 @@ void DialogHeightMap::loadFromFile()
_3dview->revert();
updateResolutionLabel();
}
}
void DialogHeightMap::resetToTerrain()
{
/*if (_canvas)
{
TerrainDefinition terrain;
terrain = terrainCreateDefinition();
sceneryGetTerrain(&terrain);
heightmapRevertToTerrain(&_value_modified, &terrain, &_canvas->area);
terrainDeleteDefinition(&terrain);
_3dview->revert();
}*/
}
void DialogHeightMap::changeResolution()
{
QString result;
QStringList items;
int current;
items << QString("64 x 64") << QString("128 x 128") << QString("256 x 256") << QString("512 x 512");
current = 1;
if (_value_modified.resolution_x == 64 && _value_modified.resolution_z == 64)
{
current = 0;
}
else if (_value_modified.resolution_x == 256 && _value_modified.resolution_z == 256)
{
current = 2;
}
else if (_value_modified.resolution_x == 512 && _value_modified.resolution_z == 512)
{
current = 3;
}
result = QInputDialog::getItem(this, tr("Paysages 3D - Change heightmap resolution"), tr("Choose the new heightmap resolution.\nBeware that lowering the resolution may imply a loss of accuracy."), items, current, false);
if (!result.isEmpty())
{
int new_res_x, new_res_z;
if (result == QString("64 x 64"))
{
new_res_x = new_res_z = 64;
}
else if (result == QString("256 x 256"))
{
new_res_x = new_res_z = 256;
}
else if (result == QString("512 x 512"))
{
new_res_x = new_res_z = 512;
}
else
{
new_res_x = new_res_z = 128;
}
if (new_res_x != _value_modified.resolution_x or new_res_z != _value_modified.resolution_z)
{
heightmapChangeResolution(&_value_modified, new_res_x, new_res_z);
_3dview->revert();
updateResolutionLabel();
}
}
}
void DialogHeightMap::updateResolutionLabel()
{
_resolution_label->setText(tr("Map resolution : %1 x %2").arg(_value_modified.resolution_x).arg(_value_modified.resolution_z));
}

View file

@ -2,16 +2,16 @@
#define _PAYSAGES_QT_DIALOGHEIGHTMAP_H_
#include <QLabel>
#include "../lib_paysages/terrain/public.h"
#include "tools.h"
#include "widgetheightmap.h"
#include "../lib_paysages/heightmap.h"
class DialogHeightMap : public DialogWithPreview
{
Q_OBJECT
public:
explicit DialogHeightMap(QWidget* parent, HeightMap* heightmap, void* canvas);
static bool editHeightMap(QWidget* parent, HeightMap* heightmap, void* canvas);
explicit DialogHeightMap(QWidget* parent, TerrainDefinition* terrain);
static bool editHeightMap(QWidget* parent, TerrainDefinition* terrain);
public slots:
virtual void accept();
@ -24,16 +24,12 @@ private slots:
void brushSizeChanged(int value);
void brushSmoothingChanged(int value);
void brushStrengthChanged(int value);
void loadFromFile();
void resetToTerrain();
void changeResolution();
void updateResolutionLabel();
//void loadFromFile();
private:
HeightMap* _value_original;
HeightMap _value_modified;
TerrainDefinition* _value_original;
TerrainDefinition* _value_modified;
WidgetHeightMap* _3dview;
QLabel* _resolution_label;
};
#endif

View file

@ -7,6 +7,7 @@
#include "../lib_paysages/scenery.h"
#include "../lib_paysages/euclid.h"
#include "dialogheightmap.h"
static TerrainDefinition* _definition;
@ -52,6 +53,7 @@ public:
_renderer.render_quality = 3;
_renderer.applyTextures = _applyTextures;
_renderer.getLightStatus = _getLightStatus;
_renderer.alterLight = _alterLight;
_renderer.camera_location.x = 0.0;
_renderer.camera_location.y = 50.0;
_renderer.camera_location.z = 0.0;
@ -127,6 +129,11 @@ private:
lightingGetStatus((LightingDefinition*)renderer->customData[2], renderer, location, status);
}
static void _alterLight(Renderer* renderer, LightDefinition* light, Vector3 location)
{
*light = renderer->terrain->alterLight(renderer, light, location);
}
};
/**************** Form ****************/
@ -135,6 +142,9 @@ FormTerrain::FormTerrain(QWidget *parent):
{
_definition = (TerrainDefinition*)TerrainDefinitionClass.create();
QPushButton* button = addButton(tr("Paint"));
connect(button, SIGNAL(clicked()), this, SLOT(startPainting()));
previewHeight = new PreviewTerrainHeight(this);
previewColor = new PreviewTerrainColor(this);
addPreview(previewHeight, tr("Height preview (normalized)"));
@ -165,3 +175,8 @@ void FormTerrain::configChangeEvent()
TerrainDefinitionClass.validate(_definition);
BaseForm::configChangeEvent();
}
void FormTerrain::startPainting()
{
DialogHeightMap::editHeightMap(this, _definition);
}

View file

@ -19,6 +19,9 @@ public slots:
protected slots:
virtual void configChangeEvent();
private slots:
void startPainting();
private:
BasePreview* previewHeight;
BasePreview* previewColor;

View file

@ -6,7 +6,9 @@
#include <GL/glu.h>
#include "tools.h"
WidgetHeightMap::WidgetHeightMap(QWidget *parent, HeightMap* heightmap):
#define HEIGHTMAP_RESOLUTION 512
WidgetHeightMap::WidgetHeightMap(QWidget *parent, TerrainDefinition* terrain):
QGLWidget(parent)
{
setMinimumSize(500, 500);
@ -15,8 +17,8 @@ WidgetHeightMap::WidgetHeightMap(QWidget *parent, HeightMap* heightmap):
setCursor(Qt::CrossCursor);
startTimer(100);
_heightmap = heightmap;
_vertices = new _VertexInfo[heightmap->resolution_x * heightmap->resolution_z];
_terrain = terrain;
_vertices = new _VertexInfo[HEIGHTMAP_RESOLUTION * HEIGHTMAP_RESOLUTION];
_dirty = true;
@ -144,7 +146,7 @@ void WidgetHeightMap::timerEvent(QTimerEvent*)
if (_last_brush_action != 0)
{
double brush_strength;
HeightMapBrush brush;
TerrainBrush brush;
brush.relative_x = (_brush_x + 40.0) / 80.0;
brush.relative_z = (_brush_z + 40.0) / 80.0;
@ -157,16 +159,16 @@ void WidgetHeightMap::timerEvent(QTimerEvent*)
switch (_brush_mode)
{
case HEIGHTMAP_BRUSH_RAISE:
heightmapBrushElevation(_heightmap, &brush, brush_strength * _last_brush_action * 20.0);
terrainBrushElevation(_terrain, &brush, brush_strength * _last_brush_action * 20.0);
break;
case HEIGHTMAP_BRUSH_SMOOTH:
if (_last_brush_action < 0)
{
heightmapBrushSmooth(_heightmap, &brush, brush_strength * 0.1);
terrainBrushSmooth(_terrain, &brush, brush_strength * 0.1);
}
else
{
heightmapBrushAddNoise(_heightmap, &brush, _brush_noise, brush_strength * 10.0);
terrainBrushAddNoise(_terrain, &brush, _brush_noise, brush_strength * 10.0);
}
break;
default:
@ -280,8 +282,8 @@ void WidgetHeightMap::paintGL()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Height map
rx = _heightmap->resolution_x;
rz = _heightmap->resolution_z;
rx = HEIGHTMAP_RESOLUTION;
rz = HEIGHTMAP_RESOLUTION;
for (int x = 0; x < rx - 1; x++)
{
glBegin(GL_QUAD_STRIP);
@ -344,8 +346,8 @@ void WidgetHeightMap::paintGL()
void WidgetHeightMap::updateVertexInfo()
{
int rx = _heightmap->resolution_x;
int rz = _heightmap->resolution_z;
int rx = HEIGHTMAP_RESOLUTION;
int rz = HEIGHTMAP_RESOLUTION;
_VertexInfo* old_vertices = _vertices;
_vertices = new _VertexInfo[rx * rz];
@ -359,7 +361,7 @@ void WidgetHeightMap::updateVertexInfo()
_VertexInfo* vertex = _vertices + z * rx + x;
vertex->point.x = 80.0 * (double)x / (double)(rx - 1) - 40.0;
vertex->point.y = _heightmap->data[z * rx + x];
vertex->point.y = 0.0; //_heightmap->data[z * rx + x];
vertex->point.z = 80.0 * (double)z / (double)(rz - 1) - 40.0;
}
}

View file

@ -4,7 +4,7 @@
#include <QGLWidget>
#include <QDateTime>
#include "../lib_paysages/euclid.h"
#include "../lib_paysages/heightmap.h"
#include "../lib_paysages/terrain/public.h"
typedef struct
{
@ -22,7 +22,7 @@ class WidgetHeightMap : public QGLWidget
{
Q_OBJECT
public:
WidgetHeightMap(QWidget* parent, HeightMap* heightmap);
WidgetHeightMap(QWidget* parent, TerrainDefinition* terrain);
~WidgetHeightMap();
void setHorizontalViewAngle(double angle_h);
@ -50,7 +50,7 @@ private:
void updateVertexInfo();
private:
HeightMap* _heightmap;
TerrainDefinition* _terrain;
_VertexInfo* _vertices;
bool _dirty;

View file

@ -1,55 +0,0 @@
#ifndef _PAYSAGES_HEIGHTMAP_H_
#define _PAYSAGES_HEIGHTMAP_H_
/* Height map for terrain */
#include "pack.h"
#include "noise.h"
#include "geoarea.h"
#include "terrain/public.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
int resolution_x;
int resolution_z;
double* data;
} HeightMap;
typedef struct
{
double relative_x;
double relative_z;
double hard_radius;
double smoothed_size;
double total_radius;
} HeightMapBrush;
HeightMap heightmapCreate();
void heightmapDelete(HeightMap* heightmap);
void heightmapCopy(HeightMap* source, HeightMap* destination);
void heightmapValidate(HeightMap* heightmap);
void heightmapSave(PackStream* stream, HeightMap* heightmap);
void heightmapLoad(PackStream* stream, HeightMap* heightmap);
void heightmapGetLimits(HeightMap* heightmap, double* ymin, double* ymax);
double heightmapGetRawValue(HeightMap* heightmap, double x, double z);
double heightmapGetValue(HeightMap* heightmap, double x, double z);
void heightmapChangeResolution(HeightMap* heightmap, int resolution_x, int resolution_z);
void heightmapImportFromPicture(HeightMap* heightmap, const char* picturepath);
void heightmapRevertToTerrain(HeightMap* heightmap, TerrainDefinition* terrain, GeoArea* area);
void heightmapBrushElevation(HeightMap* heightmap, HeightMapBrush* brush, double value);
void heightmapBrushSmooth(HeightMap* heightmap, HeightMapBrush* brush, double value);
void heightmapBrushAddNoise(HeightMap* heightmap, HeightMapBrush* brush, NoiseGenerator* generator, double value);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -84,7 +84,13 @@ static double _fakeGetHeight(Renderer* renderer, double x, double z)
static double _getHeight(Renderer* renderer, double x, double z)
{
TerrainDefinition* definition = renderer->terrain->definition;
return noiseGet2DTotal(definition->_height_noise, x / definition->scaling, z / definition->scaling) * definition->height;
x /= definition->scaling;
z /= definition->scaling;
double height = noiseGet2DTotal(definition->_height_noise, x, z);
/* TODO Apply paintings */
return height * definition->height;
}
static Color _fakeGetFinalColor(Renderer* renderer, Vector3 location, double precision)

View file

@ -1,57 +1,50 @@
#include "heightmap.h"
#include "private.h"
/*
* Terrain height map painting.
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "tools.h"
#include "system.h"
#include "noise.h"
HeightMap heightmapCreate()
TerrainHeightMap terrainHeightMapCreate()
{
HeightMap result;
TerrainHeightMap result;
result.data = malloc(sizeof(double));
/*result.data = malloc(sizeof(double));
result.resolution_x = 1;
result.resolution_z = 1;
result.resolution_z = 1;*/
return result;
}
void heightmapDelete(HeightMap* heightmap)
void terrainHeightmapDelete(TerrainHeightMap* heightmap)
{
free(heightmap->data);
/*free(heightmap->data);*/
}
void heightmapCopy(HeightMap* source, HeightMap* destination)
void terrainHeightmapCopy(TerrainHeightMap* source, TerrainHeightMap* destination)
{
destination->resolution_x = source->resolution_x;
/*destination->resolution_x = source->resolution_x;
destination->resolution_z = source->resolution_z;
destination->data = realloc(destination->data, sizeof(double) * destination->resolution_x * destination->resolution_z);
memcpy(destination->data, source->data, sizeof(double) * destination->resolution_x * destination->resolution_z);
memcpy(destination->data, source->data, sizeof(double) * destination->resolution_x * destination->resolution_z);*/
}
void heightmapValidate(HeightMap* heightmap)
void terrainHeightmapSave(PackStream* stream, TerrainHeightMap* heightmap)
{
UNUSED(heightmap);
}
void heightmapSave(PackStream* stream, HeightMap* heightmap)
{
int i;
/*int i;
packWriteInt(stream, &heightmap->resolution_x);
packWriteInt(stream, &heightmap->resolution_z);
for (i = 0; i < heightmap->resolution_x * heightmap->resolution_z; i++)
{
packWriteDouble(stream, &heightmap->data[i]);
}
}*/
}
void heightmapLoad(PackStream* stream, HeightMap* heightmap)
void terrainHeightmapLoad(PackStream* stream, TerrainHeightMap* heightmap)
{
int i;
/*int i;
packReadInt(stream, &heightmap->resolution_x);
packReadInt(stream, &heightmap->resolution_z);
@ -59,9 +52,22 @@ void heightmapLoad(PackStream* stream, HeightMap* heightmap)
for (i = 0; i < heightmap->resolution_x * heightmap->resolution_z; i++)
{
packReadDouble(stream, &heightmap->data[i]);
}
}*/
}
void terrainBrushElevation(TerrainDefinition* heightmap, TerrainBrush* brush, double value)
{
}
void terrainBrushSmooth(TerrainDefinition* heightmap, TerrainBrush* brush, double value)
{
}
void terrainBrushAddNoise(TerrainDefinition* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value)
{
}
#if 0
static void _loadFromFilePixel(HeightMap* heightmap, int x, int y, Color col)
{
assert(x >= 0 && x < heightmap->resolution_x);
@ -184,7 +190,7 @@ void heightmapRevertToTerrain(HeightMap* heightmap, TerrainDefinition* terrain,
}
static inline void _getBrushBoundaries(HeightMapBrush* brush, int rx, int rz, int* x1, int* x2, int* z1, int* z2)
static inline void _getBrushBoundaries(TerrainBrush* brush, int rx, int rz, int* x1, int* x2, int* z1, int* z2)
{
double cx = brush->relative_x * rx;
double cz = brush->relative_z * rz;
@ -229,9 +235,9 @@ static inline void _getBrushBoundaries(HeightMapBrush* brush, int rx, int rz, in
}
}
typedef double (*BrushCallback)(HeightMap* heightmap, HeightMapBrush* brush, double x, double z, double basevalue, double influence, double force, void* data);
typedef double (*BrushCallback)(HeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data);
static inline void _applyBrush(HeightMap* heightmap, HeightMapBrush* brush, double force, void* data, BrushCallback callback)
static inline void _applyBrush(HeightMap* heightmap, TerrainBrush* brush, double force, void* data, BrushCallback callback)
{
int x, x1, x2, z, z1, z2;
double dx, dz, distance, influence;
@ -267,17 +273,17 @@ static inline void _applyBrush(HeightMap* heightmap, HeightMapBrush* brush, doub
}
}
static double _applyBrushElevation(HeightMap* heightmap, HeightMapBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
static double _applyBrushElevation(HeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
{
return basevalue + influence * force * brush->total_radius;
}
void heightmapBrushElevation(HeightMap* heightmap, HeightMapBrush* brush, double value)
void terrainBrushElevation(HeightMap* heightmap, TerrainBrush* brush, double value)
{
_applyBrush(heightmap, brush, value, NULL, _applyBrushElevation);
}
static double _applyBrushSmooth(HeightMap* heightmap, HeightMapBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
static double _applyBrushSmooth(HeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
{
double ideal, factor;
ideal = heightmapGetValue(heightmap, x + brush->total_radius * 0.5, z);
@ -293,17 +299,18 @@ static double _applyBrushSmooth(HeightMap* heightmap, HeightMapBrush* brush, dou
return basevalue + (ideal - basevalue) * factor;
}
void heightmapBrushSmooth(HeightMap* heightmap, HeightMapBrush* brush, double value)
void terrainBrushSmooth(HeightMap* heightmap, TerrainBrush* brush, double value)
{
_applyBrush(heightmap, brush, value, NULL, _applyBrushSmooth);
}
static double _applyBrushAddNoise(HeightMap* heightmap, HeightMapBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
static double _applyBrushAddNoise(HeightMap* heightmap, TerrainBrush* brush, double x, double z, double basevalue, double influence, double force, void* data)
{
return basevalue + noiseGet2DTotal((NoiseGenerator*)data, x / brush->total_radius, z / brush->total_radius) * influence * force * brush->total_radius;
}
void heightmapBrushAddNoise(HeightMap* heightmap, HeightMapBrush* brush, NoiseGenerator* generator, double value)
void terrainBrushAddNoise(HeightMap* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value)
{
_applyBrush(heightmap, brush, value, generator, _applyBrushAddNoise);
}
#endif

View file

@ -11,10 +11,10 @@ void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset)
{
case TERRAIN_PRESET_STANDARD:
noiseClearLevels(definition->_height_noise);
noiseAddLevelsSimple(definition->_height_noise, 10, 1.0, 1.0);
noiseSetFunctionParams(definition->_height_noise, NOISE_FUNCTION_SIMPLEX, -0.2);
definition->height = 12.0 / noiseGetMaxValue(definition->_height_noise);
definition->scaling = 80.0;
noiseAddLevelsSimple(definition->_height_noise, 8, 12.8, 12.8); /* Detail = 0.1 */
noiseSetFunctionParams(definition->_height_noise, NOISE_FUNCTION_SIMPLEX, 0.0);
definition->height = 2.0;
definition->scaling = 10.0;
definition->shadow_smoothing = 0.03;
break;
default:

View file

@ -1,4 +1,25 @@
#ifndef _PAYSAGES_TERRAIN_PRIVATE_H_
#define _PAYSAGES_TERRAIN_PRIVATE_H_
#include "public.h"
#define TERRAIN_HEIGHTMAP_DETAIL 0.1
typedef struct
{
int xstart;
int ystart;
int xsize;
int ysize;
void* data;
} TerrainHeightMapData;
typedef struct
{
int fixed_count;
TerrainHeightMapData* fixed_data;
int floating_count;
TerrainHeightMapData* floating_data;
} TerrainHeightMap;
#endif

View file

@ -49,6 +49,19 @@ void terrainRenderSurface(Renderer* renderer);
/*Renderer terrainCreatePreviewRenderer();
Color terrainGetPreview(Renderer* renderer, double x, double y);*/
typedef struct
{
double relative_x;
double relative_z;
double hard_radius;
double smoothed_size;
double total_radius;
} TerrainBrush;
void terrainBrushElevation(TerrainDefinition* heightmap, TerrainBrush* brush, double value);
void terrainBrushSmooth(TerrainDefinition* heightmap, TerrainBrush* brush, double value);
void terrainBrushAddNoise(TerrainDefinition* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value);
#ifdef __cplusplus
}
#endif