xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
object.hpp
浏览该文件的文档.
1#pragma once
2#include <xcal/public.h>
3
4#include <memory>
9#include <xcmath/xcmath.hpp>
10
11namespace xcal::render::opengl {
12class OpenGLRender;
13}
17
18 private:
20
21 protected:
22 virtual void create() = 0;
23 virtual void destroy() = 0;
24 virtual void render() const = 0;
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
36using object_ptr = std::unique_ptr<Object>;
37
38template <class T>
39 requires std::is_base_of_v<mobject::AbsMObject, T>
41
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 }
抽象图形对象基类
图形对象命名空间
const GL::VertexArrayObject & vao() const
Definition object.hpp:29
virtual void render() const =0
GL::VertexArrayObject & vao()
Definition object.hpp:28
virtual void update_projection_view(const xcmath::mat4< float_t > &projection_view)=0
Matrix class template
Definition mat.hpp:27
基础图形对象类
xcal::render::opengl::object::object_ptr create(T *mobject)
std::unique_ptr< Object > object_ptr
Definition object.hpp:36
#define XCAL_API
Definition public.h:69