Dandelion 1.1.2
A light-weight 3D builder for educational usage
载入中...
搜索中...
未找到
group.h
浏览该文件的文档.
1#ifndef DANDELION_SCENE_GROUP_H
2#define DANDELION_SCENE_GROUP_H
3
4#include <cstddef>
5#include <string>
6
7#include <spdlog/spdlog.h>
8
9#include "object.h"
10
11/*!
12 * \ingroup rendering
13 * \ingroup simulation
14 * \file scene/group.h
15 * \~chinese
16 * \brief 包含物体组的类。
17 */
18
19/*!
20 * \ingroup rendering
21 * \ingroup simulation
22 * \~chinese
23 * \brief 表示物体组的类。
24 *
25 * 一个模型文件(例如一个 obj 文件)中可以包含多个物体,
26 * 因此加载一个模型文件的结果是一个组而不是一个物体。加载完成后,组名即文件名、
27 * 各物体名即文件中各 mesh 的名称。在删除组中所有的物体后该组为空但不会被删除,
28 * 未来将实现组间转移物体和向组中添加物体的功能。
29 */
30class Group
31{
32public:
33
34 /*!
35 * \~chinese
36 * 创建一个组只需要指定组名,加载模型数据要显式调用 `load` 方法。
37 * \param position 要创建组的组名
38 */
39 Group(const std::string& group_name);
40 ///@{
41 /*! \~chinese 禁止复制组。 */
42 Group(Group& other) = delete;
43 Group(const Group& other) = delete;
44 ///@}
45 ~Group() = default;
46 /*!
47 * \~chinese
48 * 被 `Scene::load` 调用,真正加载模型数据的函数。
49 * \param file_path 要加载模型的文件路径
50 */
51 bool load(const std::string& file_path);
52 /*! \~chinese 组中所有的物体。 */
53 std::vector<std::unique_ptr<Object>> objects;
54 /*! \~chinese 组的唯一 ID。 */
55 std::size_t id;
56 /*! \~chinese 组名,来自加载时的文件名。 */
57 std::string name;
58
59private:
60
61 /*! \~chinese 下一个可用的组 ID。 */
62 static std::size_t next_available_id;
63 std::shared_ptr<spdlog::logger> logger;
64};
65
66#endif // DANDELION_SCENE_GROUP_H
Group(const std::string &group_name)
Group(Group &other)=delete
bool load(const std::string &file_path)
定义 group.cpp:33
std::vector< std::unique_ptr< Object > > objects
定义 group.h:53
static std::size_t next_available_id
定义 group.h:62
std::string name
定义 group.h:57
Group(const Group &other)=delete
std::size_t id
定义 group.h:55
包含物体的类。