13 #ifndef OGLPLUS_GLSL_SOURCE_1207111232_HPP
14 #define OGLPLUS_GLSL_SOURCE_1207111232_HPP
17 #include <oglplus/detail/glsl_source.hpp>
25 aux::GLSLSourceWrapper* _impl;
27 template <
typename Impl,
typename P1>
28 static aux::GLSLSourceWrapper* make_impl(P1&& p1)
30 return new Impl(std::forward<P1>(p1));
33 template <
typename Impl,
typename P1,
typename P2>
34 static aux::GLSLSourceWrapper* make_impl(P1&& p1, P2&& p2)
46 if(_impl)
delete _impl;
56 : _impl(make_impl<aux::StrCRefGLSLSrcWrap>(source))
60 : _impl(make_impl<aux::StrCRefsGLSLSrcWrap>(
68 : _impl(make_impl<aux::StrCRefsGLSLSrcWrap>(
74 GLSLSource(
const std::vector<String>& strs)
75 : _impl(make_impl<aux::StrsGLSLSrcWrap>(
81 #if !OGLPLUS_NO_INITIALIZER_LISTS
82 GLSLSource(std::initializer_list<StrCRef> lits)
83 : _impl(make_impl<aux::StrCRefsGLSLSrcWrap>(
89 GLSLSource(std::initializer_list<String> strs)
90 : _impl(make_impl<aux::StrsGLSLSrcWrap>(
97 template <
typename Head,
typename Tail>
98 GLSLSource(
const StrCRefChainTpl<GLchar, Head, Tail>& source)
99 : _impl(make_impl<aux::StrGLSLSrcWrap>(source.str()))
102 explicit GLSLSource(
const String& source)
103 : _impl(make_impl<aux::StrGLSLSrcWrap>(source))
106 explicit GLSLSource(
String&& source)
107 : _impl(make_impl<aux::StrGLSLSrcWrap>(std::move(source)))
110 struct FromStream_ { };
112 GLSLSource(std::istream& input, FromStream_)
113 : _impl(make_impl<aux::InputStreamGLSLSrcWrap>(input))
116 static GLSLSource FromStream(std::istream& input)
118 return GLSLSource(input, FromStream_());
121 struct FromFile_ { };
123 GLSLSource(
const char* path, FromFile_)
124 : _impl(make_impl<aux::FileGLSLSrcWrap>(path))
127 static GLSLSource FromFile(
const char* path)
129 return GLSLSource(path, FromFile_());
132 static GLSLSource FromFile(
const String& path)
134 return GLSLSource(path.c_str(), FromFile_());
139 OGLPLUS_NOEXCEPT(true)
142 return _impl->Count();
146 const GLchar*
const*
Parts(
void) const
147 OGLPLUS_NOEXCEPT(true)
150 return _impl->Parts();
155 OGLPLUS_NOEXCEPT(true)
158 return _impl->Lengths();
164 #endif // include guard
const GLchar *const * Parts(void) const
Pointers to the individual parts of the source.
Definition: glsl_source.hpp:146
Class storing source code in GLSL.
Definition: glsl_source.hpp:22
Helper classes for passing source code in GLSL as parameters.
String const reference wrapper template.
Definition: ref_tpl.hpp:72
::std::basic_string< GLchar > String
String class.
Definition: def.hpp:36
GLsizei Count(void) const
Count of buffers storing the individual parts of the source.
Definition: glsl_source.hpp:138
GLint const * Lengths(void) const
Pointer to the lengths of the individual parts of the source.
Definition: glsl_source.hpp:154