dl
dl_actor.h
浏览该文件的文档.
1
13#pragma once
14
15#include <string>
16
17#include "dl_type.h"
19#include "math/dl_transform.h"
20#include "math/dl_rigid_body.h"
21
22namespace dl
23{
24
26
28class Actor
29{
30 friend class Factory;
31public:
36 void Update(Float dt = 0);
37
38 void Render();
39
40 //-----------------------------animation---------------------------
44 bool HasAni() { return _modelAnimationInstance; }
48 size_t GetAniSize();
53 std::string GetAniName(size_t i);
57 void SetAni(std::string_view name);
62 std::string GetAniCurrent();
63
65 {
66 if (_rigidBody)
67 {
68 log_warn0("已创建刚体,变换将不受控制!");
69 }
70 return _trans;
71 }
72
73 //void SetTransform(Transform* tsf) { _trans = tsf; }
74
75 //-----------------------------rigidBody---------------------------
79 void CreateRigidBody(RigidBodyType type, bool active);
80
82private:
83 size_t _idModel;
84 Transform* _trans; // 变换,必然存在
85 Color* _color; // 没有代表白色
86 ModelAnimationInstance* _modelAnimationInstance;// 蒙皮骨骼动画
87 RigidBody* _rigidBody; //刚体
88
89 bool _no_bone_animation();
90};
91
92
94
95}
3D绘图对象
std::string GetAniName(size_t i)
返回动画名字
friend class Factory
size_t GetAniSize()
返回动画数量
void CreateRigidBody(RigidBodyType type, bool active)
创建刚体
Transform * GetTransform()
void Update(Float dt=0)
更新动画,没有动画不用调用
void Render()
std::string GetAniCurrent()
返回当前动画
bool HasAni()
是否含有动画
void SetAni(std::string_view name)
切换动画(从头播放)
引用计数对象,通过get_gc函数创建
基于引用计数的内存池
具有矩阵的坐标系
通用类型
float Float
GC< Actor > gcActor
Array< float, 4 > Color
void log_warn0(std::string_view str, DL_SOURCE_LOCATION)