修改OpenGl渲染底层之前
This commit is contained in:
@@ -5,41 +5,37 @@ class BaseObject;
|
||||
class GameMapCamera : public Actor
|
||||
{
|
||||
private:
|
||||
GameMap *_ParentMap = nullptr;
|
||||
// 跟随对象
|
||||
BaseObject *_FromActor = nullptr;
|
||||
|
||||
public:
|
||||
// 摄像机坐标
|
||||
int X = 0;
|
||||
int Y = 0;
|
||||
int Z = 0;
|
||||
// 镜头可行坐标
|
||||
int MovableAreaX = 0;
|
||||
int MovableAreaY = 0;
|
||||
// 背景偏移量
|
||||
int BackgroundOffset = 0;
|
||||
// 背景层移动速率
|
||||
int BackgroundMoveSpeed = 1.03;
|
||||
// 人物中线长度
|
||||
int CharacterLineLength = 0;
|
||||
// 摄像机朝向
|
||||
int Direction = 1;
|
||||
// 摄像机朝向时间
|
||||
float DirectionTime = 0.f;
|
||||
// 摄像机记录的跟随对象坐标
|
||||
VecPos3 FromActorPos = {0, 0, 0};
|
||||
|
||||
// 缩放比率
|
||||
float CameraRate = 1.0;
|
||||
|
||||
// 添加平滑移动相关的成员变量
|
||||
bool _isSmoothMoving = false;
|
||||
VecPos _currentPosition; // 当前摄像机位置
|
||||
VecPos _velocity; // 当前移动速度(用于平滑移动)
|
||||
float _smoothTime = 0.1f; // 平滑时间(秒),可调整
|
||||
int _maxSpeed = 2000; // 最大移动速度,防止过快
|
||||
|
||||
public:
|
||||
GameMapCamera();
|
||||
~GameMapCamera();
|
||||
|
||||
void SetParentMap(GameMap *map);
|
||||
void SetFromActor(BaseObject *actor);
|
||||
void Update(float deltaTime);
|
||||
|
||||
void SetPos(int x, int y, int z);
|
||||
void AddPos(int x, int y, int z);
|
||||
|
||||
//同步坐标相关
|
||||
void SyncPos(float deltaTime);
|
||||
void SyncPosByFromParent(float deltaTime);
|
||||
|
||||
// 平滑阻尼函数(类似Unity的Mathf.SmoothDamp)
|
||||
VecPos SmoothDamp(const VecPos ¤t, const VecPos &target, VecPos ¤tVelocity, float smoothTime, int maxSpeed, float deltaTime);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user