00001 #ifndef GLW_GEOMETRYSHADER_H 00002 #define GLW_GEOMETRYSHADER_H 00003 00004 #include "./shader.h" 00005 00006 namespace glw 00007 { 00008 00009 class GeometryShaderArguments : public ShaderArguments 00010 { 00011 public: 00012 00013 typedef ShaderArguments BaseType; 00014 typedef GeometryShaderArguments ThisType; 00015 00016 GeometryShaderArguments(void) 00017 : BaseType() 00018 { 00019 ; 00020 } 00021 00022 void clear(void) 00023 { 00024 BaseType::clear(); 00025 } 00026 }; 00027 00028 class GeometryShader : public Shader 00029 { 00030 friend class Context; 00031 00032 public: 00033 00034 typedef Shader BaseType; 00035 typedef GeometryShader ThisType; 00036 00037 virtual Type type(void) const 00038 { 00039 return GeometryShaderType; 00040 } 00041 00042 protected: 00043 00044 GeometryShader(Context * ctx) 00045 : BaseType(ctx) 00046 { 00047 ; 00048 } 00049 00050 virtual GLenum shaderType(void) const 00051 { 00052 return GL_GEOMETRY_SHADER; 00053 } 00054 00055 bool create(const GeometryShaderArguments & args) 00056 { 00057 return BaseType::create(args); 00058 } 00059 }; 00060 00061 namespace detail { template <> struct BaseOf <GeometryShader> { typedef Shader Type; }; }; 00062 typedef detail::ObjectSharedPointerTraits <GeometryShader> ::Type GeometryShaderPtr; 00063 00064 class SafeGeometryShader : public SafeShader 00065 { 00066 friend class Context; 00067 friend class BoundGeometryShader; 00068 00069 public: 00070 00071 typedef SafeShader BaseType; 00072 typedef SafeGeometryShader ThisType; 00073 00074 protected: 00075 00076 SafeGeometryShader(const GeometryShaderPtr & geometryShader) 00077 : BaseType(geometryShader) 00078 { 00079 ; 00080 } 00081 00082 const GeometryShaderPtr & object(void) const 00083 { 00084 return static_cast<const GeometryShaderPtr &>(BaseType::object()); 00085 } 00086 00087 GeometryShaderPtr & object(void) 00088 { 00089 return static_cast<GeometryShaderPtr &>(BaseType::object()); 00090 } 00091 }; 00092 00093 namespace detail { template <> struct BaseOf <SafeGeometryShader> { typedef SafeShader Type; }; }; 00094 namespace detail { template <> struct ObjectBase <SafeGeometryShader> { typedef GeometryShader Type; }; }; 00095 namespace detail { template <> struct ObjectSafe <GeometryShader > { typedef SafeGeometryShader Type; }; }; 00096 typedef detail::ObjectSharedPointerTraits <SafeGeometryShader> ::Type GeometryShaderHandle; 00097 00098 class GeometryShaderBindingParams : public ShaderBindingParams 00099 { 00100 public: 00101 00102 typedef ShaderBindingParams BaseType; 00103 typedef GeometryShaderBindingParams ThisType; 00104 00105 GeometryShaderBindingParams(void) 00106 : BaseType(GL_GEOMETRY_SHADER, 0) 00107 { 00108 ; 00109 } 00110 }; 00111 00112 class BoundGeometryShader : public BoundShader 00113 { 00114 friend class Context; 00115 00116 public: 00117 00118 typedef BoundShader BaseType; 00119 typedef BoundGeometryShader ThisType; 00120 00121 const GeometryShaderHandle & handle(void) const 00122 { 00123 return static_cast<const GeometryShaderHandle &>(BaseType::handle()); 00124 } 00125 00126 GeometryShaderHandle & handle(void) 00127 { 00128 return static_cast<GeometryShaderHandle &>(BaseType::handle()); 00129 } 00130 00131 protected: 00132 00133 BoundGeometryShader(const GeometryShaderHandle & handle, const ShaderBindingParams & params) 00134 : BaseType(handle, params) 00135 { 00136 ; 00137 } 00138 00139 const GeometryShaderPtr & object(void) const 00140 { 00141 return this->handle()->object(); 00142 } 00143 00144 GeometryShaderPtr & object(void) 00145 { 00146 return this->handle()->object(); 00147 } 00148 }; 00149 00150 namespace detail { template <> struct ParamsOf <BoundGeometryShader> { typedef GeometryShaderBindingParams Type; }; }; 00151 namespace detail { template <> struct BaseOf <BoundGeometryShader> { typedef BoundShader Type; }; }; 00152 namespace detail { template <> struct ObjectBase <BoundGeometryShader> { typedef GeometryShader Type; }; }; 00153 namespace detail { template <> struct ObjectBound <GeometryShader > { typedef BoundGeometryShader Type; }; }; 00154 typedef detail::ObjectSharedPointerTraits <BoundGeometryShader> ::Type BoundGeometryShaderHandle; 00155 00156 }; 00157 00158 #endif // GLW_GEOMETRYSHADER_H