From 8a42d7407a270e4121e76110f086fbc9635487a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 19 Nov 2013 12:59:06 +0100 Subject: [PATCH] Removed unused ColorGradation + removed old color.h/c --- src/interface/desktop/baseform.cpp | 6 - src/interface/desktop/baseform.h | 1 - src/interface/desktop/desktop.pro | 6 - .../desktop/dialogcolorgradation.cpp | 219 ------------------ src/interface/desktop/dialogcolorgradation.h | 52 ----- src/interface/desktop/dialognoise.cpp | 1 - src/interface/desktop/dialogrender.h | 1 - src/interface/desktop/formclouds.cpp | 1 - src/interface/desktop/inputcolorgradation.cpp | 52 ----- src/interface/desktop/inputcolorgradation.h | 28 --- .../desktop/lighting/SmallPreviewColor.h | 4 +- .../desktop/previewcolorgradation.cpp | 69 ------ src/interface/desktop/previewcolorgradation.h | 32 --- src/interface/desktop/tools.h | 2 +- src/render/preview/Base2dPreviewRenderer.h | 3 +- src/render/preview/BasePreview.h | 1 - src/render/software/FluidMediumManager.h | 1 - src/rendering/atmosphere/public.h | 2 +- src/rendering/render.h | 2 +- src/rendering/rendering.pro | 2 - src/rendering/rendering_global.h | 3 + src/rendering/shared/types.h | 6 +- src/rendering/terrain/public.h | 4 +- src/rendering/tools/color.cpp | 126 ---------- src/rendering/tools/color.h | 34 --- src/rendering/tools/lighting.h | 6 +- src/rendering/tools/texture.h | 7 +- src/tests/Bruneton_Test.cpp | 1 - 28 files changed, 17 insertions(+), 655 deletions(-) delete mode 100644 src/interface/desktop/dialogcolorgradation.cpp delete mode 100644 src/interface/desktop/dialogcolorgradation.h delete mode 100644 src/interface/desktop/inputcolorgradation.cpp delete mode 100644 src/interface/desktop/inputcolorgradation.h delete mode 100644 src/interface/desktop/previewcolorgradation.cpp delete mode 100644 src/interface/desktop/previewcolorgradation.h delete mode 100644 src/rendering/tools/color.cpp delete mode 100644 src/rendering/tools/color.h diff --git a/src/interface/desktop/baseform.cpp b/src/interface/desktop/baseform.cpp index 7a3ba7d..9283a4f 100644 --- a/src/interface/desktop/baseform.cpp +++ b/src/interface/desktop/baseform.cpp @@ -4,7 +4,6 @@ #include "inputint.h" #include "inputboolean.h" #include "inputcolor.h" -#include "inputcolorgradation.h" #include "inputnoise.h" #include "inputcurve.h" #include "inputmaterial.h" @@ -439,11 +438,6 @@ BaseInput* BaseForm::addInputColor(QString label, Color* 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) { return addInput(new InputNoise(_form, label, value)); diff --git a/src/interface/desktop/baseform.h b/src/interface/desktop/baseform.h index fc293d4..78537ce 100644 --- a/src/interface/desktop/baseform.h +++ b/src/interface/desktop/baseform.h @@ -53,7 +53,6 @@ protected: BaseInput* addInputDouble(QString label, double* value, double min, double max, double small_step, double large_step); BaseInput* addInputBoolean(QString label, int* value); BaseInput* addInputColor(QString label, Color* value); - BaseInput* addInputColorGradation(QString label, ColorGradation* 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* addInputMaterial(QString label, SurfaceMaterial* material); diff --git a/src/interface/desktop/desktop.pro b/src/interface/desktop/desktop.pro index eecae4d..a076f2c 100644 --- a/src/interface/desktop/desktop.pro +++ b/src/interface/desktop/desktop.pro @@ -14,7 +14,6 @@ HEADERS += \ widgetcurveeditor.h \ tools.h \ previewmaterial.h \ - previewcolorgradation.h \ inputnoise.h \ inputmaterial.h \ inputlayers.h \ @@ -22,7 +21,6 @@ HEADERS += \ inputenum.h \ inputdouble.h \ inputcurve.h \ - inputcolorgradation.h \ inputcolor.h \ inputcamera.h \ inputboolean.h \ @@ -36,7 +34,6 @@ HEADERS += \ dialoglayers.h \ dialogexplorer.h \ dialogcurve.h \ - dialogcolorgradation.h \ baseinput.h \ baseformlayer.h \ baseform.h \ @@ -66,7 +63,6 @@ SOURCES += \ widgetcurveeditor.cpp \ tools.cpp \ previewmaterial.cpp \ - previewcolorgradation.cpp \ inputnoise.cpp \ inputmaterial.cpp \ inputlayers.cpp \ @@ -74,7 +70,6 @@ SOURCES += \ inputenum.cpp \ inputdouble.cpp \ inputcurve.cpp \ - inputcolorgradation.cpp \ inputcolor.cpp \ inputcamera.cpp \ inputboolean.cpp \ @@ -88,7 +83,6 @@ SOURCES += \ dialoglayers.cpp \ dialogexplorer.cpp \ dialogcurve.cpp \ - dialogcolorgradation.cpp \ baseinput.cpp \ baseformlayer.cpp \ baseform.cpp \ diff --git a/src/interface/desktop/dialogcolorgradation.cpp b/src/interface/desktop/dialogcolorgradation.cpp deleted file mode 100644 index 37c8cb6..0000000 --- a/src/interface/desktop/dialogcolorgradation.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "dialogcolorgradation.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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(); -} diff --git a/src/interface/desktop/dialogcolorgradation.h b/src/interface/desktop/dialogcolorgradation.h deleted file mode 100644 index 1314de7..0000000 --- a/src/interface/desktop/dialogcolorgradation.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _PAYSAGES_QT_DIALOGCOLORGRADATION_H_ -#define _PAYSAGES_QT_DIALOGCOLORGRADATION_H_ - -#include "desktop_global.h" - -#include - -#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 diff --git a/src/interface/desktop/dialognoise.cpp b/src/interface/desktop/dialognoise.cpp index fd32a06..1dd77ae 100644 --- a/src/interface/desktop/dialognoise.cpp +++ b/src/interface/desktop/dialognoise.cpp @@ -10,7 +10,6 @@ #include #include #include -#include "tools/color.h" #include "BasePreview.h" /**************** Previews ****************/ diff --git a/src/interface/desktop/dialogrender.h b/src/interface/desktop/dialogrender.h index 49c270a..6638fdf 100644 --- a/src/interface/desktop/dialogrender.h +++ b/src/interface/desktop/dialogrender.h @@ -4,7 +4,6 @@ #include #include #include "renderer.h" -#include "tools/color.h" class QThread; class QProgressBar; diff --git a/src/interface/desktop/formclouds.cpp b/src/interface/desktop/formclouds.cpp index 2c58a72..316c96e 100644 --- a/src/interface/desktop/formclouds.cpp +++ b/src/interface/desktop/formclouds.cpp @@ -1,7 +1,6 @@ #include "formclouds.h" #include "clouds/clo_preview.h" -#include "tools/color.h" #include "tools/euclid.h" #include "RenderingScenery.h" #include "BasePreview.h" diff --git a/src/interface/desktop/inputcolorgradation.cpp b/src/interface/desktop/inputcolorgradation.cpp deleted file mode 100644 index 6c7d7e3..0000000 --- a/src/interface/desktop/inputcolorgradation.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "inputcolorgradation.h" - -#include -#include -#include -#include -#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); -} diff --git a/src/interface/desktop/inputcolorgradation.h b/src/interface/desktop/inputcolorgradation.h deleted file mode 100644 index 3fa2983..0000000 --- a/src/interface/desktop/inputcolorgradation.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _PAYSAGES_QT_INPUTCOLORGRADATION_H_ -#define _PAYSAGES_QT_INPUTCOLORGRADATION_H_ - -#include -#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 diff --git a/src/interface/desktop/lighting/SmallPreviewColor.h b/src/interface/desktop/lighting/SmallPreviewColor.h index 5c1bb5d..ccc643f 100644 --- a/src/interface/desktop/lighting/SmallPreviewColor.h +++ b/src/interface/desktop/lighting/SmallPreviewColor.h @@ -1,9 +1,9 @@ #ifndef SMALLPREVIEWCOLOR_H #define SMALLPREVIEWCOLOR_H -#include "DrawingWidget.h" +#include "software_global.h" -#include "tools/color.h" +#include "DrawingWidget.h" class SmallPreviewColor: public DrawingWidget { diff --git a/src/interface/desktop/previewcolorgradation.cpp b/src/interface/desktop/previewcolorgradation.cpp deleted file mode 100644 index 8648ceb..0000000 --- a/src/interface/desktop/previewcolorgradation.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "previewcolorgradation.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#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(); -} diff --git a/src/interface/desktop/previewcolorgradation.h b/src/interface/desktop/previewcolorgradation.h deleted file mode 100644 index 7de470e..0000000 --- a/src/interface/desktop/previewcolorgradation.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _PAYSAGES_QT_PREVIEWCOLORGRADATION_H_ -#define _PAYSAGES_QT_PREVIEWCOLORGRADATION_H_ - -#include - -#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 diff --git a/src/interface/desktop/tools.h b/src/interface/desktop/tools.h index f479ca4..4ca57e6 100644 --- a/src/interface/desktop/tools.h +++ b/src/interface/desktop/tools.h @@ -6,7 +6,7 @@ #include #include "shared/types.h" -#include "tools/color.h" +#include "Color.h" static inline QColor colorToQColor(Color color) { diff --git a/src/render/preview/Base2dPreviewRenderer.h b/src/render/preview/Base2dPreviewRenderer.h index 1f17eb2..cc84044 100644 --- a/src/render/preview/Base2dPreviewRenderer.h +++ b/src/render/preview/Base2dPreviewRenderer.h @@ -4,7 +4,8 @@ #include "preview_global.h" #include "SoftwareRenderer.h" -#include "tools/color.h" + +#include "Color.h" namespace paysages { namespace preview { diff --git a/src/render/preview/BasePreview.h b/src/render/preview/BasePreview.h index e57bc4d..82d0cf9 100644 --- a/src/render/preview/BasePreview.h +++ b/src/render/preview/BasePreview.h @@ -4,7 +4,6 @@ #include "preview_global.h" #include "DrawingWidget.h" -#include "tools/color.h" #include #include class QPainter; diff --git a/src/render/software/FluidMediumManager.h b/src/render/software/FluidMediumManager.h index 552275c..99d2194 100644 --- a/src/render/software/FluidMediumManager.h +++ b/src/render/software/FluidMediumManager.h @@ -4,7 +4,6 @@ #include "software_global.h" #include "SpaceSegment.h" -#include "tools/color.h" namespace paysages { namespace software { diff --git a/src/rendering/atmosphere/public.h b/src/rendering/atmosphere/public.h index f21bf06..fb2ba04 100644 --- a/src/rendering/atmosphere/public.h +++ b/src/rendering/atmosphere/public.h @@ -6,8 +6,8 @@ #include "../rendering_global.h" #include "../tools/lighting.h" #include "../tools/euclid.h" -#include "../tools/color.h" #include "../shared/types.h" +#include "Color.h" typedef struct { diff --git a/src/rendering/render.h b/src/rendering/render.h index 981eddf..0c94b2b 100644 --- a/src/rendering/render.h +++ b/src/rendering/render.h @@ -3,8 +3,8 @@ #include "rendering_global.h" #include "shared/types.h" -#include "tools/color.h" #include "tools/euclid.h" +#include "Color.h" typedef Color (*f_RenderFragmentCallback)(Renderer* renderer, Vector3 location, void* data); diff --git a/src/rendering/rendering.pro b/src/rendering/rendering.pro index 45258f4..cdbd955 100644 --- a/src/rendering/rendering.pro +++ b/src/rendering/rendering.pro @@ -33,7 +33,6 @@ SOURCES += main.cpp \ tools/lighting.cpp \ tools/euclid.cpp \ tools/data.cpp \ - tools/color.cpp \ tools/cache.cpp \ water/wat_render.cpp \ water/wat_raster.cpp \ @@ -67,7 +66,6 @@ HEADERS += \ tools/lighting.h \ tools/euclid.h \ tools/data.h \ - tools/color.h \ tools/cache.h \ water/public.h \ water/private.h \ diff --git a/src/rendering/rendering_global.h b/src/rendering/rendering_global.h index 3225823..39af379 100644 --- a/src/rendering/rendering_global.h +++ b/src/rendering/rendering_global.h @@ -10,4 +10,7 @@ #include "definition_global.h" +class Renderer; // TEMP +class RenderingScenery; // TEMP + #endif // RENDERING_GLOBAL_H diff --git a/src/rendering/shared/types.h b/src/rendering/shared/types.h index bcd466d..ddc6950 100644 --- a/src/rendering/shared/types.h +++ b/src/rendering/shared/types.h @@ -1,10 +1,10 @@ #ifndef _PAYSAGES_TYPES_H_ #define _PAYSAGES_TYPES_H_ -#include "../tools/euclid.h" -#include "../tools/color.h" +#include "rendering_global.h" -class Renderer; +#include "../tools/euclid.h" +#include "Color.h" typedef struct { diff --git a/src/rendering/terrain/public.h b/src/rendering/terrain/public.h index cd91446..fab1ec1 100644 --- a/src/rendering/terrain/public.h +++ b/src/rendering/terrain/public.h @@ -3,8 +3,8 @@ #include "../rendering_global.h" #include "../shared/types.h" -#include "../tools/color.h" #include "../tools/euclid.h" +#include "Color.h" typedef struct { @@ -14,7 +14,7 @@ typedef struct typedef double (*FuncTerrainGetHeight)(Renderer* renderer, double x, double z, int with_painting); typedef TerrainResult (*FuncTerrainGetResult)(Renderer* renderer, double x, double z, int with_painting, int with_textures); -typedef Color(*FuncTerrainGetFinalColor)(Renderer* renderer, Vector3 location, double precision); +typedef Color (*FuncTerrainGetFinalColor)(Renderer* renderer, Vector3 location, double precision); typedef double (*FuncGetWaterHeight)(Renderer* renderer); class TerrainRenderer diff --git a/src/rendering/tools/color.cpp b/src/rendering/tools/color.cpp deleted file mode 100644 index 9359f3b..0000000 --- a/src/rendering/tools/color.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "color.h" - -#include -#include -#include -#include -#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; -} diff --git a/src/rendering/tools/color.h b/src/rendering/tools/color.h deleted file mode 100644 index af49b60..0000000 --- a/src/rendering/tools/color.h +++ /dev/null @@ -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 diff --git a/src/rendering/tools/lighting.h b/src/rendering/tools/lighting.h index f797147..ac5b8c9 100644 --- a/src/rendering/tools/lighting.h +++ b/src/rendering/tools/lighting.h @@ -3,11 +3,7 @@ #include "../rendering_global.h" #include "euclid.h" -#include "color.h" - -namespace paysages { -namespace system {class PackStream;} -} +#include "Color.h" typedef struct { diff --git a/src/rendering/tools/texture.h b/src/rendering/tools/texture.h index 7f21f37..7e41a3f 100644 --- a/src/rendering/tools/texture.h +++ b/src/rendering/tools/texture.h @@ -6,13 +6,8 @@ */ #include "../rendering_global.h" -#include "color.h" -namespace paysages { -namespace system { -class PackStream; -} -} +#include "Color.h" typedef struct Texture2D Texture2D; typedef struct Texture3D Texture3D; diff --git a/src/tests/Bruneton_Test.cpp b/src/tests/Bruneton_Test.cpp index 3d3e18e..b7cabff 100644 --- a/src/tests/Bruneton_Test.cpp +++ b/src/tests/Bruneton_Test.cpp @@ -1,6 +1,5 @@ #include "BaseTestCase.h" -#include "tools/color.h" #include "CameraDefinition.h" #include "SoftwareRenderer.h" #include "AtmosphereDefinition.h"