Giving meshes that "retro" look

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
bicunisa
Posts: 34
Joined: Thu Apr 27, 2006 10:34 pm
Contact:

Giving meshes that "retro" look

Post by bicunisa »

Hi guys,


I was wondering what is needed to give my meshes that "retro" look from old 3d games where everything was just done with wireframes.

I tried using this on one of those cubes you can get within Irrlicht:

cube->setMaterialFlag(EMF_WIREFRAME, true);

But it isn't cutting it. The wireframe shows the 2 triangles that form each cube face. What would I need to do to only show the faces (square ones) as wireframe?
OMG another MMORPG project! AztlanRPG
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You could do it with a shader, if you know how to write and use shaders...

Or you could probably do it with textures...
Image Image Image
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

you could use a texture and draw every triangle of the mesh by calling
(don't know the exact syntax, sry for that)

Code: Select all

core::triangle3df* tri = node->getTriangleSelector()->getTriangles();
//dont forget to set a material to driver with video::EMF_LIGHTING = false and the right transform state here
for(u32 i = 0; i < node->getTriangleSelector()->getTriangleCount () ; i++)
driver->drawTriangle3D(tri[i]);
in your main render loop after smgr->drawAll();
hope it helps.
i love skateboarding!
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

EMF_WIREFRAME gives the same result.

Code: Select all

+------+
|\     |
| \    |
|  \   |
|   \  |
|    \ |
|     \|
+------+
but he wants

Code: Select all

+-------+
|       |
|       |
|       |
|       |
|       |
|       |
|       |
+-------+
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

ah ok, i thought he wanted textures and the wireframe.
i love skateboarding!
asparagusx
Posts: 81
Joined: Thu Oct 16, 2008 6:50 am

Post by asparagusx »

I think what you want is this :

Image

This is a wireframe model of a building. It is not made up of triangles, but you need the 'outlines' of the various objects that define your model and this can achieved by defining the vertices of the objects. I use the following code :

Code: Select all

void DCELFace::AddLine(HEDGEPTR E,SMeshBuffer *pBuffer,const vector3df &p1,const vector3df &p2)
   {
   long Size = pBuffer->Vertices.size();
   S3DVertex vb;

   if (Size + 2 < 65534L)
      {
	   vb.Color = pBuffer->getMaterial().DiffuseColor;
      vb.Pos = p1;
      pBuffer->Vertices.push_back(vb);
      pBuffer->BoundingBox.addInternalPoint(p1); 
      
      vb.Pos = p2;
      pBuffer->Vertices.push_back(vb);
      pBuffer->BoundingBox.addInternalPoint(p2); 
      }
   }   
   
   
void DCELFace::Wireframe(void)
   {
   SMeshBuffer *pW = (SMeshBuffer *) List->Wireframe->Buffer();   
   HEDGEPTR walkerE;
   I3DPNT ws,w1,w2;
   UINT i;
   
   if (walkerE = edge)
      {
      bool start = true;  
      
      do
         {
         w2 = walkerE->origin->Vertex();
         if (start)
            {
            ws = w2;
            start = false;
            }
         else
            AddLine(walkerE,pW,w1,w2);
         w1 = w2;                              
         walkerE = walkerE->next;
         }
      while (walkerE != edge);
      AddLine(walkerE,pW,w2,ws);  
      }
	if (Holes)      
		for (i = 0; i != Holes->size(); ++i)   
			Holes->at(i)->Wireframe();
   }   

(this is code from an application and is not supposed to be used 'as is'). The basic concept is to 'travel' around the edges of each face and add lines to a vertex buffer, which is then displayed using :

Code: Select all

driver->drawVertexPrimitiveList(
					pWireframe->getVertices(), pWireframe->getVertexCount(),
					pWireframe->getIndices(), pFaceList->numLines,EVT_STANDARD, scene::EPT_LINES,EIT_16BIT);
where pWireframe is a SMeshBuffer.

Maybe this might give you some ideas.

Anton
Post Reply