xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
xcal
render
impl
opengl
utils
shaderinstence.hpp
浏览该文件的文档.
1
#include <
xcal/render/impl/opengl/gl/shaderprogram.hpp
>
2
#include <
xcal/render/impl/opengl/utils/resourcedistributor.hpp
>
3
namespace
xcal::render::opengl::utils
{
4
5
template
<
typename
Catgory,
size_t
Id>
6
struct
ResourceAllocator
<
xcal
::
render::opengl::GL::ShaderProgram
, Catgory, Id> {
7
static
std::shared_ptr<xcal::render::opengl::GL::ShaderProgram>
allocate
() {
8
static_assert
(
false
,
"Not implemented"
);
9
}
10
};
11
template
<
class
T,
size_t
_
id
>
12
using
ShaderInstance
=
13
StaticResourceDistributor<xcal::render::opengl::GL::ShaderProgram, T, _id>
;
14
15
template
<
typename
Catgory,
size_t
Id>
16
struct
ResourceAllocator
<
xcal
::
render::opengl::GL::VertexArrayObject
, Catgory,
17
Id> {
18
static
std::shared_ptr<xcal::render::opengl::GL::VertexArrayObject>
19
allocate
() {
20
return
std::make_shared<xcal::render::opengl::GL::VertexArrayObject>();
21
}
22
};
23
template
<
class
T,
size_t
_
id
>
24
using
VertexArrayObjectInstance
=
25
DynamicResourceDistributor
<
xcal::render::opengl::GL::VertexArrayObject
, T,
26
_id>;
27
28
template
<
typename
Catgory,
size_t
Id>
29
struct
ResourceAllocator
<
xcal
::
render::opengl::GL::Buffer
, Catgory, Id> {
30
static
std::shared_ptr<xcal::render::opengl::GL::Buffer>
allocate
() {
31
return
std::make_shared<xcal::render::opengl::GL::Buffer>();
32
}
33
};
34
template
<
class
T,
size_t
_
id
>
35
using
BufferInstance
=
36
DynamicResourceDistributor<xcal::render::opengl::GL::Buffer, 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
xcal::render::opengl::GL::Buffer
Definition
buffer.hpp:10
xcal::render::opengl::GL::ShaderProgram
Definition
shaderprogram.hpp:9
xcal::render::opengl::GL::VertexArrayObject
Definition
vertexarrayobject.hpp:7
xcal::render::opengl::utils::DynamicResourceDistributor
Definition
resourcedistributor.hpp:32
xcal::render::opengl::utils::StaticResourceDistributor
Definition
resourcedistributor.hpp:15
xcal::render::opengl::utils
Definition
resourcedistributor.hpp:5
xcal
Definition
test_perspective_camera.cc:11
paths.hpp
This file contains the declaration of paths used in xcal.
resourcedistributor.hpp
shaderprogram.hpp
xcal::render::opengl::utils::ResourceAllocator< xcal::render::opengl::GL::ShaderProgram, Catgory, Id >::allocate
static std::shared_ptr< xcal::render::opengl::GL::ShaderProgram > allocate()
Definition
shaderinstence.hpp:7
xcal::render::opengl::utils::ResourceAllocator< xcal::render::opengl::GL::Buffer, Catgory, Id >::allocate
static std::shared_ptr< xcal::render::opengl::GL::Buffer > allocate()
Definition
shaderinstence.hpp:30
xcal::render::opengl::utils::ResourceAllocator< xcal::render::opengl::GL::VertexArrayObject, Catgory, Id >::allocate
static std::shared_ptr< xcal::render::opengl::GL::VertexArrayObject > allocate()
Definition
shaderinstence.hpp:19
xcal::render::opengl::utils::ResourceAllocator
Definition
resourcedistributor.hpp:7
生成于 2025年 九月 19日 星期五 21:12:12 , 为 xcal使用
1.9.8