~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/gameengine/VideoTexture/FilterSource.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
-----------------------------------------------------------------------------
3
 
This source file is part of blendTex library
4
 
 
5
 
Copyright (c) 2007 The Zdeno Ash Miklas
6
 
 
7
 
This program is free software; you can redistribute it and/or modify it under
8
 
the terms of the GNU Lesser General Public License as published by the Free Software
9
 
Foundation; either version 2 of the License, or (at your option) any later
10
 
version.
11
 
 
12
 
This program is distributed in the hope that it will be useful, but WITHOUT
13
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
 
 
16
 
You should have received a copy of the GNU Lesser General Public License along with
17
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18
 
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
19
 
http://www.gnu.org/copyleft/lesser.txt.
20
 
-----------------------------------------------------------------------------
21
 
*/
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (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  Foundation,
 
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * Copyright (c) 2007 The Zdeno Ash Miklas
 
19
 *
 
20
 * This source file is part of blendTex library
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
24
 * ***** END GPL LICENSE BLOCK *****
 
25
 */
22
26
 
23
27
/** \file FilterSource.h
24
28
 *  \ingroup bgevideotex
25
29
 */
26
 
 
 
30
 
27
31
#ifndef __FILTERSOURCE_H__
28
32
#define __FILTERSOURCE_H__
29
33
 
31
35
 
32
36
#include "FilterBase.h"
33
37
 
34
 
 
35
38
/// class for RGB24 conversion
36
39
class FilterRGB24 : public FilterBase
37
40
{
97
100
        { VT_RGBA(val,src[2],src[1],src[0],0xFF); return val; }
98
101
};
99
102
 
 
103
/// class for Z_buffer conversion
 
104
class FilterZZZA : public FilterBase
 
105
{
 
106
public:
 
107
        /// constructor
 
108
        FilterZZZA (void) {}
 
109
        /// destructor
 
110
        virtual ~FilterZZZA (void) {}
 
111
 
 
112
        /// get source pixel size
 
113
        virtual unsigned int getPixelSize (void) { return 1; }
 
114
 
 
115
protected:
 
116
        /// filter pixel, source float buffer
 
117
        virtual unsigned int filter (float * src, short x, short y,
 
118
                short * size, unsigned int pixSize, unsigned int val)
 
119
        {
 
120
                // calculate gray value
 
121
        // convert float to unsigned char
 
122
                unsigned int depth = int(src[0] * 255);
 
123
                // return depth scale value
 
124
                VT_R(val) = depth;
 
125
                VT_G(val) = depth;
 
126
                VT_B(val) = depth;
 
127
                VT_A(val) = 0xFF;
 
128
 
 
129
                return val;
 
130
        }
 
131
};
 
132
 
 
133
 
 
134
/// class for Z_buffer conversion
 
135
class FilterDEPTH : public FilterBase
 
136
{
 
137
public:
 
138
        /// constructor
 
139
        FilterDEPTH (void) {}
 
140
        /// destructor
 
141
        virtual ~FilterDEPTH (void) {}
 
142
 
 
143
        /// get source pixel size
 
144
        virtual unsigned int getPixelSize (void) { return 1; }
 
145
 
 
146
protected:
 
147
        /// filter pixel, source float buffer
 
148
        virtual unsigned int filter (float * src, short x, short y,
 
149
                                     short * size, unsigned int pixSize, unsigned int val)
 
150
        {
 
151
                /* Copy the float value straight away
 
152
                 * The user can retrieve the original float value by using
 
153
                 * 'F' mode in BGL buffer */
 
154
                memcpy(&val, src, sizeof (unsigned int));
 
155
                return val;
 
156
        }
 
157
};
 
158
 
 
159
 
 
160
 
 
161
 
100
162
/// class for YV12 conversion
101
163
class FilterYV12 : public FilterBase
102
164
{