00001 /***************************************************************************** 00002 * $Id: adsomodel.h,v 1.6 2003/06/27 08:36:41 schou Exp $ 00003 * Author: Jakob Schou Jensen <schou@sourceforge.net> 00004 * Licence: GPL 00005 * 00006 * Description: Adso model represent a 3d object 00007 * 00008 ****************************************************************************/ 00009 00015 #ifndef ADSOMODEL_H 00016 #define ADSOMODEL_H 00017 00018 #include <adsomath.h> 00019 #include <adsobase.h> 00020 #include <adsosurf.h> 00021 00022 class AdsoModel { 00023 public: 00024 int count; 00025 int v_count; 00026 int *offs; 00027 int *len; 00028 vnt3f *vl; 00029 00030 // Culling parameters 00031 v3f *boundPoints; 00032 int nBoundPoints; 00033 00034 // Child models 00035 float matrix[16]; // translation/rotation 00036 float pivot, pivot2; 00037 00038 vnt3f *getTri(){ return &vl[0]; } 00039 int triCount(){ return len[0]; } 00040 00041 vnt3f *getStrip(int i){ return &vl[i+1]; } 00042 int stripLen(int i){ return len[i+1]; } 00043 int stripCount(){ return count-1; } 00044 00045 int verticeCount(){ return v_count; } 00046 00047 void draw(int method, AdsoDC *dc); 00048 00049 int load(FILE *file); 00050 int save(FILE *file); 00051 00052 AdsoModel(int c, int s){ 00053 int i; 00054 vl = new vnt3f[s]; 00055 offs = new int[c]; 00056 len = new int[c]; 00057 count = c; 00058 v_count = s; 00059 boundPoints = 0; 00060 nBoundPoints = 0; 00061 00062 pivot = 0; 00063 pivot2 = 0; 00064 for(i=0;i<16;i++) matrix[i] = (i%5==0)?1.0f:0.0f; 00065 } 00066 00067 AdsoModel(){ 00068 int i; 00069 count=0; 00070 v_count = 0; 00071 boundPoints = 0; 00072 nBoundPoints = 0; 00073 00074 pivot = 0; 00075 for(i=0;i<16;i++) matrix[i] = (i%5==0)?1.0f:0.0f; 00076 } 00077 }; 00078 00079 class AdsoModelBuild { 00080 public: 00081 Set<vnt3f> tris; 00082 // could add: Set<Set<strips>> strips; 00083 float matrix[16]; 00084 00085 void build(AdsoModel *m); 00086 }; 00087 00088 // Note that only one level supported in the hierarchical model 00089 00090 class AdsoHierModel { 00091 public: 00092 AdsoModel *childList; 00093 int nChilds; 00094 AdsoModel top; 00095 int disableChild; 00096 00097 void draw(int method, AdsoDC *dc); 00098 00099 int load(FILE *file); 00100 int save(FILE *file); 00101 AdsoHierModel *clone(); 00102 00103 AdsoHierModel(int n){ 00104 childList = new AdsoModel[n]; 00105 nChilds = n; 00106 } 00107 00108 AdsoHierModel(){ 00109 childList = 0; 00110 nChilds = 0; 00111 disableChild = -1; 00112 } 00113 }; 00114 00115 #endif 00116
1.3.2