paysages : Small fixes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@462 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-11-10 17:05:01 +00:00 committed by ThunderK
parent 4b85289ac7
commit 1f58b866e6
10 changed files with 33 additions and 149 deletions

11
TODO
View file

@ -1,11 +1,7 @@
Technology Preview 2 : Technology Preview 2 :
- Fully move layer management from BaseForm to BaseFormLayer. - Fully move layer management from BaseForm to BaseFormLayer.
- Replace math.h methods by optimized ones (fastfloor, fastsin...). - Replace math.h methods by optimized ones (fastfloor, fastsin...).
- Replace terrain canvas editor by full sculpting editor. - Add foam to water.
=> Add a generation dialog, with fixed resolution.
=> Store local terrain modifications in fully dynamic canvas.
=> Add map preview with editor area.
=> Allow camera move and zoom.
- Finalize Preetham's model usage - Finalize Preetham's model usage
=> Apply model to atmosphere (aerial perspective) => Apply model to atmosphere (aerial perspective)
=> Find a proper model for night sky (maybe Shirley) => Find a proper model for night sky (maybe Shirley)
@ -16,6 +12,11 @@ Technology Preview 2 :
Technlogy Preview 3 : Technlogy Preview 3 :
- Add logarithmic sliders for some float values. - Add logarithmic sliders for some float values.
- Replace terrain canvas editor by full sculpting editor.
=> Add a generation dialog, with fixed resolution.
=> Store local terrain modifications in fully dynamic canvas.
=> Add map preview with editor area.
=> Allow camera move and zoom.
- Improve previews. - Improve previews.
=> Add user markers on OSD. => Add user markers on OSD.
=> Add areas marking. => Add areas marking.

View file

@ -8,7 +8,8 @@ BaseFormLayer::BaseFormLayer(QWidget* parent, Layers* layers) : BaseForm(parent,
_layers_modified = NULL; _layers_modified = NULL;
if (layers) if (layers)
{ {
setLayers(layers); _layers_original = layers;
_layers_modified = layersCreateCopy(_layers_original);
} }
} }

View file

@ -2,7 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <glib-2.0/glib/gmacros.h>
#include "euclid.h" #include "euclid.h"
#include "render.h" #include "render.h"
#include "shared/types.h" #include "shared/types.h"
@ -287,11 +286,12 @@ Vector3 cameraUnproject(CameraDefinition* camera, Renderer* renderer, Vector3 po
static inline void _updateBox(Vector3* point, double* xmin, double* xmax, double* ymin, double* ymax, double* zmax) static inline void _updateBox(Vector3* point, double* xmin, double* xmax, double* ymin, double* ymax, double* zmax)
{ {
*xmin = MIN(*xmin, point->x); *xmin = (*xmin < point->x) ? *xmin : point->x;
*xmax = MAX(*xmax, point->x); *ymin = (*ymin < point->y) ? *ymin : point->y;
*ymin = MIN(*ymin, point->y);
*ymax = MAX(*ymax, point->y); *xmax = (*xmax > point->x) ? *xmax : point->x;
*zmax = MAX(*zmax, point->z); *ymax = (*ymax > point->y) ? *ymax : point->y;
*zmax = (*zmax > point->z) ? *zmax : point->z;
} }
int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, double ysize, double zsize) int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, double ysize, double zsize)

View file

