projecting pieces of texture

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.
Post Reply
AndreL
Posts: 7
Joined: Sun Aug 12, 2012 4:16 pm

projecting pieces of texture

Post by AndreL »

Please help.

I have a simple question - having a triangulated mesh, and knowing the position of 3 vertices (a triangle), how do I project the same texture whitin the 3 vertices fo the other 3 vertices defined by me?

Code: Select all

 
irr::scene::IAnimatedMesh* mesh = smgr->getMesh(".../newWallY.obj");  //the plane with 36 vertices
...
irr::scene::IMeshBuffer* mb=mesh->getMeshBuffer(i);
video::S3DVertex* vertices = (video::S3DVertex*)mb->getVertices();
 
Thank You!
AndreL
Posts: 7
Joined: Sun Aug 12, 2012 4:16 pm

Re: projecting pieces of texture

Post by AndreL »

i have this too:

irr::scene::IMesh* meshT = smgr->getMeshManipulator()->createMeshWith2TCoords(mesh->getMesh(0));
irr::video::S3DVertex2TCoords* verts2t = (irr::video::S3DVertex2TCoords*)meshT->getMeshBuffer(0)->getVertices();

having verts2t for each vertex, what do i do with them to extract a texture triangle?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: projecting pieces of texture

Post by hybrid »

Sorry, your question is still not clear to me. And seems like this also holds for most others. Maybe try to give a more comprehensible description and maybe some screenshot or sketch.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: projecting pieces of texture

Post by mongoose7 »

You could use the (x, y) coordiantes for (u, v), or the (y, z) or the (x, z). They may need to be scaled and biased because u and v range from 0.0 to 1.0. These are the planar projections. With a bit of maths, though, you can do planar projections on any plane. If you want the texture to "wrap" you could use polar coordinates. Or do you just want a tool like UVMapper?
Post Reply