The resource (linked below) has been updated with this information.

http://coding.valve-erc.com/?alias=map2dxf

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of David Speyrer
Sent: Wednesday, October 09, 2002 1:51 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [hlcoders] VALVe : map to dxf...


This code assumes that every vertex in the solid can be referred to by a
unique index, so a rectangular solid would have 8 verts with indices from 0
to 7. CreatePointIndexList fills out an array with the indices of verts on
the given face in clockwise winding order. GetConnectionVertex returns the
vertex between the two given edges. The code for CreatePointIndexList is
below.

Hope this helps!
-- David

//
// Create point list, but return indices instead of vertices.
//
PINT CSSolid::CreatePointIndexList(CSSFace &face, PINT piPoints)
{
        PINT pts;
        int nPts = 0;

        if (piPoints)
                pts = piPoints;
        else
                pts = new int[face.nEdges+1];

        SSHANDLEINFO hi;

        for (int i = 0; i < face.nEdges; i++)
        {
                // calc next edge so we can see which is the next clockwise
point
                int iNextEdge = i+1;
                if (iNextEdge == face.nEdges)
                        iNextEdge = 0;

                CSSEdge *edgeCur = (CSSEdge*) GetHandleData(face.Edges[i]);
                CSSEdge *edgeNext = (CSSEdge*)
GetHandleData(face.Edges[iNextEdge]);

                SSHANDLE hVertex = GetConnectionVertex(edgeCur, edgeNext);
                ASSERT(hVertex);

                GetHandleInfo(&hi, hVertex);
                pts[i] = hi.iIndex;
        }

        return pts;
}


-----Original Message-----
From: Cortex [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 07, 2002 1:11 PM
To: [EMAIL PROTECTED]
Subject: [hlcoders] VALVe : map to dxf...


Hello,

I'm trying to create a map to dxf converter, using the code that Valve gave
gratefully (http://www.coding.valve-erc.com) ;) But I don't understand the
LAST (!!) loop :( Here's the malicious piece of code :) :

   // triangulate each face and write
   for(i = 0; i < m_nFaces; i++)
   {
      CSSFace &face = m_Faces[i];
      PINT pVerts = CreatePointIndexList(face);

      for(int v = 0; v < face.nEdges; v++)
         pVerts[v]++;

      for(v = 0; v < face.nEdges-2; v++)
      {
         fprintf(stream, "0\nVERTEX\n8\n%s\n10\n0\n20\n0\n30\n"
            "0\n70\n128\n71\n%d\n72\n%d\n73\n%d\n", szName,
            v == 0 ? pVerts[0] : -pVerts[0],
            pVerts[v+1],
            v == (face.nEdges-3) ? pVerts[v+2] : -pVerts[v+2]
            );
      }
   }

I only need more informations about the CSSFace class (the members), the
CreatePointIndexList and the calculation of the "nEdges" member of CSSFace
:) Then, I'll be able to understand what gets done, and be able to merge it
to my code.

Thanks to anyone who could help me ;)

     - Cortex : HL Albator coder and mapper ( www.hlalbator.fr.st )
     - email : [EMAIL PROTECTED]  &  ICQ : 71548738



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to