2012-04-30 20:23:53 +02:00
|
|
|
#ifndef GLW_FRAGMENTSHADER_H
|
|
|
|
#define GLW_FRAGMENTSHADER_H
|
|
|
|
|
|
|
|
#include "./shader.h"
|
|
|
|
|
|
|
|
namespace glw
|
|
|
|
{
|
|
|
|
|
|
|
|
class FragmentShaderArguments : public ShaderArguments
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
typedef ShaderArguments BaseType;
|
2012-04-30 20:23:53 +02:00
|
|
|
typedef FragmentShaderArguments ThisType;
|
|
|
|
|
|
|
|
FragmentShaderArguments(void)
|
2012-05-07 15:18:05 +02:00
|
|
|
: BaseType()
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
;
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void clear(void)
|
|
|
|
{
|
|
|
|
BaseType::clear();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
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
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
friend class Context;
|
|
|
|
friend class BoundFragmentShader;
|
|
|
|
|
2012-04-30 20:23:53 +02:00
|
|
|
public:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
typedef SafeShader BaseType;
|
2012-04-30 20:23:53 +02:00
|
|
|
typedef SafeFragmentShader ThisType;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
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)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
class BoundFragmentShader : public BoundShader
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
friend class Context;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
typedef BoundShader BaseType;
|
|
|
|
typedef BoundFragmentShader ThisType;
|
2012-04-30 20:23:53 +02:00
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const FragmentShaderHandle & handle(void) const
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
return static_cast<const FragmentShaderHandle &>(BaseType::handle());
|
|
|
|
}
|
|
|
|
|
|
|
|
FragmentShaderHandle & handle(void)
|
|
|
|
{
|
|
|
|
return static_cast<FragmentShaderHandle &>(BaseType::handle());
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
BoundFragmentShader(const FragmentShaderHandle & handle, const ShaderBindingParams & params)
|
|
|
|
: BaseType(handle, params)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const FragmentShaderPtr & object(void) const
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
return this->handle()->object();
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
FragmentShaderPtr & object(void)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
return this->handle()->object();
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
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;
|
2012-04-30 20:23:53 +02:00
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
};
|
2012-04-30 20:23:53 +02:00
|
|
|
|
|
|
|
#endif // GLW_FRAGMENTSHADER_H
|