00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00033
00034
#ifndef SH_SHATTRIB_HPP
00035
#define SH_SHATTRIB_HPP
00036
00037
#ifndef SH_DO_NOT_INCLUDE_GENERIC_IMPL
00038
# define SH_DO_NOT_INCLUDE_GENERIC_IMPL
00039
# include "ShGeneric.hpp"
00040
# undef SH_DO_NOT_INCLUDE_GENERIC_IMPL
00041
#else
00042
# include "ShGeneric.hpp"
00043
#endif
00044
namespace SH {
00045
00060
template<
int N, ShBindingType Binding,
typename T=
float,
bool Swizzled=false>
00061 class ShAttrib :
public ShGeneric<N, T> {
00062
public:
00063
ShAttrib();
00064
ShAttrib(
const ShGeneric<N, T>& other);
00065
ShAttrib(
const ShAttrib<N, Binding, T, Swizzled>& other);
00066
ShAttrib(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00067
explicit ShAttrib(T data[N]);
00068
00069 ~
ShAttrib();
00070
00071
ShAttrib& operator=(
const ShGeneric<N, T>& other);
00072
ShAttrib& operator=(
const ShAttrib<N, Binding, T, Swizzled>& other);
00073
00074
ShAttrib& operator=(
const ShProgram& prg);
00075
00076
ShAttrib& operator+=(
const ShGeneric<N, T>& right);
00077
ShAttrib& operator-=(
const ShGeneric<N, T>& right);
00078
ShAttrib& operator*=(
const ShGeneric<N, T>& right);
00079
ShAttrib& operator/=(
const ShGeneric<N, T>& right);
00080
ShAttrib& operator%=(
const ShGeneric<N, T>& right);
00081
ShAttrib& operator*=(T);
00082
ShAttrib& operator/=(T);
00083
ShAttrib& operator%=(T);
00084
ShAttrib& operator+=(T);
00085
ShAttrib& operator-=(T);
00086
ShAttrib& operator+=(
const ShGeneric<1, T>&);
00087
ShAttrib& operator-=(
const ShGeneric<1, T>&);
00088
ShAttrib& operator*=(
const ShGeneric<1, T>&);
00089
ShAttrib& operator/=(
const ShGeneric<1, T>&);
00090
ShAttrib& operator%=(
const ShGeneric<1, T>&);
00091
ShAttrib<1, Binding, T, true> operator()(
int)
const;
00092
ShAttrib<2, Binding, T, true> operator()(
int,
int)
const;
00093
ShAttrib<3, Binding, T, true> operator()(
int,
int,
int)
const;
00094
ShAttrib<4, Binding, T, true> operator()(
int,
int,
int,
int)
const;
00095
ShAttrib<1, Binding, T, true> operator[](
int)
const;
00096
00097
template<
int N2>
00098
ShAttrib<N2, Binding, T, true> swiz(
int indices[])
const;
00099
00100
ShAttrib operator-()
const;
00101
typedef T ValueType;
00102
static const int typesize = N;
00103
static const ShBindingType binding_type = Binding;
00104
static const ShSemanticType semantic_type = SH_ATTRIB;
00105
00106
typedef ShAttrib<N, SH_INPUT, T> InputType;
00107
typedef ShAttrib<N, SH_OUTPUT, T> OutputType;
00108
typedef ShAttrib<N, SH_INOUT, T> InOutType;
00109
typedef ShAttrib<N, SH_TEMP, T> TempType;
00110
typedef ShAttrib<N, SH_CONST, T> ConstType;
00111
private:
00112
typedef ShGeneric<N, T> ParentType;
00113 };
00114
00115
template<ShBindingType Binding,
typename T,
bool Swizzled>
00116
class ShAttrib<1, Binding, T, Swizzled> :
public ShGeneric<1, T> {
00117
public:
00118
ShAttrib();
00119
ShAttrib(
const ShGeneric<1, T>& other);
00120
ShAttrib(
const ShAttrib<1, Binding, T, Swizzled>& other);
00121
ShAttrib(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00122
explicit ShAttrib(T data[1]);
00123
00124
ShAttrib(T);
00125
00126 ~
ShAttrib();
00127
00128
ShAttrib& operator=(
const ShGeneric<1, T>& other);
00129
ShAttrib& operator=(
const ShAttrib<1, Binding, T, Swizzled>& other);
00130
00131
ShAttrib& operator=(T other);
00132
00133
ShAttrib& operator=(
const ShProgram& prg);
00134
00135
ShAttrib& operator+=(
const ShGeneric<1, T>& right);
00136
ShAttrib& operator-=(
const ShGeneric<1, T>& right);
00137
ShAttrib& operator*=(
const ShGeneric<1, T>& right);
00138
ShAttrib& operator/=(
const ShGeneric<1, T>& right);
00139
ShAttrib& operator%=(
const ShGeneric<1, T>& right);
00140
ShAttrib& operator*=(T);
00141
ShAttrib& operator/=(T);
00142
ShAttrib& operator%=(T);
00143
ShAttrib& operator+=(T);
00144
ShAttrib& operator-=(T);
00145
ShAttrib<1, Binding, T, true> operator()(
int) const;
00146
ShAttrib<2, Binding, T, true> operator()(
int,
int) const;
00147
ShAttrib<3, Binding, T, true> operator()(
int,
int,
int) const;
00148
ShAttrib<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00149
ShAttrib<1, Binding, T, true> operator[](
int) const;
00150
00151 template<
int N2>
00152
ShAttrib<N2, Binding, T, true> swiz(
int indices[]) const;
00153
00154
ShAttrib operator-() const;
00155 typedef T ValueType;
00156 static const
int typesize = 1;
00157 static const ShBindingType binding_type = Binding;
00158 static const ShSemanticType semantic_type = SH_ATTRIB;
00159
00160 typedef
ShAttrib<1, SH_INPUT, T> InputType;
00161 typedef ShAttrib<1, SH_OUTPUT, T> OutputType;
00162 typedef ShAttrib<1, SH_INOUT, T> InOutType;
00163 typedef ShAttrib<1, SH_TEMP, T> TempType;
00164 typedef ShAttrib<1, SH_CONST, T> ConstType;
00165 private:
00166 typedef
ShGeneric<1, T> ParentType;
00167 };
00168
00169 template<ShBindingType Binding, typename T,
bool Swizzled>
00170 class ShAttrib<2, Binding, T, Swizzled> : public ShGeneric<2, T> {
00171
public:
00172 ShAttrib();
00173 ShAttrib(
const ShGeneric<2, T>& other);
00174 ShAttrib(
const ShAttrib<2, Binding, T, Swizzled>& other);
00175 ShAttrib(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00176
explicit ShAttrib(T data[2]);
00177
00178 ShAttrib(T, T);
00179 ShAttrib(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00180
00181 ~ShAttrib();
00182
00183 ShAttrib& operator=(
const ShGeneric<2, T>& other);
00184 ShAttrib& operator=(
const ShAttrib<2, Binding, T, Swizzled>& other);
00185
00186 ShAttrib& operator=(
const ShProgram& prg);
00187
00188 ShAttrib& operator+=(
const ShGeneric<2, T>& right);
00189 ShAttrib& operator-=(
const ShGeneric<2, T>& right);
00190 ShAttrib& operator*=(
const ShGeneric<2, T>& right);
00191 ShAttrib& operator/=(
const ShGeneric<2, T>& right);
00192 ShAttrib& operator%=(
const ShGeneric<2, T>& right);
00193 ShAttrib& operator*=(T);
00194 ShAttrib& operator/=(T);
00195 ShAttrib& operator%=(T);
00196 ShAttrib& operator+=(T);
00197 ShAttrib& operator-=(T);
00198 ShAttrib& operator+=(
const ShGeneric<1, T>&);
00199 ShAttrib& operator-=(
const ShGeneric<1, T>&);
00200 ShAttrib& operator*=(
const ShGeneric<1, T>&);
00201 ShAttrib& operator/=(
const ShGeneric<1, T>&);
00202 ShAttrib& operator%=(
const ShGeneric<1, T>&);
00203
ShAttrib<1, Binding, T, true> operator()(
int) const;
00204 ShAttrib<2, Binding, T, true> operator()(
int,
int) const;
00205 ShAttrib<3, Binding, T, true> operator()(
int,
int,
int) const;
00206 ShAttrib<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00207 ShAttrib<1, Binding, T, true> operator[](
int) const;
00208
00209 template<
int N2>
00210 ShAttrib<N2, Binding, T, true> swiz(
int indices[]) const;
00211
00212 ShAttrib operator-() const;
00213 typedef T ValueType;
00214 static const
int typesize = 2;
00215 static const ShBindingType binding_type = Binding;
00216 static const ShSemanticType semantic_type = SH_ATTRIB;
00217
00218 typedef ShAttrib<2, SH_INPUT, T> InputType;
00219 typedef ShAttrib<2, SH_OUTPUT, T> OutputType;
00220 typedef ShAttrib<2, SH_INOUT, T> InOutType;
00221 typedef ShAttrib<2, SH_TEMP, T> TempType;
00222 typedef ShAttrib<2, SH_CONST, T> ConstType;
00223 private:
00224 typedef ShGeneric<2, T> ParentType;
00225 };
00226
00227 template<ShBindingType Binding, typename T,
bool Swizzled>
00228 class ShAttrib<3, Binding, T, Swizzled> : public ShGeneric<3, T> {
00229
public:
00230 ShAttrib();
00231 ShAttrib(
const ShGeneric<3, T>& other);
00232 ShAttrib(
const ShAttrib<3, Binding, T, Swizzled>& other);
00233 ShAttrib(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00234
explicit ShAttrib(T data[3]);
00235
00236 ShAttrib(T, T, T);
00237 ShAttrib(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00238
00239 ~ShAttrib();
00240
00241 ShAttrib& operator=(
const ShGeneric<3, T>& other);
00242 ShAttrib& operator=(
const ShAttrib<3, Binding, T, Swizzled>& other);
00243
00244 ShAttrib& operator=(
const ShProgram& prg);
00245
00246 ShAttrib& operator+=(
const ShGeneric<3, T>& right);
00247 ShAttrib& operator-=(
const ShGeneric<3, T>& right);
00248 ShAttrib& operator*=(
const ShGeneric<3, T>& right);
00249 ShAttrib& operator/=(
const ShGeneric<3, T>& right);
00250 ShAttrib& operator%=(
const ShGeneric<3, T>& right);
00251 ShAttrib& operator*=(T);
00252 ShAttrib& operator/=(T);
00253 ShAttrib& operator%=(T);
00254 ShAttrib& operator+=(T);
00255 ShAttrib& operator-=(T);
00256 ShAttrib& operator+=(
const ShGeneric<1, T>&);
00257 ShAttrib& operator-=(
const ShGeneric<1, T>&);
00258 ShAttrib& operator*=(
const ShGeneric<1, T>&);
00259 ShAttrib& operator/=(
const ShGeneric<1, T>&);
00260 ShAttrib& operator%=(
const ShGeneric<1, T>&);
00261
ShAttrib<1, Binding, T, true> operator()(
int) const;
00262 ShAttrib<2, Binding, T, true> operator()(
int,
int) const;
00263 ShAttrib<3, Binding, T, true> operator()(
int,
int,
int) const;
00264 ShAttrib<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00265 ShAttrib<1, Binding, T, true> operator[](
int) const;
00266
00267 template<
int N2>
00268 ShAttrib<N2, Binding, T, true> swiz(
int indices[]) const;
00269
00270 ShAttrib operator-() const;
00271 typedef T ValueType;
00272 static const
int typesize = 3;
00273 static const ShBindingType binding_type = Binding;
00274 static const ShSemanticType semantic_type = SH_ATTRIB;
00275
00276 typedef ShAttrib<3, SH_INPUT, T> InputType;
00277 typedef ShAttrib<3, SH_OUTPUT, T> OutputType;
00278 typedef ShAttrib<3, SH_INOUT, T> InOutType;
00279 typedef ShAttrib<3, SH_TEMP, T> TempType;
00280 typedef ShAttrib<3, SH_CONST, T> ConstType;
00281 private:
00282 typedef ShGeneric<3, T> ParentType;
00283 };
00284
00285 template<ShBindingType Binding, typename T,
bool Swizzled>
00286 class ShAttrib<4, Binding, T, Swizzled> : public ShGeneric<4, T> {
00287
public:
00288 ShAttrib();
00289 ShAttrib(
const ShGeneric<4, T>& other);
00290 ShAttrib(
const ShAttrib<4, Binding, T, Swizzled>& other);
00291 ShAttrib(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00292
explicit ShAttrib(T data[4]);
00293
00294 ShAttrib(T, T, T, T);
00295 ShAttrib(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00296
00297 ~ShAttrib();
00298
00299 ShAttrib& operator=(
const ShGeneric<4, T>& other);
00300 ShAttrib& operator=(
const ShAttrib<4, Binding, T, Swizzled>& other);
00301
00302 ShAttrib& operator=(
const ShProgram& prg);
00303
00304 ShAttrib& operator+=(
const ShGeneric<4, T>& right);
00305 ShAttrib& operator-=(
const ShGeneric<4, T>& right);
00306 ShAttrib& operator*=(
const ShGeneric<4, T>& right);
00307 ShAttrib& operator/=(
const ShGeneric<4, T>& right);
00308 ShAttrib& operator%=(
const ShGeneric<4, T>& right);
00309 ShAttrib& operator*=(T);
00310 ShAttrib& operator/=(T);
00311 ShAttrib& operator%=(T);
00312 ShAttrib& operator+=(T);
00313 ShAttrib& operator-=(T);
00314 ShAttrib& operator+=(
const ShGeneric<1, T>&);
00315 ShAttrib& operator-=(
const ShGeneric<1, T>&);
00316 ShAttrib& operator*=(
const ShGeneric<1, T>&);
00317 ShAttrib& operator/=(
const ShGeneric<1, T>&);
00318 ShAttrib& operator%=(
const ShGeneric<1, T>&);
00319
ShAttrib<1, Binding, T, true> operator()(
int) const;
00320 ShAttrib<2, Binding, T, true> operator()(
int,
int) const;
00321 ShAttrib<3, Binding, T, true> operator()(
int,
int,
int) const;
00322 ShAttrib<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00323 ShAttrib<1, Binding, T, true> operator[](
int) const;
00324
00325 template<
int N2>
00326 ShAttrib<N2, Binding, T, true> swiz(
int indices[]) const;
00327
00328 ShAttrib operator-() const;
00329 typedef T ValueType;
00330 static const
int typesize = 4;
00331 static const ShBindingType binding_type = Binding;
00332 static const ShSemanticType semantic_type = SH_ATTRIB;
00333
00334 typedef ShAttrib<4, SH_INPUT, T> InputType;
00335 typedef ShAttrib<4, SH_OUTPUT, T> OutputType;
00336 typedef ShAttrib<4, SH_INOUT, T> InOutType;
00337 typedef ShAttrib<4, SH_TEMP, T> TempType;
00338 typedef ShAttrib<4, SH_CONST, T> ConstType;
00339 private:
00340 typedef ShGeneric<4, T> ParentType;
00341 };
00342
00343 typedef ShAttrib<1, SH_INPUT,
float>
ShInputAttrib1f;
00344 typedef ShAttrib<1, SH_OUTPUT,
float>
ShOutputAttrib1f;
00345 typedef ShAttrib<1, SH_INOUT,
float>
ShInOutAttrib1f;
00346 typedef ShAttrib<1, SH_TEMP,
float>
ShAttrib1f;
00347 typedef ShAttrib<1, SH_CONST,
float>
ShConstAttrib1f;
00348 typedef ShAttrib<2, SH_INPUT,
float>
ShInputAttrib2f;
00349 typedef ShAttrib<2, SH_OUTPUT,
float>
ShOutputAttrib2f;
00350 typedef ShAttrib<2, SH_INOUT,
float>
ShInOutAttrib2f;
00351 typedef ShAttrib<2, SH_TEMP,
float>
ShAttrib2f;
00352 typedef ShAttrib<2, SH_CONST,
float>
ShConstAttrib2f;
00353 typedef ShAttrib<3, SH_INPUT,
float>
ShInputAttrib3f;
00354 typedef ShAttrib<3, SH_OUTPUT,
float>
ShOutputAttrib3f;
00355 typedef ShAttrib<3, SH_INOUT,
float>
ShInOutAttrib3f;
00356 typedef ShAttrib<3, SH_TEMP,
float>
ShAttrib3f;
00357 typedef ShAttrib<3, SH_CONST,
float>
ShConstAttrib3f;
00358 typedef ShAttrib<4, SH_INPUT,
float>
ShInputAttrib4f;
00359 typedef ShAttrib<4, SH_OUTPUT,
float>
ShOutputAttrib4f;
00360 typedef ShAttrib<4, SH_INOUT,
float>
ShInOutAttrib4f;
00361 typedef ShAttrib<4, SH_TEMP,
float>
ShAttrib4f;
00362 typedef ShAttrib<4, SH_CONST,
float>
ShConstAttrib4f;
00363
00364 }
00365 #include "ShGenericImpl.hpp"
00366 #include "ShAttribImpl.hpp"
00367
00368 #endif