paysages: Small changes.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@290 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
3d61522711
commit
e9fd162907
7 changed files with 159 additions and 6 deletions
|
@ -8,6 +8,9 @@ MOC_DIR = ./moc/$$BUILDMODE/
|
||||||
DESTDIR = ../build/$$BUILDMODE/
|
DESTDIR = ../build/$$BUILDMODE/
|
||||||
CONFIG += $$BUILDMODE
|
CONFIG += $$BUILDMODE
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS_DEBUG += -pg
|
||||||
|
QMAKE_LFLAGS_DEBUG += -pg
|
||||||
|
|
||||||
unix:LIBS += -L$$DESTDIR -lpaysages
|
unix:LIBS += -L$$DESTDIR -lpaysages
|
||||||
win32:LIBS += $$DESTDIR/libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0
|
win32:LIBS += $$DESTDIR/libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ CC_LDFLAGS = $(shell pkg-config --libs glib-2.0 gthread-2.0) -lIL -lILU
|
||||||
|
|
||||||
ifeq ($(BUILDMODE),debug)
|
ifeq ($(BUILDMODE),debug)
|
||||||
CC_FLAGS += -g -pg
|
CC_FLAGS += -g -pg
|
||||||
|
CC_LDFLAGS += -g -pg
|
||||||
endif
|
endif
|
||||||
ifeq ($(BUILDMODE),release)
|
ifeq ($(BUILDMODE),release)
|
||||||
CC_FLAGS += -O3 -DNDEBUG
|
CC_FLAGS += -O3 -DNDEBUG
|
||||||
|
|
|
@ -163,12 +163,13 @@ void autoGenRealisticLandscape(int seed)
|
||||||
zoneAddHeightRangeQuick(texture->zone, 1.0, -1.0, 0.0, 3.0, 15.0);
|
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);
|
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 0.2, 0.3);
|
||||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
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_height = 0.02;
|
||||||
texture->bump_scaling = 0.1;
|
texture->bump_scaling = 0.1;
|
||||||
texture->material.base.r = 0.2;
|
texture->material.base.r = 0.12;
|
||||||
texture->material.base.g = 0.24;
|
texture->material.base.g = 0.19;
|
||||||
texture->material.base.b = 0.05;
|
texture->material.base.b = 0.035;
|
||||||
texture->material.reflection = 0.1;
|
texture->material.reflection = 0.1;
|
||||||
texture->material.shininess = 2.0;
|
texture->material.shininess = 2.0;
|
||||||
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
/*texture = texturesGetLayer(&textures, texturesAddLayer(&textures));
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "euclid.h"
|
#include "euclid.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "vegetation.h"
|
||||||
|
|
||||||
AtmosphereDefinition _atmosphere;
|
AtmosphereDefinition _atmosphere;
|
||||||
CameraDefinition _camera;
|
CameraDefinition _camera;
|
||||||
|
@ -13,6 +14,7 @@ LightingDefinition _lighting;
|
||||||
SkyDefinition _sky;
|
SkyDefinition _sky;
|
||||||
TerrainDefinition _terrain;
|
TerrainDefinition _terrain;
|
||||||
TexturesDefinition _textures;
|
TexturesDefinition _textures;
|
||||||
|
VegetationDefinition* _vegetation;
|
||||||
WaterDefinition _water;
|
WaterDefinition _water;
|
||||||
|
|
||||||
void sceneryInit()
|
void sceneryInit()
|
||||||
|
@ -25,6 +27,7 @@ void sceneryInit()
|
||||||
skyInit();
|
skyInit();
|
||||||
terrainInit();
|
terrainInit();
|
||||||
texturesInit();
|
texturesInit();
|
||||||
|
vegetationInit();
|
||||||
waterInit();
|
waterInit();
|
||||||
|
|
||||||
_atmosphere = atmosphereCreateDefinition();
|
_atmosphere = atmosphereCreateDefinition();
|
||||||
|
@ -34,6 +37,7 @@ void sceneryInit()
|
||||||
_sky = skyCreateDefinition();
|
_sky = skyCreateDefinition();
|
||||||
_terrain = terrainCreateDefinition();
|
_terrain = terrainCreateDefinition();
|
||||||
_textures = texturesCreateDefinition();
|
_textures = texturesCreateDefinition();
|
||||||
|
_vegetation = vegetationCreateDefinition();
|
||||||
_water = waterCreateDefinition();
|
_water = waterCreateDefinition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +50,7 @@ void sceneryQuit()
|
||||||
skyDeleteDefinition(&_sky);
|
skyDeleteDefinition(&_sky);
|
||||||
terrainDeleteDefinition(&_terrain);
|
terrainDeleteDefinition(&_terrain);
|
||||||
texturesDeleteDefinition(&_textures);
|
texturesDeleteDefinition(&_textures);
|
||||||
|
vegetationDeleteDefinition(_vegetation);
|
||||||
waterDeleteDefinition(&_water);
|
waterDeleteDefinition(&_water);
|
||||||
|
|
||||||
atmosphereQuit();
|
atmosphereQuit();
|
||||||
|
@ -55,6 +60,7 @@ void sceneryQuit()
|
||||||
skyQuit();
|
skyQuit();
|
||||||
terrainQuit();
|
terrainQuit();
|
||||||
texturesQuit();
|
texturesQuit();
|
||||||
|
vegetationQuit();
|
||||||
waterQuit();
|
waterQuit();
|
||||||
noiseQuit();
|
noiseQuit();
|
||||||
}
|
}
|
||||||
|
@ -71,6 +77,7 @@ void scenerySaveToFile(char* filepath)
|
||||||
skySave(f, &_sky);
|
skySave(f, &_sky);
|
||||||
terrainSave(f, &_terrain);
|
terrainSave(f, &_terrain);
|
||||||
texturesSave(f, &_textures);
|
texturesSave(f, &_textures);
|
||||||
|
vegetationSave(f, _vegetation);
|
||||||
waterSave(f, &_water);
|
waterSave(f, &_water);
|
||||||
|
|
||||||
fflush(f);
|
fflush(f);
|
||||||
|
@ -91,6 +98,7 @@ void sceneryLoadFromFile(char* filepath)
|
||||||
skyLoad(f, &_sky);
|
skyLoad(f, &_sky);
|
||||||
terrainLoad(f, &_terrain);
|
terrainLoad(f, &_terrain);
|
||||||
texturesLoad(f, &_textures);
|
texturesLoad(f, &_textures);
|
||||||
|
vegetationLoad(f, _vegetation);
|
||||||
waterLoad(f, &_water);
|
waterLoad(f, &_water);
|
||||||
|
|
||||||
atmosphereValidateDefinition(&_atmosphere);
|
atmosphereValidateDefinition(&_atmosphere);
|
||||||
|
@ -100,6 +108,7 @@ void sceneryLoadFromFile(char* filepath)
|
||||||
skyValidateDefinition(&_sky);
|
skyValidateDefinition(&_sky);
|
||||||
terrainValidateDefinition(&_terrain);
|
terrainValidateDefinition(&_terrain);
|
||||||
texturesValidateDefinition(&_textures);
|
texturesValidateDefinition(&_textures);
|
||||||
|
vegetationValidateDefinition(_vegetation);
|
||||||
waterValidateDefinition(&_water);
|
waterValidateDefinition(&_water);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -187,6 +196,17 @@ 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);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#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 "renderer.h"
|
#include "renderer.h"
|
||||||
|
@ -50,6 +51,9 @@ 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);
|
||||||
|
|
||||||
|
|
76
lib_paysages/vegetation.c
Normal file
76
lib_paysages/vegetation.c
Normal 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
48
lib_paysages/vegetation.h
Normal 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
|
Loading…
Reference in a new issue