摄像机组件. 更多...
#include <Camera.h>
Public 成员函数 | |
| Camera () | |
| 构造函数 设置屏幕中心位置. | |
| ~Camera () | |
| virtual void | BeginPlay () override |
| 初始化虚拟参数 防止开始产生一定距离偏差进行处理 | |
| Vector2D | GetCameraPosition () |
| 获取相机虚拟位置. | |
| float | GetSpringArmLength () |
| 获取虚拟弹簧长度. | |
| void | SetMainCamera () |
| 设置世界主相机. | |
| void | SetSpringArmLength (float length) |
| 设置虚拟弹簧长度. | |
| void | SetSmoothness (short smooth) |
| 设置平滑度. | |
| void | SetDistanceThreshold (float threshold) |
| 设置线性阈值. | |
| void | SetRectFrame (const Rect &frame) |
| 设置相机可活动框架. | |
| void | ShakeCamera (float indensity, int decay=5) |
| 震动相机 | |
Public 成员函数 继承自 SceneComponent | |
| virtual void | Update (float deltaTime) override |
| void | AttachTo (SceneComponent *par) |
| 设置所属组件 | |
| void | DetachForm (SceneComponent *par) |
| 解除所属组件. | |
| virtual void | Destruct () |
| 解除场景组件绑定并销毁 | |
| virtual void | EndPlay () override |
| 把一些不能写在析构函数的一些操作写在这里 | |
| Vector2D | GetLocalPosition () const |
| 获取相对坐标 | |
| float | GetLocalRotation () const |
| 获取相对角度 | |
| Vector2D | GetLocalScale () const |
| 获取相对缩放大小 | |
| Vector2D | GetWorldPosition () const |
| 获取场景组件的世界坐标 | |
| float | GetWorldRotation () const |
| 获取场景组件的世界旋转角度 | |
| Vector2D | GetWorldScale () const |
| 获取场景组件的世界的缩放大小 | |
| void | SetLocalPosition (const Vector2D &pos) |
| 设置相对坐标 | |
| void | SetLocalRotation (float rot) |
| 设置相对角度 | |
| void | SetLocalScale (const Vector2D &scale) |
| 设置相对缩放大小 | |
| void | AddPosition (const Vector2D &pos) |
| 加上一个坐标 | |
| void | AddRotation (float rot) |
| 加上一个角度 | |
Public 成员函数 继承自 Component | |
| void | SetOwner (class Object *owner) |
| 设置绑定对象. | |
| virtual void | Activate () |
| 激活组件 | |
| virtual void | Deactivate () |
| 停用组件 | |
| Object * | GetOwner () const |
| 获取绑定对象指针 | |
Public 成员函数 继承自 base | |
| base () | |
| virtual | ~base () |
| std::string | GetName () const |
| void | SetName (const std::string &name) |
Private 成员函数 | |
| Vector2D | Lerp (Vector2D start, Vector2D end, float t) |
| 线性插值. | |
| float | Lerp (float start, float end, float t) |
| 线性插值. | |
| float | SmoothStep (float x) |
| 平滑处理. | |
| void | Calculate () |
| 实现计算相机虚拟坐标. | |
Private 属性 | |
| Transform | camera_virtual |
| 虚拟相机场景属性 | |
| Rect | frame |
| 相机可活动框 | |
| float | distanceThreshold = 50.f |
| 线性阈值1~500 | |
| short | Smoothness = 50 |
| 平滑度0~100 | |
| float | ShakeIndensity = 0.f |
| 震动强度 0~100 | |
| bool | shakeFlag = false |
| 震动标志位 | |
| Vector2D | shakeCenter = Vector2D() |
| 震动中心 | |
| Vector2D | shakeSpeed = Vector2D(0.05f, 0.05f) |
| 震动速度 | |
| int | shakeDecay = 5 |
| 震动衰减系数1~100 | |
| float | springArmLength = 20.f |
| 弹簧长度1~10000 | |
| float | springArmLength_virtual = 100.f |
| 虚拟弹簧长度 | |
| float | smoothnessForSpringArm = 20.f |
| 弹簧平滑度0~100 | |
| class Controller * | controlAttached = nullptr |
友元 | |
| class | SpriteRenderer |
| class | Particle |
| class | Controller |
| class | BoxCollider |
| class | World |
| void | Object::DrawDebugPosition () const |
额外继承的成员函数 | |
Protected 成员函数 继承自 SceneComponent | |
| void | process_Destruct () |
| 销毁组件 | |
Protected 属性 继承自 SceneComponent | |
| SceneComponent * | parent = nullptr |
| 父指针 | |
Protected 属性 继承自 Component | |
| class Object * | pOwner = nullptr |
| 处理控制逻辑 有对象物体的指针才能进行控制 | |
| bool | bIsEnabled = true |
| 是否激活 | |
摄像机组件.
|
inline |
构造函数 设置屏幕中心位置.
|
inline |
|
overridevirtual |
初始化虚拟参数 防止开始产生一定距离偏差进行处理
重载 SceneComponent .
|
private |
实现计算相机虚拟坐标.
实现计算相机坐标
|
inline |
获取相机虚拟位置.
|
inline |
获取虚拟弹簧长度.
|
private |
线性插值.
| [in] | start | 开始值 |
| [in] | end | 结束值 |
| {in] | t 系数 0.001~0.1(尽量小效果会好) |
线性插值.
| [in] | start | 开始坐标 |
| [in] | end | 结束坐标 |
| [in] | t | 系数 0.001~0.1(尽量小效果会好) |
| void Camera::SetDistanceThreshold | ( | float | threshold | ) |
设置线性阈值.
| [in] | threshold | 线性阈值 |
| void Camera::SetMainCamera | ( | ) |
设置世界主相机.
| void Camera::SetRectFrame | ( | const Rect & | frame | ) |
设置相机可活动框架.
| [in] | frame | 相机可活动框(视野框) |
| void Camera::SetSmoothness | ( | short | smooth | ) |
设置平滑度.
| [in] | smooth | 平滑度 |
| void Camera::SetSpringArmLength | ( | float | length | ) |
设置虚拟弹簧长度.
| [in] | length | 弹簧长度 |
| void Camera::ShakeCamera | ( | float | indensity, |
| int | decay = 5 ) |
震动相机
| [in] | indensity | 震动强度 |
| [in] | decay | 震动衰减系数 默认为5 |
|
private |
平滑处理.
| [in] | x | 要平滑处理的值 |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
虚拟相机场景属性
|
private |
|
private |
线性阈值1~500
|
private |
相机可活动框
|
private |
震动衰减系数1~100
|
private |
震动标志位
|
private |
震动强度 0~100
|
private |
平滑度0~100
|
private |
弹簧平滑度0~100
|
private |
弹簧长度1~10000
|
private |
虚拟弹簧长度