/** ** File : vsplit.h ** Description: vsplit implementations **/ #ifndef _vsplit_h_ #define _vsplit_h_ #include "excptn.h" typedef float WEDGEATTRD[5]; // wedge attribute delta /* * Vertex split record. * Records the information necessary to split a vertex of the mesh, * in order to add to the mesh 1 new vertex and 1 or 2 new faces. */ class Vsplit { public: /* * Default operator=() and copy_constructor are safe. */ void read(istream& is); void write(ostream& os) const; void OK() const { }; int adds_two_faces() const { return 0; }; /* * This format provides these limits: * - maximum number of faces: 1<<32 * - maximum vertex valence: 1<<16 * - maximum number of materials: 1<<16 * * Encoding of vertices vs, vl, vr. * Face flclw is the face just CLW of vl from vs. * vs is the vs_index\'th vertex of flclw * (vl is the (vs_index+2)%3\'th vertex of face flclw) * vr is the (vlr_offset1-1)\'th vertex when rotating CLW about vs * from vl * * Special cases: * - vlr_offset1==1 : no_vr and no_fr * - vlr_offest1==0: no flclw! vspl.flclw is actually flccw. */ DWORD flclw; // 0..(mesh.numFaces()-1) WORD vlr_offset1; // 0..(max_vertex_valence) (prob < valence/2) WORD code; // (vs_index(2),ii(2),ws(3),wt(3),wl(2),wr(2), // fl_matid>=0(1),fr_matid>=0(1)) enum { B_STMASK=0x0007, B_LSAME=0x0001, B_RSAME=0x0002, B_CSAME=0x0004, // B_LRMASK=0x0003, B_ABOVE=0x0000, B_BELOW=0x0001, B_NEW =0x0002, // must be on separate bit. }; enum { VSINDEX_SHIFT=0, VSINDEX_MASK=(0x0003< do entropy coding on (ii,wl,wr,ws,wt) symbol as a whole. * * Face attribute values (usually predicted correctly) * these are defined only if {L,R}NF respectively * otherwise for now they are set to 0 */ WORD fl_matid; WORD fr_matid; /* * Vertex attribute deltas: * ----------------------- * for ii==2: vad_large=new_vt-old_vs, vad_small=new_vs-old_vs * for ii==0: vad_large=new_vs-old_vs, vad_small=new_vt-old_vs * for ii==1: vad_large=new_vt-new_i, vad_small=new_i-old_vs * where new_i=interp(new_vt,new_vs) */ float vad_large[3]; float vad_small[3]; // is zero if "MeshSimplify -nofitgeom" /* * Wedge attribute deltas (size 1--6) * Order: [(wvtfl, wvsfl), [(wvtfr, wvsfr)], wvlfl, [wvrfr]] * [nx, ny, nz, s, t] */ float ar_wad[6][5]; /* * Indicates if the Vsplit has been modified or not */ BOOL modified; private: int expected_wad_num() const; }; class VsplitArray { private: DWORD m_cRef; Vsplit* m_vsarr; DWORD numVS; public: void write(ostream& os) const; ULONG AddRef(void); ULONG Release(void); Vsplit& elem(DWORD i) { return m_vsarr[i]; }; VsplitArray(DWORD i); }; #endif _vsplit_h_