Added toggle for painted area display in terrain painting dialog

This commit is contained in:
Michaël Lemaire 2013-06-20 17:38:23 +02:00
parent 25a49f52d8
commit a76853c237
3 changed files with 47 additions and 4 deletions

View file

@ -45,6 +45,13 @@
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>Display :</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
@ -65,6 +72,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>Painted area</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -795,6 +812,7 @@
<signal>heightmapChanged()</signal>
<slot>toggleWater(bool)</slot>
<slot>toggleGrid(bool)</slot>
<slot>togglePaintedArea(bool)</slot>
</slots>
</customwidget>
</customwidgets>
@ -927,7 +945,7 @@
<slot>toggleWater(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>60</x>
<x>153</x>
<y>43</y>
</hint>
<hint type="destinationlabel">
@ -943,8 +961,8 @@
<slot>toggleGrid(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>161</x>
<y>40</y>
<x>234</x>
<y>43</y>
</hint>
<hint type="destinationlabel">
<x>121</x>
@ -984,6 +1002,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>checkBox_3</sender>
<signal>toggled(bool)</signal>
<receiver>widget_heightmap</receiver>
<slot>togglePaintedArea(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>307</x>
<y>33</y>
</hint>
<hint type="destinationlabel">
<x>377</x>
<y>519</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>brushConfigChanged()</slot>

View file

@ -27,6 +27,7 @@ QGLWidget(parent)
_water = true;
_wireframe = true;
_painted_area = true;
WaterDefinition* water_definition = (WaterDefinition*)WaterDefinitionClass.create();
sceneryGetWater(water_definition);
_water_height = 0.0;
@ -103,6 +104,12 @@ void WidgetHeightMap::toggleGrid(bool enabled)
updateGL();
}
void WidgetHeightMap::togglePaintedArea(bool enabled)
{
_painted_area = enabled;
updateGL();
}
void WidgetHeightMap::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Up)
@ -409,7 +416,7 @@ void WidgetHeightMap::paintGL()
brush_influence = 0.0;
}
glColor3f(0.8 + brush_influence, vertex->painted ? 1.0 : 0.8, 0.8);
glColor3f(0.8 + brush_influence, (_painted_area && vertex->painted) ? 1.0 : 0.8, 0.8);
glNormal3f(vertex->normal.x, vertex->normal.y, vertex->normal.z);
glVertex3f(vertex->point.x, vertex->point.y, vertex->point.z);
}

View file

@ -30,6 +30,7 @@ public slots:
void revert();
void toggleWater(bool enabled);
void toggleGrid(bool enabled);
void togglePaintedArea(bool enabled);
signals:
void heightmapChanged();
@ -63,6 +64,7 @@ private:
double _water_height;
bool _water;
bool _wireframe;
bool _painted_area;
double _average_frame_time;