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"> <property name="spacing">
<number>20</number> <number>20</number>
</property> </property>
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>Display :</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkBox"> <widget class="QCheckBox" name="checkBox">
<property name="text"> <property name="text">
@ -65,6 +72,16 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -795,6 +812,7 @@
<signal>heightmapChanged()</signal> <signal>heightmapChanged()</signal>
<slot>toggleWater(bool)</slot> <slot>toggleWater(bool)</slot>
<slot>toggleGrid(bool)</slot> <slot>toggleGrid(bool)</slot>
<slot>togglePaintedArea(bool)</slot>
</slots> </slots>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
@ -927,7 +945,7 @@
<slot>toggleWater(bool)</slot> <slot>toggleWater(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>60</x> <x>153</x>
<y>43</y> <y>43</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
@ -943,8 +961,8 @@
<slot>toggleGrid(bool)</slot> <slot>toggleGrid(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>161</x> <x>234</x>
<y>40</y> <y>43</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>121</x> <x>121</x>
@ -984,6 +1002,22 @@
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
<slots> <slots>
<slot>brushConfigChanged()</slot> <slot>brushConfigChanged()</slot>

View file

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

View file

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