xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
xcal
render
impl
opengl
object
object.hpp
浏览该文件的文档.
1
#pragma once
2
#include <
xcal/public.h
>
3
4
#include <memory>
5
#include <
xcal/mobject/core/abs_mobject.hpp
>
6
#include <
xcal/mobject/core/mobject.hpp
>
7
#include <
xcal/render/impl/opengl/core/typedef.hpp
>
8
#include <
xcal/render/impl/opengl/gl/vertexarrayobject.hpp
>
9
#include <
xcmath/xcmath.hpp
>
10
11
namespace
xcal::render::opengl
{
12
class
OpenGLRender;
13
}
14
namespace
xcal::render::opengl::object
{
15
class
XCAL_API
Object
{
16
friend
class
xcal::render::opengl::OpenGLRender
;
17
18
private
:
19
GL::VertexArrayObject
vao_;
20
21
protected
:
22
virtual
void
create
() = 0;
23
virtual
void
destroy
() = 0;
24
virtual
void
render
()
const
= 0;
25
virtual
void
update_projection_view
(
26
const
xcmath::mat4<float_t>
& projection_view) = 0;
27
28
GL::VertexArrayObject
&
vao
() {
return
vao_; }
29
const
GL::VertexArrayObject
&
vao
()
const
{
return
vao_; }
30
31
public
:
32
Object
();
33
virtual
~Object
();
34
};
35
36
using
object_ptr
= std::unique_ptr<Object>;
37
38
template
<
class
T>
39
requires
std::is_base_of_v<mobject::AbsMObject, T>
40
xcal::render::opengl::object::object_ptr
create
(T* mobject);
41
42
object_ptr
create
(
mobject::AbsMObject
* mobject);
43
}
// namespace xcal::render::opengl::object
44
#define XCAL_OPENGL_REGIST_OBJECT(class_, type) \
45
template <> \
46
xcal::render::opengl::object::object_ptr \
47
xcal::render::opengl::object::create<xcal::mobject::type>( \
48
xcal::mobject::type * mobj)
49
50
#define XCAL_OPENGL_REGIST_OBJECT_IMPL(class_, type) \
51
template <> \
52
xcal::render::opengl::object::object_ptr \
53
xcal::render::opengl::object::create<xcal::mobject::type>( \
54
xcal::mobject::type * mobj) { \
55
return std::make_unique<class_>(mobj); \
56
}
abs_mobject.hpp
抽象图形对象基类
xcal::mobject::AbsMObject
图形对象命名空间
Definition
abs_mobject.hpp:31
xcal::render::opengl::GL::VertexArrayObject
Definition
vertexarrayobject.hpp:7
xcal::render::opengl::OpenGLRender
Definition
opengl_render.hpp:22
xcal::render::opengl::object::Object
Definition
object.hpp:15
xcal::render::opengl::object::Object::vao
const GL::VertexArrayObject & vao() const
Definition
object.hpp:29
xcal::render::opengl::object::Object::render
virtual void render() const =0
xcal::render::opengl::object::Object::create
virtual void create()=0
xcal::render::opengl::object::Object::vao
GL::VertexArrayObject & vao()
Definition
object.hpp:28
xcal::render::opengl::object::Object::update_projection_view
virtual void update_projection_view(const xcmath::mat4< float_t > &projection_view)=0
xcal::render::opengl::object::Object::destroy
virtual void destroy()=0
xcmath::mat
Matrix class template
Definition
mat.hpp:27
mobject.hpp
基础图形对象类
xcal::render::opengl::object
Definition
typedef.hpp:36
xcal::render::opengl::object::create
xcal::render::opengl::object::object_ptr create(T *mobject)
xcal::render::opengl::object::object_ptr
std::unique_ptr< Object > object_ptr
Definition
object.hpp:36
xcal::render::opengl
Definition
rendercommand.hpp:7
public.h
XCAL_API
#define XCAL_API
Definition
public.h:69
typedef.hpp
vertexarrayobject.hpp
xcmath.hpp
生成于 2025年 九月 19日 星期五 21:12:12 , 为 xcal使用
1.9.8