paysages: Small changes.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@290 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-04-09 19:58:08 +00:00 committed by ThunderK
parent 3d61522711
commit e9fd162907
7 changed files with 159 additions and 6 deletions

View file

@ -8,6 +8,9 @@ MOC_DIR = ./moc/$$BUILDMODE/
DESTDIR = ../build/$$BUILDMODE/
CONFIG += $$BUILDMODE
QMAKE_CXXFLAGS_DEBUG += -pg
QMAKE_LFLAGS_DEBUG += -pg
unix:LIBS += -L$$DESTDIR -lpaysages
win32:LIBS += $$DESTDIR/libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0

View file

@ -10,6 +10,7 @@ CC_LDFLAGS = $(shell pkg-config --libs glib-2.0 gthread-2.0) -lIL -lILU
ifeq ($(BUILDMODE),debug)
CC_FLAGS += -g -pg
CC_LDFLAGS += -g -pg
endif
ifeq ($(BUILDMODE),release)
CC_FLAGS += -O3 -DNDEBUG

View file

@ -163,12 +163,13 @@ void autoGenRealisticLandscape(int seed)
zoneAddHeightRangeQuick(texture->zone, 1.0, -1.0, 0.0, 3.0, 15.0);
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 0.2, 0.3);
noiseGenerateBaseNoise(texture->bump_noise, 102400);
noiseAddLevelsSimple(texture->bump_noise, 8, 1.0, 0.4);
noiseAddLevelsSimple(texture->bump_noise, 5, 1.0, 0.4);
noiseAddLevelsSimple(texture->bump_noise, 2, 0.03, 0.08);
texture->bump_height = 0.02;
texture->bump_scaling = 0.1;
texture->material.base.r = 0.2;
texture->material.base.g = 0.24;
texture->material.base.b = 0.05;
texture->material.base.r = 0.12;
texture->material.base.g = 0.19;
texture->material.base.b = 0.035;
texture->material.reflection = 0.1;
texture->material.shininess = 2.0;
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));

View file

@ -5,6 +5,7 @@
#include "euclid.h"
#include "render.h"
#include "system.h"
#include "vegetation.h"
AtmosphereDefinition _atmosphere;
CameraDefinition _camera;
@ -13,6 +14,7 @@ LightingDefinition _lighting;
SkyDefinition _sky;
TerrainDefinition _terrain;
TexturesDefinition _textures;
VegetationDefinition* _vegetation;
WaterDefinition _water;
void sceneryInit()
@ -25,6 +27,7 @@ void sceneryInit()
skyInit();
terrainInit();
texturesInit();
vegetationInit();
waterInit();
_atmosphere = atmosphereCreateDefinition();
@ -34,6 +37,7 @@ void sceneryInit()
_sky = skyCreateDefinition();
_terrain = terrainCreateDefinition();
_textures = texturesCreateDefinition();
_vegetation = vegetationCreateDefinition();
_water = waterCreateDefinition();
}
@ -46,6 +50,7 @@ void sceneryQuit()
skyDeleteDefinition(&_sky);
terrainDeleteDefinition(&_terrain);
texturesDeleteDefinition(&_textures);
vegetationDeleteDefinition(_vegetation);
waterDeleteDefinition(&_water);
atmosphereQuit();
@ -55,6 +60,7 @@ void sceneryQuit()
skyQuit();
terrainQuit();
texturesQuit();
vegetationQuit();
waterQuit();
noiseQuit();
}
@ -71,6 +77,7 @@ void scenerySaveToFile(char* filepath)
skySave(f, &_sky);
terrainSave(f, &_terrain);
texturesSave(f, &_textures);
vegetationSave(f, _vegetation);
waterSave(f, &_water);
fflush(f);
@ -91,6 +98,7 @@ void sceneryLoadFromFile(char* filepath)
skyLoad(f, &_sky);
terrainLoad(f, &_terrain);
texturesLoad(f, &_textures);
vegetationLoad(f, _vegetation);
waterLoad(f, &_water);
atmosphereValidateDefinition(&_atmosphere);
@ -100,6 +108,7 @@ void sceneryLoadFromFile(char* filepath)
skyValidateDefinition(&_sky);
terrainValidateDefinition(&_terrain);
texturesValidateDefinition(&_textures);
vegetationValidateDefinition(_vegetation);
waterValidateDefinition(&_water);
fclose(f);
@ -187,6 +196,17 @@ void sceneryGetTextures(TexturesDefinition* textures)
texturesCopyDefinition(&_textures, textures);
}
void scenerySetVegetation(VegetationDefinition* vegetation)
{
vegetationCopyDefinition(vegetation, _vegetation);
vegetationValidateDefinition(_vegetation);
}
void sceneryGetTVegetation(VegetationDefinition* vegetation)
{
vegetationCopyDefinition(_vegetation, vegetation);
}
void scenerySetWater(WaterDefinition* water)
{
waterCopyDefinition(water, &_water);

View file

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

76
lib_paysages/vegetation.c Normal file
View file

@ -0,0 +1,76 @@
#include "vegetation.h"
#define MAX_LAYER_COUNT 50
struct VegetationDefinition {
int nb_layers;
VegetationLayerDefinition layers[MAX_LAYER_COUNT];
};
void vegetationInit()
{
}
void vegetationQuit()
{
}
void vegetationSave(FILE* f, VegetationDefinition* definition)
{
}
void vegetationLoad(FILE* f, 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)
{
}

48
lib_paysages/vegetation.h Normal file
View file

@ -0,0 +1,48 @@
#ifndef _PAYSAGES_VEGETATION_H_
#define _PAYSAGES_VEGETATION_H_
#include <stdio.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 vegetationInit();
void vegetationQuit();
void vegetationSave(FILE* f, VegetationDefinition* definition);
void vegetationLoad(FILE* f, 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