xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
opengl_render.hpp
浏览该文件的文档.
1#pragma once
2#include <xcal/public.h>
3
4#include <memory>
5#include <unordered_map>
6#include <vector>
15
16void framebuffer_size_callback(GLFWwindow* window, int w, int h);
18class Context;
19class UIRender;
20} // namespace xcal::render::opengl::ui
21namespace xcal::render::opengl {
23 friend void ::framebuffer_size_callback(GLFWwindow* window, int w, int h);
24 friend class ui::UIRender;
25
26 private:
27 GLFWwindow* window_{nullptr};
28 std::unique_ptr<ui::Context> ui_render_{nullptr};
29 std::unordered_map<mobject::AbsMObject*, object::object_ptr> objects_;
30 std::unique_ptr<camera::AbsCamera> default_camera_{nullptr};
31 std::unique_ptr<animation::TimelineDriver> playing_timeline_{nullptr};
32 std::chrono::high_resolution_clock::time_point last_time_point_;
33 const camera::AbsCamera* current_camera_{nullptr};
34 std::vector<xcal::render::opengl::GL::RenderCommand> render_commands_;
35
36 protected:
37 void framebuffer_size_callback(GLFWwindow* window, int w, int h);
38
39 private:
40 void setup_scene();
41 void setup_gl();
42 void setup_glfw();
43
44 public:
45 bool_t play_timeline(animation::Timeline* timeline);
46 void show(int width = 800, int height = 600);
47 void render_frame();
48 void set_scene(Scene* scene) override;
49 std::vector<char> read_pixels_char() const;
51 return default_camera_.get();
52 }
54 return current_camera_;
55 }
56
57 public:
58 explicit OpenGLRender(Scene* scene);
59 ~OpenGLRender() override;
60
61 public:
62 OpenGLRender(const OpenGLRender&) = delete;
64};
65} // namespace xcal::render::opengl
抽象相机基类
抽象图形对象基类
相机系统命名空间
xcal::camera::AbsCamera * default_camera() const
OpenGLRender & operator=(const OpenGLRender &)=delete
OpenGLRender(const OpenGLRender &)=delete
const xcal::camera::AbsCamera * current_camera() const
bool bool_t
Definition public.h:28
void framebuffer_size_callback(GLFWwindow *window, int w, int h)
Definition opengl.cc:17
void framebuffer_size_callback(GLFWwindow *window, int w, int h)
Definition opengl.cc:17
#define XCAL_API
Definition public.h:69
struct GLFWwindow GLFWwindow
Definition typedef.hpp:6