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 <QHBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <qt4/QtGui/qboxlayout.h>
|
|
||||||
|
|
||||||
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
|
BaseForm::BaseForm(QWidget* parent, bool auto_apply, bool with_layers) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,6 +88,9 @@ public:
|
||||||
_renderer.render_quality = 3;
|
_renderer.render_quality = 3;
|
||||||
_renderer.applyLightingToSurface = _applyLightingToSurface;
|
_renderer.applyLightingToSurface = _applyLightingToSurface;
|
||||||
_renderer.customData[0] = &_lighting;
|
_renderer.customData[0] = &_lighting;
|
||||||
|
_renderer.camera_location.x = 0.0;
|
||||||
|
_renderer.camera_location.y = 20.0;
|
||||||
|
_renderer.camera_location.z = 0.0;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
QColor getColor(double x, double y)
|
QColor getColor(double x, double y)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <qt4/QtGui/qmessagebox.h>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "formatmosphere.h"
|
#include "formatmosphere.h"
|
||||||
#include "formclouds.h"
|
#include "formclouds.h"
|
||||||
|
|
|
@ -4,32 +4,32 @@
|
||||||
<context>
|
<context>
|
||||||
<name>BaseForm</name>
|
<name>BaseForm</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="33"/>
|
<location filename="../gui_qt/baseform.cpp" line="32"/>
|
||||||
<source>Layers : </source>
|
<source>Layers : </source>
|
||||||
<translation>Niveaux :</translation>
|
<translation>Niveaux :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="39"/>
|
<location filename="../gui_qt/baseform.cpp" line="38"/>
|
||||||
<source>Add layer</source>
|
<source>Add layer</source>
|
||||||
<translation>Ajouter un niveau</translation>
|
<translation>Ajouter un niveau</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="43"/>
|
<location filename="../gui_qt/baseform.cpp" line="42"/>
|
||||||
<source>Delete layer</source>
|
<source>Delete layer</source>
|
||||||
<translation>Supprimer un niveau</translation>
|
<translation>Supprimer un niveau</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="74"/>
|
<location filename="../gui_qt/baseform.cpp" line="73"/>
|
||||||
<source>Apply</source>
|
<source>Apply</source>
|
||||||
<translation>Appliquer</translation>
|
<translation>Appliquer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="77"/>
|
<location filename="../gui_qt/baseform.cpp" line="76"/>
|
||||||
<source>Revert</source>
|
<source>Revert</source>
|
||||||
<translation>Annuler les modifications</translation>
|
<translation>Annuler les modifications</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/baseform.cpp" line="245"/>
|
<location filename="../gui_qt/baseform.cpp" line="244"/>
|
||||||
<source>Layer %1</source>
|
<source>Layer %1</source>
|
||||||
<translation>Niveau %1</translation>
|
<translation>Niveau %1</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -477,7 +477,7 @@ Maintenir Ctrl : Plus rapide</translation>
|
||||||
<context>
|
<context>
|
||||||
<name>FormTextures</name>
|
<name>FormTextures</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="125"/>
|
<location filename="../gui_qt/formtextures.cpp" line="128"/>
|
||||||
<source>Coverage preview</source>
|
<source>Coverage preview</source>
|
||||||
<translation>Aperçu de la couverture</translation>
|
<translation>Aperçu de la couverture</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -486,77 +486,77 @@ Maintenir Ctrl : Plus rapide</translation>
|
||||||
<translation type="obsolete">Rendu en couleur</translation>
|
<translation type="obsolete">Rendu en couleur</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="126"/>
|
<location filename="../gui_qt/formtextures.cpp" line="129"/>
|
||||||
<source>Lighted sample</source>
|
<source>Lighted sample</source>
|
||||||
<translation>Echantillon éclairé</translation>
|
<translation>Echantillon éclairé</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="128"/>
|
<location filename="../gui_qt/formtextures.cpp" line="131"/>
|
||||||
<source>Surface noise</source>
|
<source>Surface noise</source>
|
||||||
<translation>Bruit de surface</translation>
|
<translation>Bruit de surface</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="129"/>
|
<location filename="../gui_qt/formtextures.cpp" line="132"/>
|
||||||
<source>Surface noise height</source>
|
<source>Surface noise height</source>
|
||||||
<translation>Hauteur du bruit</translation>
|
<translation>Hauteur du bruit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="130"/>
|
<location filename="../gui_qt/formtextures.cpp" line="133"/>
|
||||||
<source>Surface noise scaling</source>
|
<source>Surface noise scaling</source>
|
||||||
<translation>Echelle du bruit</translation>
|
<translation>Echelle du bruit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="131"/>
|
<location filename="../gui_qt/formtextures.cpp" line="134"/>
|
||||||
<source>Base color</source>
|
<source>Base color</source>
|
||||||
<translation>Couleur de base</translation>
|
<translation>Couleur de base</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="132"/>
|
<location filename="../gui_qt/formtextures.cpp" line="135"/>
|
||||||
<source>Light reflection</source>
|
<source>Light reflection</source>
|
||||||
<translation>Réflexion de lumière</translation>
|
<translation>Réflexion de lumière</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="133"/>
|
<location filename="../gui_qt/formtextures.cpp" line="136"/>
|
||||||
<source>Light reflection shininess</source>
|
<source>Light reflection shininess</source>
|
||||||
<translation>Concentration de la réflexion de lumière</translation>
|
<translation>Concentration de la réflexion de lumière</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="136"/>
|
<location filename="../gui_qt/formtextures.cpp" line="139"/>
|
||||||
<source>Soft minimal height</source>
|
<source>Soft minimal height</source>
|
||||||
<translation>Altitude minimal (adoucie)</translation>
|
<translation>Altitude minimal (adoucie)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="135"/>
|
<location filename="../gui_qt/formtextures.cpp" line="138"/>
|
||||||
<source>Hard minimal height</source>
|
<source>Hard minimal height</source>
|
||||||
<translation>Altitude minimale</translation>
|
<translation>Altitude minimale</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="138"/>
|
<location filename="../gui_qt/formtextures.cpp" line="141"/>
|
||||||
<source>Hard maximal height</source>
|
<source>Hard maximal height</source>
|
||||||
<translation>Altitude maximale</translation>
|
<translation>Altitude maximale</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="137"/>
|
<location filename="../gui_qt/formtextures.cpp" line="140"/>
|
||||||
<source>Soft maximal height</source>
|
<source>Soft maximal height</source>
|
||||||
<translation>Altitude maximale (adoucie)</translation>
|
<translation>Altitude maximale (adoucie)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="140"/>
|
<location filename="../gui_qt/formtextures.cpp" line="143"/>
|
||||||
<source>Soft minimal slope</source>
|
<source>Soft minimal slope</source>
|
||||||
<translation>Pente minimale (adoucie)</translation>
|
<translation>Pente minimale (adoucie)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="139"/>
|
<location filename="../gui_qt/formtextures.cpp" line="142"/>
|
||||||
<source>Hard minimal slope</source>
|
<source>Hard minimal slope</source>
|
||||||
<translation>Pente minimale</translation>
|
<translation>Pente minimale</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="142"/>
|
<location filename="../gui_qt/formtextures.cpp" line="145"/>
|
||||||
<source>Hard maximal slope</source>
|
<source>Hard maximal slope</source>
|
||||||
<translation>Pente maximale</translation>
|
<translation>Pente maximale</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../gui_qt/formtextures.cpp" line="141"/>
|
<location filename="../gui_qt/formtextures.cpp" line="144"/>
|
||||||
<source>Soft maximal slope</source>
|
<source>Soft maximal slope</source>
|
||||||
<translation>Pente maximale (adoucie)</translation>
|
<translation>Pente maximale (adoucie)</translation>
|
||||||
</message>
|
</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);
|
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);
|
zoneAddSlopeRangeQuick(texture->zone, 1.0, 0.0, 0.0, 5.0, 5.0);
|
||||||
noiseGenerateBaseNoise(texture->bump_noise, 102400);
|
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_height = 0.1;
|
||||||
texture->bump_scaling = 0.15;
|
texture->bump_scaling = 0.15;
|
||||||
texture->material.base.r = 0.6;
|
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);
|
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, 6, 1.0, 0.4);
|
noiseAddLevelsSimple(texture->bump_noise, 8, 1.0, 0.4);
|
||||||
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.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)
|
int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3 start, Vector3 direction, Vector3* hit_point, Color* hit_color)
|
||||||
{
|
{
|
||||||
Vector3 inc_vector;
|
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);
|
direction = v3Normalize(direction);
|
||||||
inc_factor = (double)renderer->render_quality;
|
inc_factor = (double)renderer->render_quality;
|
||||||
inc_base = 1.0;
|
inc_base = 1.0;
|
||||||
inc_value = inc_base / inc_factor;
|
inc_value = inc_base / inc_factor;
|
||||||
|
lastdiff = start.y - _getHeight(definition, start.x, start.z);
|
||||||
|
|
||||||
length = 0.0;
|
length = 0.0;
|
||||||
do
|
do
|
||||||
|
@ -267,7 +268,15 @@ int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3
|
||||||
diff = start.y - height;
|
diff = start.y - height;
|
||||||
if (diff < 0.0)
|
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_point = start;
|
||||||
*hit_color = _getColor(definition, renderer, start, renderer->getPrecision(renderer, start));
|
*hit_color = _getColor(definition, renderer, start, renderer->getPrecision(renderer, start));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -285,6 +294,7 @@ int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3
|
||||||
{
|
{
|
||||||
inc_value = diff;
|
inc_value = diff;
|
||||||
}
|
}
|
||||||
|
lastdiff = diff;
|
||||||
} while (length < 50.0 && start.y <= definition->_max_height);
|
} while (length < 50.0 && start.y <= definition->_max_height);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue