/*****************************************************************************/ /* */ /* F I S T : Fast, Industrial-Strength Triangulation */ /* */ /*****************************************************************************/ /* */ /* (C) Martin Held */ /* (C) Universitaet Salzburg, Salzburg, Austria */ /* */ /* This code is not in the public domain. All rights reserved! Please make */ /* sure to read the full copyright statement contained in api_functions.cpp. */ /* */ /*****************************************************************************/ /* */ /* get standard libraries */ /* */ #include /* */ /* get my header files */ /* */ #include "sgo.h" /* #include "martin.h" #include "defs.h" #include "header.h" */ /* */ /* function prototypes of functions provided in this file */ /* */ void WriteFileMagic(FILE *fp); void WriteFileEnd(FILE *fp); void WriteObjType(FILE *fp, int num_tri); void WriteSgiTri(FILE *fp, float sgi_tri[3][3]); /* */ /* SGI's defs */ /* */ #define OBJ_QUADLIST 1 #define OBJ_TRILIST 2 #define OBJ_TRIMESH 3 #define OBJ_END 4 #define OP_BGNTMESH 1 #define OP_SWAPTMESH 2 #define OP_ENDBGNTMESH 3 #define OP_ENDTMESH 4 #define SOMAGIC 0x5424 #define FASTMAGIC 0x5423 const float null_color[3] = { 1.0, 0.0, 0.0 }; const float null_normal[3] = { 0.0, 0.0, 0.0 }; void WriteFileMagic(FILE *fp) { long magic = SOMAGIC; fwrite(&magic, sizeof(long), 1, fp); return; } int mycount = 0; void WriteFileEnd(FILE *fp) { long end = OBJ_END; fwrite(&end, sizeof(long), 1, fp); return; } void WriteObjType(FILE *fp, int num_tri) { long type_and_count[2]; type_and_count[0] = OBJ_TRILIST; type_and_count[1] = num_tri * 27; fwrite(&type_and_count[0], 4, 2, fp); return; } void WriteSgiTri(FILE *fp, float sgi_tri[3][3]) { fwrite(&null_normal[0], 4, 3, fp); fwrite(&null_color[0], 4, 3, fp); fwrite(&sgi_tri[0][0], 4, 3, fp); fwrite(&null_normal[0], 4, 3, fp); fwrite(&null_color[0], 4, 3, fp); fwrite(&sgi_tri[1][0], 4, 3, fp); fwrite(&null_normal[0], 4, 3, fp); fwrite(&null_color[0], 4, 3, fp); fwrite(&sgi_tri[2][0], 4, 3, fp); return; }