qt - qt 3d Qml 透明 Scene2D 纹理
问题描述
如何在没有此默认灰色背景的情况下渲染网格纹理?我的意思是,使用 Scene2D 组件来生成带有 alpha 的纹理。现在看起来我的红色矩形下方有 PhonMaterial。
Entity {
id: root
components: [cubeTransform, cubeMaterial, cubeMesh]
PlaneMesh {
id: cubeMesh
width: 10
height: 10
}
Transform {
id: cubeTransform
translation: Qt.vector3d(0, 4, 0)
scale3D: Qt.vector3d(1, 1, 1)
}
TextureMaterial {
id: cubeMaterial
texture: textureId
}
Scene2D {
id: qmlTexture
output: RenderTargetOutput {
attachmentPoint: RenderTargetOutput.Color0
texture: Texture2D {
id: textureId
width: 100
height: 1024
format: Texture.RGBA8_UNorm
generateMipMaps: true
magnificationFilter: Texture.Linear
minificationFilter: Texture.LinearMipMapLinear
wrapMode {
x: WrapMode.ClampToEdge
y: WrapMode.ClampToEdge
}
}
}
Rectangle {
x: 50
width: 50
height: textureId.height
color: "red"
}
}
}
现在,一半的网格是红色的(应该如此),但第二个是白色的,而不是透明的。
解决方案
推荐阅读
- c# - 从数组创建列表的效率
- typescript - 当条件总是计算为假时,TypeScript 是否应该发出警告?
- python - 滚动条显示但不滚动动态创建的组合框小部件
- ios - 由 jonkykong Scale Animation 制作的 SideMenu 导致演示文稿出现布局问题
- ide - 在 Rider ide 中更改 Debug 中值的字体大小
- apache-nifi - ControllerServiceInstantiationException 试图将 NiFi 从 1.5.0 升级到 1.8.0
- javascript - JQuery position() 在 Safari 中返回零
- java - (不)Netty 调用 System.gc()
- html - 我正在使用 ionic 4 制作应用程序。当我尝试从 ts 文件创建按钮时,按钮确实显示在浏览器上但是(onclick)功能不起作用
- c# - 如何使用 linq 改进查询