2012-04-30 20:23:53 +02:00
|
|
|
#ifndef GLW_VERTEXSHADER_H
|
|
|
|
#define GLW_VERTEXSHADER_H
|
|
|
|
|
|
|
|
#include "./shader.h"
|
|
|
|
|
|
|
|
namespace glw
|
|
|
|
{
|
|
|
|
|
|
|
|
class VertexShaderArguments : public ShaderArguments
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef ShaderArguments BaseType;
|
|
|
|
typedef VertexShaderArguments ThisType;
|
|
|
|
|
|
|
|
VertexShaderArguments(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 VertexShader : public Shader
|
|
|
|
{
|
|
|
|
friend class Context;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef Shader BaseType;
|
|
|
|
typedef VertexShader ThisType;
|
|
|
|
|
|
|
|
virtual Type type(void) const
|
|
|
|
{
|
|
|
|
return VertexShaderType;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
VertexShader(Context * ctx)
|
|
|
|
: BaseType(ctx)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual GLenum shaderType(void) const
|
|
|
|
{
|
|
|
|
return GL_VERTEX_SHADER;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool create(const VertexShaderArguments & args)
|
|
|
|
{
|
|
|
|
return BaseType::create(args);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace detail { template <> struct BaseOf <VertexShader> { typedef Shader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <VertexShader> ::Type VertexShaderPtr;
|
|
|
|
|
|
|
|
class SafeVertexShader : public SafeShader
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
friend class Context;
|
|
|
|
friend class BoundVertexShader;
|
|
|
|
|
2012-04-30 20:23:53 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
typedef SafeShader BaseType;
|
|
|
|
typedef SafeVertexShader ThisType;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
SafeVertexShader(const VertexShaderPtr & vertexShader)
|
|
|
|
: BaseType(vertexShader)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
const VertexShaderPtr & object(void) const
|
|
|
|
{
|
|
|
|
return static_cast<const VertexShaderPtr &>(BaseType::object());
|
|
|
|
}
|
|
|
|
|
|
|
|
VertexShaderPtr & object(void)
|
|
|
|
{
|
|
|
|
return static_cast<VertexShaderPtr &>(BaseType::object());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace detail { template <> struct BaseOf <SafeVertexShader> { typedef SafeShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBase <SafeVertexShader> { typedef VertexShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectSafe <VertexShader > { typedef SafeVertexShader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <SafeVertexShader> ::Type VertexShaderHandle;
|
|
|
|
|
|
|
|
class VertexShaderBindingParams : public ShaderBindingParams
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef ShaderBindingParams BaseType;
|
|
|
|
typedef VertexShaderBindingParams ThisType;
|
|
|
|
|
|
|
|
VertexShaderBindingParams(void)
|
|
|
|
: BaseType(GL_VERTEX_SHADER, 0)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
class BoundVertexShader : 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 BoundVertexShader ThisType;
|
2012-04-30 20:23:53 +02:00
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const VertexShaderHandle & handle(void) const
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
return static_cast<const VertexShaderHandle &>(BaseType::handle());
|
|
|
|
}
|
|
|
|
|
|
|
|
VertexShaderHandle & handle(void)
|
|
|
|
{
|
|
|
|
return static_cast<VertexShaderHandle &>(BaseType::handle());
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
BoundVertexShader(const VertexShaderHandle & handle, const ShaderBindingParams & params)
|
|
|
|
: BaseType(handle, params)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const VertexShaderPtr & 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
|
|
|
VertexShaderPtr & 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 <BoundVertexShader> { typedef VertexShaderBindingParams Type; }; };
|
|
|
|
namespace detail { template <> struct BaseOf <BoundVertexShader> { typedef BoundShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBase <BoundVertexShader> { typedef VertexShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBound <VertexShader > { typedef BoundVertexShader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <BoundVertexShader> ::Type BoundVertexShaderHandle;
|
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_VERTEXSHADER_H
|