If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
AndreL
Posts: 7 Joined: Sun Aug 12, 2012 4:16 pm
Post
by AndreL » Mon Aug 13, 2012 11:39 am
Hi,
i'm having problems finding out the color of the vertices in my mesh, is that info in the MeshBuffer?
Code: Select all
irr::scene::IMeshBuffer* mb=mesh->getMeshBuffer(i);
video::S3DVertex* vertices = (video::S3DVertex*)mb->getVertices();
the video::S3DVertex* vertices have the vertices right position, but now how do i find the colors?
CuteAlien
Admin
Posts: 9933 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Mon Aug 13, 2012 12:52 pm
AndreL
Posts: 7 Joined: Sun Aug 12, 2012 4:16 pm
Post
by AndreL » Mon Aug 13, 2012 8:26 pm
I'm really new at this and stuck at this point, could you please show me an example, how do i get access to the mesh vertex color?
CuteAlien
Admin
Posts: 9933 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Mon Aug 13, 2012 9:27 pm
You already got the pointer to vertices above - so you can just loop over them and get the color.
Something like:
Code: Select all
irr::scene::IMeshBuffer* mb=mesh->getMeshBuffer(i);
if ( mb->getVertexType () == EVT_STANDARD )
{
video::S3DVertex* vertices = (video::S3DVertex*)mb->getVertices();
for ( u32 v=0; v < mb->getVertexCount (); ++v )
{
video::SColor myCol = vertices[v].Color;
}
}
AndreL
Posts: 7 Joined: Sun Aug 12, 2012 4:16 pm
Post
by AndreL » Tue Aug 14, 2012 12:14 am
Thanks CuteAlien, however, myCol is returning all white for all vertices.
CuteAlien
Admin
Posts: 9933 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Tue Aug 14, 2012 7:47 am
I don't know anything about your .obj file ... maybe they are white?
AndreL
Posts: 7 Joined: Sun Aug 12, 2012 4:16 pm
Post
by AndreL » Tue Aug 14, 2012 8:53 am
it's just a plane exported in maya, with a texture file, just red. 4 vertices, 6 indexes.
hybrid
Admin
Posts: 14143 Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:
Post
by hybrid » Tue Aug 14, 2012 9:29 am
.obj does not support vertex color IIRC.
mongoose7
Posts: 1227 Joined: Wed Apr 06, 2011 12:13 pm
Post
by mongoose7 » Tue Aug 14, 2012 12:12 pm
Kd?
Anyway, he's exported with a texture and expects the vertices to have the colour of the texture. The vertices are white, the texture is read. Enough said.
MTLZ
Posts: 11 Joined: Wed Apr 25, 2012 1:39 pm
Location: Paris, France
Contact:
Post
by MTLZ » Sat Jan 04, 2014 9:34 am
Sorry to bring back this thread but I have exactly the same problem.
I'm looking for a mesh format that support materials and vertex colors. I though "obj" was the one but there is no vertex color.
Can anyone advice me which format Irrlicht can import with materials and vertex color ?
Thanks.