mesh.xml how to draw lines

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
vanceg
Gnoblar
Posts: 2
Joined: Sat Dec 31, 2016 11:22 pm

mesh.xml how to draw lines

Post by vanceg »

Hi,

I would like to load a mesh:

Code: Select all

m_pTestEntity = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("TestEntity", "Origin.mesh");
which contains lines. Is it possible to create an <X>.mesh.xml that contains lines instead of faces?

I have tried to use a "face" with same 2 vertexes but noting rendered. Maybe there is another trick that can achieve this?

Code: Select all

<mesh>
    <submeshes>
        <submesh material="Material" usesharedvertices="false">
            <faces count="1">
                <face v1="1" v2="0" v3="1"/>
            </faces>
            <geometry vertexcount="2">
                <vertexbuffer positions="true" normals="true">
                    <vertex>
                        <position x="0.000000" y="0.000000" z="0.000000"/>
                        <normal x="0.000000" y="-0.000000" z="-1.000000"/>
                    </vertex>
                    <vertex>
                        <position x="1.000000" y="0.000000" z="0.000000"/>
                        <normal x="0.000000" y="-0.000000" z="-1.000000"/>
                    </vertex>
                </vertexbuffer>
            </geometry>
        </submesh>
    </submeshes>
</mesh>
Trying to avoid having to use a ManualObject to draw bunch of lines in code...

Thank you!
Vance
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: mesh.xml how to draw lines

Post by dark_sylinc »

Your line:

Code: Select all

<submesh material="Material" usesharedvertices="false">
Should be replaced with:

Code: Select all

<submesh material="Material" usesharedvertices="false" operationtype="line_list">
Otherwise you will be trying to render a triangle with 2 vertices (which won't work), instead of a line.
vanceg
Gnoblar
Posts: 2
Joined: Sat Dec 31, 2016 11:22 pm

Re: mesh.xml how to draw lines

Post by vanceg »

Thank you! Thank worked !
Didn't know "line_list" existed since it is not in the DTD: http://www.ogre3d.org/tikiwiki/tiki-ind ... eshxml+DTD
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: mesh.xml how to draw lines

Post by dark_sylinc »

Added the missing entries to the DTD. Thanks.
Post Reply