1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
43 #include "OSGShaderVariables.h"
47 void osgUniformShaderVariableSwitch(DrawEnv
*pEnv
,
53 switch(pVar
->getTypeId())
55 case ShaderVariable::SHVTypeBool
:
56 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
57 osgUniformShaderVariableBool (pEnv
, pVar
, loc
, uiProgram
,
61 case ShaderVariable::SHVTypeInt
:
62 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
63 osgUniformShaderVariableInt (pEnv
, pVar
, loc
, uiProgram
,
67 case ShaderVariable::SHVTypeUInt
:
68 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
69 osgUniformShaderVariableUInt (pEnv
, pVar
, loc
, uiProgram
,
73 case ShaderVariable::SHVTypeReal
:
74 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
75 osgUniformShaderVariableReal (pEnv
, pVar
, loc
, uiProgram
,
79 case ShaderVariable::SHVTypeVec2f
:
80 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
81 osgUniformShaderVariableVec2f (pEnv
, pVar
, loc
, uiProgram
,
85 case ShaderVariable::SHVTypeVec3f
:
86 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
87 osgUniformShaderVariableVec3f (pEnv
, pVar
, loc
, uiProgram
,
91 case ShaderVariable::SHVTypeVec4f
:
92 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
93 osgUniformShaderVariableVec4f (pEnv
, pVar
, loc
, uiProgram
,
97 case ShaderVariable::SHVTypePnt2f
:
98 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
99 osgUniformShaderVariablePnt2f (pEnv
, pVar
, loc
, uiProgram
,
103 case ShaderVariable::SHVTypePnt3f
:
104 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
105 osgUniformShaderVariablePnt3f (pEnv
, pVar
, loc
, uiProgram
,
109 case ShaderVariable::SHVTypeMatrix
:
110 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
111 osgUniformShaderVariableMatrix (pEnv
, pVar
, loc
, uiProgram
,
115 case ShaderVariable::SHVTypeMInt
:
116 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
117 osgUniformShaderVariableMInt (pEnv
, pVar
, loc
, uiProgram
,
121 case ShaderVariable::SHVTypeMUInt
:
122 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
123 osgUniformShaderVariableMUInt (pEnv
, pVar
, loc
, uiProgram
,
127 case ShaderVariable::SHVTypeMReal
:
128 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
129 osgUniformShaderVariableMReal (pEnv
, pVar
, loc
, uiProgram
,
133 case ShaderVariable::SHVTypeMVec2f
:
134 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
135 osgUniformShaderVariableMVec2f (pEnv
, pVar
, loc
, uiProgram
,
139 case ShaderVariable::SHVTypeMVec3f
:
140 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
141 osgUniformShaderVariableMVec3f (pEnv
, pVar
, loc
, uiProgram
,
145 case ShaderVariable::SHVTypeMVec4f
:
146 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
147 osgUniformShaderVariableMVec4f (pEnv
, pVar
, loc
, uiProgram
,
151 case ShaderVariable::SHVTypeMMatrix
:
152 osgUniformShaderVariableLocation(pEnv
, pVar
, loc
, uiProgram
);
153 osgUniformShaderVariableMMatrix (pEnv
, pVar
, loc
, uiProgram
,
157 case ShaderVariable::SHVTypeUniformBlock
:
158 osgUniformShaderUniformBlockLocation(pEnv
, pVar
, loc
, uiProgram
);
159 osgUniformShaderUniformBlockBinding (pEnv
, pVar
, loc
, uiProgram
,
163 case ShaderVariable::SHVTypeShaderStorageBlock
:
164 osgUniformShaderStorageBlockLocation(pEnv
, pVar
, loc
, uiProgram
);
165 osgUniformShaderStorageBlockBinding (pEnv
, pVar
, loc
, uiProgram
,
169 case ShaderVariable::SHVTypeOSG
:
174 SWARNING
<< "Variable '"
175 << pVar
->getName() << "' has unknown type '"
176 << pVar
->getTypeId() << "'."