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_SHPOINT_HPP
00035
#define SH_SHPOINT_HPP
00036
00037
#include "ShAttrib.hpp"
00038
namespace SH {
00039
00044
template<
int N, ShBindingType Binding,
typename T=
float,
bool Swizzled=false>
00045 class ShPoint :
public ShAttrib<N, Binding, T, Swizzled> {
00046
public:
00047
ShPoint();
00048
ShPoint(
const ShGeneric<N, T>& other);
00049
ShPoint(
const ShPoint<N, Binding, T, Swizzled>& other);
00050
ShPoint(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00051
explicit ShPoint(T data[N]);
00052
00053 ~
ShPoint();
00054
00055
ShPoint& operator=(
const ShGeneric<N, T>& other);
00056
ShPoint& operator=(
const ShPoint<N, Binding, T, Swizzled>& other);
00057
00058
ShPoint& operator=(
const ShProgram& prg);
00059
00060
ShPoint& operator+=(
const ShGeneric<N, T>& right);
00061
ShPoint& operator-=(
const ShGeneric<N, T>& right);
00062
ShPoint& operator*=(
const ShGeneric<N, T>& right);
00063
ShPoint& operator/=(
const ShGeneric<N, T>& right);
00064
ShPoint& operator%=(
const ShGeneric<N, T>& right);
00065
ShPoint& operator*=(T);
00066
ShPoint& operator/=(T);
00067
ShPoint& operator%=(T);
00068
ShPoint& operator+=(T);
00069
ShPoint& operator-=(T);
00070
ShPoint& operator+=(
const ShGeneric<1, T>&);
00071
ShPoint& operator-=(
const ShGeneric<1, T>&);
00072
ShPoint& operator*=(
const ShGeneric<1, T>&);
00073
ShPoint& operator/=(
const ShGeneric<1, T>&);
00074
ShPoint& operator%=(
const ShGeneric<1, T>&);
00075
ShPoint<1, Binding, T, true> operator()(
int)
const;
00076
ShPoint<2, Binding, T, true> operator()(
int,
int)
const;
00077
ShPoint<3, Binding, T, true> operator()(
int,
int,
int)
const;
00078
ShPoint<4, Binding, T, true> operator()(
int,
int,
int,
int)
const;
00079
ShPoint<1, Binding, T, true> operator[](
int)
const;
00080
00081
template<
int N2>
00082
ShPoint<N2, Binding, T, true> swiz(
int indices[])
const;
00083
00084
ShPoint 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_POINT;
00089
00090
typedef ShPoint<N, SH_INPUT, T> InputType;
00091
typedef ShPoint<N, SH_OUTPUT, T> OutputType;
00092
typedef ShPoint<N, SH_INOUT, T> InOutType;
00093
typedef ShPoint<N, SH_TEMP, T> TempType;
00094
typedef ShPoint<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 ShPoint<1, Binding, T, Swizzled> :
public ShAttrib<1, Binding, T, Swizzled> {
00101
public:
00102
ShPoint();
00103
ShPoint(
const ShGeneric<1, T>& other);
00104
ShPoint(
const ShPoint<1, Binding, T, Swizzled>& other);
00105
ShPoint(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00106
explicit ShPoint(T data[1]);
00107
00108
ShPoint(T);
00109
00110 ~
ShPoint();
00111
00112
ShPoint& operator=(
const ShGeneric<1, T>& other);
00113
ShPoint& operator=(
const ShPoint<1, Binding, T, Swizzled>& other);
00114
00115
ShPoint& operator=(T other);
00116
00117
ShPoint& operator=(
const ShProgram& prg);
00118
00119
ShPoint& operator+=(
const ShGeneric<1, T>& right);
00120
ShPoint& operator-=(
const ShGeneric<1, T>& right);
00121
ShPoint& operator*=(
const ShGeneric<1, T>& right);
00122
ShPoint& operator/=(
const ShGeneric<1, T>& right);
00123
ShPoint& operator%=(
const ShGeneric<1, T>& right);
00124
ShPoint& operator*=(T);
00125
ShPoint& operator/=(T);
00126
ShPoint& operator%=(T);
00127
ShPoint& operator+=(T);
00128
ShPoint& operator-=(T);
00129
ShPoint<1, Binding, T, true> operator()(
int) const;
00130
ShPoint<2, Binding, T, true> operator()(
int,
int) const;
00131
ShPoint<3, Binding, T, true> operator()(
int,
int,
int) const;
00132
ShPoint<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00133
ShPoint<1, Binding, T, true> operator[](
int) const;
00134
00135 template<
int N2>
00136
ShPoint<N2, Binding, T, true> swiz(
int indices[]) const;
00137
00138
ShPoint 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_POINT;
00143
00144 typedef
ShPoint<1, SH_INPUT, T> InputType;
00145 typedef ShPoint<1, SH_OUTPUT, T> OutputType;
00146 typedef ShPoint<1, SH_INOUT, T> InOutType;
00147 typedef ShPoint<1, SH_TEMP, T> TempType;
00148 typedef ShPoint<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 ShPoint<2, Binding, T, Swizzled> : public ShAttrib<2, Binding, T, Swizzled> {
00155
public:
00156 ShPoint();
00157 ShPoint(
const ShGeneric<2, T>& other);
00158 ShPoint(
const ShPoint<2, Binding, T, Swizzled>& other);
00159 ShPoint(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00160
explicit ShPoint(T data[2]);
00161
00162 ShPoint(T, T);
00163 ShPoint(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00164
00165 ~ShPoint();
00166
00167 ShPoint& operator=(
const ShGeneric<2, T>& other);
00168 ShPoint& operator=(
const ShPoint<2, Binding, T, Swizzled>& other);
00169
00170 ShPoint& operator=(
const ShProgram& prg);
00171
00172 ShPoint& operator+=(
const ShGeneric<2, T>& right);
00173 ShPoint& operator-=(
const ShGeneric<2, T>& right);
00174 ShPoint& operator*=(
const ShGeneric<2, T>& right);
00175 ShPoint& operator/=(
const ShGeneric<2, T>& right);
00176 ShPoint& operator%=(
const ShGeneric<2, T>& right);
00177 ShPoint& operator*=(T);
00178 ShPoint& operator/=(T);
00179 ShPoint& operator%=(T);
00180 ShPoint& operator+=(T);
00181 ShPoint& operator-=(T);
00182 ShPoint& operator+=(
const ShGeneric<1, T>&);
00183 ShPoint& operator-=(
const ShGeneric<1, T>&);
00184 ShPoint& operator*=(
const ShGeneric<1, T>&);
00185 ShPoint& operator/=(
const ShGeneric<1, T>&);
00186 ShPoint& operator%=(
const ShGeneric<1, T>&);
00187
ShPoint<1, Binding, T, true> operator()(
int) const;
00188 ShPoint<2, Binding, T, true> operator()(
int,
int) const;
00189 ShPoint<3, Binding, T, true> operator()(
int,
int,
int) const;
00190 ShPoint<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00191 ShPoint<1, Binding, T, true> operator[](
int) const;
00192
00193 template<
int N2>
00194 ShPoint<N2, Binding, T, true> swiz(
int indices[]) const;
00195
00196 ShPoint 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_POINT;
00201
00202 typedef ShPoint<2, SH_INPUT, T> InputType;
00203 typedef ShPoint<2, SH_OUTPUT, T> OutputType;
00204 typedef ShPoint<2, SH_INOUT, T> InOutType;
00205 typedef ShPoint<2, SH_TEMP, T> TempType;
00206 typedef ShPoint<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 ShPoint<3, Binding, T, Swizzled> : public ShAttrib<3, Binding, T, Swizzled> {
00213
public:
00214 ShPoint();
00215 ShPoint(
const ShGeneric<3, T>& other);
00216 ShPoint(
const ShPoint<3, Binding, T, Swizzled>& other);
00217 ShPoint(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00218
explicit ShPoint(T data[3]);
00219
00220 ShPoint(T, T, T);
00221 ShPoint(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00222
00223 ~ShPoint();
00224
00225 ShPoint& operator=(
const ShGeneric<3, T>& other);
00226 ShPoint& operator=(
const ShPoint<3, Binding, T, Swizzled>& other);
00227
00228 ShPoint& operator=(
const ShProgram& prg);
00229
00230 ShPoint& operator+=(
const ShGeneric<3, T>& right);
00231 ShPoint& operator-=(
const ShGeneric<3, T>& right);
00232 ShPoint& operator*=(
const ShGeneric<3, T>& right);
00233 ShPoint& operator/=(
const ShGeneric<3, T>& right);
00234 ShPoint& operator%=(
const ShGeneric<3, T>& right);
00235 ShPoint& operator*=(T);
00236 ShPoint& operator/=(T);
00237 ShPoint& operator%=(T);
00238 ShPoint& operator+=(T);
00239 ShPoint& operator-=(T);
00240 ShPoint& operator+=(
const ShGeneric<1, T>&);
00241 ShPoint& operator-=(
const ShGeneric<1, T>&);
00242 ShPoint& operator*=(
const ShGeneric<1, T>&);
00243 ShPoint& operator/=(
const ShGeneric<1, T>&);
00244 ShPoint& operator%=(
const ShGeneric<1, T>&);
00245
ShPoint<1, Binding, T, true> operator()(
int) const;
00246 ShPoint<2, Binding, T, true> operator()(
int,
int) const;
00247 ShPoint<3, Binding, T, true> operator()(
int,
int,
int) const;
00248 ShPoint<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00249 ShPoint<1, Binding, T, true> operator[](
int) const;
00250
00251 template<
int N2>
00252 ShPoint<N2, Binding, T, true> swiz(
int indices[]) const;
00253
00254 ShPoint 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_POINT;
00259
00260 typedef ShPoint<3, SH_INPUT, T> InputType;
00261 typedef ShPoint<3, SH_OUTPUT, T> OutputType;
00262 typedef ShPoint<3, SH_INOUT, T> InOutType;
00263 typedef ShPoint<3, SH_TEMP, T> TempType;
00264 typedef ShPoint<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 ShPoint<4, Binding, T, Swizzled> : public ShAttrib<4, Binding, T, Swizzled> {
00271
public:
00272 ShPoint();
00273 ShPoint(
const ShGeneric<4, T>& other);
00274 ShPoint(
const ShPoint<4, Binding, T, Swizzled>& other);
00275 ShPoint(
const ShVariableNodePtr& node,
const ShSwizzle& swizzle,
bool neg);
00276
explicit ShPoint(T data[4]);
00277
00278 ShPoint(T, T, T, T);
00279 ShPoint(
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&,
const ShGeneric<1, T>&);
00280
00281 ~ShPoint();
00282
00283 ShPoint& operator=(
const ShGeneric<4, T>& other);
00284 ShPoint& operator=(
const ShPoint<4, Binding, T, Swizzled>& other);
00285
00286 ShPoint& operator=(
const ShProgram& prg);
00287
00288 ShPoint& operator+=(
const ShGeneric<4, T>& right);
00289 ShPoint& operator-=(
const ShGeneric<4, T>& right);
00290 ShPoint& operator*=(
const ShGeneric<4, T>& right);
00291 ShPoint& operator/=(
const ShGeneric<4, T>& right);
00292 ShPoint& operator%=(
const ShGeneric<4, T>& right);
00293 ShPoint& operator*=(T);
00294 ShPoint& operator/=(T);
00295 ShPoint& operator%=(T);
00296 ShPoint& operator+=(T);
00297 ShPoint& operator-=(T);
00298 ShPoint& operator+=(
const ShGeneric<1, T>&);
00299 ShPoint& operator-=(
const ShGeneric<1, T>&);
00300 ShPoint& operator*=(
const ShGeneric<1, T>&);
00301 ShPoint& operator/=(
const ShGeneric<1, T>&);
00302 ShPoint& operator%=(
const ShGeneric<1, T>&);
00303
ShPoint<1, Binding, T, true> operator()(
int) const;
00304 ShPoint<2, Binding, T, true> operator()(
int,
int) const;
00305 ShPoint<3, Binding, T, true> operator()(
int,
int,
int) const;
00306 ShPoint<4, Binding, T, true> operator()(
int,
int,
int,
int) const;
00307 ShPoint<1, Binding, T, true> operator[](
int) const;
00308
00309 template<
int N2>
00310 ShPoint<N2, Binding, T, true> swiz(
int indices[]) const;
00311
00312 ShPoint 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_POINT;
00317
00318 typedef ShPoint<4, SH_INPUT, T> InputType;
00319 typedef ShPoint<4, SH_OUTPUT, T> OutputType;
00320 typedef ShPoint<4, SH_INOUT, T> InOutType;
00321 typedef ShPoint<4, SH_TEMP, T> TempType;
00322 typedef ShPoint<4, SH_CONST, T> ConstType;
00323 private:
00324 typedef ShAttrib<4, Binding, T, Swizzled> ParentType;
00325 };
00326
00327 typedef ShPoint<1, SH_INPUT,
float>
ShInputPoint1f;
00328 typedef ShPoint<1, SH_OUTPUT,
float>
ShOutputPoint1f;
00329 typedef ShPoint<1, SH_INOUT,
float>
ShInOutPoint1f;
00330 typedef ShPoint<1, SH_TEMP,
float>
ShPoint1f;
00331 typedef ShPoint<1, SH_CONST,
float>
ShConstPoint1f;
00332 typedef ShPoint<2, SH_INPUT,
float>
ShInputPoint2f;
00333 typedef ShPoint<2, SH_OUTPUT,
float>
ShOutputPoint2f;
00334 typedef ShPoint<2, SH_INOUT,
float>
ShInOutPoint2f;
00335 typedef ShPoint<2, SH_TEMP,
float>
ShPoint2f;
00336 typedef ShPoint<2, SH_CONST,
float>
ShConstPoint2f;
00337 typedef ShPoint<3, SH_INPUT,
float>
ShInputPoint3f;
00338 typedef ShPoint<3, SH_OUTPUT,
float>
ShOutputPoint3f;
00339 typedef ShPoint<3, SH_INOUT,
float>
ShInOutPoint3f;
00340 typedef ShPoint<3, SH_TEMP,
float>
ShPoint3f;
00341 typedef ShPoint<3, SH_CONST,
float>
ShConstPoint3f;
00342 typedef ShPoint<4, SH_INPUT,
float>
ShInputPoint4f;
00343 typedef ShPoint<4, SH_OUTPUT,
float>
ShOutputPoint4f;
00344 typedef ShPoint<4, SH_INOUT,
float>
ShInOutPoint4f;
00345 typedef ShPoint<4, SH_TEMP,
float>
ShPoint4f;
00346 typedef ShPoint<4, SH_CONST,
float>
ShConstPoint4f;
00347
00348 }
00349 #include "ShPointImpl.hpp"
00350
00351 #endif