~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADAFramework/include/COLLADAFWPassClear.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of COLLADAFramework.
 
5
 
 
6
    Licensed under the MIT Open Source License, 
 
7
    for details please see LICENSE file or the website
 
8
    http://www.opensource.org/licenses/mit-license.php
 
9
*/
 
10
 
 
11
#ifndef __COLLADAFW_PASSCLEAR_H__
 
12
#define __COLLADAFW_PASSCLEAR_H__
 
13
 
 
14
#include "COLLADAFWPrerequisites.h"
 
15
#include "COLLADAFWColor.h"
 
16
 
 
17
 
 
18
namespace COLLADAFW
 
19
{
 
20
 
 
21
    /** 
 
22
    Specifies whether a render target surface is to be cleared, and which value to use.
 
23
    Before drawing, render target surfaces may need to be reset to a blank canvas or default. The
 
24
    <color_clear> declarations specify which value to use. If no clearing statement is included, 
 
25
    the target surface is unchanged as rendering begins.
 
26
    
 
27
    This element contains four float values representing the red, green, blue, and alpha channels.
 
28
    When this element exists inside a pass, it a cue to the runtime that a particular backbuffer or 
 
29
    render-target resource should be cleared. This means that all existing image data in the 
 
30
    resource should be replaced with the color provided. This element puts the resource into a fresh 
 
31
    and known state so that other operations that use this resource execute as expected.
 
32
    The index attribute identifies the resource that you want to clear. An index of 0 identifies the 
 
33
    primary resource. The primary resource may be the backbuffer or the override provided with an 
 
34
    appropriate <*_target> element (<color_target>, <depth_target>, or <stencil_target>).
 
35
    Current platforms have fairly restrictive rules for setting up multiple render targets (MRTs). 
 
36
    For example, MRTs can have only four color buffers, which must all be the same size and pixel 
 
37
    format, one depth buffer, and one stencil buffer active for all color buffers. The COLLADA FX 
 
38
    declaration is designed to be looser in its restrictions, so an FX runtime must validate that a 
 
39
    particular MRT declaration in a <pass> is possible before attempting to apply it, and flag it as 
 
40
    an error if it fails.
 
41
    */
 
42
    class PassColorClear : public PassOutput
 
43
    {
 
44
        private:
 
45
        
 
46
        /** The color value. */
 
47
        Color mColor;
 
48
 
 
49
        public:
 
50
 
 
51
        /** Constructor. */
 
52
        PassColorClear () 
 
53
            : PassOutput ( PassOutput::OUTPUT_TYPE_COLOR )
 
54
            , mColor ( 0.0f, 0.0f, 0.0f, 0.0f )
 
55
        {}
 
56
 
 
57
        /** Constructor. */
 
58
        PassColorClear ( float red, float green, float blue, float alpha ) 
 
59
            : PassOutput ( PassOutput::OUTPUT_TYPE_COLOR )
 
60
            , mColor ( red, green, blue, alpha )
 
61
        {}
 
62
 
 
63
        /** Destructor. */
 
64
                virtual ~PassColorClear();
 
65
 
 
66
        /** The color value. */
 
67
        const Color getColor () const { return mColor; }
 
68
 
 
69
        /** The color value. */
 
70
        void setColor ( const Color Color ) { mColor = Color; }
 
71
 
 
72
        private:
 
73
 
 
74
        /** Disable default copy ctor. */
 
75
                PassColorClear( const PassColorClear& pre );
 
76
 
 
77
        /** Disable default assignment operator. */
 
78
                const PassColorClear& operator= ( const PassColorClear& pre );
 
79
 
 
80
        };
 
81
 
 
82
    /** 
 
83
    Specifies whether a render target surface is to be cleared, and which value to use.
 
84
 
 
85
    Before drawing, render target surfaces may need resetting to a blank canvas or to a default. 
 
86
    These <depth_clear> declarations specify which value to use. If no clearing statement is 
 
87
    included, the target surface is unchanged as rendering begins.
 
88
 
 
89
    This element contains a single float value that is used to clear a resource.
 
90
    When this element exists inside a pass, it a cue to the runtime that a particular backbuffer or 
 
91
    render-target resource should be cleared. This means that all existing image data in the 
 
92
    resource should be replaced with the float value provided. This puts the resource into a fresh 
 
93
    and known state so that other operations with this resource execute as expected.
 
94
    The index attribute identifies the resource that you want to clear. An index of 0 identifies 
 
95
    the primary resource. The primary resource may be the backbuffer or the override provided with 
 
96
    an appropriate <*_target> element (<color_target>, <depth_target>, or <stencil_target>)
 
97
    Current platforms have fairly restrictive rules for setting up MRTs; for example, MRTs can have 
 
98
    only four color buffers, which must be all of the same size and pixel format, and only one depth 
 
99
    buffer and one stencil buffer active for all color buffers. The COLLADA FX declaration is 
 
100
    designed to be looser in its restrictions, so an FX runtime must validate that a particular MRT 
 
101
    declaration in a <pass> is possible before attempting to apply it, and flag it as an error if it 
 
102
    fails.
 
103
    */
 
104
    class PassDepthClear : public PassOutput
 
105
    {
 
106
    private:
 
107
 
 
108
        float mResource;
 
109
 
 
110
    public:
 
111
 
 
112
        /** Constructor. */
 
113
        PassDepthClear() 
 
114
            : PassOutput ( PassOutput::OUTPUT_TYPE_DEPTH )
 
115
            , mResource (0.0f) 
 
116
        {}
 
117
 
 
118
        /** Constructor. */
 
119
        PassDepthClear( float resource ) 
 
120
            : PassOutput ( PassOutput::OUTPUT_TYPE_DEPTH )
 
121
            , mResource ( resource ) 
 
122
        {}
 
123
 
 
124
        /** Destructor. */
 
125
        virtual ~PassDepthClear();
 
126
 
 
127
        const float getResource () const { return mResource; }
 
128
        void setResource ( const float Resource ) { mResource = Resource; }
 
129
 
 
130
    private:
 
131
 
 
132
        /** Disable default copy ctor. */
 
133
        PassDepthClear( const PassDepthClear& pre );
 
134
 
 
135
        /** Disable default assignment operator. */
 
136
        const PassDepthClear& operator= ( const PassDepthClear& pre );
 
137
 
 
138
    };
 
139
 
 
140
    /** 
 
141
    Specifies whether a render target surface is to be cleared, and which value to use.
 
142
    
 
143
    Before drawing, render target surfaces may need resetting to a blank canvas or default. These
 
144
    <stencil_clear> declarations specify which value to use. If no clearing statement is included, 
 
145
    the target surface will be unchanged as rendering begins.
 
146
    
 
147
    This element contains an xs:byte that is the value used to clear a resource.
 
148
    When this element exists inside a pass, it a cue to the runtime that a particular backbuffer or 
 
149
    render-target resource should be cleared. This means that all existing image data in the 
 
150
    resource should be replaced with the value provided. This puts the resource into a fresh and 
 
151
    known state so that other operations with this resource execute as expected.
 
152
    The index attribute identifies the resource that you want to clear. An index of 0 identifies the 
 
153
    primary resource. The primary resource may be the backbuffer or the override provided with an 
 
154
    appropriate <*_target> element (<color_target>, <depth_target>, or <stencil_target>).
 
155
    Current platforms have fairly restrictive rules for setting up MRTs; for example, only four 
 
156
    color buffers, which must be all of the same size and pixel format, and only one depth buffer 
 
157
    and one stencil buffer active for all color buffers. The COLLADA FX declaration is designed to 
 
158
    be looser in its restrictions, so an FX runtime must validate that a particular MRT declaration 
 
159
    in a <pass> is possible before attempting to apply it, and flag it as an error if it fails.
 
160
    */
 
161
    class PassStencilClear : public PassOutput
 
162
    {
 
163
    private:
 
164
 
 
165
        unsigned char mClearValue;
 
166
 
 
167
    public:
 
168
 
 
169
        /** Constructor. */
 
170
        PassStencilClear() 
 
171
            : PassOutput ( PassOutput::OUTPUT_TYPE_STENCIL )
 
172
            , mClearValue (0) 
 
173
        {}
 
174
 
 
175
        /** Constructor. */
 
176
        PassStencilClear( unsigned char clearValue ) 
 
177
            : PassOutput ( PassOutput::OUTPUT_TYPE_STENCIL )
 
178
            , mClearValue ( clearValue ) 
 
179
        {}
 
180
 
 
181
        /** Destructor. */
 
182
        virtual ~PassStencilClear();
 
183
 
 
184
        const unsigned char getClearValue () const { return mClearValue; }
 
185
        void setClearValue ( const unsigned char ClearValue ) { mClearValue = ClearValue; }
 
186
 
 
187
    private:
 
188
 
 
189
        /** Disable default copy ctor. */
 
190
        PassStencilClear( const PassStencilClear& pre );
 
191
 
 
192
        /** Disable default assignment operator. */
 
193
        const PassStencilClear& operator= ( const PassStencilClear& pre );
 
194
 
 
195
    };
 
196
 
 
197
} // namespace COLLADAFW
 
198
 
 
199
#endif // __COLLADAFW_PASSCLEAR_H__