Removed unused ColorGradation + removed old color.h/c
This commit is contained in:
parent
a108682b4d
commit
8a42d7407a
28 changed files with 17 additions and 655 deletions
|
@ -4,7 +4,6 @@
|
||||||
#include "inputint.h"
|
#include "inputint.h"
|
||||||
#include "inputboolean.h"
|
#include "inputboolean.h"
|
||||||
#include "inputcolor.h"
|
#include "inputcolor.h"
|
||||||
#include "inputcolorgradation.h"
|
|
||||||
#include "inputnoise.h"
|
#include "inputnoise.h"
|
||||||
#include "inputcurve.h"
|
#include "inputcurve.h"
|
||||||
#include "inputmaterial.h"
|
#include "inputmaterial.h"
|
||||||
|
@ -439,11 +438,6 @@ BaseInput* BaseForm::addInputColor(QString label, Color* value)
|
||||||
return addInput(new InputColor(_form, label, value));
|
return addInput(new InputColor(_form, label, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseInput* BaseForm::addInputColorGradation(QString label, ColorGradation* value)
|
|
||||||
{
|
|
||||||
return addInput(new InputColorGradation(_form, label, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseInput* BaseForm::addInputNoise(QString label, NoiseGenerator* value)
|
BaseInput* BaseForm::addInputNoise(QString label, NoiseGenerator* value)
|
||||||
{
|
{
|
||||||
return addInput(new InputNoise(_form, label, value));
|
return addInput(new InputNoise(_form, label, value));
|
||||||
|
|
|
@ -53,7 +53,6 @@ protected:
|
||||||
BaseInput* addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step);
|
BaseInput* addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step);
|
||||||
BaseInput* addInputBoolean(QString label, int* value);
|
BaseInput* addInputBoolean(QString label, int* value);
|
||||||
BaseInput* addInputColor(QString label, Color* value);
|
BaseInput* addInputColor(QString label, Color* value);
|
||||||
BaseInput* addInputColorGradation(QString label, ColorGradation* value);
|
|
||||||
BaseInput* addInputNoise(QString label, NoiseGenerator* value);
|
BaseInput* addInputNoise(QString label, NoiseGenerator* value);
|
||||||
BaseInput* addInputCurve(QString label, Curve* value, double xmin, double xmax, double ymin, double ymax, QString xlabel, QString ylabel);
|
BaseInput* addInputCurve(QString label, Curve* value, double xmin, double xmax, double ymin, double ymax, QString xlabel, QString ylabel);
|
||||||
BaseInput* addInputMaterial(QString label, SurfaceMaterial* material);
|
BaseInput* addInputMaterial(QString label, SurfaceMaterial* material);
|
||||||
|
|
|
@ -14,7 +14,6 @@ HEADERS += \
|
||||||
widgetcurveeditor.h \
|
widgetcurveeditor.h \
|
||||||
tools.h \
|
tools.h \
|
||||||
previewmaterial.h \
|
previewmaterial.h \
|
||||||
previewcolorgradation.h \
|
|
||||||
inputnoise.h \
|
inputnoise.h \
|
||||||
inputmaterial.h \
|
inputmaterial.h \
|
||||||
inputlayers.h \
|
inputlayers.h \
|
||||||
|
@ -22,7 +21,6 @@ HEADERS += \
|
||||||
inputenum.h \
|
inputenum.h \
|
||||||
inputdouble.h \
|
inputdouble.h \
|
||||||
inputcurve.h \
|
inputcurve.h \
|
||||||
inputcolorgradation.h \
|
|
||||||
inputcolor.h \
|
inputcolor.h \
|
||||||
inputcamera.h \
|
inputcamera.h \
|
||||||
inputboolean.h \
|
inputboolean.h \
|
||||||
|
@ -36,7 +34,6 @@ HEADERS += \
|
||||||
dialoglayers.h \
|
dialoglayers.h \
|
||||||
dialogexplorer.h \
|
dialogexplorer.h \
|
||||||
dialogcurve.h \
|
dialogcurve.h \
|
||||||
dialogcolorgradation.h \
|
|
||||||
baseinput.h \
|
baseinput.h \
|
||||||
baseformlayer.h \
|
baseformlayer.h \
|
||||||
baseform.h \
|
baseform.h \
|
||||||
|
@ -66,7 +63,6 @@ SOURCES += \
|
||||||
widgetcurveeditor.cpp \
|
widgetcurveeditor.cpp \
|
||||||
tools.cpp \
|
tools.cpp \
|
||||||
previewmaterial.cpp \
|
previewmaterial.cpp \
|
||||||
previewcolorgradation.cpp \
|
|
||||||
inputnoise.cpp \
|
inputnoise.cpp \
|
||||||
inputmaterial.cpp \
|
inputmaterial.cpp \
|
||||||
inputlayers.cpp \
|
inputlayers.cpp \
|
||||||
|
@ -74,7 +70,6 @@ SOURCES += \
|
||||||
inputenum.cpp \
|
inputenum.cpp \
|
||||||
inputdouble.cpp \
|
inputdouble.cpp \
|
||||||
inputcurve.cpp \
|
inputcurve.cpp \
|
||||||
inputcolorgradation.cpp \
|
|
||||||
inputcolor.cpp \
|
inputcolor.cpp \
|
||||||
inputcamera.cpp \
|
inputcamera.cpp \
|
||||||
inputboolean.cpp \
|
inputboolean.cpp \
|
||||||
|
@ -88,7 +83,6 @@ SOURCES += \
|
||||||
dialoglayers.cpp \
|
dialoglayers.cpp \
|
||||||
dialogexplorer.cpp \
|
dialogexplorer.cpp \
|
||||||
dialogcurve.cpp \
|
dialogcurve.cpp \
|
||||||
dialogcolorgradation.cpp \
|
|
||||||
baseinput.cpp \
|
baseinput.cpp \
|
||||||
baseformlayer.cpp \
|
baseformlayer.cpp \
|
||||||
baseform.cpp \
|
baseform.cpp \
|
||||||
|
|
|
@ -1,219 +0,0 @@
|
||||||
#include "dialogcolorgradation.h"
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include "Curve.h"
|
|
||||||
#include "tools.h"
|
|
||||||
#include "previewcolorgradation.h"
|
|
||||||
#include "widgetcurveeditor.h"
|
|
||||||
|
|
||||||
/**************** Dialog ****************/
|
|
||||||
DialogColorGradation::DialogColorGradation(QWidget *parent, ColorGradation* gradation):
|
|
||||||
QDialog(parent)
|
|
||||||
{
|
|
||||||
QWidget* buttons;
|
|
||||||
QWidget* form;
|
|
||||||
QGridLayout* form_layout;
|
|
||||||
QLabel* label;
|
|
||||||
|
|
||||||
_base = gradation;
|
|
||||||
_current = colorGradationCreate();
|
|
||||||
colorGradationCopy(_base, _current);
|
|
||||||
|
|
||||||
setLayout(new QVBoxLayout());
|
|
||||||
|
|
||||||
form = new QWidget(this);
|
|
||||||
form_layout = new QGridLayout();
|
|
||||||
form->setLayout(form_layout);
|
|
||||||
layout()->addWidget(form);
|
|
||||||
|
|
||||||
label = new QLabel(tr("This is the curve editor for color components.\nClick on a component preview below to edit it.\nClick on points and drag them to move them.\nDouble click to add a new point.\nRight click on a point to delete it."), form);
|
|
||||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
label->setMinimumWidth(150);
|
|
||||||
label->setMaximumWidth(200);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
form_layout->addWidget(label, 0, 1);
|
|
||||||
_curve_editor = new WidgetCurveEditor(form, 0.0, 1.0, 0.0, 1.0);
|
|
||||||
_curve_editor->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
form_layout->addWidget(_curve_editor, 0, 0);
|
|
||||||
connect(_curve_editor, SIGNAL(liveChanged()), this, SLOT(updateColors()));
|
|
||||||
|
|
||||||
label = new QLabel(tr("Red preview, click to edit"), form);
|
|
||||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
label->setMinimumWidth(150);
|
|
||||||
label->setMaximumWidth(200);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
form_layout->addWidget(label, 1, 1);
|
|
||||||
_preview_red = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_RED);
|
|
||||||
_preview_red->setMinimumHeight(30);
|
|
||||||
_preview_red->setMaximumHeight(60);
|
|
||||||
_preview_red->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
connect(_preview_red, SIGNAL(clicked()), this, SLOT(selectRed()));
|
|
||||||
form_layout->addWidget(_preview_red, 1, 0);
|
|
||||||
|
|
||||||
label = new QLabel(tr("Green preview, click to edit"), form);
|
|
||||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
label->setMinimumWidth(150);
|
|
||||||
label->setMaximumWidth(200);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
form_layout->addWidget(label, 2, 1);
|
|
||||||
_preview_green = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_GREEN);
|
|
||||||
_preview_green->setMinimumHeight(30);
|
|
||||||
_preview_green->setMaximumHeight(60);
|
|
||||||
_preview_green->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
connect(_preview_green, SIGNAL(clicked()), this, SLOT(selectGreen()));
|
|
||||||
form_layout->addWidget(_preview_green, 2, 0);
|
|
||||||
|
|
||||||
label = new QLabel(tr("Blue preview, click to edit"), form);
|
|
||||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
label->setMinimumWidth(150);
|
|
||||||
label->setMaximumWidth(200);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
form_layout->addWidget(label, 3, 1);
|
|
||||||
_preview_blue = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_BLUE);
|
|
||||||
_preview_blue->setMinimumHeight(30);
|
|
||||||
_preview_blue->setMaximumHeight(60);
|
|
||||||
_preview_blue->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
connect(_preview_blue, SIGNAL(clicked()), this, SLOT(selectBlue()));
|
|
||||||
form_layout->addWidget(_preview_blue, 3, 0);
|
|
||||||
|
|
||||||
label = new QLabel(tr("Final preview"), form);
|
|
||||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
|
||||||
label->setMinimumWidth(150);
|
|
||||||
label->setMaximumWidth(200);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
form_layout->addWidget(label, 4, 1);
|
|
||||||
_preview_final = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_FINAL);
|
|
||||||
_preview_final->setMinimumHeight(30);
|
|
||||||
_preview_final->setMaximumHeight(60);
|
|
||||||
_preview_final->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
form_layout->addWidget(_preview_final, 4, 0);
|
|
||||||
|
|
||||||
buttons = new QWidget(this);
|
|
||||||
layout()->addWidget(buttons);
|
|
||||||
buttons->setLayout(new QHBoxLayout());
|
|
||||||
|
|
||||||
_button_accept = new QPushButton(tr("Validate"), buttons);
|
|
||||||
buttons->layout()->addWidget(_button_accept);
|
|
||||||
QObject::connect(_button_accept, SIGNAL(clicked()), this, SLOT(accept()));
|
|
||||||
|
|
||||||
_button_revert = new QPushButton(tr("Revert"), buttons);
|
|
||||||
buttons->layout()->addWidget(_button_revert);
|
|
||||||
QObject::connect(_button_revert, SIGNAL(clicked()), this, SLOT(revert()));
|
|
||||||
|
|
||||||
_button_cancel = new QPushButton(tr("Cancel"), buttons);
|
|
||||||
buttons->layout()->addWidget(_button_cancel);
|
|
||||||
QObject::connect(_button_cancel, SIGNAL(clicked()), this, SLOT(reject()));
|
|
||||||
|
|
||||||
_curve = new Curve;
|
|
||||||
|
|
||||||
setWindowTitle(tr("Paysages 3D - Color gradation editor"));
|
|
||||||
resize(900, 600);
|
|
||||||
|
|
||||||
revert();
|
|
||||||
}
|
|
||||||
|
|
||||||
DialogColorGradation::~DialogColorGradation()
|
|
||||||
{
|
|
||||||
colorGradationDelete(_current);
|
|
||||||
delete _curve;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DialogColorGradation::getGradation(QWidget* parent, ColorGradation* gradation)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
DialogColorGradation* dialog = new DialogColorGradation(parent, gradation);
|
|
||||||
result = dialog->exec();
|
|
||||||
|
|
||||||
delete dialog;
|
|
||||||
|
|
||||||
return (result != 0) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::closeEvent(QCloseEvent*)
|
|
||||||
{
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::accept()
|
|
||||||
{
|
|
||||||
colorGradationCopy(_current, _base);
|
|
||||||
QDialog::accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::revert()
|
|
||||||
{
|
|
||||||
_selected = 0;
|
|
||||||
colorGradationCopy(_base, _current);
|
|
||||||
revertToCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::selectRed()
|
|
||||||
{
|
|
||||||
colorGradationGetRedCurve(_current, _curve);
|
|
||||||
_curve_editor->setCurve(_curve);
|
|
||||||
_curve_editor->setPenColor(QColor(255, 0, 0));
|
|
||||||
_selected = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::selectGreen()
|
|
||||||
{
|
|
||||||
colorGradationGetGreenCurve(_current, _curve);
|
|
||||||
_curve_editor->setCurve(_curve);
|
|
||||||
_curve_editor->setPenColor(QColor(0, 200, 0));
|
|
||||||
_selected = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::selectBlue()
|
|
||||||
{
|
|
||||||
colorGradationGetBlueCurve(_current, _curve);
|
|
||||||
_curve_editor->setCurve(_curve);
|
|
||||||
_curve_editor->setPenColor(QColor(0, 0, 255));
|
|
||||||
_selected = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::updateColors()
|
|
||||||
{
|
|
||||||
Curve curve;
|
|
||||||
|
|
||||||
_curve_editor->getCurve(&curve);
|
|
||||||
|
|
||||||
switch (_selected)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
_preview_red->update();
|
|
||||||
_preview_green->update();
|
|
||||||
_preview_blue->update();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
colorGradationSetRedCurve(_current, &curve);
|
|
||||||
_preview_red->update();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
colorGradationSetGreenCurve(_current, &curve);
|
|
||||||
_preview_green->update();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
colorGradationSetBlueCurve(_current, &curve);
|
|
||||||
_preview_blue->update();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
_preview_final->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogColorGradation::revertToCurrent()
|
|
||||||
{
|
|
||||||
updateColors();
|
|
||||||
selectRed();
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
#ifndef _PAYSAGES_QT_DIALOGCOLORGRADATION_H_
|
|
||||||
#define _PAYSAGES_QT_DIALOGCOLORGRADATION_H_
|
|
||||||
|
|
||||||
#include "desktop_global.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
#include "tools/color.h"
|
|
||||||
|
|
||||||
class QPushButton;
|
|
||||||
class WidgetCurveEditor;
|
|
||||||
class PreviewColorGradation;
|
|
||||||
|
|
||||||
class DialogColorGradation : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit DialogColorGradation(QWidget* parent, ColorGradation* gradation);
|
|
||||||
~DialogColorGradation();
|
|
||||||
|
|
||||||
static bool getGradation(QWidget* parent, ColorGradation* gradation);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void accept();
|
|
||||||
void revert();
|
|
||||||
void selectRed();
|
|
||||||
void selectGreen();
|
|
||||||
void selectBlue();
|
|
||||||
void updateColors();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void closeEvent(QCloseEvent* e);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void revertToCurrent();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ColorGradation* _base;
|
|
||||||
ColorGradation* _current;
|
|
||||||
Curve* _curve;
|
|
||||||
WidgetCurveEditor* _curve_editor;
|
|
||||||
PreviewColorGradation* _preview_red;
|
|
||||||
PreviewColorGradation* _preview_green;
|
|
||||||
PreviewColorGradation* _preview_blue;
|
|
||||||
PreviewColorGradation* _preview_final;
|
|
||||||
int _selected;
|
|
||||||
QPushButton* _button_accept;
|
|
||||||
QPushButton* _button_revert;
|
|
||||||
QPushButton* _button_cancel;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "tools/color.h"
|
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
|
|
||||||
/**************** Previews ****************/
|
/**************** Previews ****************/
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "tools/color.h"
|
|
||||||
|
|
||||||
class QThread;
|
class QThread;
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "formclouds.h"
|
#include "formclouds.h"
|
||||||
|
|
||||||
#include "clouds/clo_preview.h"
|
#include "clouds/clo_preview.h"
|
||||||
#include "tools/color.h"
|
|
||||||
#include "tools/euclid.h"
|
#include "tools/euclid.h"
|
||||||
#include "RenderingScenery.h"
|
#include "RenderingScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
#include "inputcolorgradation.h"
|
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QColorDialog>
|
|
||||||
#include "dialogcolorgradation.h"
|
|
||||||
#include "previewcolorgradation.h"
|
|
||||||
#include "tools.h"
|
|
||||||
|
|
||||||
InputColorGradation::InputColorGradation(QWidget* form, QString label, ColorGradation* value) : BaseInput(form, label)
|
|
||||||
{
|
|
||||||
_value = value;
|
|
||||||
|
|
||||||
_control = new PreviewColorGradation(form, value, COLORGRADATIONBAND_FINAL);
|
|
||||||
_control->setMinimumSize(200, 20);
|
|
||||||
|
|
||||||
_preview = new QPushButton(tr("Edit"), form);
|
|
||||||
_preview->setMaximumWidth(150);
|
|
||||||
|
|
||||||
connect((QPushButton*)_preview, SIGNAL(clicked()), this, SLOT(editGradation()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputColorGradation::updatePreview()
|
|
||||||
{
|
|
||||||
_control->update();
|
|
||||||
BaseInput::updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputColorGradation::applyValue()
|
|
||||||
{
|
|
||||||
BaseInput::applyValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputColorGradation::revert()
|
|
||||||
{
|
|
||||||
BaseInput::revert();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputColorGradation::editGradation()
|
|
||||||
{
|
|
||||||
ColorGradation* gradation;
|
|
||||||
|
|
||||||
gradation = colorGradationCreate();
|
|
||||||
colorGradationCopy(_value, gradation);
|
|
||||||
if (DialogColorGradation::getGradation(_control, gradation))
|
|
||||||
{
|
|
||||||
colorGradationCopy(gradation, _value);
|
|
||||||
applyValue();
|
|
||||||
}
|
|
||||||
colorGradationDelete(gradation);
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef _PAYSAGES_QT_INPUTCOLORGRADATION_H_
|
|
||||||
#define _PAYSAGES_QT_INPUTCOLORGRADATION_H_
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "baseinput.h"
|
|
||||||
|
|
||||||
#include "tools/color.h"
|
|
||||||
|
|
||||||
class InputColorGradation:public BaseInput
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
InputColorGradation(QWidget* form, QString label, ColorGradation* value);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void updatePreview();
|
|
||||||
virtual void applyValue();
|
|
||||||
virtual void revert();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void editGradation();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ColorGradation* _value;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef SMALLPREVIEWCOLOR_H
|
#ifndef SMALLPREVIEWCOLOR_H
|
||||||
#define SMALLPREVIEWCOLOR_H
|
#define SMALLPREVIEWCOLOR_H
|
||||||
|
|
||||||
#include "DrawingWidget.h"
|
#include "software_global.h"
|
||||||
|
|
||||||
#include "tools/color.h"
|
#include "DrawingWidget.h"
|
||||||
|
|
||||||
class SmallPreviewColor: public DrawingWidget
|
class SmallPreviewColor: public DrawingWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
#include "previewcolorgradation.h"
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include "Curve.h"
|
|
||||||
#include "baseform.h"
|
|
||||||
#include "tools.h"
|
|
||||||
#include "widgetcurveeditor.h"
|
|
||||||
|
|
||||||
/**************** Preview ****************/
|
|
||||||
PreviewColorGradation::PreviewColorGradation(QWidget* parent, ColorGradation* gradation, EnumColorGradationBand band) : QWidget(parent)
|
|
||||||
{
|
|
||||||
this->gradation = gradation;
|
|
||||||
this->band = band;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewColorGradation::paintEvent(QPaintEvent*)
|
|
||||||
{
|
|
||||||
Curve curve;
|
|
||||||
QPainter painter(this);
|
|
||||||
int width = this->width();
|
|
||||||
int height = this->height();
|
|
||||||
|
|
||||||
switch (band)
|
|
||||||
{
|
|
||||||
case COLORGRADATIONBAND_RED:
|
|
||||||
colorGradationGetRedCurve(gradation, &curve);
|
|
||||||
break;
|
|
||||||
case COLORGRADATIONBAND_GREEN:
|
|
||||||
colorGradationGetGreenCurve(gradation, &curve);
|
|
||||||
break;
|
|
||||||
case COLORGRADATIONBAND_BLUE:
|
|
||||||
colorGradationGetBlueCurve(gradation, &curve);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
switch (band)
|
|
||||||
{
|
|
||||||
case COLORGRADATIONBAND_RED:
|
|
||||||
painter.setPen(QColor::fromRgbF(curve.getValue((double)x / (double)width), 0.0, 0.0));
|
|
||||||
break;
|
|
||||||
case COLORGRADATIONBAND_GREEN:
|
|
||||||
painter.setPen(QColor::fromRgbF(0.0, curve.getValue((double)x / (double)width), 0.0));
|
|
||||||
break;
|
|
||||||
case COLORGRADATIONBAND_BLUE:
|
|
||||||
painter.setPen(QColor::fromRgbF(0.0, 0.0, curve.getValue((double)x / (double)width)));
|
|
||||||
break;
|
|
||||||
case COLORGRADATIONBAND_FINAL:
|
|
||||||
painter.setPen(colorToQColor(colorGradationGet(gradation, (double)x / (double)width)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
painter.drawLine(x, 0, x, height - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewColorGradation::mouseReleaseEvent(QMouseEvent*)
|
|
||||||
{
|
|
||||||
emit clicked();
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
#ifndef _PAYSAGES_QT_PREVIEWCOLORGRADATION_H_
|
|
||||||
#define _PAYSAGES_QT_PREVIEWCOLORGRADATION_H_
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#include "tools/color.h"
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
COLORGRADATIONBAND_RED,
|
|
||||||
COLORGRADATIONBAND_GREEN,
|
|
||||||
COLORGRADATIONBAND_BLUE,
|
|
||||||
COLORGRADATIONBAND_FINAL
|
|
||||||
} EnumColorGradationBand;
|
|
||||||
|
|
||||||
class PreviewColorGradation:public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
PreviewColorGradation(QWidget* parent, ColorGradation* gradation, EnumColorGradationBand band);
|
|
||||||
void paintEvent(QPaintEvent* event);
|
|
||||||
void mouseReleaseEvent(QMouseEvent* event);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ColorGradation* gradation;
|
|
||||||
EnumColorGradationBand band;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include "shared/types.h"
|
#include "shared/types.h"
|
||||||
#include "tools/color.h"
|
#include "Color.h"
|
||||||
|
|
||||||
static inline QColor colorToQColor(Color color)
|
static inline QColor colorToQColor(Color color)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include "preview_global.h"
|
#include "preview_global.h"
|
||||||
|
|
||||||
#include "SoftwareRenderer.h"
|
#include "SoftwareRenderer.h"
|
||||||
#include "tools/color.h"
|
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace preview {
|
namespace preview {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "preview_global.h"
|
#include "preview_global.h"
|
||||||
|
|
||||||
#include "DrawingWidget.h"
|
#include "DrawingWidget.h"
|
||||||
#include "tools/color.h"
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "software_global.h"
|
#include "software_global.h"
|
||||||
|
|
||||||
#include "SpaceSegment.h"
|
#include "SpaceSegment.h"
|
||||||
#include "tools/color.h"
|
|
||||||
|
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace software {
|
namespace software {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include "../rendering_global.h"
|
#include "../rendering_global.h"
|
||||||
#include "../tools/lighting.h"
|
#include "../tools/lighting.h"
|
||||||
#include "../tools/euclid.h"
|
#include "../tools/euclid.h"
|
||||||
#include "../tools/color.h"
|
|
||||||
#include "../shared/types.h"
|
#include "../shared/types.h"
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#include "rendering_global.h"
|
#include "rendering_global.h"
|
||||||
#include "shared/types.h"
|
#include "shared/types.h"
|
||||||
#include "tools/color.h"
|
|
||||||
#include "tools/euclid.h"
|
#include "tools/euclid.h"
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
typedef Color (*f_RenderFragmentCallback)(Renderer* renderer, Vector3 location, void* data);
|
typedef Color (*f_RenderFragmentCallback)(Renderer* renderer, Vector3 location, void* data);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ SOURCES += main.cpp \
|
||||||
tools/lighting.cpp \
|
tools/lighting.cpp \
|
||||||
tools/euclid.cpp \
|
tools/euclid.cpp \
|
||||||
tools/data.cpp \
|
tools/data.cpp \
|
||||||
tools/color.cpp \
|
|
||||||
tools/cache.cpp \
|
tools/cache.cpp \
|
||||||
water/wat_render.cpp \
|
water/wat_render.cpp \
|
||||||
water/wat_raster.cpp \
|
water/wat_raster.cpp \
|
||||||
|
@ -67,7 +66,6 @@ HEADERS += \
|
||||||
tools/lighting.h \
|
tools/lighting.h \
|
||||||
tools/euclid.h \
|
tools/euclid.h \
|
||||||
tools/data.h \
|
tools/data.h \
|
||||||
tools/color.h \
|
|
||||||
tools/cache.h \
|
tools/cache.h \
|
||||||
water/public.h \
|
water/public.h \
|
||||||
water/private.h \
|
water/private.h \
|
||||||
|
|
|
@ -10,4 +10,7 @@
|
||||||
|
|
||||||
#include "definition_global.h"
|
#include "definition_global.h"
|
||||||
|
|
||||||
|
class Renderer; // TEMP
|
||||||
|
class RenderingScenery; // TEMP
|
||||||
|
|
||||||
#endif // RENDERING_GLOBAL_H
|
#endif // RENDERING_GLOBAL_H
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef _PAYSAGES_TYPES_H_
|
#ifndef _PAYSAGES_TYPES_H_
|
||||||
#define _PAYSAGES_TYPES_H_
|
#define _PAYSAGES_TYPES_H_
|
||||||
|
|
||||||
#include "../tools/euclid.h"
|
#include "rendering_global.h"
|
||||||
#include "../tools/color.h"
|
|
||||||
|
|
||||||
class Renderer;
|
#include "../tools/euclid.h"
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#include "../rendering_global.h"
|
#include "../rendering_global.h"
|
||||||
#include "../shared/types.h"
|
#include "../shared/types.h"
|
||||||
#include "../tools/color.h"
|
|
||||||
#include "../tools/euclid.h"
|
#include "../tools/euclid.h"
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
#include "color.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
|
||||||
#include <cmath>
|
|
||||||
#include "PackStream.h"
|
|
||||||
#include "Curve.h"
|
|
||||||
|
|
||||||
/******************************** ColorGradation ********************************/
|
|
||||||
struct ColorGradation
|
|
||||||
{
|
|
||||||
Curve* red;
|
|
||||||
Curve* green;
|
|
||||||
Curve* blue;
|
|
||||||
};
|
|
||||||
|
|
||||||
ColorGradation* colorGradationCreate()
|
|
||||||
{
|
|
||||||
ColorGradation* result;
|
|
||||||
|
|
||||||
result = new ColorGradation;
|
|
||||||
result->red = new Curve;
|
|
||||||
result->green = new Curve;
|
|
||||||
result->blue = new Curve;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationDelete(ColorGradation* gradation)
|
|
||||||
{
|
|
||||||
delete gradation->red;
|
|
||||||
delete gradation->green;
|
|
||||||
delete gradation->blue;
|
|
||||||
delete gradation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationCopy(ColorGradation* source, ColorGradation* destination)
|
|
||||||
{
|
|
||||||
source->red->copy(destination->red);
|
|
||||||
source->green->copy(destination->green);
|
|
||||||
source->blue->copy(destination->blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationClear(ColorGradation* gradation)
|
|
||||||
{
|
|
||||||
gradation->red->clear();
|
|
||||||
gradation->green->clear();
|
|
||||||
gradation->blue->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationSave(PackStream* stream, ColorGradation* gradation)
|
|
||||||
{
|
|
||||||
gradation->red->save(stream);
|
|
||||||
gradation->green->save(stream);
|
|
||||||
gradation->blue->save(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationLoad(PackStream* stream, ColorGradation* gradation)
|
|
||||||
{
|
|
||||||
gradation->red->load(stream);
|
|
||||||
gradation->green->load(stream);
|
|
||||||
gradation->blue->load(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationGetRedCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
gradation->red->copy(curve);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationGetGreenCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
gradation->green->copy(curve);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationGetBlueCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
gradation->blue->copy(curve);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationSetRedCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
curve->copy(gradation->red);
|
|
||||||
gradation->red->validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationSetGreenCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
curve->copy(gradation->green);
|
|
||||||
gradation->green->validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationSetBlueCurve(ColorGradation* gradation, Curve* curve)
|
|
||||||
{
|
|
||||||
curve->copy(gradation->blue);
|
|
||||||
gradation->blue->validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationQuickAdd(ColorGradation* gradation, double value, Color* col)
|
|
||||||
{
|
|
||||||
colorGradationQuickAddRgb(gradation, value, col->r, col->g, col->b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void colorGradationQuickAddRgb(ColorGradation* gradation, double value, double r, double g, double b)
|
|
||||||
{
|
|
||||||
gradation->red->addPoint(value, r);
|
|
||||||
gradation->red->validate();
|
|
||||||
|
|
||||||
gradation->green->addPoint(value, g);
|
|
||||||
gradation->green->validate();
|
|
||||||
|
|
||||||
gradation->blue->addPoint(value, b);
|
|
||||||
gradation->blue->validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
Color colorGradationGet(ColorGradation* gradation, double value)
|
|
||||||
{
|
|
||||||
Color result;
|
|
||||||
|
|
||||||
result.r = gradation->red->getValue(value);
|
|
||||||
result.g = gradation->green->getValue(value);
|
|
||||||
result.b = gradation->blue->getValue(value);
|
|
||||||
result.a = 1.0;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
#ifndef _PAYSAGES_TOOLS_COLOR_H_
|
|
||||||
#define _PAYSAGES_TOOLS_COLOR_H_
|
|
||||||
|
|
||||||
#include "../rendering_global.h"
|
|
||||||
|
|
||||||
/* ColorGradation */
|
|
||||||
typedef struct ColorGradation ColorGradation;
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT ColorGradation* colorGradationCreate();
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationDelete(ColorGradation* gradation);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationCopy(ColorGradation* source, ColorGradation* destination);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationClear(ColorGradation* gradation);
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationSave(PackStream* stream, ColorGradation* gradation);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationLoad(PackStream* stream, ColorGradation* gradation);
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationGetRedCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationGetGreenCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationGetBlueCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationSetRedCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationSetGreenCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationSetBlueCurve(ColorGradation* gradation, Curve* curve);
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationQuickAdd(ColorGradation* gradation, double value, Color* col);
|
|
||||||
RENDERINGSHARED_EXPORT void colorGradationQuickAddRgb(ColorGradation* gradation, double value, double r, double g, double b);
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT Color colorGradationGet(ColorGradation* gradation, double value);
|
|
||||||
|
|
||||||
|
|
||||||
// TEMP
|
|
||||||
#include "Color.h"
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -3,11 +3,7 @@
|
||||||
|
|
||||||
#include "../rendering_global.h"
|
#include "../rendering_global.h"
|
||||||
#include "euclid.h"
|
#include "euclid.h"
|
||||||
#include "color.h"
|
#include "Color.h"
|
||||||
|
|
||||||
namespace paysages {
|
|
||||||
namespace system {class PackStream;}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,13 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../rendering_global.h"
|
#include "../rendering_global.h"
|
||||||
#include "color.h"
|
|
||||||
|
|
||||||
namespace paysages {
|
#include "Color.h"
|
||||||
namespace system {
|
|
||||||
class PackStream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct Texture2D Texture2D;
|
typedef struct Texture2D Texture2D;
|
||||||
typedef struct Texture3D Texture3D;
|
typedef struct Texture3D Texture3D;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "BaseTestCase.h"
|
#include "BaseTestCase.h"
|
||||||
|
|
||||||
#include "tools/color.h"
|
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
#include "SoftwareRenderer.h"
|
#include "SoftwareRenderer.h"
|
||||||
#include "AtmosphereDefinition.h"
|
#include "AtmosphereDefinition.h"
|
||||||
|
|
Loading…
Reference in a new issue