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_SHCOLOR_HPP
00035
#define SH_SHCOLOR_HPP
00036
00037
#include "ShAttrib.hpp"
00038
namespace SH {
00039
00044
template<
int N, ShBindingType Binding,
typename T=
float,
bool Swizzled=false>
00045 class ShColor :
public ShAttrib<N, Binding, T, Swizzled> {
00046
public:
00047
ShColor();
00048
ShColor(
const ShGeneric<N, T>& other);
00049
ShColor(
const ShColor<N, Binding, T, Swizzled>& other);
00050
ShColor(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00051
explicit ShColor(T data[N]);
00052
00053 ~
ShColor();
00054
00055
ShColor& operator=(
const ShGeneric<N, T>& other);
00056
ShColor& operator=(
const ShColor<N, Binding, T, Swizzled>& other);
00057
00058
ShColor& operator=(
const ShProgram& prg);
00059
00060
ShColor& operator+=(
const ShGeneric<N, T>& right);
00061
ShColor& operator-=(
const ShGeneric<N, T>& right);
00062
ShColor& operator*=(
const ShGeneric<N, T>& right);
00063
ShColor& operator/=(
const ShGeneric<N, T>& right);
00064
ShColor& operator%=(
const ShGeneric<N, T>& right);
00065
ShColor& operator*=(T);
00066
ShColor& operator/=(T);
00067
ShColor& operator%=(T);
00068
ShColor& operator+=(T);
00069
ShColor& operator-=(T);
00070
ShColor& operator+=(
const ShGeneric<1, T>&);
00071
ShColor& operator-=(
const ShGeneric<1, T>&);
00072
ShColor& operator*=(
const ShGeneric<1, T>&);
00073
ShColor& operator/=(
const ShGeneric<1, T>&);
00074
ShColor& operator%=(
const ShGeneric<1, T>&);
00075
ShColor<1, Binding, T, true> operator()(
int)
const;
00076
ShColor<2, Binding, T, true> operator()(
int,
int)
const;
00077
ShColor<3, Binding, T, true> operator()(
int,
int,
int)
const;
00078
ShColor<4, Binding, T, true> operator()(
int,
int,
int,
int)
const;
00079
ShColor<1, Binding, T, true> operator[](
int)
const;
00080
00081
template<
int N2>
00082
ShColor<N2, Binding, T, true> swiz(
int indices[])
const;
00083
00084
ShColor operator-()
const;
00085
typedef T ValueType;
00086
static const int typesize = N;
00087
static const ShBindingType binding_type = Binding;
00088
static const ShSemanticType semantic_type = SH_COLOR;
00089
00090
typedef ShColor<N, SH_INPUT, T> InputType;
00091
typedef ShColor<N, SH_OUTPUT, T> OutputType;
00092
typedef ShColor<N, SH_INOUT, T> InOutType;
00093
typedef ShColor<N, SH_TEMP, T> TempType;
00094
typedef ShColor<N, SH_CONST, T> ConstType;
00095
private:
00096
typedef ShAttrib<N, Binding, T, Swizzled> ParentType;
00097 };
00098
00099
template<ShBindingType Binding,
typename T,
bool Swizzled>
00100
class ShColor<1, Binding, T, Swizzled> :
public ShAttrib<1, Binding, T, Swizzled> {
00101
public:
00102
ShColor();
00103
ShColor(
const ShGeneric<1, T>& other);
00104
ShColor(
const ShColor<1, Binding, T, Swizzled>& other);
00105
ShColor(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00106
explicit ShColor(T data[1]);
00107
00108
ShColor(T);
00109
00110 ~
ShColor();
00111
00112
ShColor& operator=(
const ShGeneric<1, T>& other);
00113
ShColor& operator=(
const ShColor<1, Binding, T, Swizzled>& other);
00114
00115
ShColor& operator=(T other);
00116
00117
ShColor& operator=(
const ShProgram& prg);
00118
00119
ShColor& operator+=(
const ShGeneric<1, T>& right);
00120
ShColor& operator-=(
const ShGeneric<1, T>& right);
00121
ShColor& operator*=(
const ShGeneric<1, T>& right);
00122
ShColor& operator/=(
const ShGeneric<1, T>& right);
00123
ShColor& operator%=(
const ShGeneric<1, T>& right);
00124
ShColor& operator*=(T);
00125
ShColor& operator/=(T);
00126
ShColor& operator%=(T);
00127
ShColor& operator+=(T);
00128
ShColor& operator-=(T);
00129
ShColor<1, Binding, T, true> operator()(
int) const;
00130
ShColor<2, Binding, T, true> operator()(
int,
int) const;
00131
ShColor<3, Binding, T, true> operator()(
int,
int,
int) const;
00132
ShColor<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00133
ShColor<1, Binding, T, true> operator[](
int) const;
00134
00135 template<
int N2>
00136
ShColor<N2, Binding, T, true> swiz(
int indices[]) const;
00137
00138
ShColor operator-() const;
00139 typedef T ValueType;
00140 static const
int typesize = 1;
00141 static const ShBindingType binding_type = Binding;
00142 static const ShSemanticType semantic_type = SH_COLOR;
00143
00144 typedef
ShColor<1, SH_INPUT, T> InputType;
00145 typedef ShColor<1, SH_OUTPUT, T> OutputType;
00146 typedef ShColor<1, SH_INOUT, T> InOutType;
00147 typedef ShColor<1, SH_TEMP, T> TempType;
00148 typedef ShColor<1, SH_CONST, T> ConstType;
00149 private:
00150 typedef
ShAttrib<1, Binding, T, Swizzled> ParentType;
00151 };
00152
00153 template<ShBindingType Binding, typename T,
bool Swizzled>
00154 class ShColor<2, Binding, T, Swizzled> : public ShAttrib<2, Binding, T, Swizzled> {
00155
public:
00156 ShColor();
00157 ShColor(
const ShGeneric<2, T>& other);
00158 ShColor(
const ShColor<2, Binding, T, Swizzled>& other);
00159 ShColor(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00160
explicit ShColor(T data[2]);
00161
00162 ShColor(T, T);
00163 ShColor(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00164
00165 ~ShColor();
00166
00167 ShColor& operator=(
const ShGeneric<2, T>& other);
00168 ShColor& operator=(
const ShColor<2, Binding, T, Swizzled>& other);
00169
00170 ShColor& operator=(
const ShProgram& prg);
00171
00172 ShColor& operator+=(
const ShGeneric<2, T>& right);
00173 ShColor& operator-=(
const ShGeneric<2, T>& right);
00174 ShColor& operator*=(
const ShGeneric<2, T>& right);
00175 ShColor& operator/=(
const ShGeneric<2, T>& right);
00176 ShColor& operator%=(
const ShGeneric<2, T>& right);
00177 ShColor& operator*=(T);
00178 ShColor& operator/=(T);
00179 ShColor& operator%=(T);
00180 ShColor& operator+=(T);
00181 ShColor& operator-=(T);
00182 ShColor& operator+=(
const ShGeneric<1, T>&);
00183 ShColor& operator-=(
const ShGeneric<1, T>&);
00184 ShColor& operator*=(
const ShGeneric<1, T>&);
00185 ShColor& operator/=(
const ShGeneric<1, T>&);
00186 ShColor& operator%=(
const ShGeneric<1, T>&);
00187
ShColor<1, Binding, T, true> operator()(
int) const;
00188 ShColor<2, Binding, T, true> operator()(
int,
int) const;
00189 ShColor<3, Binding, T, true> operator()(
int,
int,
int) const;
00190 ShColor<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00191 ShColor<1, Binding, T, true> operator[](
int) const;
00192
00193 template<
int N2>
00194 ShColor<N2, Binding, T, true> swiz(
int indices[]) const;
00195
00196 ShColor operator-() const;
00197 typedef T ValueType;
00198 static const
int typesize = 2;
00199 static const ShBindingType binding_type = Binding;
00200 static const ShSemanticType semantic_type = SH_COLOR;
00201
00202 typedef ShColor<2, SH_INPUT, T> InputType;
00203 typedef ShColor<2, SH_OUTPUT, T> OutputType;
00204 typedef ShColor<2, SH_INOUT, T> InOutType;
00205 typedef ShColor<2, SH_TEMP, T> TempType;
00206 typedef ShColor<2, SH_CONST, T> ConstType;
00207 private:
00208 typedef ShAttrib<2, Binding, T, Swizzled> ParentType;
00209 };
00210
00211 template<ShBindingType Binding, typename T,
bool Swizzled>
00212 class ShColor<3, Binding, T, Swizzled> : public ShAttrib<3, Binding, T, Swizzled> {
00213
public:
00214 ShColor();
00215 ShColor(
const ShGeneric<3, T>& other);
00216 ShColor(
const ShColor<3, Binding, T, Swizzled>& other);
00217 ShColor(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00218
explicit ShColor(T data[3]);
00219
00220 ShColor(T, T, T);
00221 ShColor(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00222
00223 ~ShColor();
00224
00225 ShColor& operator=(
const ShGeneric<3, T>& other);
00226 ShColor& operator=(
const ShColor<3, Binding, T, Swizzled>& other);
00227
00228 ShColor& operator=(
const ShProgram& prg);
00229
00230 ShColor& operator+=(
const ShGeneric<3, T>& right);
00231 ShColor& operator-=(
const ShGeneric<3, T>& right);
00232 ShColor& operator*=(
const ShGeneric<3, T>& right);
00233 ShColor& operator/=(
const ShGeneric<3, T>& right);
00234 ShColor& operator%=(
const ShGeneric<3, T>& right);
00235 ShColor& operator*=(T);
00236 ShColor& operator/=(T);
00237 ShColor& operator%=(T);
00238 ShColor& operator+=(T);
00239 ShColor& operator-=(T);
00240 ShColor& operator+=(
const ShGeneric<1, T>&);
00241 ShColor& operator-=(
const ShGeneric<1, T>&);
00242 ShColor& operator*=(
const ShGeneric<1, T>&);
00243 ShColor& operator/=(
const ShGeneric<1, T>&);
00244 ShColor& operator%=(
const ShGeneric<1, T>&);
00245
ShColor<1, Binding, T, true> operator()(
int) const;
00246 ShColor<2, Binding, T, true> operator()(
int,
int) const;
00247 ShColor<3, Binding, T, true> operator()(
int,
int,
int) const;
00248 ShColor<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00249 ShColor<1, Binding, T, true> operator[](
int) const;
00250
00251 template<
int N2>
00252 ShColor<N2, Binding, T, true> swiz(
int indices[]) const;
00253
00254 ShColor operator-() const;
00255 typedef T ValueType;
00256 static const
int typesize = 3;
00257 static const ShBindingType binding_type = Binding;
00258 static const ShSemanticType semantic_type = SH_COLOR;
00259
00260 typedef ShColor<3, SH_INPUT, T> InputType;
00261 typedef ShColor<3, SH_OUTPUT, T> OutputType;
00262 typedef ShColor<3, SH_INOUT, T> InOutType;
00263 typedef ShColor<3, SH_TEMP, T> TempType;
00264 typedef ShColor<3, SH_CONST, T> ConstType;
00265 private:
00266 typedef ShAttrib<3, Binding, T, Swizzled> ParentType;
00267 };
00268
00269 template<ShBindingType Binding, typename T,
bool Swizzled>
00270 class ShColor<4, Binding, T, Swizzled> : public ShAttrib<4, Binding, T, Swizzled> {
00271
public:
00272 ShColor();
00273 ShColor(
const ShGeneric<4, T>& other);
00274 ShColor(
const ShColor<4, Binding, T, Swizzled>& other);
00275 ShColor(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00276
explicit ShColor(T data[4]);
00277
00278 ShColor(T, T, T, T);
00279 ShColor(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00280
00281 ~ShColor();
00282
00283 ShColor& operator=(
const ShGeneric<4, T>& other);
00284 ShColor& operator=(
const ShColor<4, Binding, T, Swizzled>& other);
00285
00286 ShColor& operator=(
const ShProgram& prg);
00287
00288 ShColor& operator+=(
const ShGeneric<4, T>& right);
00289 ShColor& operator-=(
const ShGeneric<4, T>& right);
00290 ShColor& operator*=(
const ShGeneric<4, T>& right);
00291 ShColor& operator/=(
const ShGeneric<4, T>& right);
00292 ShColor& operator%=(
const ShGeneric<4, T>& right);
00293 ShColor& operator*=(T);
00294 ShColor& operator/=(T);
00295 ShColor& operator%=(T);
00296 ShColor& operator+=(T);
00297 ShColor& operator-=(T);
00298 ShColor& operator+=(
const ShGeneric<1, T>&);
00299 ShColor& operator-=(
const ShGeneric<1, T>&);
00300 ShColor& operator*=(
const ShGeneric<1, T>&);
00301 ShColor& operator/=(
const ShGeneric<1, T>&);
00302 ShColor& operator%=(
const ShGeneric<1, T>&);
00303
ShColor<1, Binding, T, true> operator()(
int) const;
00304 ShColor<2, Binding, T, true> operator()(
int,
int) const;
00305 ShColor<3, Binding, T, true> operator()(
int,
int,
int) const;
00306 ShColor<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00307 ShColor<1, Binding, T, true> operator[](
int) const;
00308
00309 template<
int N2>
00310 ShColor<N2, Binding, T, true> swiz(
int indices[]) const;
00311
00312 ShColor operator-() const;
00313 typedef T ValueType;
00314 static const
int typesize = 4;
00315 static const ShBindingType binding_type = Binding;
00316 static const ShSemanticType semantic_type = SH_COLOR;
00317
00318 typedef ShColor<4, SH_INPUT, T> InputType;
00319 typedef ShColor<4, SH_OUTPUT, T> OutputType;
00320 typedef ShColor<4, SH_INOUT, T> InOutType;
00321 typedef ShColor<4, SH_TEMP, T> TempType;
00322 typedef ShColor<4, SH_CONST, T> ConstType;
00323 private:
00324 typedef ShAttrib<4, Binding, T, Swizzled> ParentType;
00325 };
00326
00327 typedef ShColor<1, SH_INPUT,
float>
ShInputColor1f;
00328 typedef ShColor<1, SH_OUTPUT,
float>
ShOutputColor1f;
00329 typedef ShColor<1, SH_INOUT,
float>
ShInOutColor1f;
00330 typedef ShColor<1, SH_TEMP,
float>
ShColor1f;
00331 typedef ShColor<1, SH_CONST,
float>
ShConstColor1f;
00332 typedef ShColor<2, SH_INPUT,
float>
ShInputColor2f;
00333 typedef ShColor<2, SH_OUTPUT,
float>
ShOutputColor2f;
00334 typedef ShColor<2, SH_INOUT,
float>
ShInOutColor2f;
00335 typedef ShColor<2, SH_TEMP,
float>
ShColor2f;
00336 typedef ShColor<2, SH_CONST,
float>
ShConstColor2f;
00337 typedef ShColor<3, SH_INPUT,
float>
ShInputColor3f;
00338 typedef ShColor<3, SH_OUTPUT,
float>
ShOutputColor3f;
00339 typedef ShColor<3, SH_INOUT,
float>
ShInOutColor3f;
00340 typedef ShColor<3, SH_TEMP,
float>
ShColor3f;
00341 typedef ShColor<3, SH_CONST,
float>
ShConstColor3f;
00342 typedef ShColor<4, SH_INPUT,
float>
ShInputColor4f;
00343 typedef ShColor<4, SH_OUTPUT,
float>
ShOutputColor4f;
00344 typedef ShColor<4, SH_INOUT,
float>
ShInOutColor4f;
00345 typedef ShColor<4, SH_TEMP,
float>
ShColor4f;
00346 typedef ShColor<4, SH_CONST,
float>
ShConstColor4f;
00347
00348 }
00349 #include "ShColorImpl.hpp"
00350
00351 #endif