xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
main.cc
浏览该文件的文档.
1#include <xcal/public.h>
2
3#include <memory>
10#include <xcmath/utils/show.hpp>
11
12int main(int argc, char **argv) {
13 XCAL_INFO(XCAL, APP) << "app start";
14 auto scene = std::make_unique<xcal::scene::Scene>();
15 using namespace xcal::mobject;
16 using namespace xcal::camera;
17 using namespace xcal::animation;
18
19 // XCAL_INFO(XCAL, APP) << "cc pos: " << cc->pos().value();
20 auto l1 =
21 scene->add<Line>(3)->set_pos({0, 0})->set_stroke_color({1, 0, 0, 1});
22 auto c1 = scene->add<Circle>();
23 c1->set_radius(1.f / 2)
24 ->set_stroke_color({0.5, 0, 0.5})
25 ->translate(0, 1)
26 ->scale(0.5);
27 auto c2 = scene->add<Circle>()->set_radius(0.5f / 2)->set_stroke_color(
28 {0, 0.5, 0.5});
29 auto l2 = scene->add<Line>(2)->set_stroke_color(0, 0, 1)->rotate(45);
30 auto l3 = scene->add<Line>(2)->set_stroke_color(0, 1, 0)->rotate(90);
31 scene->add<PerspectiveCamera>(45.0, 16 / 9.0, 0.1, 1000.0)
32 ->set_position(0, 0, 3)
33 ->set_target(0, 0, 0);
34 // auto a_r = scene->add<ScalerInterpolation>(&c1->rotation(), 0, 360,
35 // interpolation_functions::linear);
36 // auto timeline = scene->add<Timeline>();
37 // timeline->add(a_r, 0, 10);
38
39 auto render = xcal::render::opengl::OpenGLRender{scene.get()};
40 render.default_camera()
41 ->set_background_color(0.2, 0.2, 0.2, 1.0)
42 ->set_position(0, 0, 3);
43
44 render.show(1200, 675);
45 XCAL_INFO(XCAL, APP) << "app end";
46 return 0;
47}
AbsCamera * set_target(Args &&... args)
设置相机目标点
AbsCamera * set_position(Args &&... args)
设置相机位置
AbsCamera * set_background_color(Args &&... args)
设置背景颜色
圆形图形对象类
Definition circle.hpp:18
xcal::camera::AbsCamera * default_camera() const
int main()
Definition axis.cc:9
PerspectiveCamera 测试套件
透视相机类
#define XCAL_INFO(role, label)
Definition public.h:24