智能客服
你问我答,随时在线为你解决问题
Class Info |
|---|
class Transform : public IComponent 坐标转换类,主要提供不同坐标系下向量平移、旋转和缩放功能,以及不同坐标间的转换矩阵。 |
Constructor Name |
|---|
Transform(SceneObject* sceneObject= nullptr) 构造函数。 |
Destructor Name |
|---|
virtual ~Transform() 析构函数。 |
Qualifier and Type |
Method Name and Description |
|---|---|
void |
Translate(const Vector3& translate) 局部坐标系下的平移变换。 |
void |
Rotate(f32 angle, const Vector3& axis) 局部坐标系下的旋转变换,绕旋转轴axis旋转angle弧度。 |
void |
局部坐标系下的缩放变换。 |
void |
SetLocalPosition(const Vector3& position) 设置局部坐标系下,当前场景对象相对于父场景对象的位置。 |
void |
SetLocalRotation(const Vector3& rotation) 设置当前场景对象在局部坐标系下的旋转向量(相对于父场景对象)。 |
void |
SetLocalScale(const Vector3& scale) 设置当前场景对象在局部坐标系下的缩放向量(相对于父场景对象)。 |
void |
SetWorldPosition(const Vector3& position) 设置当前场景对象在世界坐标系下的绝对位置。 |
void |
SetWorldRotation(const Vector3& rotation) 设置当前场景对象在世界坐标系下的旋转向量。 |
void |
SetWorldScale(const Vector3& scale) 设置当前场景对象在世界坐标系下的缩放向量。 |
const |
GetLocalPosition() const 获取局部坐标系下当前场景对象相对于父场景对象的位置。 |
const |
GetLocalRotation() const 获取当前场景对象在局部坐标系下的旋转向量(相对于父场景对象)。 |
const |
GetLocalScale() const 获取当前场景对象在局部坐标系下的缩放向量(相对于父场景对象)。 |
const |
GetWorldPosition() const 获取当前场景对象在世界坐标系下的绝对位置。 |
const |
GetWorldRotation() const 获取当前场景对象在世界坐标系下的旋转向量。 |
const |
GetWorldScale() const 获取当前场景对象在世界坐标系下的缩放向量。 |
const |
GetLocalToWorldMatrix() const 获取局部坐标转换为世界坐标的转换矩阵。 |
bool |
IsTransChanged() const 判断是否发生了平移变换。 |
void |
清空坐标变换标志位。 |
Constructor |
|---|
Transform(SceneObject* sceneObject= nullptr) 构造函数。 |
Parameters
Name |
Description |
|---|---|
sceneObject |
指定初始化的场景对象。 |
Destructor |
|---|
virtual ~Transform() 析构函数。 |
Method |
|---|
void Translate(const Vector3& translate) 局部坐标系下的平移变换。 |
Parameters
Name |
Description |
|---|---|
translate |
平移向量。 |
Parameters
Name |
Description |
|---|---|
angle |
旋转弧度。 |
axis |
旋转轴。 |
Method |
|---|
void SetLocalPosition(const Vector3& position) 设置局部坐标系下,当前场景对象相对于父场景对象的位置。 |
Parameters
Name |
Description |
|---|---|
position |
Vector3类型局部坐标系下待设置的位置。 |
Method |
|---|
void SetLocalRotation(const Vector3& rotation) 设置当前场景对象在局部坐标系下的旋转向量(相对于父场景对象)。 |
Parameters
Name |
Description |
|---|---|
rotation |
Vector3类型局部坐标系下的待设置旋转向量。各分量的值为弧度。 |
Method |
|---|
void SetLocalScale(const Vector3& scale) 设置当前场景对象在局部坐标系下的缩放向量(相对于父场景对象)。 |
Parameters
Name |
Description |
|---|---|
scale |
Vector3类型局部坐标系下的待设置缩放向量。各分量的值为弧度。 |
Method |
|---|
void SetWorldPosition(const Vector3& position) 设置当前场景对象在世界坐标系下的绝对位置。 |
Parameters
Name |
Description |
|---|---|
position |
Vector3类型给定世界坐标系下的位置。 |
Method |
|---|
void SetWorldRotation(const Vector3& rotation) 设置当前场景对象在世界坐标系下的旋转向量。 |
Parameters
Name |
Description |
|---|---|
rotation |
Vector3类型给定世界坐标系下的旋转向量。各分量的值为弧度。 |
Method |
|---|
void SetWorldScale(const Vector3& scale) 设置当前场景对象在世界坐标系下的缩放向量。 |
Parameters
Name |
Description |
|---|---|
scale |
Vector3类型给定世界坐标系下的缩放向量。 |
Method |
|---|
const Vector3& GetLocalPosition() const 获取局部坐标系下当前场景对象相对于父场景对象的位置。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回局部坐标系下当前场景对象相对于父场景对象的位置。 |
Method |
|---|
const Vector3& GetLocalRotation() const 获取当前场景对象在局部坐标系下的旋转向量(相对于父场景对象)。返回值各分量的值为弧度。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回当前场景对象在局部坐标系下的旋转向量(相对于父场景对象)。各分量的值为弧度。 |
Method |
|---|
const Vector3& GetLocalScale() const 获取当前场景对象在局部坐标系下的缩放向量(相对于父场景对象)。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回当前场景对象在局部坐标系下的缩放向量(相对于父场景对象)。 |
Method |
|---|
const Vector3& GetWorldPosition() const 获取当前场景对象在世界坐标系下的绝对位置。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回当前场景对象在世界坐标系下的绝对位置。 |
Method |
|---|
const Vector3& GetWorldRotation() const 获取当前场景对象在世界坐标系下的旋转向量。返回值各分量的值为弧度。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回当前场景对象在世界坐标系下的旋转向量。各分量的值为弧度。 |
Method |
|---|
const Vector3& GetWorldScale() const 获取当前场景对象在世界坐标系下的缩放向量。 |
Returns
Type |
Description |
|---|---|
const Vector3& |
返回当前场景对象在世界坐标系下的缩放向量。 |
Method |
|---|
const Matrix4& GetLocalToWorldMatrix() const 获取局部坐标转换为世界坐标的转换矩阵。 |
Returns
Type |
Description |
|---|---|
const Matrix4& |
局部坐标转换为世界坐标的转换矩阵。 |
Method |
|---|
bool IsTransChanged() const 判断是否进行了平移变换。 |
Returns
Type |
Description |
|---|---|
bool |
|
Method |
|---|
void ClearTransFlags() 清空坐标变换标志位。 |