paysages : Small changes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@488 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-12-24 15:15:40 +00:00 committed by ThunderK
parent 67eadf9048
commit eaf72f810c
17 changed files with 123 additions and 111 deletions

View file

@ -120,7 +120,7 @@ int main(int argc, char** argv)
printf("Initializing ...\n"); printf("Initializing ...\n");
paysagesInit(); paysagesInit();
if (conf_file_path) if (conf_file_path)
{ {
paysagesLoad(conf_file_path); paysagesLoad(conf_file_path);
@ -131,14 +131,14 @@ int main(int argc, char** argv)
for (outputcount = 0; outputcount < conf_nb_pictures; outputcount++) for (outputcount = 0; outputcount < conf_nb_pictures; outputcount++)
{ {
autoSetDaytimeFraction(conf_daytime_start); /*autoSetDaytimeFraction(conf_daytime_start);*/ /* TODO */
sprintf(outputpath, "output/pic%05d.png", outputcount); sprintf(outputpath, "output/pic%05d.png", outputcount);
startRender(&renderer, outputpath, conf_render_params); startRender(&renderer, outputpath, conf_render_params);
conf_daytime_start += conf_daytime_step; conf_daytime_start += conf_daytime_step;
} }
printf("Cleaning up ...\n"); printf("Cleaning up ...\n");
rendererDelete(&renderer); rendererDelete(&renderer);
paysagesQuit(); paysagesQuit();

View file

@ -20,7 +20,7 @@ public:
_noise_original = noise; _noise_original = noise;
_noise_preview = noiseCreateGenerator(); _noise_preview = noiseCreateGenerator();
_level = -1; _level = -1;
configScaling(0.15, 6.0, 0.09, 6.0); configScaling(0.15, 6.0, 0.09, 6.0);
} }
@ -58,7 +58,7 @@ public:
{ {
_noise_original = noise; _noise_original = noise;
_noise_preview = noiseCreateGenerator(); _noise_preview = noiseCreateGenerator();
configScaling(0.15, 6.0, 0.09, 6.0); configScaling(0.15, 6.0, 0.09, 6.0);
} }
protected: protected:
@ -108,7 +108,7 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
previews->layout()->addWidget(label); previews->layout()->addWidget(label);
previews->layout()->addWidget(previewLevel); previews->layout()->addWidget(previewLevel);
previewTotal = new PreviewTotal(previews, _current); previewTotal = new PreviewTotal(previews, _current);
label = new QLabel(tr("Total preview")); label = new QLabel(tr("Total preview"));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@ -118,11 +118,11 @@ DialogNoise::DialogNoise(QWidget *parent, NoiseGenerator* value):
form = new QWidget(this); form = new QWidget(this);
form->setLayout(new QVBoxLayout()); form->setLayout(new QVBoxLayout());
layout()->addWidget(form); layout()->addWidget(form);
function = new QWidget(form); function = new QWidget(form);
function->setLayout(new QHBoxLayout()); function->setLayout(new QHBoxLayout());
form->layout()->addWidget(function); form->layout()->addWidget(function);
function->layout()->addWidget(new QLabel(tr("Noise function"))); function->layout()->addWidget(new QLabel(tr("Noise function")));
function_algo = new QComboBox(function); function_algo = new QComboBox(function);
function_algo->addItems(QStringList(tr("Simplex (best)")) << tr("Perlin (fast)") << tr("Naive (slow)")); function_algo->addItems(QStringList(tr("Simplex (best)")) << tr("Perlin (fast)") << tr("Naive (slow)"));
@ -222,7 +222,7 @@ bool DialogNoise::getNoise(QWidget* parent, NoiseGenerator* noise)
return (result != 0) ? true : false; return (result != 0) ? true : false;
} }
void DialogNoise::closeEvent(QCloseEvent* e) void DialogNoise::closeEvent(QCloseEvent*)
{ {
reject(); reject();
} }
@ -245,7 +245,7 @@ void DialogNoise::revertToCurrent()
int i, n; int i, n;
int selected; int selected;
NoiseFunction function; NoiseFunction function;
selected = levels->currentRow(); selected = levels->currentRow();
levels->clear(); levels->clear();
@ -254,7 +254,7 @@ void DialogNoise::revertToCurrent()
{ {
levels->addItem(QString(tr("Component %1")).arg(i + 1)); levels->addItem(QString(tr("Component %1")).arg(i + 1));
} }
if (n > 0) if (n > 0)
{ {
if (selected < 0) if (selected < 0)
@ -267,7 +267,7 @@ void DialogNoise::revertToCurrent()
} }
levels->setCurrentRow(selected); levels->setCurrentRow(selected);
} }
function = noiseGetFunction(_current); function = noiseGetFunction(_current);
function_algo->setCurrentIndex((int)function.algorithm); function_algo->setCurrentIndex((int)function.algorithm);
function_ridge->setValue(round(function.ridge_factor * 20.0)); function_ridge->setValue(round(function.ridge_factor * 20.0));
@ -279,7 +279,7 @@ void DialogNoise::revertToCurrent()
void DialogNoise::addLevel() void DialogNoise::addLevel()
{ {
NoiseLevel level; NoiseLevel level;
level.height = 0.1; level.height = 0.1;
level.scaling = 0.1; level.scaling = 0.1;
level.xoffset = 0.0; level.xoffset = 0.0;
@ -288,20 +288,20 @@ void DialogNoise::addLevel()
noiseAddLevel(_current, level); noiseAddLevel(_current, level);
revertToCurrent(); revertToCurrent();
levels->setCurrentRow(levels->count() - 1); levels->setCurrentRow(levels->count() - 1);
} }
void DialogNoise::removeLevel() void DialogNoise::removeLevel()
{ {
int row; int row;
row = levels->currentRow(); row = levels->currentRow();
noiseRemoveLevel(_current, _current_level); noiseRemoveLevel(_current, _current_level);
revertToCurrent(); revertToCurrent();
if (row >= levels->count()) if (row >= levels->count())
{ {
row--; row--;
@ -312,13 +312,13 @@ void DialogNoise::removeLevel()
void DialogNoise::functionChanged() void DialogNoise::functionChanged()
{ {
NoiseFunction function; NoiseFunction function;
function.algorithm = (NoiseFunctionAlgorithm)function_algo->currentIndex(); function.algorithm = (NoiseFunctionAlgorithm)function_algo->currentIndex();
function.ridge_factor = (double)function_ridge->value() * 0.05; function.ridge_factor = (double)function_ridge->value() * 0.05;
noiseSetFunction(_current, &function); noiseSetFunction(_current, &function);
noiseValidate(_current); noiseValidate(_current);
previewLevel->redraw(); previewLevel->redraw();
previewTotal->redraw(); previewTotal->redraw();
} }

View file

@ -8,12 +8,12 @@ ExplorerChunkSky::ExplorerChunkSky(Renderer* renderer, double size, SkyboxOrient
{ {
_box_size = size; _box_size = size;
_orientation = orientation; _orientation = orientation;
setMaxTextureSize(256); setMaxTextureSize(256);
maintain(); maintain();
} }
void ExplorerChunkSky::onRenderEvent(QGLWidget* widget) void ExplorerChunkSky::onRenderEvent(QGLWidget*)
{ {
double size = _box_size; double size = _box_size;
Vector3 camera = renderer()->camera_location; Vector3 camera = renderer()->camera_location;
@ -85,7 +85,7 @@ void ExplorerChunkSky::onRenderEvent(QGLWidget* widget)
glEnd(); glEnd();
} }
double ExplorerChunkSky::getDisplayedSizeHint(CameraDefinition* camera) double ExplorerChunkSky::getDisplayedSizeHint(CameraDefinition*)
{ {
return 1000.0; return 1000.0;
} }
@ -93,10 +93,10 @@ double ExplorerChunkSky::getDisplayedSizeHint(CameraDefinition* camera)
Color ExplorerChunkSky::getTextureColor(double x, double y) Color ExplorerChunkSky::getTextureColor(double x, double y)
{ {
Vector3 location; Vector3 location;
x -= 0.5; x -= 0.5;
y -= 0.5; y -= 0.5;
switch(_orientation) switch(_orientation)
{ {
case SKYBOX_NORTH: case SKYBOX_NORTH:

View file

@ -94,7 +94,7 @@ void ExplorerChunkTerrain::onCameraEvent(CameraDefinition* camera)
_lock_data.unlock(); _lock_data.unlock();
} }
void ExplorerChunkTerrain::onRenderEvent(QGLWidget* widget) void ExplorerChunkTerrain::onRenderEvent(QGLWidget*)
{ {
_lock_data.lock(); _lock_data.lock();
int tessellation_size = _tessellation_current_size; int tessellation_size = _tessellation_current_size;

View file

@ -77,7 +77,8 @@ FormAtmosphere::FormAtmosphere(QWidget *parent):
addPreview(previewEast, QString(tr("East preview"))); addPreview(previewEast, QString(tr("East preview")));
addInputEnum(tr("Color model"), (int*)&_definition->model, QStringList(tr("Preetham/Shirley analytic model")) << tr("Bruneton/Neyret precomputed model")); addInputEnum(tr("Color model"), (int*)&_definition->model, QStringList(tr("Preetham/Shirley analytic model")) << tr("Bruneton/Neyret precomputed model"));
addInputDouble(tr("Day time"), &_definition->daytime, 0.14, 0.86, 0.002, 0.1); addInputInt(tr("Day time (hour)"), &_definition->hour, 0, 23, 1, 10);
addInputInt(tr("Day time (minute)"), &_definition->minute, 0, 59, 1, 10);
addInputColor(tr("Sun color"), &_definition->sun_color); addInputColor(tr("Sun color"), &_definition->sun_color);
addInputDouble(tr("Sun radius"), &_definition->sun_radius, 0.0, 0.4, 0.004, 0.04); addInputDouble(tr("Sun radius"), &_definition->sun_radius, 0.0, 0.4, 0.004, 0.04);
addInputDouble(tr("Sun halo radius"), &_definition->sun_halo_size, 0.0, 0.4, 0.004, 0.04); addInputDouble(tr("Sun halo radius"), &_definition->sun_halo_size, 0.0, 0.4, 0.004, 0.04);

View file

@ -47,7 +47,7 @@ protected:
{ {
cloudsLayerCopyDefinition(_original_layer, _preview_layer); cloudsLayerCopyDefinition(_original_layer, _preview_layer);
} }
static Color _applyLightStatus(Renderer* renderer, LightStatus* status, Vector3 location, Vector3 normal, SurfaceMaterial material) static Color _applyLightStatus(Renderer*, LightStatus*, Vector3, Vector3, SurfaceMaterial)
{ {
return COLOR_WHITE; return COLOR_WHITE;
} }

View file

@ -56,7 +56,7 @@ int main(int argc, char** argv)
app.installTranslator(&qtTranslator); app.installTranslator(&qtTranslator);
} }
splash->showMessage(app.tr("Preloading..."), Qt::AlignCenter, Qt::white); //splash->showMessage(app.tr("Preloading..."), Qt::AlignCenter, Qt::white);
app.processEvents(); app.processEvents();
paysagesInit(); paysagesInit();
@ -184,7 +184,6 @@ void MainWindow::fileNew()
if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
{ {
autoGenRealisticLandscape(0); autoGenRealisticLandscape(0);
autoSetDaytime(8, 30);
refreshAll(); refreshAll();
} }
} }

View file

@ -0,0 +1,41 @@
#include "private.h"
#include <assert.h>
#include <math.h>
#include "../renderer.h"
Color basicApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base)
{
Vector3 direction = v3Sub(location, renderer->camera_location);
double distance = v3Norm(direction);
AtmosphereDefinition* definition = renderer->atmosphere->definition;
double near = 10.0 - definition->humidity * 10.0;
double far = 100.0 - definition->humidity * 90.0;
double max = 0.85 + definition->humidity * 0.12;
assert(near < far);
if (distance < near)
{
return base;
}
else
{
if (distance > far)
{
distance = far;
}
double factor = (distance - near) / (far - near);
/* TODO Get sky color without celestial objects (sun, stars...) */
double angle = (1.0 - factor) * (1.0 - factor) * (1.0 - factor) * (1.0 - factor) * M_PI_4;
direction = v3Normalize(direction);
direction.y = sin(angle);
Color sky = renderer->atmosphere->getSkyColor(renderer, v3Normalize(direction));
sky.a = max * factor;
colorMask(&base, &sky);
return base;
}
}

View file

@ -25,7 +25,7 @@ static const double exposure = 0.4;
static const double ISun = 100.0; static const double ISun = 100.0;
static const double AVERAGE_GROUND_REFLECTANCE = 0.1; static const double AVERAGE_GROUND_REFLECTANCE = 0.1;
#if 0 #if 1
#define RES_MU 128 #define RES_MU 128
#define RES_MU_S 32 #define RES_MU_S 32
#define RES_R 32 #define RES_R 32

View file

@ -23,7 +23,24 @@ static int _inited = 0;
/******************** Definition ********************/ /******************** Definition ********************/
static void _validateDefinition(AtmosphereDefinition* definition) static void _validateDefinition(AtmosphereDefinition* definition)
{ {
UNUSED(definition); if (definition->hour < 0)
{
definition->hour = 0;
}
if (definition->hour > 23)
{
definition->hour = 23;
}
if (definition->minute < 0)
{
definition->minute = 0;
}
if (definition->minute > 59)
{
definition->minute = 59;
}
definition->_daytime = (double)definition->hour / 24.0 + (double)definition->minute / 1440.0;
} }
static AtmosphereDefinition* _createDefinition() static AtmosphereDefinition* _createDefinition()
@ -54,7 +71,8 @@ static void _deleteDefinition(AtmosphereDefinition* definition)
static void _copyDefinition(AtmosphereDefinition* source, AtmosphereDefinition* destination) static void _copyDefinition(AtmosphereDefinition* source, AtmosphereDefinition* destination)
{ {
destination->model = source->model; destination->model = source->model;
destination->daytime = source->daytime; destination->hour = source->hour;
destination->minute = source->minute;
destination->sun_color = source->sun_color; destination->sun_color = source->sun_color;
destination->sun_radius = source->sun_radius; destination->sun_radius = source->sun_radius;
destination->sun_halo_size = source->sun_halo_size; destination->sun_halo_size = source->sun_halo_size;
@ -69,7 +87,8 @@ static void _copyDefinition(AtmosphereDefinition* source, AtmosphereDefinition*
static void _saveDefinition(PackStream* stream, AtmosphereDefinition* definition) static void _saveDefinition(PackStream* stream, AtmosphereDefinition* definition)
{ {
packWriteInt(stream, (int*)&definition->model); packWriteInt(stream, (int*)&definition->model);
packWriteDouble(stream, &definition->daytime); packWriteInt(stream, &definition->hour);
packWriteInt(stream, &definition->minute);
colorSave(stream, &definition->sun_color); colorSave(stream, &definition->sun_color);
packWriteDouble(stream, &definition->sun_radius); packWriteDouble(stream, &definition->sun_radius);
packWriteDouble(stream, &definition->sun_halo_size); packWriteDouble(stream, &definition->sun_halo_size);
@ -81,7 +100,8 @@ static void _saveDefinition(PackStream* stream, AtmosphereDefinition* definition
static void _loadDefinition(PackStream* stream, AtmosphereDefinition* definition) static void _loadDefinition(PackStream* stream, AtmosphereDefinition* definition)
{ {
packReadInt(stream, (int*)&definition->model); packReadInt(stream, (int*)&definition->model);
packReadDouble(stream, &definition->daytime); packReadInt(stream, &definition->hour);
packReadInt(stream, &definition->minute);
colorLoad(stream, &definition->sun_color); colorLoad(stream, &definition->sun_color);
packReadDouble(stream, &definition->sun_radius); packReadDouble(stream, &definition->sun_radius);
packReadDouble(stream, &definition->sun_halo_size); packReadDouble(stream, &definition->sun_halo_size);
@ -175,7 +195,7 @@ static Color _getSkyColor(Renderer* renderer, Vector3 direction)
static Vector3 _getSunDirection(Renderer* renderer) static Vector3 _getSunDirection(Renderer* renderer)
{ {
Vector3 result; Vector3 result;
double sun_angle = (renderer->atmosphere->definition->daytime + 0.75) * M_PI * 2.0; double sun_angle = (renderer->atmosphere->definition->_daytime + 0.75) * M_PI * 2.0;
result.x = cos(sun_angle); result.x = cos(sun_angle);
result.y = sin(sun_angle); result.y = sin(sun_angle);
result.z = 0.0; result.z = 0.0;
@ -207,7 +227,7 @@ static int _getSkydomeLights(Renderer* renderer, LightDefinition* lights, int ma
{ {
definition = renderer->atmosphere->definition; definition = renderer->atmosphere->definition;
sun_angle = (definition->daytime + 0.75) * M_PI * 2.0; sun_angle = (definition->_daytime + 0.75) * M_PI * 2.0;
sun_direction.x = cos(sun_angle); sun_direction.x = cos(sun_angle);
sun_direction.y = sin(sun_angle); sun_direction.y = sin(sun_angle);
sun_direction.z = 0.0; sun_direction.z = 0.0;
@ -321,14 +341,11 @@ static void _bindRenderer(AtmosphereRenderer* renderer, AtmosphereDefinition* de
switch (definition->model) switch (definition->model)
{ {
case ATMOSPHERE_MODEL_PREETHAM:
renderer->applyAerialPerspective = preethamApplyAerialPerspective;
break;
case ATMOSPHERE_MODEL_BRUNETON: case ATMOSPHERE_MODEL_BRUNETON:
renderer->applyAerialPerspective = brunetonApplyAerialPerspective; renderer->applyAerialPerspective = brunetonApplyAerialPerspective;
break; break;
default: default:
renderer->applyAerialPerspective = _fakeApplyAerialPerspective; renderer->applyAerialPerspective = basicApplyAerialPerspective;
} }
mutexAcquire(cache->lock); mutexAcquire(cache->lock);

View file

@ -135,33 +135,3 @@ Color preethamGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3
colorMask(&result, &humidity_color); colorMask(&result, &humidity_color);
return result; return result;
} }
Color preethamApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base)
{
Vector3 ray = v3Sub(location, renderer->camera_location);
Vector3 direction = v3Normalize(ray);
double distance = v3Norm(ray);
AtmosphereDefinition* definition = renderer->atmosphere->definition;
double near = 10.0 - definition->humidity * 10.0;
double far = 100.0 - definition->humidity * 90.0;
double max = 0.85 + definition->humidity * 0.12;
assert(near < far);
if (distance < near)
{
return base;
}
else
{
Vector3 sun_position = renderer->atmosphere->getSunDirection(renderer);
Color sky = preethamGetSkyColor(definition, renderer->camera_location, direction, sun_position);
if (distance > far)
{
distance = far;
}
sky.a = max * ((distance - near) / (far - near));
colorMask(&base, &sky);
return base;
}
}

View file

@ -22,30 +22,35 @@ void atmosphereAutoPreset(AtmosphereDefinition* definition, AtmospherePreset pre
{ {
case ATMOSPHERE_PRESET_CLEAR_DAY: case ATMOSPHERE_PRESET_CLEAR_DAY:
definition->model = ATMOSPHERE_MODEL_BRUNETON; definition->model = ATMOSPHERE_MODEL_BRUNETON;
definition->daytime = 0.4; definition->hour = 15;
definition->minute = 0;
definition->dome_lighting = 0.6; definition->dome_lighting = 0.6;
break; break;
case ATMOSPHERE_PRESET_CLEAR_SUNSET: case ATMOSPHERE_PRESET_CLEAR_SUNSET:
definition->model = ATMOSPHERE_MODEL_BRUNETON; definition->model = ATMOSPHERE_MODEL_BRUNETON;
definition->daytime = 0.74; definition->hour = 17;
definition->minute = 45;
definition->dome_lighting = 0.8; definition->dome_lighting = 0.8;
definition->sun_radius = 0.03; definition->sun_radius = 0.03;
break; break;
case ATMOSPHERE_PRESET_HAZY_MORNING: case ATMOSPHERE_PRESET_HAZY_MORNING:
definition->model = ATMOSPHERE_MODEL_PREETHAM; definition->model = ATMOSPHERE_MODEL_PREETHAM;
definition->daytime = 0.3; definition->hour = 8;
definition->minute = 30;
definition->dome_lighting = 0.5; definition->dome_lighting = 0.5;
definition->humidity = 0.3; definition->humidity = 0.3;
break; break;
case ATMOSPHERE_PRESET_FOGGY: case ATMOSPHERE_PRESET_FOGGY:
definition->model = ATMOSPHERE_MODEL_PREETHAM; definition->model = ATMOSPHERE_MODEL_PREETHAM;
definition->daytime = 0.4; definition->hour = 15;
definition->minute = 0;
definition->dome_lighting = 0.7; definition->dome_lighting = 0.7;
definition->humidity = 0.6; definition->humidity = 0.6;
break; break;
case ATMOSPHERE_PRESET_STORMY: case ATMOSPHERE_PRESET_STORMY:
definition->model = ATMOSPHERE_MODEL_PREETHAM; definition->model = ATMOSPHERE_MODEL_PREETHAM;
definition->daytime = 0.4; definition->hour = 15;
definition->minute = 0;
definition->dome_lighting = 0.3; definition->dome_lighting = 0.3;
definition->humidity = 0.9; definition->humidity = 0.9;
break; break;

View file

@ -5,11 +5,12 @@
#define SPHERE_SIZE 1000.0 #define SPHERE_SIZE 1000.0
Color basicApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base);
void brunetonInit(); void brunetonInit();
Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position); Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position);
Color brunetonApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base); Color brunetonApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base);
Color preethamGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position); Color preethamGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position);
Color preethamApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base);
#endif #endif

View file

@ -29,13 +29,16 @@ typedef enum
typedef struct typedef struct
{ {
AtmosphereModel model; AtmosphereModel model;
double daytime; int hour;
int minute;
double humidity; double humidity;
Color sun_color; Color sun_color;
double sun_radius; double sun_radius;
double sun_halo_size; double sun_halo_size;
Curve* sun_halo_profile; Curve* sun_halo_profile;
double dome_lighting; double dome_lighting;
double _daytime;
} AtmosphereDefinition; } AtmosphereDefinition;
typedef int (*FuncAtmosphereGetSkydomeLights)(Renderer* renderer, LightDefinition* array, int max_lights); typedef int (*FuncAtmosphereGetSkydomeLights)(Renderer* renderer, LightDefinition* array, int max_lights);

View file

@ -16,28 +16,6 @@
#include "water.h" #include "water.h"
#include "zone.h" #include "zone.h"
void autoSetDaytime(int hour, int minute)
{
autoSetDaytimeFraction((double)hour / 24.0 + (double)minute / 1440.0);
}
void autoSetDaytimeFraction(double daytime)
{
AtmosphereDefinition* atmosphere;
daytime = fmod(daytime, 1.0);
if (daytime < 0.0)
{
daytime += 1.0;
}
atmosphere = AtmosphereDefinitionClass.create();
sceneryGetAtmosphere(atmosphere);
atmosphere->daytime = daytime;
scenerySetAtmosphere(atmosphere);
AtmosphereDefinitionClass.destroy(atmosphere);
}
void autoGenRealisticLandscape(int seed) void autoGenRealisticLandscape(int seed)
{ {
WaterDefinition water; WaterDefinition water;

View file

@ -7,8 +7,6 @@
extern "C" { extern "C" {
#endif #endif
void autoSetDaytime(int hour, int minute);
void autoSetDaytimeFraction(double daytime);
void autoGenRealisticLandscape(int seed); void autoGenRealisticLandscape(int seed);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -32,7 +32,6 @@ void paysagesInit()
cameraDeleteDefinition(&camera); cameraDeleteDefinition(&camera);
autoGenRealisticLandscape(0); autoGenRealisticLandscape(0);
autoSetDaytime(8, 30);
// DEBUG // DEBUG
/*double last_height, height, x; /*double last_height, height, x;
@ -52,7 +51,7 @@ void paysagesQuit()
{ {
sceneryQuit(); sceneryQuit();
renderQuit(); renderQuit();
openclQuit(); openclQuit();
} }
@ -60,21 +59,21 @@ FileOperationResult paysagesSave(char* filepath)
{ {
PackStream* stream = packWriteFile(filepath); PackStream* stream = packWriteFile(filepath);
double app_header, version_header; double app_header, version_header;
if (!stream) if (!stream)
{ {
return FILE_OPERATION_IOERROR; return FILE_OPERATION_IOERROR;
} }
app_header = (double)APP_HEADER; app_header = (double)APP_HEADER;
packWriteDouble(stream, &app_header); packWriteDouble(stream, &app_header);
version_header = (double)PAYSAGES_CURRENT_DATA_VERSION; version_header = (double)PAYSAGES_CURRENT_DATA_VERSION;
packWriteDouble(stream, &version_header); packWriteDouble(stream, &version_header);
scenerySave(stream); scenerySave(stream);
packCloseStream(stream); packCloseStream(stream);
return FILE_OPERATION_OK; return FILE_OPERATION_OK;
} }
@ -94,7 +93,7 @@ FileOperationResult paysagesLoad(char* filepath)
packCloseStream(stream); packCloseStream(stream);
return FILE_OPERATION_APP_MISMATCH; return FILE_OPERATION_APP_MISMATCH;
} }
packReadDouble(stream, &version_header); packReadDouble(stream, &version_header);
if ((int)version_header != PAYSAGES_CURRENT_DATA_VERSION) if ((int)version_header != PAYSAGES_CURRENT_DATA_VERSION)
{ {
@ -105,6 +104,6 @@ FileOperationResult paysagesLoad(char* filepath)
sceneryLoad(stream); sceneryLoad(stream);
packCloseStream(stream); packCloseStream(stream);
return FILE_OPERATION_OK; return FILE_OPERATION_OK;
} }