From 201bd756254124373edf181a1c045e42157b3f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 3 Jan 2012 16:05:08 +0000 Subject: [PATCH] paysages : Refactoring terrain and textures - WIP. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@210 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- lib_paysages/terrain.c | 4 ++-- lib_paysages/textures.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_paysages/terrain.c b/lib_paysages/terrain.c index a752146..0525354 100644 --- a/lib_paysages/terrain.c +++ b/lib_paysages/terrain.c @@ -260,12 +260,12 @@ static void _renderQuad(double x, double z, double size) double terrainGetHeight(double x, double z) { - return _getHeight(&_definition, x, z, 0.01 / (double)render_quality); + return _getHeight(&_definition, x, z, 0.0); } double terrainGetHeightNormalized(double x, double z) { - return 0.5 + _getHeight(&_definition, x, z, 0.01 / (double)render_quality) / (_max_height * 2.0); + return 0.5 + _getHeight(&_definition, x, z, 0.0) / (_max_height * 2.0); } Color terrainGetColorCustom(double x, double z, double detail, TerrainDefinition* definition, TerrainQuality* quality, TerrainEnvironment* environment) diff --git a/lib_paysages/textures.c b/lib_paysages/textures.c index 83c8543..9d4be49 100644 --- a/lib_paysages/textures.c +++ b/lib_paysages/textures.c @@ -123,6 +123,7 @@ static inline Vector3 _getNormal(TextureDefinition* definition, Vector3 point, d ref.x = 0.0; ref.y = 0.0; + point.y = terrainGetHeight(point.x, point.z) + noiseGet2DTotal(definition->bump_noise, point.x, point.z); dpoint.x = point.x - scale; dpoint.z = point.z;