1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
#ifndef GLW_FRAGMENTSHADER_H
#define GLW_FRAGMENTSHADER_H
#include "./shader.h"
namespace glw
{
class FragmentShaderArguments : public ShaderArguments
{
public:
typedef ShaderArguments BaseType;
typedef FragmentShaderArguments ThisType;
FragmentShaderArguments(void)
: BaseType()
{
;
}
void clear(void)
{
BaseType::clear();
}
};
class FragmentShader : public Shader
{
friend class Context;
public:
typedef Shader BaseType;
typedef FragmentShader ThisType;
virtual Type type(void) const
{
return FragmentShaderType;
}
protected:
FragmentShader(Context * ctx)
: BaseType(ctx)
{
;
}
virtual GLenum shaderType(void) const
{
return GL_FRAGMENT_SHADER;
}
bool create(const FragmentShaderArguments & args)
{
return BaseType::create(args);
}
};
namespace detail { template <> struct BaseOf <FragmentShader> { typedef Shader Type; }; };
typedef detail::ObjectSharedPointerTraits <FragmentShader> ::Type FragmentShaderPtr;
class SafeFragmentShader : public SafeShader
{
friend class Context;
friend class BoundFragmentShader;
public:
typedef SafeShader BaseType;
typedef SafeFragmentShader ThisType;
protected:
SafeFragmentShader(const FragmentShaderPtr & fragmentShader)
: BaseType(fragmentShader)
{
;
}
const FragmentShaderPtr & object(void) const
{
return static_cast<const FragmentShaderPtr &>(BaseType::object());
}
FragmentShaderPtr & object(void)
{
return static_cast<FragmentShaderPtr &>(BaseType::object());
}
};
namespace detail { template <> struct BaseOf <SafeFragmentShader> { typedef SafeShader Type; }; };
namespace detail { template <> struct ObjectBase <SafeFragmentShader> { typedef FragmentShader Type; }; };
namespace detail { template <> struct ObjectSafe <FragmentShader > { typedef SafeFragmentShader Type; }; };
typedef detail::ObjectSharedPointerTraits <SafeFragmentShader> ::Type FragmentShaderHandle;
class FragmentShaderBindingParams : public ShaderBindingParams
{
public:
typedef ShaderBindingParams BaseType;
typedef FragmentShaderBindingParams ThisType;
FragmentShaderBindingParams(void)
: BaseType(GL_FRAGMENT_SHADER, 0)
{
;
}
};
class BoundFragmentShader : public BoundShader
{
friend class Context;
public:
typedef BoundShader BaseType;
typedef BoundFragmentShader ThisType;
const FragmentShaderHandle & handle(void) const
{
return static_cast<const FragmentShaderHandle &>(BaseType::handle());
}
FragmentShaderHandle & handle(void)
{
return static_cast<FragmentShaderHandle &>(BaseType::handle());
}
protected:
BoundFragmentShader(const FragmentShaderHandle & handle, const ShaderBindingParams & params)
: BaseType(handle, params)
{
;
}
const FragmentShaderPtr & object(void) const
{
return this->handle()->object();
}
FragmentShaderPtr & object(void)
{
return this->handle()->object();
}
};
namespace detail { template <> struct ParamsOf <BoundFragmentShader> { typedef FragmentShaderBindingParams Type; }; };
namespace detail { template <> struct BaseOf <BoundFragmentShader> { typedef BoundShader Type; }; };
namespace detail { template <> struct ObjectBase <BoundFragmentShader> { typedef FragmentShader Type; }; };
namespace detail { template <> struct ObjectBound <FragmentShader > { typedef BoundFragmentShader Type; }; };
typedef detail::ObjectSharedPointerTraits <BoundFragmentShader> ::Type BoundFragmentShaderHandle;
};
#endif // GLW_FRAGMENTSHADER_H
|