2
// Copyright (C) 1997 - 2001, Paul C. Gregory
4
// Contact: pgregory@aqsis.org
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.
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.
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
22
\brief Implements the basic shader operations. (Color, vector componets related)
23
\author Paul C. Gregory (pgregory@aqsis.org)
29
#include "shaderexecenv.h"
34
//----------------------------------------------------------------------
35
// setcomp(c,__iGrid,v)
36
void CqShaderExecEnv::SO_setcomp( IqShaderData* p, IqShaderData* index, IqShaderData* v, IqShader* pShader )
41
__fVarying=(p)->Class()==class_varying;
42
__fVarying=(v)->Class()==class_varying||__fVarying;
43
__fVarying=(index)->Class()==class_varying||__fVarying;
46
const CqBitVector& RS = RunningState();
49
if(!__fVarying || RS.Value( __iGrid ) )
52
(p)->GetColor(_aq_p,__iGrid);
54
(index)->GetFloat(_aq_index,__iGrid);
56
(v)->GetFloat(_aq_v,__iGrid);
57
_aq_p [ static_cast<int>( _aq_index ) ] = _aq_v;
58
(p)->SetColor(_aq_p,__iGrid);
61
while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
64
//----------------------------------------------------------------------
66
void CqShaderExecEnv::SO_setxcomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
71
__fVarying=(p)->Class()==class_varying;
72
__fVarying=(v)->Class()==class_varying||__fVarying;
75
const CqBitVector& RS = RunningState();
78
if(!__fVarying || RS.Value( __iGrid ) )
81
(p)->GetPoint(_aq_p,__iGrid);
83
(v)->GetFloat(_aq_v,__iGrid);
85
(p)->SetPoint(_aq_p,__iGrid);
88
while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
91
//----------------------------------------------------------------------
93
void CqShaderExecEnv::SO_setycomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
98
__fVarying=(p)->Class()==class_varying;
99
__fVarying=(v)->Class()==class_varying||__fVarying;
102
const CqBitVector& RS = RunningState();
105
if(!__fVarying || RS.Value( __iGrid ) )
108
(p)->GetPoint(_aq_p,__iGrid);
110
(v)->GetFloat(_aq_v,__iGrid);
112
(p)->SetPoint(_aq_p,__iGrid);
115
while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
118
//----------------------------------------------------------------------
120
void CqShaderExecEnv::SO_setzcomp( IqShaderData* p, IqShaderData* v, IqShader* pShader )
125
__fVarying=(p)->Class()==class_varying;
126
__fVarying=(v)->Class()==class_varying||__fVarying;
129
const CqBitVector& RS = RunningState();
132
if(!__fVarying || RS.Value( __iGrid ) )
135
(p)->GetPoint(_aq_p,__iGrid);
137
(v)->GetFloat(_aq_v,__iGrid);
139
(p)->SetPoint(_aq_p,__iGrid);
142
while( ( ++__iGrid < shadingPointCount() ) && __fVarying);
148
//---------------------------------------------------------------------