TextureData QML Type
自定义纹理数据的基本类型。更多
Import Statement: | import QtQuick3D |
In C++: | QQuick3DTextureData |
Inherits: | |
Inherited By: |
详细说明
自定义纹理数据允许使用应用程序生成的纹理数据,这些数据也可能动态变化。要使用自定义纹理数据,请设置Texture 的textureData 属性以引用 TextureData 对象。
自定义纹理数据在 C++ 中是通过创建QQuick3DTextureData 实例(通常是子类)来实现的。QQuick3DTextureData 类型以 TextureData 的名称注册到 QML 中。一旦子类注册到 QML,Texture 对象就可以开始引用它。
使用此 API 的一个例子是,需要在运行时程序化地生成纹理,而不是从文件加载静态图像。
import MyCustomTexture 1.0 Model { source: "#Cube" materials: [ DefaultMaterial { diffuseMap: diffuseMapCustomTexture } ] } Texture { id: diffuseMapCustomTexture textureData: MyCustomTextureData { } }
另请参阅 Texture 。
© 2025 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.