paysages: Fixed terrain ray walking (added backward estimation of true intersection) + fixed textures lighted preview.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@289 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
ae30098277
commit
3d61522711
7 changed files with 40 additions and 28 deletions
|
@ -11,7 +11,6 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <qt4/QtGui/qboxlayout.h>
|
||||
|
||||
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
|
||||
{
|
||||
|
|
|
@ -88,6 +88,9 @@ public:
|
|||
_renderer.render_quality = 3;
|
||||
_renderer.applyLightingToSurface = _applyLightingToSurface;
|
||||
_renderer.customData[0] = &_lighting;
|
||||
_renderer.camera_location.x = 0.0;
|
||||
_renderer.camera_location.y = 20.0;
|
||||
_renderer.camera_location.z = 0.0;
|
||||
}
|
||||
protected:
|
||||
QColor getColor(double x, double y)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <QTabWidget>
|
||||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include <qt4/QtGui/qmessagebox.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "formatmosphere.h"
|
||||
#include "formclouds.h"
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
<context>
|
||||
<name>BaseForm</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="33"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="32"/>
|
||||
<source>Layers : </source>
|
||||
<translation>Niveaux :</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="39"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="38"/>
|
||||
<source>Add layer</source>
|
||||
<translation>Ajouter un niveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="43"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="42"/>
|
||||
<source>Delete layer</source>
|
||||
<translation>Supprimer un niveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="74"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="73"/>
|
||||
<source>Apply</source>
|
||||
<translation>Appliquer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="77"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="76"/>
|
||||
<source>Revert</source>
|
||||
<translation>Annuler les modifications</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/baseform.cpp" line="245"/>
|
||||
<location filename="../gui_qt/baseform.cpp" line="244"/>
|
||||
<source>Layer %1</source>
|
||||
<translation>Niveau %1</translation>
|
||||
</message>
|
||||
|
@ -477,7 +477,7 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>FormTextures</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="125"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="128"/>
|
||||
<source>Coverage preview</source>
|
||||
<translation>Aperçu de la couverture</translation>
|
||||
</message>
|
||||
|
@ -486,77 +486,77 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<translation type="obsolete">Rendu en couleur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="126"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="129"/>
|
||||
<source>Lighted sample</source>
|
||||
<translation>Echantillon éclairé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="128"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="131"/>
|
||||
<source>Surface noise</source>
|
||||
<translation>Bruit de surface</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="129"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="132"/>
|
||||
<source>Surface noise height</source>
|
||||
<translation>Hauteur du bruit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="130"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="133"/>
|
||||
<source>Surface noise scaling</source>
|
||||
<translation>Echelle du bruit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="131"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="134"/>
|
||||
<source>Base color</source>
|
||||
<translation>Couleur de base</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="132"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="135"/>
|
||||
<source>Light reflection</source>
|
||||
<translation>Réflexion de lumière</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="133"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="136"/>
|
||||
<source>Light reflection shininess</source>
|
||||
<translation>Concentration de la réflexion de lumière</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="136"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="139"/>
|
||||
<source>Soft minimal height</source>
|
||||
<translation>Altitude minimal (adoucie)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="135"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="138"/>
|
||||
<source>Hard minimal height</source>
|
||||
<translation>Altitude minimale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="138"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="141"/>
|
||||
<source>Hard maximal height</source>
|
||||
<translation>Altitude maximale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="137"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="140"/>
|
||||
<source>Soft maximal height</source>
|
||||
<translation>Altitude maximale (adoucie)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="140"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="143"/>
|
||||
<source>Soft minimal slope</source>
|
||||
<translation>Pente minimale (adoucie)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="139"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="142"/>
|
||||
<source>Hard minimal slope</source>
|
||||
<translation>Pente minimale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="142"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="145"/>
|
||||
<source>Hard maximal slope</source>
|
||||
<translation>Pente maximale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="141"/>
|
||||
<location filename="../gui_qt/formtextures.cpp" line="144"/>
|
||||
<source>Soft maximal slope</source>
|
||||
<translation>Pente maximale (adoucie)</translation>
|
||||
</message>
|
||||
|
|
BIN
images/logo.ico
Normal file
BIN
images/logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -151,7 +151,7 @@ void autoGenRealisticLandscape(int seed)
|
|||
zoneAddHeightRangeQuick(texture->zone, 1.0, -20.0, -20.0, 20.0, 20.0);
|
||||
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 5.0, 5.0);
|
||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
||||
noiseAddLevelsSimple(texture->bump_noise, 6, 1.0, 1.0);
|
||||
noiseAddLevelsSimple(texture->bump_noise, 8, 1.0, 1.0);
|
||||
texture->bump_height = 0.1;
|
||||
texture->bump_scaling = 0.15;
|
||||
texture->material.base.r = 0.6;
|
||||
|
@ -163,7 +163,7 @@ 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, 6, 1.0, 0.4);
|
||||
noiseAddLevelsSimple(texture->bump_noise, 8, 1.0, 0.4);
|
||||
texture->bump_height = 0.02;
|
||||
texture->bump_scaling = 0.1;
|
||||
texture->material.base.r = 0.2;
|
||||
|
|
|
@ -250,12 +250,13 @@ static Color _getColor(TerrainDefinition* definition, Renderer* renderer, Vector
|
|||
int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3 start, Vector3 direction, Vector3* hit_point, Color* hit_color)
|
||||
{
|
||||
Vector3 inc_vector;
|
||||
double inc_value, inc_base, inc_factor, height, diff, length;
|
||||
double inc_value, inc_base, inc_factor, height, diff, lastdiff, length;
|
||||
|
||||
direction = v3Normalize(direction);
|
||||
inc_factor = (double)renderer->render_quality;
|
||||
inc_base = 1.0;
|
||||
inc_value = inc_base / inc_factor;
|
||||
lastdiff = start.y - _getHeight(definition, start.x, start.z);
|
||||
|
||||
length = 0.0;
|
||||
do
|
||||
|
@ -267,7 +268,15 @@ int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3
|
|||
diff = start.y - height;
|
||||
if (diff < 0.0)
|
||||
{
|
||||
start.y = height;
|
||||
if (fabs(diff - lastdiff) > 0.00001)
|
||||
{
|
||||
start = v3Add(start, v3Scale(inc_vector, -diff / (diff - lastdiff)));
|
||||
start.y = _getHeight(definition, start.x, start.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
start.y = height;
|
||||
}
|
||||
*hit_point = start;
|
||||
*hit_color = _getColor(definition, renderer, start, renderer->getPrecision(renderer, start));
|
||||
return 1;
|
||||
|
@ -285,6 +294,7 @@ int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3
|
|||
{
|
||||
inc_value = diff;
|
||||
}
|
||||
lastdiff = diff;
|
||||
} while (length < 50.0 && start.y <= definition->_max_height);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue