paysages: WIP
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@568 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
e116d01c29
commit
b5b3e401db
10 changed files with 822 additions and 50 deletions
5
Makefile
5
Makefile
|
@ -1,4 +1,4 @@
|
|||
BUILDMODE=debug
|
||||
BUILDMODE=release
|
||||
BUILDPATH=./build/${BUILDMODE}
|
||||
CC=gcc
|
||||
MAKE=make
|
||||
|
@ -26,6 +26,9 @@ clean:
|
|||
rm -f ${BUILDPATH}/libpaysages_exploring.so
|
||||
rm -f ${BUILDPATH}/libpaysages_rendering.so
|
||||
|
||||
debug:
|
||||
make BUILDMODE=debug all
|
||||
|
||||
release:
|
||||
make BUILDMODE=release all
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<file>images/revert.png</file>
|
||||
<file>images/explore.png</file>
|
||||
<file>images/render.png</file>
|
||||
<file>images/about.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/tabs">
|
||||
<file>images/tab_atmosphere.png</file>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include "ui_dialogterrainpainting.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include <QKeyEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QMessageBox>
|
||||
|
||||
DialogTerrainPainting::DialogTerrainPainting(QWidget*parent, TerrainDefinition* terrain) :
|
||||
QDialog(parent),
|
||||
|
@ -12,6 +15,12 @@ DialogTerrainPainting::DialogTerrainPainting(QWidget*parent, TerrainDefinition*
|
|||
_terrain_original = terrain;
|
||||
_terrain_modified = (TerrainDefinition*)TerrainDefinitionClass.create();
|
||||
|
||||
QWidget* widget = findChild<QWidget*>("widget_commands");
|
||||
if (widget)
|
||||
{
|
||||
widget->hide();
|
||||
}
|
||||
|
||||
revert();
|
||||
|
||||
brushConfigChanged();
|
||||
|
@ -22,6 +31,88 @@ DialogTerrainPainting::~DialogTerrainPainting()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void DialogTerrainPainting::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
QComboBox* input_brush_mode = findChild<QComboBox*>("input_brush_mode");
|
||||
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_F2:
|
||||
if (input_brush_mode)
|
||||
{
|
||||
input_brush_mode->setCurrentIndex(0);
|
||||
}
|
||||
event->accept();
|
||||
break;
|
||||
case Qt::Key_F3:
|
||||
if (input_brush_mode)
|
||||
{
|
||||
input_brush_mode->setCurrentIndex(1);
|
||||
}
|
||||
event->accept();
|
||||
break;
|
||||
case Qt::Key_F4:
|
||||
if (input_brush_mode)
|
||||
{
|
||||
input_brush_mode->setCurrentIndex(2);
|
||||
}
|
||||
event->accept();
|
||||
break;
|
||||
case Qt::Key_F11:
|
||||
if (input_brush_mode)
|
||||
{
|
||||
input_brush_mode->setCurrentIndex(3);
|
||||
}
|
||||
event->accept();
|
||||
break;
|
||||
case Qt::Key_F12:
|
||||
if (input_brush_mode)
|
||||
{
|
||||
input_brush_mode->setCurrentIndex(4);
|
||||
}
|
||||
event->accept();
|
||||
break;
|
||||
default:
|
||||
QDialog::keyReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogTerrainPainting::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
QSlider* input_brush_size = findChild<QSlider*>("input_brush_size");
|
||||
QSlider* input_brush_smoothing = findChild<QSlider*>("input_brush_smoothing");
|
||||
QSlider* input_brush_strength = findChild<QSlider*>("input_brush_strength");
|
||||
|
||||
if (event->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
if (input_brush_size)
|
||||
{
|
||||
input_brush_size->setValue(input_brush_size->value() + (event->delta() > 0 ? 1 : -1));
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else if (event->modifiers() & Qt::ShiftModifier)
|
||||
{
|
||||
if (input_brush_strength)
|
||||
{
|
||||
input_brush_strength->setValue(input_brush_strength->value() + (event->delta() > 0 ? 1 : -1));
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else if (event->modifiers() & Qt::AltModifier)
|
||||
{
|
||||
if (input_brush_smoothing)
|
||||
{
|
||||
input_brush_smoothing->setValue(input_brush_smoothing->value() + (event->delta() > 0 ? 1 : -1));
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogTerrainPainting::accept()
|
||||
{
|
||||
TerrainDefinitionClass.copy(_terrain_modified, _terrain_original);
|
||||
|
|
|
@ -17,6 +17,10 @@ public:
|
|||
explicit DialogTerrainPainting(QWidget *parent, TerrainDefinition* terrain);
|
||||
~DialogTerrainPainting();
|
||||
|
||||
protected:
|
||||
virtual void keyReleaseEvent(QKeyEvent* event);
|
||||
virtual void wheelEvent(QWheelEvent* event);
|
||||
|
||||
public slots:
|
||||
void brushConfigChanged();
|
||||
void heightmapChanged();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>949</width>
|
||||
<height>618</height>
|
||||
<width>1116</width>
|
||||
<height>726</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -29,19 +29,487 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="WidgetHeightMap" name="widget_heightmap" native="true">
|
||||
<widget class="QWidget" name="verticalWidget2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Water</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>Grid</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Commands</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../data/ui_pictures.qrc">
|
||||
<normaloff>:/buttons/logo/images/about.png</normaloff>:/buttons/logo/images/about.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">F1</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_commands" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Shortcuts</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Switch to raise/lower tool</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F3</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Show these commands</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F4</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F2</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F11</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Switch to noise/smooth tool</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Switch to flatten tool</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Switch to magix fix tool</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F12</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Switch to restore tool</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Brush control</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Set brush smoothing</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SHIFT + Mouse wheel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Set brush size</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CTRL + Mouse wheel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ALT + Mouse wheel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Set brush strength</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Camera control</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="horizontalSpacing">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_34">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mouse wheel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_35">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Borders</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>Scroll view</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string>Zoom</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="WidgetHeightMap" name="widget_heightmap" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -72,17 +540,17 @@
|
|||
<widget class="QComboBox" name="input_brush_mode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Raise / Lower (F1)</string>
|
||||
<string>Raise / Lower (F2)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Add noise / Smooth (F2)</string>
|
||||
<string>Add noise / Smooth (F3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flatten terrain (F3)</string>
|
||||
<string>Flatten terrain (F4)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -325,6 +793,8 @@
|
|||
<container>1</container>
|
||||
<slots>
|
||||
<signal>heightmapChanged()</signal>
|
||||
<slot>toggleWater(bool)</slot>
|
||||
<slot>toggleGrid(bool)</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
@ -334,7 +804,9 @@
|
|||
<tabstop>input_brush_smoothing</tabstop>
|
||||
<tabstop>input_brush_strength</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../../data/ui_pictures.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>input_brush_smoothing</sender>
|
||||
|
@ -343,8 +815,8 @@
|
|||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>728</x>
|
||||
<y>97</y>
|
||||
<x>919</x>
|
||||
<y>94</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
|
@ -375,8 +847,8 @@
|
|||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>762</x>
|
||||
<y>135</y>
|
||||
<x>919</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
|
@ -391,8 +863,8 @@
|
|||
<slot>brushConfigChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>676</x>
|
||||
<y>67</y>
|
||||
<x>919</x>
|
||||
<y>73</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>437</x>
|
||||
|
@ -400,22 +872,6 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_heightmap</sender>
|
||||
<signal>heightmapChanged()</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>heightmapChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>396</x>
|
||||
<y>566</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>445</x>
|
||||
<y>618</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_4</sender>
|
||||
<signal>cancelClicked()</signal>
|
||||
|
@ -423,12 +879,12 @@
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>870</x>
|
||||
<y>600</y>
|
||||
<x>875</x>
|
||||
<y>580</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>711</x>
|
||||
<y>618</y>
|
||||
<y>597</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
@ -439,12 +895,12 @@
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>816</x>
|
||||
<y>593</y>
|
||||
<x>943</x>
|
||||
<y>587</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>683</x>
|
||||
<y>615</y>
|
||||
<y>597</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
@ -455,12 +911,76 @@
|
|||
<slot>revert()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>827</x>
|
||||
<y>606</y>
|
||||
<x>943</x>
|
||||
<y>587</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>747</x>
|
||||
<y>618</y>
|
||||
<y>597</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget_heightmap</receiver>
|
||||
<slot>toggleWater(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>40</x>
|
||||
<y>21</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>39</x>
|
||||
<y>160</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkBox_2</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget_heightmap</receiver>
|
||||
<slot>toggleGrid(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>102</x>
|
||||
<y>17</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>102</x>
|
||||
<y>143</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>widget_heightmap</sender>
|
||||
<signal>heightmapChanged()</signal>
|
||||
<receiver>DialogTerrainPainting</receiver>
|
||||
<slot>heightmapChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>465</x>
|
||||
<y>523</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>481</x>
|
||||
<y>569</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widget_commands</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>516</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>517</x>
|
||||
<y>50</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
@ -469,5 +989,6 @@
|
|||
<slot>brushConfigChanged()</slot>
|
||||
<slot>heightmapChanged()</slot>
|
||||
<slot>revert()</slot>
|
||||
<slot>displayCommands()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
<property name="title">
|
||||
<string>Infinite base shape</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
|
@ -76,6 +79,9 @@
|
|||
<property name="title">
|
||||
<string>Manual modifications</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
|
@ -115,6 +121,9 @@
|
|||
<property name="title">
|
||||
<string>Global modifiers</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
|
@ -181,6 +190,9 @@
|
|||
<property name="title">
|
||||
<string>Rendering control</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
|
@ -217,6 +229,9 @@
|
|||
<property name="title">
|
||||
<string>Links to other modules</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
|
@ -318,6 +333,9 @@
|
|||
<property name="title">
|
||||
<string>Result preview</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="BasePreview" name="preview_shape" native="true">
|
||||
|
@ -384,6 +402,9 @@
|
|||
<property name="title">
|
||||
<string>Actions</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="button_revert">
|
||||
|
|
|
@ -90,6 +90,18 @@ void WidgetHeightMap::revert()
|
|||
updateGL();
|
||||
}
|
||||
|
||||
void WidgetHeightMap::toggleWater(bool enabled)
|
||||
{
|
||||
_water = enabled;
|
||||
updateGL();
|
||||
}
|
||||
|
||||
void WidgetHeightMap::toggleGrid(bool enabled)
|
||||
{
|
||||
_wireframe = enabled;
|
||||
updateGL();
|
||||
}
|
||||
|
||||
void WidgetHeightMap::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Up)
|
||||
|
@ -124,11 +136,18 @@ void WidgetHeightMap::keyPressEvent(QKeyEvent* event)
|
|||
|
||||
void WidgetHeightMap::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
if (event->orientation() == Qt::Vertical)
|
||||
if (event->modifiers() == Qt::NoModifier)
|
||||
{
|
||||
zoomTopCamera(-0.05 * (double) event->delta());
|
||||
if (event->orientation() == Qt::Vertical)
|
||||
{
|
||||
zoomTopCamera(-0.05 * (double) event->delta());
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void WidgetHeightMap::mousePressEvent(QMouseEvent* event)
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void revert();
|
||||
void toggleWater(bool enabled);
|
||||
void toggleGrid(bool enabled);
|
||||
|
||||
signals:
|
||||
void heightmapChanged();
|
||||
|
|
|
@ -1 +1,89 @@
|
|||
#include "chunk.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct ExplorerChunk
|
||||
{
|
||||
/* Links */
|
||||
Renderer* renderer;
|
||||
ColorProfile* color_profile;
|
||||
|
||||
/* Protected override */
|
||||
ExplorerChunkOverride override;
|
||||
|
||||
/* Bounding box */
|
||||
double xmin;
|
||||
double xmax;
|
||||
double ymin;
|
||||
double ymax;
|
||||
double zmin;
|
||||
double zmax;
|
||||
|
||||
/* General status */
|
||||
int reset_needed;
|
||||
double distance_to_camera;
|
||||
|
||||
/* Tesselation */
|
||||
Vector3* vertex_data;
|
||||
int tessellation_max_size;
|
||||
int tessellation_current_size;
|
||||
double tessellation_step;
|
||||
|
||||
/* Texture */
|
||||
/*GLuint texture_opengl_id;
|
||||
int texture_changed;
|
||||
int texture_current_size;
|
||||
int texture_max_size;*/
|
||||
};
|
||||
|
||||
ExplorerChunk* exporerChunkCreate(Renderer* renderer, ColorProfile* color_profile, ExplorerChunkOverride override)
|
||||
{
|
||||
ExplorerChunk* result;
|
||||
|
||||
result = malloc(sizeof(ExplorerChunk));
|
||||
|
||||
result->renderer = renderer;
|
||||
result->color_profile = color_profile;
|
||||
|
||||
result->override = override;
|
||||
|
||||
result->xmin = 0.0;
|
||||
result->xmax = 0.0;
|
||||
result->ymin = 0.0;
|
||||
result->ymax = 0.0;
|
||||
result->zmin = 0.0;
|
||||
result->zmax = 0.0;
|
||||
|
||||
result->reset_needed = 0;
|
||||
result->distance_to_camera = 0.0;
|
||||
|
||||
result->vertex_data = malloc(sizeof(Vector3) * 4);
|
||||
result->tessellation_max_size = 1;
|
||||
result->tessellation_current_size = 0;
|
||||
|
||||
explorerChunkMarkForReset(result);
|
||||
|
||||
/* TODO Insert in chunk list */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void explorerChunkDelete(ExplorerChunk* chunk)
|
||||
{
|
||||
free(chunk);
|
||||
}
|
||||
|
||||
void explorerChunkUpdateBoundingBox(ExplorerChunk* chunk, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
|
||||
{
|
||||
chunk->xmin = xmin;
|
||||
chunk->xmax = xmax;
|
||||
chunk->ymin = ymin;
|
||||
chunk->ymax = ymax;
|
||||
chunk->zmin = zmin;
|
||||
chunk->zmax = zmax;
|
||||
}
|
||||
|
||||
void explorerChunkMarkForReset(ExplorerChunk* chunk)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,32 @@
|
|||
#ifndef _PAYSAGES_EXPLORING_CHUNK_H_
|
||||
#define _PAYSAGES_EXPLORING_CHUNK_H_
|
||||
|
||||
#include "rendering/tools/euclid.h"
|
||||
#include "rendering/tools/color.h"
|
||||
#include "rendering/renderer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ExplorerChunk ExplorerChunk;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*getStatus)(ExplorerChunk* chunk);
|
||||
Vector3 (*getVertex)(ExplorerChunk* chunk, Renderer* renderer, double x, double y);
|
||||
Color (*getColor)(ExplorerChunk* chunk, Renderer* renderer, double x, double y, Vector3 vertex);
|
||||
void (*onBeforeDelete)(ExplorerChunk* chunk, void* private_data);
|
||||
void* private_data;
|
||||
} ExplorerChunkOverride;
|
||||
|
||||
/* Public methods */
|
||||
ExplorerChunk* exporerChunkCreate(Renderer* renderer, ColorProfile* color_profile, ExplorerChunkOverride override);
|
||||
void explorerChunkDelete(ExplorerChunk* chunk);
|
||||
|
||||
/* Methods to call from an updateStatus() callback only (never to be called twice concurrently on the same chunk) */
|
||||
void explorerChunkUpdateBoundingBox(ExplorerChunk* chunk, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
|
||||
void explorerChunkMarkForReset(ExplorerChunk* chunk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue