xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
shaderinstence.hpp
浏览该文件的文档.
4
5template <typename Catgory, size_t Id>
7 static std::shared_ptr<xcal::render::opengl::GL::ShaderProgram> allocate() {
8 static_assert(false, "Not implemented");
9 }
10};
11template <class T, size_t _id>
14
15template <typename Catgory, size_t Id>
17 Id> {
18 static std::shared_ptr<xcal::render::opengl::GL::VertexArrayObject>
20 return std::make_shared<xcal::render::opengl::GL::VertexArrayObject>();
21 }
22};
23template <class T, size_t _id>
26 _id>;
27
28template <typename Catgory, size_t Id>
30 static std::shared_ptr<xcal::render::opengl::GL::Buffer> allocate() {
31 return std::make_shared<xcal::render::opengl::GL::Buffer>();
32 }
33};
34template <class T, size_t _id>
37
38} // namespace xcal::render::opengl::utils
39
40#define XCAL_DEFINE_STATIC_GLOBJECT(T, Catgory, Id) \
41 template <> \
42 std::shared_ptr<T> \
43 xcal::render::opengl::utils::ResourceAllocator<T, Catgory, Id>::allocate()
44#define XCAL_STATIC_GLOBJECT(T, Catgory, Id) \
45 (::xcal::render::opengl::utils::StaticResourceDistributor<T, Catgory, \
46 Id>::instance())
47
48#define XCAL_BUFFER_INSTANCE(T, _id) \
49 template <> \
50 std::shared_ptr<xcal::render::opengl::GL::Buffer> \
51 xcal::render::opengl::utils::ResourceAllocator< \
52 xcal::render::opengl::GL::Buffer, T, _id>::allocate()
53#define XCAL_SHADER_INSTANCE(T, _id) \
54 template <> \
55 std::shared_ptr<xcal::render::opengl::GL::ShaderProgram> \
56 xcal::render::opengl::utils::ResourceAllocator< \
57 xcal::render::opengl::GL::ShaderProgram, T, _id>::allocate()
58
59#ifdef XCAL_debug
60# define SHADER_FILE(name) (std::string(XCAL_OPENGL_SHADER_DIR) + (name))
61#else
62# include <xcal/utils/paths.hpp>
63# define SHADER_FILE(name) \
64 (xcal::utils::paths::EXECUTABLE_DIR + "/" + XCAL_OPENGL_SHADER_DIR + \
65 name)
66#endif
This file contains the declaration of paths used in xcal.