【问题标题】:VertexDeclaration is not included OGRE::VES_DEFFUSE不包含 VertexDeclaration OGRE::VES_DEFFUSE
【发布时间】:2014-12-26 07:50:02
【问题描述】:

我在我的 Ogre 程序中加载了一个实体。然后在 vertexDeclaration 中列出 Elements,如下所示。

Ogre::VertexDeclaration::VertexElementList lst = vertex_data->vertexDeclaration->getElements();

在列表中,我只看到了 VES_POSITION 和 VES_NORMAL。因此,当我运行以下代码时,

const Ogre::VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_DIFFUSE);

posElem 不包含任何内容或为空。如何访问这种不存在的元素?有可能吗?然后我在我的实体中添加了如下材料。这次模型成功加载了材质和漫反射属性。但问题仍然存在。这意味着 VertexDeclaration 不包含具有 VES_DEFFUSE 语义的元素(仅 VES_POSITION 和 VES_NORMAL)。我还加载了一些其他模型,但它们都没有具有 VES_DEFFUSE 语义的元素。

material base_mesh
{

technique
{
pass
{
lighting on
ambient 0.3 0.3 0.3 1
diffuse 0.1 0.7 0.2 1
emissive 0 0 0 1


}
}
}

【问题讨论】:

  • 如果网格没有特定属性 - 为什么它会出现在运行时?您的网格数据和具体问题是什么?

标签: c++ vertex ogre3d


【解决方案1】:

我使用 OgreXmlConverter 将我的网格文件转换为 xml 文件。然后编辑 xml 文件并将 colour_diffuse 标签添加到每个顶点标签,如下所示(示例):

<vertex>
<position y="2.779611" x="0.272802" z="0.245147"/>
<normal y="-0.291635" x="0.955870" z="0.034669"/>
<colour_diffuse value="1 1 1 1" /></vertex>
<vertex>

然后转换回网格文件。现在在 VertexDeclaration 中我们有 VES_DEFFUSE 语义元素。

【讨论】:

    猜你喜欢
    • 2012-05-16
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-19
    相关资源
    最近更新 更多