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
00027
#ifndef SHBASETEXTURE_HPP
00028
#define SHBASETEXTURE_HPP
00029
00030
#include <string>
00031
#include "ShDllExport.hpp"
00032
#include "ShTextureNode.hpp"
00033
#include "ShMemory.hpp"
00034
#include "ShVariable.hpp"
00035
#include "ShAttrib.hpp"
00036
#include "ShMetaForwarder.hpp"
00037
00038
namespace SH {
00039
00040
class
00041
SH_DLLEXPORT ShBaseTexture :
public ShMetaForwarder {
00042
public:
00043 ShBaseTexture(
const ShTextureNodePtr& node);
00044
00045
protected:
00046 ShTextureNodePtr m_node;
00047 };
00048
00051
template<
typename T>
00052 class ShBaseTexture1D :
public ShBaseTexture {
00053
public:
00054
ShBaseTexture1D(
const ShTextureTraits& traits);
00055
ShBaseTexture1D(
int width,
const ShTextureTraits& traits);
00056
00057 T operator()(
const ShGeneric<1, float>& coords)
const;
00058 T operator[](
const ShGeneric<1, float>& coords)
const;
00059
00060
ShMemoryPtr memory();
00061
void memory(
ShMemoryPtr memory);
00062
void size(
int width);
00063
00064
ShAttrib1f size()
const;
00065
int width() {
return m_node->width(); }
00066
00067
typedef T return_type;
00068 };
00069
00072
template<
typename T>
00073
class ShBaseTexture2D :
public ShBaseTexture {
00074
public:
00075
ShBaseTexture2D(
const ShTextureTraits& traits);
00076
ShBaseTexture2D(
int width,
int height,
const ShTextureTraits& traits);
00077
00078 T operator()(
const ShGeneric<2, float>& coords)
const;
00079 T operator[](
const ShGeneric<2, float>& coords)
const;
00081 T operator()(
const ShGeneric<2, float>& coords,
00082
const ShGeneric<2, float>& dx,
00083
const ShGeneric<2, float>& dy)
const;
00084
00085
ShMemoryPtr memory();
00086
void memory(
ShMemoryPtr memory);
00087
void size(
int width,
int height);
00088
00089
ShAttrib2f size() const;
00090
00091
int width() {
return m_node->width(); }
00092
int height() {
return m_node->height(); }
00093
00094
typedef T return_type;
00095 };
00096
00099
template<
typename T>
00100
class ShBaseTextureRect :
public ShBaseTexture {
00101
public:
00102
ShBaseTextureRect(
const ShTextureTraits& traits);
00103
ShBaseTextureRect(
int width,
int height,
const ShTextureTraits& traits);
00104
00105 T operator()(
const ShGeneric<2, float>& coords)
const;
00106 T operator[](
const ShGeneric<2, float>& coords)
const;
00107
00108
ShMemoryPtr memory();
00109
void memory(
ShMemoryPtr memory);
00110
void size(
int width,
int height);
00111
00112
ShAttrib2f size()
const;
00113
00114
int width() {
return m_node->width(); }
00115
int height() {
return m_node->height(); }
00116
00117 typedef T return_type;
00118 };
00119
00122
template<
typename T>
00123
class ShBaseTexture3D :
public ShBaseTexture {
00124
public:
00125
ShBaseTexture3D(
const ShTextureTraits& traits);
00126
ShBaseTexture3D(
int width,
int height,
int depth,
const ShTextureTraits& traits);
00127
00128 T operator()(
const ShGeneric<3, float>& coords)
const;
00129 T operator[](
const ShGeneric<3, float>& coords)
const;
00130
00131
ShMemoryPtr memory();
00132
void memory(
ShMemoryPtr memory);
00133
void size(
int width,
int height,
int depth);
00134
00135
ShAttrib3f size()
const;
00136
int width() {
return m_node->width(); }
00137
int height() {
return m_node->height(); }
00138 int depth() {
return m_node->depth(); }
00139
00140
typedef T return_type;
00141 };
00142
00145
template<
typename T>
00146
class ShBaseTextureCube :
public ShBaseTexture {
00147
public:
00148 ShBaseTextureCube(
const ShTextureTraits& traits);
00149 ShBaseTextureCube(
int width,
int height,
const ShTextureTraits& traits);
00150
00151 T operator()(
const ShGeneric<3, float>& coords)
const;
00152
00153 ShMemoryPtr memory(ShCubeDirection face);
00154
void memory(ShMemoryPtr memory, ShCubeDirection face);
00155
void size(
int width,
int height);
00156
00157 ShAttrib2f size() const;
00158
00159
int width() {
return m_node->width(); }
00160
int height() {
return m_node->height(); }
00161
00162
typedef T return_type;
00163 };
00164
00165 }
00166
00167
#include "ShBaseTextureImpl.hpp"
00168
00169
#endif