@ -5,7 +5,6 @@
#include "euclid.h" #include "euclid.h"
#include "render.h" #include "render.h"
#include "system.h" #include "system.h"
#include "vegetation.h"
static AtmosphereDefinition _atmosphere; static AtmosphereDefinition _atmosphere;
static CameraDefinition _camera; static CameraDefinition _camera;
@ -14,7 +13,6 @@ static LightingDefinition _lighting;
static SkyDefinition _sky; static SkyDefinition _sky;
static TerrainDefinition _terrain; static TerrainDefinition _terrain;
static TexturesDefinition _textures; static TexturesDefinition _textures;
static VegetationDefinition* _vegetation;
static WaterDefinition _water; static WaterDefinition _water;
static SceneryCustomDataCallback _custom_save = NULL; static SceneryCustomDataCallback _custom_save = NULL;
@ -33,7 +31,6 @@ void sceneryInit()
_sky = skyCreateDefinition(); _sky = skyCreateDefinition();
_terrain = terrainCreateDefinition(); _terrain = terrainCreateDefinition();
_textures = texturesCreateDefinition(); _textures = texturesCreateDefinition();
_vegetation = vegetationCreateDefinition();
_water = waterCreateDefinition(); _water = waterCreateDefinition();
_custom_save = NULL; _custom_save = NULL;
@ -49,7 +46,6 @@ void sceneryQuit()
skyDeleteDefinition(&_sky); skyDeleteDefinition(&_sky);
terrainDeleteDefinition(&_terrain); terrainDeleteDefinition(&_terrain);
texturesDeleteDefinition(&_textures); texturesDeleteDefinition(&_textures);
vegetationDeleteDefinition(_vegetation);
waterDeleteDefinition(&_water); waterDeleteDefinition(&_water);
lightingQuit(); lightingQuit();
@ -73,7 +69,6 @@ void scenerySave(PackStream* stream)
skySave(stream, &_sky); skySave(stream, &_sky);
terrainSave(stream, &_terrain); terrainSave(stream, &_terrain);
texturesSave(stream, &_textures); texturesSave(stream, &_textures);
vegetationSave(stream, _vegetation);
waterSave(stream, &_water); waterSave(stream, &_water);
if (_custom_save) if (_custom_save)
@ -94,7 +89,6 @@ void sceneryLoad(PackStream* stream)
skyLoad(stream, &_sky); skyLoad(stream, &_sky);
terrainLoad(stream, &_terrain); terrainLoad(stream, &_terrain);
texturesLoad(stream, &_textures); texturesLoad(stream, &_textures);
vegetationLoad(stream, _vegetation);
waterLoad(stream, &_water); waterLoad(stream, &_water);
atmosphereValidateDefinition(&_atmosphere); atmosphereValidateDefinition(&_atmosphere);
@ -104,7 +98,6 @@ void sceneryLoad(PackStream* stream)
skyValidateDefinition(&_sky); skyValidateDefinition(&_sky);
terrainValidateDefinition(&_terrain); terrainValidateDefinition(&_terrain);
texturesValidateDefinition(&_textures); texturesValidateDefinition(&_textures);
vegetationValidateDefinition(_vegetation);
waterValidateDefinition(&_water); waterValidateDefinition(&_water);
if (_custom_load) if (_custom_load)
@ -195,17 +188,6 @@ void sceneryGetTextures(TexturesDefinition* textures)
texturesCopyDefinition(&_textures, textures); texturesCopyDefinition(&_textures, textures);
} }
void scenerySetVegetation(VegetationDefinition* vegetation)
{
vegetationCopyDefinition(vegetation, _vegetation);
vegetationValidateDefinition(_vegetation);
}
void sceneryGetTVegetation(VegetationDefinition* vegetation)
{
vegetationCopyDefinition(_vegetation, vegetation);
}
void scenerySetWater(WaterDefinition* water) void scenerySetWater(WaterDefinition* water)
{ {
waterCopyDefinition(water, &_water); waterCopyDefinition(water, &_water);

View file

@ -15,7 +15,6 @@
#include "sky.h" #include "sky.h"
#include "terrain.h" #include "terrain.h"
#include "textures.h" #include "textures.h"
#include "vegetation.h"
#include "water.h" #include "water.h"
#include "pack.h" #include "pack.h"
#include "renderer.h" #include "renderer.h"
@ -55,9 +54,6 @@ void sceneryGetTerrain(TerrainDefinition* terrain);
void scenerySetTextures(TexturesDefinition* textures); void scenerySetTextures(TexturesDefinition* textures);
void sceneryGetTextures(TexturesDefinition* textures); void sceneryGetTextures(TexturesDefinition* textures);
void scenerySetVegetation(VegetationDefinition* vegetation);
void sceneryGetVegetation(VegetationDefinition* vegetation);
void scenerySetWater(WaterDefinition* water); void scenerySetWater(WaterDefinition* water);
void sceneryGetWater(WaterDefinition* water); void sceneryGetWater(WaterDefinition* water);

View file

@ -49,7 +49,9 @@ static int _getCoreCount()
void systemInit() void systemInit()
{ {
#ifndef GLIB_VERSION_2_32
g_thread_init(NULL); g_thread_init(NULL);
#endif
_core_count = _getCoreCount(); _core_count = _getCoreCount();
ilInit(); ilInit();
iluInit(); iluInit();

View file

@ -4,6 +4,7 @@
/* Library dependent features */ /* Library dependent features */
#include "color.h" #include "color.h"
#include <stdlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -27,8 +28,12 @@ typedef GThread Thread;
static inline Thread* threadCreate(ThreadFunction function, void* data) static inline Thread* threadCreate(ThreadFunction function, void* data)
{ {
#ifdef GLIB_VERSION_2_32
return g_thread_new("thread", (GThreadFunc)function, data);
#else
GError* error; GError* error;
return g_thread_create((GThreadFunc)function, data, 1, &error); return g_thread_create((GThreadFunc)function, data, 1, &error);
#endif
} }
static inline void* threadJoin(Thread* thread) static inline void* threadJoin(Thread* thread)
@ -40,12 +45,23 @@ typedef GMutex Mutex;
static inline Mutex* mutexCreate() static inline Mutex* mutexCreate()
{ {
#ifdef GLIB_VERSION_2_32
Mutex* mutex = malloc(sizeof(Mutex));
g_mutex_init(mutex);
return mutex;
#else
return g_mutex_new(); return g_mutex_new();
#endif
} }
static inline void mutexDestroy(Mutex* mutex) static inline void mutexDestroy(Mutex* mutex)
{ {
#ifdef GLIB_VERSION_2_32
g_mutex_clear(mutex);
free(mutex);
#else
g_mutex_free(mutex); g_mutex_free(mutex);
#endif
} }
static inline void mutexAcquire(Mutex* mutex) static inline void mutexAcquire(Mutex* mutex)

View file

@ -122,7 +122,7 @@ Vector3 terrainCanvasApply(TerrainCanvas* canvas, Vector3 location)
location.z <= canvas->area.location_z + canvas->area.size_z) location.z <= canvas->area.location_z + canvas->area.size_z)
{ {
double inside_x, inside_z; double inside_x, inside_z;
double height, distance; double height;
/* Get height map displacement */ /* Get height map displacement */
geoareaToLocal(&canvas->area, location.x, location.z, &inside_x, &inside_z); geoareaToLocal(&canvas->area, location.x, location.z, &inside_x, &inside_z);

View file

@ -1,68 +0,0 @@
#include "vegetation.h"
#define MAX_LAYER_COUNT 50
struct VegetationDefinition {
int nb_layers;
VegetationLayerDefinition layers[MAX_LAYER_COUNT];
};
void vegetationSave(PackStream* stream, VegetationDefinition* definition)
{
}
void vegetationLoad(PackStream* stream, VegetationDefinition* definition)
{
}
VegetationDefinition* vegetationCreateDefinition()
{
}
void vegetationDeleteDefinition(VegetationDefinition* definition)
{
}
void vegetationCopyDefinition(VegetationDefinition* source, VegetationDefinition* destination)
{
}
void vegetationValidateDefinition(VegetationDefinition* definition)
{
}
VegetationLayerDefinition vegetationLayerCreateDefinition()
{
}
void vegetationLayerDeleteDefinition(VegetationLayerDefinition* definition)
{
}
void vegetationLayerCopyDefinition(VegetationLayerDefinition* source, VegetationLayerDefinition* destination)
{
}
void vegetationLayerValidateDefinition(VegetationLayerDefinition* definition)
{
}
int vegetationGetLayerCount(VegetationDefinition* definition)
{
}
int vegetationGetLayer(VegetationDefinition* definition, int position, VegetationLayerDefinition* layer)
{
}
int vegetationSetLayer(VegetationDefinition* definition, int position, VegetationLayerDefinition* layer)
{
}
int vegetationAddLayer(VegetationDefinition* definition)
{
}
void vegetationDeleteLayer(VegetationDefinition* definition, int layer)
{
}

View file

@ -1,46 +0,0 @@
#ifndef _PAYSAGES_VEGETATION_H_
#define _PAYSAGES_VEGETATION_H_
#include "pack.h"
#include "zone.h"
#ifdef __cplusplus
extern "C" {
#endif
#define VEGETATION_MAX_LAYERS 50
typedef struct
{
Zone* zone;
double max_height;
} VegetationLayerDefinition;
typedef struct VegetationDefinition VegetationDefinition;
void vegetationSave(PackStream* stream, VegetationDefinition* definition);
void vegetationLoad(PackStream* stream, VegetationDefinition* definition);
VegetationDefinition* vegetationCreateDefinition();
void vegetationDeleteDefinition(VegetationDefinition* definition);
void vegetationCopyDefinition(VegetationDefinition* source, VegetationDefinition* destination);
void vegetationValidateDefinition(VegetationDefinition* definition);
VegetationLayerDefinition vegetationLayerCreateDefinition();
void vegetationLayerDeleteDefinition(VegetationLayerDefinition* definition);
void vegetationLayerCopyDefinition(VegetationLayerDefinition* source, VegetationLayerDefinition* destination);
void vegetationLayerValidateDefinition(VegetationLayerDefinition* definition);
int vegetationGetLayerCount(VegetationDefinition* definition);
int vegetationGetLayer(VegetationDefinition* definition, int position, VegetationLayerDefinition* layer);
int vegetationSetLayer(VegetationDefinition* definition, int position, VegetationLayerDefinition* layer);
int vegetationAddLayer(VegetationDefinition* definition);
void vegetationDeleteLayer(VegetationDefinition* definition, int layer);
/*double vegetationGetLayerCoverage(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail);*/
#ifdef __cplusplus
}
#endif
#endif