A little cleaning, and fixed some camera issues

This commit is contained in:
Michaël Lemaire 2013-06-16 23:01:22 +02:00
parent 5c21a548e3
commit d401d0105c
9 changed files with 24 additions and 49 deletions

2
TODO
View file

@ -1,4 +1,6 @@
Technology Preview 2 :
- Investigate the preview render threads dying.
- Add initial terrain offset so that the (0,0) coordinates are above water.
- Finalize terrain editor.
=> Add a generation dialog for base noise (overwriting changes).
- Get rid of noise dialogs, for simpler settings.

View file

@ -25,7 +25,6 @@
#include "dialogexplorer.h"
#include "rendering/main.h"
#include "rendering/auto.h"
#include "rendering/scenery.h"
#include "tools.h"
@ -126,6 +125,9 @@ MainWindow::MainWindow(QWidget *parent) :
scenerySetCustomDataCallback(MainWindow::guiSaveCallback, MainWindow::guiLoadCallback, this);
// FIXME AutoPreset has already been called by paysagesInit but we need to redo it here because
// the auto apply on FormRender overwrites the camera. Delete this when the render form is no longer a BaseForm.
sceneryAutoPreset(0);
refreshAll();
}
@ -170,7 +172,7 @@ 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)
{
autoGenRealisticLandscape(0);
sceneryAutoPreset(0);
refreshAll();
}
}

View file

@ -13,7 +13,6 @@
#include "tools.h"
#include "rendering/scenery.h"
#include "rendering/auto.h"
static DialogRender* _current_dialog;

View file

@ -1,21 +0,0 @@
#include "auto.h"
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include "render.h"
#include "scenery.h"
#include "system.h"
#include "zone.h"
void autoGenRealisticLandscape(int seed)
{
if (!seed)
{
seed = time(NULL);
}
srand(seed);
sceneryAutoPreset();
}

View file

@ -1,16 +0,0 @@
#ifndef _PAYSAGES_AUTO_H_
#define _PAYSAGES_AUTO_H_
#include "renderer.h"
#ifdef __cplusplus
extern "C" {
#endif
void autoGenRealisticLandscape(int seed);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -116,9 +116,9 @@ void cameraValidateDefinition(CameraDefinition* definition, int check_above)
}
}
if (definition->location.y > 100.0)
if (definition->location.y > 300.0)
{
definition->location.y = 100.0;
definition->location.y = 300.0;
}
definition->forward.x = 1.0;

View file

@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "auto.h"
#include "tools/data.h"
#include "system.h"
#include "scenery.h"
@ -24,8 +23,6 @@ void paysagesInit()
sceneryInit();
renderInit();
autoGenRealisticLandscape(0);
}
void paysagesQuit()

View file

@ -1,5 +1,6 @@
#include "scenery.h"
#include <time.h>
#include "tools/color.h"
#include "tools/euclid.h"
#include "render.h"
@ -29,6 +30,8 @@ void sceneryInit()
_custom_save = NULL;
_custom_load = NULL;
sceneryAutoPreset(0);
}
void sceneryQuit()
@ -43,13 +46,23 @@ void sceneryQuit()
noiseQuit();
}
void sceneryAutoPreset()
void sceneryAutoPreset(int seed)
{
if (!seed)
{
seed = time(NULL);
}
srand(seed);
terrainAutoPreset(_terrain, TERRAIN_PRESET_STANDARD);
texturesAutoPreset(_textures, TEXTURES_PRESET_IRELAND);
atmosphereAutoPreset(_atmosphere, ATMOSPHERE_PRESET_CLEAR_DAY);
waterAutoPreset(_water, WATER_PRESET_LAKE);
cloudsAutoPreset(_clouds, CLOUDS_PRESET_PARTLY_CLOUDY);
cameraSetLocation(_camera, VECTOR_ZERO);
cameraSetTarget(_camera, VECTOR_NORTH);
cameraValidateDefinition(_camera, 1);
}
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data)
@ -203,8 +216,6 @@ Renderer* sceneryCreateStandardRenderer()
result = rendererCreate();
cameraCopyDefinition(_camera, result->render_camera);
result->rayWalking = _rayWalking;
result->getPrecision = _getPrecision;
@ -215,6 +226,7 @@ Renderer* sceneryCreateStandardRenderer()
void sceneryBindRenderer(Renderer* renderer)
{
cameraCopyDefinition(_camera, renderer->render_camera);
AtmosphereRendererClass.bind(renderer, _atmosphere);
TerrainRendererClass.bind(renderer, _terrain);
TexturesRendererClass.bind(renderer, _textures);

View file

@ -26,7 +26,7 @@ typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data);
void sceneryInit();
void sceneryQuit();
void sceneryAutoPreset();
void sceneryAutoPreset(int seed);
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data);