Help with strip faces

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
h3x3r
Posts: 165
Joined: Wed Jun 01, 2016 5:53 pm

Help with strip faces

Post by h3x3r »

Hi everyone. Can somebody please help me out output strip faces with 010 hex editor template?
I wrote base template but i need compose other code to it and i don't know how...

This is base template:

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File:
//   Authors:
//   Version:
//   Purpose:
//  Category:
// File Mask:
//  ID Bytes:
//   History:
//------------------------------------------------
local int i;
local string VT="vt",V="v",F="f";
uint MAGIC,UNK0,UNK1,NULL;
float VAL0,VAL1,VAL2,VAL3;
float VAL4,VAL5,VAL6,VAL7;
uint FLAG,FACE_COUNT,VTX_BLOCK_SIZE,NULL;
local uint VERTEX_COUNT=VTX_BLOCK_SIZE-48;

struct {
    for( i = 0; i < VERTEX_COUNT/28; i++ )
    struct{
        float X,Y,Z,UVU,UVV,UNK0,UNK1;
        Printf("%s %f %f %f\n",V,X,Y,Z);
        Printf("%s %f %f\n",VT,UVU,-UVV);
    }VTX;
}VTX_BLOCK;

struct {
    for( i = 0; i < FACE_COUNT/3; i++ )
    {
        WORD f1,f2,f3;
        Printf("%s %u %u %u\n",F,f1+1,f2+1,f3+1);
    }
}FACE_INDICES;


And code for implementing:

Code: Select all

void build_TriList (WORD VertexCount)
{   
   int faceDir, startDir= -1 ;
   WORD a=0, b=1, cnt=0, f1,f2,f3 ;

   f1 = a + 1 ;
   f2 = b + 1 ;
   faceDir = startDir ;
   do {
      cnt++ ;   f3 = cnt ;
      faceDir *= -1 ;
      if ((f1!=f2)&&(f2!=f3)&&(f3!=f1)) {
         if (faceDir > 0) fprintf( stream, "f %d %d %d\n", f1, f2, f3 ) ;
         else fprintf( stream, "f %d %d %d\n", f1, f3, f2 ) ;
      }
      f1 = f2 ;
      f2 = f3 ;
   } while (cnt < VertexCount) ;
}

Attached sample file. I appreciate any help. Thanks in advance!