本文介绍了Qt3D 默认统一和属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习在 QML 中使用着色器,我找不到任何关于传递给着色器的默认统一和属性值的参考.在某些示例中,我们可以看到其中的几个,例如 vertexPositionmodelViewProjection(也作为 modelViewProjection>mvp),但是没有包含我们可以使用的所有变量的明确列表.

在 Qt 源代码中调查后,我发现了许多变量的默认名称:

  1. 统一变量(在 renderview.cpp 中找到)
    • modelMatrix
    • viewMatrix
    • 投影矩阵
    • 模型视图
    • viewProjectionMatrix
    • modelViewProjection
    • MVP
    • 逆模型矩阵
    • inverseViewMatrix
    • 逆投影矩阵
    • inverseModelView
    • inverseViewProjectionMatrix
    • inverseModelViewProjection
    • modelNormalMatrix
    • modelViewNormal
    • 视口矩阵
    • inverseViewportMatrix
    • 曝光
    • 伽玛
    • 时间
    • 眼睛位置
  2. 属性(在 qattribute.cpp 中找到)
    • 顶点位置
    • vertexNormal
    • 顶点颜色
    • vertexTexCoord
    • vertexTangent

仅此而已吗?这些变量在很大程度上足以开发我现在正在做的大多数着色器,但我只是想知道我是否遗漏了什么.

解决方案

确认@aRaMinet 所说的部分内容来源

I began to learn using shaders with QML, and I can't find any references that talk about default uniform and attribute values that are passed to the shaders. In certain examples, we can saw several of them like vertexPosition or modelViewProjection (that is also passed as mvp), but there is no clear list containing all the variables that we can use.

After investigating in Qt source code, I found out default name for many variables:

  1. uniform variables (found in renderview.cpp)
    • modelMatrix
    • viewMatrix
    • projectionMatrix
    • modelView
    • viewProjectionMatrix
    • modelViewProjection
    • mvp
    • inverseModelMatrix
    • inverseViewMatrix
    • inverseProjectionMatrix
    • inverseModelView
    • inverseViewProjectionMatrix
    • inverseModelViewProjection
    • modelNormalMatrix
    • modelViewNormal
    • viewportMatrix
    • inverseViewportMatrix
    • exposure
    • gamma
    • time
    • eyePosition
  2. attributes (found in qattribute.cpp)
    • vertexPosition
    • vertexNormal
    • vertexColor
    • vertexTexCoord
    • vertexTangent

Is that all? These variables are largely sufficient to develop most oh the shaders I am doing right now, but I just want to know if I miss something.

解决方案

to confirm part of what @aRaMinet saidsource Qt Documentation

这篇关于Qt3D 默认统一和属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 02:37