~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/filters/phongbumpmap/phongbumpmap.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (c) 2010 José Luis Vergara <pentalis@gmail.com>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#ifndef PHONGBUMPMAP_H
 
20
#define PHONGBUMPMAP_H
 
21
 
 
22
#include <QWidget>
 
23
 
 
24
#include <QObject>
 
25
#include <QVariant>
 
26
 
 
27
#include <kis_types.h>
 
28
#include <filter/kis_filter.h>
 
29
#include "kis_config_widget.h"
 
30
 
 
31
#include "ui_wdgphongbumpmap.h"
 
32
 
 
33
#include "constants.h"
 
34
 
 
35
#include "phong_pixel_processor.h"
 
36
 
 
37
 
 
38
class KisNodeModel;
 
39
 
 
40
class PhongBumpmapWidget : public QWidget, public Ui::WdgPhongBumpmap
 
41
{
 
42
    Q_OBJECT
 
43
 
 
44
public:
 
45
    
 
46
    PhongBumpmapWidget(QWidget *parent) : QWidget(parent)
 
47
    {
 
48
        setupUi(this);
 
49
        
 
50
        ambientReflectivityKisDoubleSliderSpinBox  -> setRange(0, 1, 2);
 
51
        diffuseReflectivityKisDoubleSliderSpinBox  -> setRange(0, 1, 2);
 
52
        specularReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
 
53
        shinynessExponentKisSliderSpinBox          -> setRange(1, 200);
 
54
        
 
55
        ambientReflectivityKisDoubleSliderSpinBox  -> setValue(0.1);
 
56
        diffuseReflectivityKisDoubleSliderSpinBox  -> setValue(0.5);
 
57
        specularReflectivityKisDoubleSliderSpinBox -> setValue(0.5);
 
58
        shinynessExponentKisSliderSpinBox          -> setValue(40);
 
59
    }
 
60
};
 
61
 
 
62
class KritaPhongBumpmap : public QObject
 
63
{
 
64
public:
 
65
    KritaPhongBumpmap(QObject *parent, const QVariantList &);
 
66
    virtual ~KritaPhongBumpmap();
 
67
};
 
68
 
 
69
 
 
70
/**
 
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.
 
74
 *
 
75
 */
 
76
class KisFilterPhongBumpmap : public KisFilter
 
77
{
 
78
public:
 
79
    KisFilterPhongBumpmap();
 
80
    
 
81
public:
 
82
 
 
83
    using KisFilter::process;
 
84
 
 
85
    void process(KisConstProcessingInformation src,
 
86
                 KisProcessingInformation dst,
 
87
                 const QSize& size,
 
88
                 const KisFilterConfiguration* config,
 
89
                 KoUpdater* progressUpdater
 
90
                ) const;
 
91
 
 
92
    qreal inline pixelProcess (quint8* heightmap, quint32 posup, quint32 posdown, quint32 posleft, quint32 posright);
 
93
    
 
94
    QRect neededRect(const QRect &rect, const KisFilterConfiguration* config) const;
 
95
    QRect changedRect(const QRect &rect, const KisFilterConfiguration* config) const;
 
96
    
 
97
    bool supportsAdjustmentLayers() const {
 
98
        return false;
 
99
    }
 
100
 
 
101
    virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev, const KisImageWSP image = 0) const;
 
102
    virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const;
 
103
    
 
104
};
 
105
 
 
106
class KisPhongBumpmapConfigWidget : public KisConfigWidget
 
107
{
 
108
 
 
109
    Q_OBJECT
 
110
 
 
111
public:
 
112
    KisPhongBumpmapConfigWidget(const KisPaintDeviceSP dev, const KisImageWSP image, QWidget * parent, Qt::WFlags f = 0);
 
113
    virtual ~KisPhongBumpmapConfigWidget() {}
 
114
 
 
115
    void setConfiguration(const KisPropertiesConfiguration* config);
 
116
    KisPropertiesConfiguration* configuration() const;
 
117
 
 
118
    PhongBumpmapWidget * m_page;
 
119
 
 
120
private:
 
121
 
 
122
    KisPaintDeviceSP m_device;
 
123
    KisImageWSP m_image;
 
124
};
 
125
 
 
126
#endif