~ubuntu-branches/ubuntu/quantal/aqsis/quantal

« back to all changes in this revision

Viewing changes to libs/shadervm/shaderexecenv/shadeops_comp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-08-06 04:53:26 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806045326-z6xeaaao62idxcc6
Tags: 1.6.0-0ubuntu1
* New upstream release
* debian/control:
  - changed name of lib package to libaqsis1 instead of aqsis-libsc2a
  - changed name of dev package to libaqsis-dev instead of aqsis-libs-dev
  - Added aqsis-data package
  - Revised summary text according to that specified by the RISpec (Pixar)
* Moved examples installation from aqsis.install to aqsis-data.install
* debian/rules: 
  - added content to binary-indep target
* debian/rules: added explicit name of mime file to force dh_installmime
  to generate postinst and prerm scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Aqsis
 
2
// Copyright (C) 1997 - 2001, Paul C. Gregory
 
3
//
 
4
// Contact: pgregory@aqsis.org
 
5
//
 
6
// This library is free software; you can redistribute it and/or
 
7
// modify it under the terms of the GNU General Public
 
8
// License as published by the Free Software Foundation; either
 
9
// version 2 of the License, or (at your option) any later version.
 
10
//
 
11
// This library is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
// General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public
 
17
// License along with this library; if not, write to the Free Software
 
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 
 
20
 
 
21
/** \file
 
22
                \brief Implements the basic shader operations. (Color, vector componets related)
 
23
                \author Paul C. Gregory (pgregory@aqsis.org)
 
24
*/
 
25
 
 
26
 
 
27
#include        <stdio.h>
 
28
 
 
29
#include        "shaderexecenv.h"
 
30
 
 
31
namespace Aqsis {
 
32
 
 
33
 
 
34
//----------------------------------------------------------------------
 
35
// setcomp(c,__iGrid,v)
 
36
void    CqShaderExecEnv::SO_setcomp( IqShaderData* p, IqShaderData* index, IqShaderData* v, IqShader* pShader )
 
37
{
 
38
        bool __fVarying;
 
39
        TqUint __iGrid;
 
40
 
 
41
        __fVarying=(p)->Class()==class_varying;
 
42
        __fVarying=(v)->Class()==class_varying||__fVarying;
 
43
        __fVarying=(index)->Class()==class_varying||__fVarying;
 
44
 
 
45
        __iGrid = 0;
 
46
        const CqBitVector& RS = RunningState();
 
47
        do
 
48
        {
 
49
                if(!__fVarying || RS.Value( __iGrid ) )
 
50
                {
 
51
                        CqColor _aq_p;
 
52
                        (p)->GetColor(_aq_p,__iGrid);
 
53
                        TqFloat _aq_index;
 
54
                        (index)->GetFloat(_aq_index,__iGrid);
 
55
                        TqFloat _aq_v;
 
56
                        (v)->GetFloat(_aq_v,__iGrid);
 
57
                        _aq_p [ static_cast<int>( _aq_index ) ] = _aq_v;
 
58
                        (p)->SetColor(_aq_p,__iGrid);
 
59
                }
 
60
        }
 
61
        while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
 
62
}
 
63
 
 
64
//----------------------------------------------------------------------
 
65
// setxcomp(p,v)
 
66
void    CqShaderExecEnv::SO_setxcomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
 
67
{
 
68
        bool __fVarying;
 
69
        TqUint __iGrid;
 
70
 
 
71
        __fVarying=(p)->Class()==class_varying;
 
72
        __fVarying=(v)->Class()==class_varying||__fVarying;
 
73
 
 
74
        __iGrid = 0;
 
75
        const CqBitVector& RS = RunningState();
 
76
        do
 
77
        {
 
78
                if(!__fVarying || RS.Value( __iGrid ) )
 
79
                {
 
80
                        CqVector3D _aq_p;
 
81
                        (p)->GetPoint(_aq_p,__iGrid);
 
82
                        TqFloat _aq_v;
 
83
                        (v)->GetFloat(_aq_v,__iGrid);
 
84
                        _aq_p.x( _aq_v );
 
85
                        (p)->SetPoint(_aq_p,__iGrid);
 
86
                }
 
87
        }
 
88
        while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
 
89
}
 
90
 
 
91
//----------------------------------------------------------------------
 
92
// setycomp(p,v)
 
93
void    CqShaderExecEnv::SO_setycomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
 
94
{
 
95
        bool __fVarying;
 
96
        TqUint __iGrid;
 
97
 
 
98
        __fVarying=(p)->Class()==class_varying;
 
99
        __fVarying=(v)->Class()==class_varying||__fVarying;
 
100
 
 
101
        __iGrid = 0;
 
102
        const CqBitVector& RS = RunningState();
 
103
        do
 
104
        {
 
105
                if(!__fVarying || RS.Value( __iGrid ) )
 
106
                {
 
107
                        CqVector3D _aq_p;
 
108
                        (p)->GetPoint(_aq_p,__iGrid);
 
109
                        TqFloat _aq_v;
 
110
                        (v)->GetFloat(_aq_v,__iGrid);
 
111
                        _aq_p.y( _aq_v );
 
112
                        (p)->SetPoint(_aq_p,__iGrid);
 
113
                }
 
114
        }
 
115
        while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
 
116
}
 
117
 
 
118
//----------------------------------------------------------------------
 
119
// setzcomp(p,v)
 
120
void    CqShaderExecEnv::SO_setzcomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
 
121
{
 
122
        bool __fVarying;
 
123
        TqUint __iGrid;
 
124
 
 
125
        __fVarying=(p)->Class()==class_varying;
 
126
        __fVarying=(v)->Class()==class_varying||__fVarying;
 
127
 
 
128
        __iGrid = 0;
 
129
        const CqBitVector& RS = RunningState();
 
130
        do
 
131
        {
 
132
                if(!__fVarying || RS.Value( __iGrid ) )
 
133
                {
 
134
                        CqVector3D _aq_p;
 
135
                        (p)->GetPoint(_aq_p,__iGrid);
 
136
                        TqFloat _aq_v;
 
137
                        (v)->GetFloat(_aq_v,__iGrid);
 
138
                        _aq_p.z( _aq_v );
 
139
                        (p)->SetPoint(_aq_p,__iGrid);
 
140
                }
 
141
        }
 
142
        while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
 
143
}
 
144
 
 
145
 
 
146
 
 
147
} // namespace Aqsis
 
148
//---------------------------------------------------------------------