A little cleaning, and fixed some camera issues
This commit is contained in:
parent
5c21a548e3
commit
d401d0105c
9 changed files with 24 additions and 49 deletions
2
TODO
2
TODO
|
@ -1,4 +1,6 @@
|
||||||
Technology Preview 2 :
|
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.
|
- Finalize terrain editor.
|
||||||
=> Add a generation dialog for base noise (overwriting changes).
|
=> Add a generation dialog for base noise (overwriting changes).
|
||||||
- Get rid of noise dialogs, for simpler settings.
|
- Get rid of noise dialogs, for simpler settings.
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "dialogexplorer.h"
|
#include "dialogexplorer.h"
|
||||||
|
|
||||||
#include "rendering/main.h"
|
#include "rendering/main.h"
|
||||||
#include "rendering/auto.h"
|
|
||||||
#include "rendering/scenery.h"
|
#include "rendering/scenery.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
|
@ -126,6 +125,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
|
|
||||||
scenerySetCustomDataCallback(MainWindow::guiSaveCallback, MainWindow::guiLoadCallback, this);
|
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();
|
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)
|
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();
|
refreshAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#include "rendering/scenery.h"
|
#include "rendering/scenery.h"
|
||||||
#include "rendering/auto.h"
|
|
||||||
|
|
||||||
static DialogRender* _current_dialog;
|
static DialogRender* _current_dialog;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -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;
|
definition->forward.x = 1.0;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "auto.h"
|
|
||||||
#include "tools/data.h"
|
#include "tools/data.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "scenery.h"
|
#include "scenery.h"
|
||||||
|
@ -24,8 +23,6 @@ void paysagesInit()
|
||||||
|
|
||||||
sceneryInit();
|
sceneryInit();
|
||||||
renderInit();
|
renderInit();
|
||||||
|
|
||||||
autoGenRealisticLandscape(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void paysagesQuit()
|
void paysagesQuit()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "scenery.h"
|
#include "scenery.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include "tools/color.h"
|
#include "tools/color.h"
|
||||||
#include "tools/euclid.h"
|
#include "tools/euclid.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
@ -29,6 +30,8 @@ void sceneryInit()
|
||||||
|
|
||||||
_custom_save = NULL;
|
_custom_save = NULL;
|
||||||
_custom_load = NULL;
|
_custom_load = NULL;
|
||||||
|
|
||||||
|
sceneryAutoPreset(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sceneryQuit()
|
void sceneryQuit()
|
||||||
|
@ -43,13 +46,23 @@ void sceneryQuit()
|
||||||
noiseQuit();
|
noiseQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sceneryAutoPreset()
|
void sceneryAutoPreset(int seed)
|
||||||
{
|
{
|
||||||
|
if (!seed)
|
||||||
|
{
|
||||||
|
seed = time(NULL);
|
||||||
|
}
|
||||||
|
srand(seed);
|
||||||
|
|
||||||
terrainAutoPreset(_terrain, TERRAIN_PRESET_STANDARD);
|
terrainAutoPreset(_terrain, TERRAIN_PRESET_STANDARD);
|
||||||
texturesAutoPreset(_textures, TEXTURES_PRESET_IRELAND);
|
texturesAutoPreset(_textures, TEXTURES_PRESET_IRELAND);
|
||||||
atmosphereAutoPreset(_atmosphere, ATMOSPHERE_PRESET_CLEAR_DAY);
|
atmosphereAutoPreset(_atmosphere, ATMOSPHERE_PRESET_CLEAR_DAY);
|
||||||
waterAutoPreset(_water, WATER_PRESET_LAKE);
|
waterAutoPreset(_water, WATER_PRESET_LAKE);
|
||||||
cloudsAutoPreset(_clouds, CLOUDS_PRESET_PARTLY_CLOUDY);
|
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)
|
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data)
|
||||||
|
@ -203,8 +216,6 @@ Renderer* sceneryCreateStandardRenderer()
|
||||||
|
|
||||||
result = rendererCreate();
|
result = rendererCreate();
|
||||||
|
|
||||||
cameraCopyDefinition(_camera, result->render_camera);
|
|
||||||
|
|
||||||
result->rayWalking = _rayWalking;
|
result->rayWalking = _rayWalking;
|
||||||
result->getPrecision = _getPrecision;
|
result->getPrecision = _getPrecision;
|
||||||
|
|
||||||
|
@ -215,6 +226,7 @@ Renderer* sceneryCreateStandardRenderer()
|
||||||
|
|
||||||
void sceneryBindRenderer(Renderer* renderer)
|
void sceneryBindRenderer(Renderer* renderer)
|
||||||
{
|
{
|
||||||
|
cameraCopyDefinition(_camera, renderer->render_camera);
|
||||||
AtmosphereRendererClass.bind(renderer, _atmosphere);
|
AtmosphereRendererClass.bind(renderer, _atmosphere);
|
||||||
TerrainRendererClass.bind(renderer, _terrain);
|
TerrainRendererClass.bind(renderer, _terrain);
|
||||||
TexturesRendererClass.bind(renderer, _textures);
|
TexturesRendererClass.bind(renderer, _textures);
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data);
|
||||||
void sceneryInit();
|
void sceneryInit();
|
||||||
void sceneryQuit();
|
void sceneryQuit();
|
||||||
|
|
||||||
void sceneryAutoPreset();
|
void sceneryAutoPreset(int seed);
|
||||||
|
|
||||||
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data);
|
void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue