2
* Copyright (c) 2010 José Luis Vergara <pentalis@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#ifndef PHONGBUMPMAP_H
20
#define PHONGBUMPMAP_H
27
#include <kis_types.h>
28
#include <filter/kis_filter.h>
29
#include "kis_config_widget.h"
31
#include "ui_wdgphongbumpmap.h"
33
#include "constants.h"
35
#include "phong_pixel_processor.h"
40
class PhongBumpmapWidget : public QWidget, public Ui::WdgPhongBumpmap
46
PhongBumpmapWidget(QWidget *parent) : QWidget(parent)
50
ambientReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
51
diffuseReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
52
specularReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
53
shinynessExponentKisSliderSpinBox -> setRange(1, 200);
55
ambientReflectivityKisDoubleSliderSpinBox -> setValue(0.1);
56
diffuseReflectivityKisDoubleSliderSpinBox -> setValue(0.5);
57
specularReflectivityKisDoubleSliderSpinBox -> setValue(0.5);
58
shinynessExponentKisSliderSpinBox -> setValue(40);
62
class KritaPhongBumpmap : public QObject
65
KritaPhongBumpmap(QObject *parent, const QVariantList &);
66
virtual ~KritaPhongBumpmap();
71
* Implementation of the phong illumination model on top of a
72
* heightmap-based mesh to achieve a bumpmapping effect with
73
* multiple illumination sources.
76
class KisFilterPhongBumpmap : public KisFilter
79
KisFilterPhongBumpmap();
83
using KisFilter::process;
85
void process(KisConstProcessingInformation src,
86
KisProcessingInformation dst,
88
const KisFilterConfiguration* config,
89
KoUpdater* progressUpdater
92
qreal inline pixelProcess (quint8* heightmap, quint32 posup, quint32 posdown, quint32 posleft, quint32 posright);
94
QRect neededRect(const QRect &rect, const KisFilterConfiguration* config) const;
95
QRect changedRect(const QRect &rect, const KisFilterConfiguration* config) const;
97
bool supportsAdjustmentLayers() const {
101
virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev, const KisImageWSP image = 0) const;
102
virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const;
106
class KisPhongBumpmapConfigWidget : public KisConfigWidget
112
KisPhongBumpmapConfigWidget(const KisPaintDeviceSP dev, const KisImageWSP image, QWidget * parent, Qt::WFlags f = 0);
113
virtual ~KisPhongBumpmapConfigWidget() {}
115
void setConfiguration(const KisPropertiesConfiguration* config);
116
KisPropertiesConfiguration* configuration() const;
118
PhongBumpmapWidget * m_page;
122
KisPaintDeviceSP m_device;