Implemented a basic fog control widget.
--HG-- branch : gsoc2013-dfighterhg/feature/gsoc2013-dfighter
parent
ed885d3df6
commit
1cc71457eb
@ -0,0 +1,116 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "fog_widget.h"
|
||||
#include "nel3d_interface.h"
|
||||
#include <QColorDialog>
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
FogWidget::FogWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
iface = NULL;
|
||||
setupUi( this );
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
FogWidget::~FogWidget()
|
||||
{
|
||||
iface = NULL;
|
||||
}
|
||||
|
||||
void FogWidget::loadValues()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
fogCB->setChecked( s.enable );
|
||||
startSB->setValue( s.start );
|
||||
endSB->setValue( s.end );
|
||||
setColorButtonColor( s.color[ 0 ], s.color[ 1 ], s.color[ 2 ] );
|
||||
}
|
||||
|
||||
void FogWidget::setupConnections()
|
||||
{
|
||||
connect( fogCB, SIGNAL( clicked( bool ) ), this, SLOT( onFogCBClicked() ) );
|
||||
connect( startSB, SIGNAL( valueChanged( double ) ), this, SLOT( onStartSBChanged() ) );
|
||||
connect( endSB, SIGNAL( valueChanged( double ) ), this, SLOT( onEndSBChanged() ) );
|
||||
connect( colorButton, SIGNAL( clicked( bool ) ), this, SLOT( onColorButtonClicked() ) );
|
||||
}
|
||||
|
||||
void FogWidget::onFogCBClicked()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.enable = fogCB->isChecked();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
|
||||
if( !s.enable )
|
||||
iface->setBGColor( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
void FogWidget::onStartSBChanged()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.start = startSB->value();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::onEndSBChanged()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.end = endSB->value();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::onColorButtonClicked()
|
||||
{
|
||||
QColor c = QColorDialog::getColor();
|
||||
|
||||
setColorButtonColor( c.red(), c.green(), c.blue() );
|
||||
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.color[ 0 ] = c.red();
|
||||
s.color[ 1 ] = c.green();
|
||||
s.color[ 2 ] = c.blue();
|
||||
s.color[ 3 ] = 255;
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::setColorButtonColor( int r, int g, int b )
|
||||
{
|
||||
QString sh;
|
||||
sh = QString( "background-color: rgb(%1, %2, %3);" ).arg( r ).arg( g ).arg( b );
|
||||
colorButton->setStyleSheet( sh );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef FOG_WIDGET_H
|
||||
#define FOG_WIDGET_H
|
||||
|
||||
#include "ui_fog_widget.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
class CNel3DInterface;
|
||||
|
||||
class FogWidget : public QWidget, public Ui::FogWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FogWidget( QWidget *parent = NULL );
|
||||
~FogWidget();
|
||||
|
||||
void loadValues();
|
||||
|
||||
void setNl3DIface( CNel3DInterface *iface ){ this->iface = iface; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFogCBClicked();
|
||||
void onStartSBChanged();
|
||||
void onEndSBChanged();
|
||||
void onColorButtonClicked();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void setColorButtonColor( int r, int g, int b );
|
||||
|
||||
|
||||
CNel3DInterface *iface;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FogWidget</class>
|
||||
<widget class="QWidget" name="FogWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fog settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="fogCB">
|
||||
<property name="text">
|
||||
<string>Enable fog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="startSB"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>End</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="endSB"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="colorButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -0,0 +1,22 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "lights_widget.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef LIGHTS_WIDGET_H
|
||||
#define LIGHTS_WIDGET_H
|
||||
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LightsWidget</class>
|
||||
<widget class="QDialog" name="LightsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Light settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue