本页内容

Qt3DExtras::QSphereGeometry Class

class Qt3DExtras::QSphereGeometry

QSphereGeometry 类可用于在三维空间中创建一个球体。更多内容...

头文件: #include <Qt3DExtras/QSphereGeometry>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
在 QML 中: SphereGeometry
继承自: Qt3DCore::QGeometry
状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

QSphereGeometry(Qt3DCore::QNode *parent = nullptr)
bool generateTangents() const
Qt3DCore::QAttribute *indexAttribute() const
Qt3DCore::QAttribute *normalAttribute() const
Qt3DCore::QAttribute *positionAttribute() const
float radius() const
int rings() const
int slices() const
Qt3DCore::QAttribute *tangentAttribute() const
Qt3DCore::QAttribute *texCoordAttribute() const
void updateIndices()
void updateVertices()

公共槽位

void setGenerateTangents(bool gen)
void setRadius(float radius)
void setRings(int rings)
void setSlices(int slices)

信号

void generateTangentsChanged(bool generateTangents)
void radiusChanged(float radius)
void ringsChanged(int rings)
void slicesChanged(int slices)

详细说明

QSphereGeometry 类最常在QSphereMesh 内部使用,但也可用于自定义的Qt3DRender::QGeometryRenderer 子类中。

属性文档

generateTangents : bool

存储自动生成切向量标志的值。切向量与法向量正交。

访问函数:

bool generateTangents() const
void setGenerateTangents(bool gen)

通知信号:

void generateTangentsChanged(bool generateTangents)

[read-only] indexAttribute : Qt3DCore::QAttribute* const

存储几何索引属性。

访问函数:

Qt3DCore::QAttribute *indexAttribute() const

[read-only] normalAttribute : Qt3DCore::QAttribute* const

存储几何体法线属性。

访问函数:

Qt3DCore::QAttribute *normalAttribute() const

[read-only] positionAttribute : Qt3DCore::QAttribute* const

存储几何体位置属性。

访问函数:

Qt3DCore::QAttribute *positionAttribute() const

radius : float

存储球体的半径。

访问函数:

float radius() const
void setRadius(float radius)

通知信号:

void radiusChanged(float radius)

rings : int

存储球体中的环的数量。

访问函数:

int rings() const
void setRings(int rings)

通知信号:

void ringsChanged(int rings)

slices : int

存储球体中的切片数量。

访问函数:

int slices() const
void setSlices(int slices)

通知信号:

void slicesChanged(int slices)

[read-only] tangentAttribute : Qt3DCore::QAttribute* const

存储几何体的切线属性。

访问函数:

Qt3DCore::QAttribute *tangentAttribute() const

[read-only] texCoordAttribute : Qt3DCore::QAttribute* const

存储几何体纹理坐标属性。

访问函数:

Qt3DCore::QAttribute *texCoordAttribute() const

成员函数文档

[explicit] QSphereGeometry::QSphereGeometry(Qt3DCore::QNode *parent = nullptr)

使用parent 创建一个新的 QSphereGeometry。

void QSphereGeometry::updateIndices()

根据环和切片的属性更新索引。

void QSphereGeometry::updateVertices()

根据环、切片和半径属性更新顶点

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.