3D 摄像机控制器(eve.Camera / eve.CameraController)。 更多...
#include <CameraController.h>
Public 成员函数 | |
| CameraController () | |
| ~CameraController ()=default | |
| void | setCamera (graphics::Camera3D *cam) |
| graphics::Camera3D * | getCamera () const |
| void | setTarget (float x, float y, float z) |
| float | getTargetX () const |
| float | getTargetY () const |
| float | getTargetZ () const |
| void | setOffset (float x, float y, float z) |
| follow:摄像机相对 target 的偏移(默认 (0, 2, 6))。 | |
| void | setLookAhead (float x, float y, float z) |
| follow:额外的视线前移点(可让镜头看向玩家前方)。 | |
| void | setMode (const std::string &mode) |
| std::string | getMode () const |
| void | setRadius (float r) |
| void | setAzimuth (float deg) |
| void | setElevation (float deg) |
| void | setOrbitSpeed (float degPerSec) |
| void | setYaw (float deg) |
| void | setPitch (float deg) |
| void | setSmooth (float damping) |
| void | setMaxSpeed (float unitsPerSec) |
| void | snap () |
| void | addView (const std::string &name, float ex, float ey, float ez, float tx, float ty, float tz) |
| bool | switchTo (const std::string &name, float blendTime) |
| void | playSequence (float stepTime) |
| void | stopSequence () |
| bool | isPlaying () const |
| void | update (float dt) |
详细描述
3D 摄像机控制器(eve.Camera / eve.CameraController)。
驱动一个 graphics::Camera3D,内置多种方便玩家使用的视角行为:
- follow 自动追踪目标(第三人称跟随,镜头挂在 target + offset)
- orbit 自动盘旋(绕 target 公转,azimuth 按 orbitSpeed 自动旋转)
- topdown 俯视(从 target 正上方往下拍)
- firstperson 第一人称(eye 位于 target,用 yaw/pitch 控制朝向)
- cinematic 过场/自动切换视角(在一组命名 View 之间平滑插值)
所有行为都经过统一的指数阻尼平滑(setSmooth,对应"平滑移动"), 也支持 maxSpeed 限速避免抖动,snap() 可立即到位不做平滑。
在文件 CameraController.h 第 29 行定义.
构造及析构函数说明
◆ CameraController()
|
default |
◆ ~CameraController()
成员函数说明
◆ addView()
| void eve::camera::CameraController::addView | ( | const std::string & | name, |
| float | ex, | ||
| float | ey, | ||
| float | ez, | ||
| float | tx, | ||
| float | ty, | ||
| float | tz | ||
| ) |
在文件 CameraController.cpp 第 52 行定义.
◆ getCamera()
| graphics::Camera3D * eve::camera::CameraController::getCamera | ( | ) | const |
在文件 CameraController.cpp 第 18 行定义.
◆ getMode()
| std::string eve::camera::CameraController::getMode | ( | ) | const |
在文件 CameraController.cpp 第 38 行定义.
◆ getTargetX()
| float eve::camera::CameraController::getTargetX | ( | ) | const |
在文件 CameraController.cpp 第 24 行定义.
◆ getTargetY()
| float eve::camera::CameraController::getTargetY | ( | ) | const |
在文件 CameraController.cpp 第 25 行定义.
◆ getTargetZ()
| float eve::camera::CameraController::getTargetZ | ( | ) | const |
在文件 CameraController.cpp 第 26 行定义.
◆ isPlaying()
| bool eve::camera::CameraController::isPlaying | ( | ) | const |
在文件 CameraController.cpp 第 103 行定义.
◆ playSequence()
| void eve::camera::CameraController::playSequence | ( | float | stepTime | ) |
在文件 CameraController.cpp 第 91 行定义.
引用了 switchTo().
◆ setAzimuth()
| void eve::camera::CameraController::setAzimuth | ( | float | deg | ) |
在文件 CameraController.cpp 第 41 行定义.
◆ setCamera()
| void eve::camera::CameraController::setCamera | ( | graphics::Camera3D * | cam | ) |
在文件 CameraController.cpp 第 16 行定义.
◆ setElevation()
| void eve::camera::CameraController::setElevation | ( | float | deg | ) |
在文件 CameraController.cpp 第 42 行定义.
◆ setLookAhead()
| void eve::camera::CameraController::setLookAhead | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
◆ setMaxSpeed()
| void eve::camera::CameraController::setMaxSpeed | ( | float | unitsPerSec | ) |
在文件 CameraController.cpp 第 50 行定义.
◆ setMode()
| void eve::camera::CameraController::setMode | ( | const std::string & | mode | ) |
在文件 CameraController.cpp 第 36 行定义.
◆ setOffset()
| void eve::camera::CameraController::setOffset | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
◆ setOrbitSpeed()
| void eve::camera::CameraController::setOrbitSpeed | ( | float | degPerSec | ) |
在文件 CameraController.cpp 第 43 行定义.
◆ setPitch()
| void eve::camera::CameraController::setPitch | ( | float | deg | ) |
在文件 CameraController.cpp 第 46 行定义.
◆ setRadius()
| void eve::camera::CameraController::setRadius | ( | float | r | ) |
在文件 CameraController.cpp 第 40 行定义.
◆ setSmooth()
| void eve::camera::CameraController::setSmooth | ( | float | damping | ) |
在文件 CameraController.cpp 第 48 行定义.
◆ setTarget()
| void eve::camera::CameraController::setTarget | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
在文件 CameraController.cpp 第 20 行定义.
◆ setYaw()
| void eve::camera::CameraController::setYaw | ( | float | deg | ) |
在文件 CameraController.cpp 第 45 行定义.
◆ snap()
| void eve::camera::CameraController::snap | ( | ) |
在文件 CameraController.cpp 第 162 行定义.
◆ stopSequence()
| void eve::camera::CameraController::stopSequence | ( | ) |
在文件 CameraController.cpp 第 101 行定义.
◆ switchTo()
| bool eve::camera::CameraController::switchTo | ( | const std::string & | name, |
| float | blendTime | ||
| ) |
◆ update()
| void eve::camera::CameraController::update | ( | float | dt | ) |
在文件 CameraController.cpp 第 168 行定义.
引用了 d, name , 以及 switchTo().
该类的文档由以下文件生成:
- src/modules/camera/CameraController.h
- src/modules/camera/CameraController.cpp