2012-04-30 20:23:53 +02:00
|
|
|
#ifndef GLW_GEOMETRYSHADER_H
|
|
|
|
#define GLW_GEOMETRYSHADER_H
|
|
|
|
|
|
|
|
#include "./shader.h"
|
|
|
|
|
|
|
|
namespace glw
|
|
|
|
{
|
|
|
|
|
|
|
|
class GeometryShaderArguments : public ShaderArguments
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
typedef ShaderArguments BaseType;
|
2012-04-30 20:23:53 +02:00
|
|
|
typedef GeometryShaderArguments ThisType;
|
|
|
|
|
|
|
|
GeometryShaderArguments(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 GeometryShader : public Shader
|
|
|
|
{
|
|
|
|
friend class Context;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef Shader BaseType;
|
|
|
|
typedef GeometryShader ThisType;
|
|
|
|
|
|
|
|
virtual Type type(void) const
|
|
|
|
{
|
|
|
|
return GeometryShaderType;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
GeometryShader(Context * ctx)
|
|
|
|
: BaseType(ctx)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual GLenum shaderType(void) const
|
|
|
|
{
|
|
|
|
return GL_GEOMETRY_SHADER;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool create(const GeometryShaderArguments & args)
|
|
|
|
{
|
|
|
|
return BaseType::create(args);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace detail { template <> struct BaseOf <GeometryShader> { typedef Shader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <GeometryShader> ::Type GeometryShaderPtr;
|
|
|
|
|
|
|
|
class SafeGeometryShader : public SafeShader
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
friend class Context;
|
|
|
|
friend class BoundGeometryShader;
|
|
|
|
|
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 SafeGeometryShader ThisType;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
SafeGeometryShader(const GeometryShaderPtr & geometryShader)
|
|
|
|
: BaseType(geometryShader)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
const GeometryShaderPtr & object(void) const
|
|
|
|
{
|
|
|
|
return static_cast<const GeometryShaderPtr &>(BaseType::object());
|
|
|
|
}
|
|
|
|
|
|
|
|
GeometryShaderPtr & object(void)
|
|
|
|
{
|
|
|
|
return static_cast<GeometryShaderPtr &>(BaseType::object());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace detail { template <> struct BaseOf <SafeGeometryShader> { typedef SafeShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBase <SafeGeometryShader> { typedef GeometryShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectSafe <GeometryShader > { typedef SafeGeometryShader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <SafeGeometryShader> ::Type GeometryShaderHandle;
|
|
|
|
|
|
|
|
class GeometryShaderBindingParams : public ShaderBindingParams
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef ShaderBindingParams BaseType;
|
|
|
|
typedef GeometryShaderBindingParams ThisType;
|
|
|
|
|
|
|
|
GeometryShaderBindingParams(void)
|
|
|
|
: BaseType(GL_GEOMETRY_SHADER, 0)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
class BoundGeometryShader : 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 BoundGeometryShader ThisType;
|
2012-04-30 20:23:53 +02:00
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const GeometryShaderHandle & handle(void) const
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
2012-05-07 15:18:05 +02:00
|
|
|
return static_cast<const GeometryShaderHandle &>(BaseType::handle());
|
|
|
|
}
|
|
|
|
|
|
|
|
GeometryShaderHandle & handle(void)
|
|
|
|
{
|
|
|
|
return static_cast<GeometryShaderHandle &>(BaseType::handle());
|
2012-04-30 20:23:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
BoundGeometryShader(const GeometryShaderHandle & handle, const ShaderBindingParams & params)
|
|
|
|
: BaseType(handle, params)
|
2012-04-30 20:23:53 +02:00
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2012-05-07 15:18:05 +02:00
|
|
|
const GeometryShaderPtr & 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
|
|
|
GeometryShaderPtr & 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 <BoundGeometryShader> { typedef GeometryShaderBindingParams Type; }; };
|
|
|
|
namespace detail { template <> struct BaseOf <BoundGeometryShader> { typedef BoundShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBase <BoundGeometryShader> { typedef GeometryShader Type; }; };
|
|
|
|
namespace detail { template <> struct ObjectBound <GeometryShader > { typedef BoundGeometryShader Type; }; };
|
|
|
|
typedef detail::ObjectSharedPointerTraits <BoundGeometryShader> ::Type BoundGeometryShaderHandle;
|
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_GEOMETRYSHADER_H
|