[Alliance CVS] pcs2 ase_dstructs.h, 1.10, 1.11 ase_file.cpp, 1.9, 1.10 ase_file.h, 1.10, 1.11 pcs2.
Status: Pre-Alpha
Brought to you by:
kazan
Update of /cvsroot/alliance/pcs2 In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv3649 Modified Files: ase_dstructs.h ase_file.cpp ase_file.h pcs2.cpp pcs2_filethread.cpp pcs_file.cpp pcs_file.h pcs_file_dstructs.h vector3d.cpp Log Message: Disable ASE after more trying to get it working. Format found to be unreliable. Index: ase_dstructs.h =================================================================== RCS file: /cvsroot/alliance/pcs2/ase_dstructs.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ase_dstructs.h 11 Feb 2008 13:19:40 -0000 1.10 --- ase_dstructs.h 12 Feb 2008 18:59:49 -0000 1.11 *************** *** 14,17 **** --- 14,20 ---- * * $Log$ + * Revision 1.11 2008/02/12 18:59:49 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.10 2008/02/11 13:19:40 kazan * Few tweaks to the loader from what i learned by loading the Sol City ASE *************** *** 204,207 **** --- 207,225 ---- //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + // this is a more portal vertex we can export to + struct ase_compat_vertex + { + vector3d point; + float u; + float v; + }; + + struct ase_compat_face + { + std::vector<ase_compat_vertex> verts; + vector3d normal; + }; + + //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- struct mesh *************** *** 219,222 **** --- 237,243 ---- std::string write(); + ase_compat_face fetchCompatface(int facenum); + std::vector<ase_compat_face> getCompatFaces(); + }; *************** *** 256,259 **** --- 277,281 ---- }; + }; // namespace ase Index: ase_file.cpp =================================================================== RCS file: /cvsroot/alliance/pcs2/ase_file.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ase_file.cpp 11 Feb 2008 13:19:40 -0000 1.9 --- ase_file.cpp 12 Feb 2008 18:59:50 -0000 1.10 *************** *** 14,17 **** --- 14,20 ---- * * $Log$ + * Revision 1.10 2008/02/12 18:59:50 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.9 2008/02/11 13:19:40 kazan * Few tweaks to the loader from what i learned by loading the Sol City ASE *************** *** 55,121 **** //**************************************************************************** ! // Loader //**************************************************************************** ! bool ase_file::LoadFromFile(std::string &filename) { ! ifstream in(filename.c_str(), ios::in | ios::binary); ! if (!in) ! throw ase_exception(string("Could not open file ") + filename.c_str()); ! // ---------------------------------------------- ! int i = 0; ! string sTemp, sTemp2; ! /* ! map<int, char> braces; ! map<int, int> brace_pairs; ! while (true) { ! in.ignore(INT_MAX, '{'); ! if (!in.eof()) ! { ! braces[int(in.tellg())-1] = '{'; ! } ! else ! break; } ! // ---------------------------------------------- ! //reset the seek position to the start ! in.seekg(0, ios::beg); ! in.clear(); ! while (true) { ! in.ignore(INT_MAX, '}'); ! if (!in.eof()) { ! braces[int(in.tellg())-1] = '}'; } - else - break; } ! // ---------------------------------------------- ! in.seekg(0, ios::beg); ! in.clear(); ! stack<int> bracestack; ! for (map<int, char>::iterator it = braces.begin(); it != braces.end(); it++) ! { ! if ((*it).second == '{') ! bracestack.push((*it).first); ! if ((*it).second == '}') ! { ! iTemp = bracestack.top(); ! bracestack.pop(); ! brace_pairs[iTemp] = (*it).first-iTemp; ! } ! }*/ in >> sTemp; --- 58,193 ---- + vector3d ase::ASE_Translate_Vector(vector3d vec) + { + vector3d retval = vec; + retval.x = -retval.x; + return retval; + } + //**************************************************************************** ! // Misc Functions //**************************************************************************** + bool ase_file::validSubmat(int matid, int submatid) + { + if ((unsigned int)matid > material_list.size()) + throw ase_exception("Matid out of range"); + + return matid != 0 && ((unsigned int)submatid)-1 < material_list[matid].submats.size(); + } + + //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! material& ase_file::resolveMaterialReference(int matid, int submatid) { ! if ((unsigned int)matid > material_list.size()) ! throw ase_exception("Matid out of range"); ! material &curmat = material_list[matid]; ! if (validSubmat(matid, submatid)) ! return curmat.submats[((unsigned int)submatid)-1]; + // either submatid ==0, or it's invalid - return the main material + return curmat; + } ! //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! ! std::string ase_file::getTextureName(int matid, int submatid) ! { ! material &mat = resolveMaterialReference(matid, submatid); ! if (submatid > 0) { ! if (mat.diffuse_map.bitmap != "") ! return mat.diffuse_map.bitmap; ! // else change to parent material ! mat = resolveMaterialReference(matid, 0); } + return mat.diffuse_map.bitmap; + } + //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! int ase_file::getObjectParent(size_t idx) ! { ! geomobject& obj = getObject(idx); ! if (obj.parent != "") ! for (size_t i = 0; i < objects.size(); i++) ! if (obj.parent == objects[i].name) ! return i; ! return -1; ! } ! ! //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! ! int ase_file::find_matching_curlybrace(int start_offset, const std::string &str) ! { ! int depth = 0; ! for (unsigned int i = start_offset; i < str.size(); i++) { ! if (str[i] == '{') ! depth++; ! if (str[i] == '}') { ! if (depth == 0) ! return i; ! depth--; } } ! return -1; // fail ! } ! //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! void ase_file::reset() ! { ! comment = ""; ! myScene = scene(); ! material_list.resize(0); ! objects.resize(0); ! helper_objects.resize(0); ! } ! ! ! //**************************************************************************** ! // Loader Macros ! //**************************************************************************** ! ! #define ASE_In_Expect(in,str,tag) in >> str; if (str != tag) throw ase_exception(string("Expected Value \"") + string(tag) + string("\" Not found, found \"") + str + string("\" instead.")); ! ! #define ASE_In_Read(var) in >> var; ! ! #define ASE_In_Var(tag,dst,vname) if (vname == tag) { in >> dst; continue; } ! #define ASE_In_Bool(tag,dst,vname) if (vname == tag) { dst = true; continue; } ! #define ASE_In_2Var(tag,dst1,dst2,vname) if (vname == tag) { in >> dst1 >> dst2; continue; } ! #define ASE_In_2VarArray(tag,dst1,dst2,vname,vec1,vec2) if (vname == tag) { in >> dst1 >> dst2; vec1.push_back(dst1); vec2.push_back(dst2); continue; } ! ! #define ASE_In_QuotedStr(tag,dst,vname) if (vname == tag) { in.ignore(10, '"'); getline(in,dst,'"'); continue; } ! #define ASE_In_UnquotedStr(tag,dst,vname) ASE_In_Var(tag,dst,vname) ! #define ASE_In_If(tag,vname) if (vname == tag) { ! #define ASE_In_Else continue; } else { ! #define ASE_In_Endif continue; } ! ! #define ASE_In_BreakIf(tag,vname) if (vname == tag) break; ! #define ASE_In_UnexpectedVar(section,vname) throw ase_exception(string("Unrecognized ") + string(section) + string(" Variable: ") + vname); ! ! #define ASE_In_Start_VarProcessing(in,endtag,vname) string vname; while (in >> vname) { ASE_In_BreakIf(endtag,vname) ! #define ASE_In_End_VarProcessing(section,vname) ASE_In_UnexpectedVar(section,vname) } ! ! //**************************************************************************** ! // Loader ! //**************************************************************************** ! ! ! bool ase_file::LoadFromFile(std::string &filename) ! { ! ifstream in(filename.c_str(), ios::in | ios::binary); ! if (!in) ! throw ase_exception(string("Could not open file ") + filename.c_str()); ! ! // ---------------------------------------------- ! int i = 0; ! string sTemp, sTemp2; in >> sTemp; *************** *** 139,143 **** else if (sTemp == "*SCENE" || sTemp == "*MATERIAL_LIST" || sTemp == "*GEOMOBJECT" || sTemp == "*HELPEROBJECT") { ! ASE_Expect(in,sTemp2,"{") //iTemp = int(in.tellg())-1; //size = brace_pairs[iTemp]; --- 211,215 ---- else if (sTemp == "*SCENE" || sTemp == "*MATERIAL_LIST" || sTemp == "*GEOMOBJECT" || sTemp == "*HELPEROBJECT") { ! ASE_In_Expect(in,sTemp2,"{") //iTemp = int(in.tellg())-1; //size = brace_pairs[iTemp]; *************** *** 203,207 **** int i, mat_count, itemp; ! ASE_Expect(in,sTemp,"*MATERIAL_COUNT"); in >> mat_count; --- 275,279 ---- int i, mat_count, itemp; ! ASE_In_Expect(in,sTemp,"*MATERIAL_COUNT"); in >> mat_count; *************** *** 209,215 **** for (i = 0; i < mat_count; i++) { ! ASE_Expect(in,sTemp,"*MATERIAL"); ! ASE_Read(itemp) ! ASE_Expect(in,sTemp,"{"); material mat_temp; --- 281,287 ---- for (i = 0; i < mat_count; i++) { ! ASE_In_Expect(in,sTemp,"*MATERIAL"); ! ASE_In_Read(itemp) ! ASE_In_Expect(in,sTemp,"{"); material mat_temp; *************** *** 218,222 **** material_list.push_back(mat_temp); } ! ASE_Expect(in,sTemp,"}"); } --- 290,294 ---- material_list.push_back(mat_temp); } ! ASE_In_Expect(in,sTemp,"}"); } *************** *** 233,267 **** - //**************************************************************************** - // Misc Functions - //**************************************************************************** - - int ase_file::find_matching_curlybrace(int start_offset, const std::string &str) - { - int depth = 0; - for (unsigned int i = start_offset; i < str.size(); i++) - { - if (str[i] == '{') - depth++; - if (str[i] == '}') - { - if (depth == 0) - return i; - depth--; - } - } - return -1; // fail - } - - //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - void ase_file::reset() - { - comment = ""; - myScene = scene(); - material_list.resize(0); - objects.resize(0); - helper_objects.resize(0); - } //**************************************************************************** --- 305,308 ---- *************** *** 271,283 **** void scene::read(std::istream &in) { ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*SCENE_FILENAME",filename,sTemp) ! ASE_Var("*SCENE_FIRSTFRAME",first_frame,sTemp) ! ASE_Var("*SCENE_LASTFRAME",last_frame,sTemp) ! ASE_Var("*SCENE_FRAMESPEED",frame_speed,sTemp) ! ASE_Var("*SCENE_TICKSPERFRAME",ticks_per_frame,sTemp) ! ASE_Var("*SCENE_BACKGROUND_STATIC",background_rgb,sTemp) ! ASE_Var("*SCENE_AMBIENT_STATIC",ambient_rgb,sTemp) ! ASE_End_VarProcessing("*SCENE",sTemp) } --- 312,324 ---- void scene::read(std::istream &in) { ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*SCENE_FILENAME",filename,sTemp) ! ASE_In_Var("*SCENE_FIRSTFRAME",first_frame,sTemp) ! ASE_In_Var("*SCENE_LASTFRAME",last_frame,sTemp) ! ASE_In_Var("*SCENE_FRAMESPEED",frame_speed,sTemp) ! ASE_In_Var("*SCENE_TICKSPERFRAME",ticks_per_frame,sTemp) ! ASE_In_Var("*SCENE_BACKGROUND_STATIC",background_rgb,sTemp) ! ASE_In_Var("*SCENE_AMBIENT_STATIC",ambient_rgb,sTemp) ! ASE_In_End_VarProcessing("*SCENE",sTemp) } *************** *** 296,319 **** void texture_map::read(std::istream &in) { ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*MAP_NAME",name,sTemp) ! ASE_QuotedStr("*MAP_CLASS",mapclass,sTemp) ! ASE_Var("*MAP_SUBNO",subno,sTemp) ! ASE_Var("*MAP_AMOUNT",amount,sTemp) ! ASE_QuotedStr("*BITMAP",bitmap,sTemp) ! ASE_UnquotedStr("*MAP_TYPE",type,sTemp) ! ASE_Var("*UVW_U_OFFSET",u_offset,sTemp) ! ASE_Var("*UVW_V_OFFSET",v_offset,sTemp) ! ASE_Var("*UVW_U_TILING",u_tiling,sTemp) ! ASE_Var("*UVW_V_TILING",v_tiling,sTemp) ! ASE_Var("*UVW_ANGLE",angle,sTemp) ! ASE_Var("*UVW_BLUR",blur,sTemp) ! ASE_Var("*UVW_BLUR_OFFSET",blur_offset,sTemp) ! ASE_Var("*UVW_NOUSE_AMT",noise_amt,sTemp) ! ASE_Var("*UVW_NOISE_SIZE",noise_size,sTemp) ! ASE_Var("*UVW_NOISE_LEVEL",noise_level,sTemp) ! ASE_Var("*UVW_NOISE_PHASE",noise_phase,sTemp) ! ASE_UnquotedStr("*BITMAP_FILTER",filter,sTemp) ! ASE_End_VarProcessing("*MAP",sTemp) } --- 337,360 ---- void texture_map::read(std::istream &in) { ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*MAP_NAME",name,sTemp) ! ASE_In_QuotedStr("*MAP_CLASS",mapclass,sTemp) ! ASE_In_Var("*MAP_SUBNO",subno,sTemp) ! ASE_In_Var("*MAP_AMOUNT",amount,sTemp) ! ASE_In_QuotedStr("*BITMAP",bitmap,sTemp) ! ASE_In_UnquotedStr("*MAP_TYPE",type,sTemp) ! ASE_In_Var("*UVW_U_OFFSET",u_offset,sTemp) ! ASE_In_Var("*UVW_V_OFFSET",v_offset,sTemp) ! ASE_In_Var("*UVW_U_TILING",u_tiling,sTemp) ! ASE_In_Var("*UVW_V_TILING",v_tiling,sTemp) ! ASE_In_Var("*UVW_ANGLE",angle,sTemp) ! ASE_In_Var("*UVW_BLUR",blur,sTemp) ! ASE_In_Var("*UVW_BLUR_OFFSET",blur_offset,sTemp) ! ASE_In_Var("*UVW_NOUSE_AMT",noise_amt,sTemp) ! ASE_In_Var("*UVW_NOISE_SIZE",noise_size,sTemp) ! ASE_In_Var("*UVW_NOISE_LEVEL",noise_level,sTemp) ! ASE_In_Var("*UVW_NOISE_PHASE",noise_phase,sTemp) ! ASE_In_UnquotedStr("*BITMAP_FILTER",filter,sTemp) ! ASE_In_End_VarProcessing("*MAP",sTemp) } *************** *** 333,388 **** { int itemp; ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*MATERIAL_NAME",name,sTemp) ! ASE_QuotedStr("*MATERIAL_CLASS",matclass,sTemp) ! ASE_Var("*MATERIAL_AMBIENT",ambient,sTemp) ! ASE_Var("*MATERIAL_DIFFUSE",diffuse,sTemp) ! ASE_Var("*MATERIAL_SPECULAR",specular,sTemp) ! ASE_Var("*MATERIAL_SHINE",shine,sTemp) ! ASE_Var("*MATERIAL_SHINESTRENGTH",shine_strength,sTemp) ! ASE_Var("*MATERIAL_TRANSPARENCY",transparency,sTemp) ! ASE_Var("*MATERIAL_WIRESIZE",wiresize,sTemp) ! ASE_UnquotedStr("*MATERIAL_SHADING",shading,sTemp) ! ASE_Var("*MATERIAL_XP_FALLOFF",xp_falloff,sTemp) ! ASE_Var("*MATERIAL_SELFILLUM",self_illum,sTemp) ! ASE_UnquotedStr("*MATERIAL_FALLOFF",falloff,sTemp) ! ASE_UnquotedStr("*MATERIAL_XP_TYPE",xp_type,sTemp) ! ASE_Var("*NUMSUBMTLS",itemp,sTemp) ! ASE_Bool("*MATERIAL_TWOSIDED",twosided,sTemp) ! ASE_If("*MAP_DIFFUSE",sTemp) ! ASE_Expect(in,sTemp,"{") diffuse_map.read(in); ! ASE_Endif ! ASE_If("*MAP_SPECULAR",sTemp) ! ASE_Expect(in,sTemp,"{") specular_map.read(in); ! ASE_Endif ! ASE_If("*MAP_SHINE",sTemp) ! ASE_Expect(in,sTemp,"{") shine_map.read(in); ! ASE_Endif ! ASE_If("*MAP_BUMP",sTemp) ! ASE_Expect(in,sTemp,"{") bump_map.read(in); ! ASE_Endif ! ASE_If("*MAP_SELFILLUM",sTemp) ! ASE_Expect(in,sTemp,"{") shine_map.read(in); ! ASE_Endif ! ASE_If("*SUBMATERIAL",sTemp) ! ASE_Read(itemp) ! ASE_Expect(in,sTemp,"{") material submat; submat.read(in); submats.push_back(submat); ! ASE_Endif ! ASE_End_VarProcessing("*MATERIAL",sTemp) } --- 374,429 ---- { int itemp; ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*MATERIAL_NAME",name,sTemp) ! ASE_In_QuotedStr("*MATERIAL_CLASS",matclass,sTemp) ! ASE_In_Var("*MATERIAL_AMBIENT",ambient,sTemp) ! ASE_In_Var("*MATERIAL_DIFFUSE",diffuse,sTemp) ! ASE_In_Var("*MATERIAL_SPECULAR",specular,sTemp) ! ASE_In_Var("*MATERIAL_SHINE",shine,sTemp) ! ASE_In_Var("*MATERIAL_SHINESTRENGTH",shine_strength,sTemp) ! ASE_In_Var("*MATERIAL_TRANSPARENCY",transparency,sTemp) ! ASE_In_Var("*MATERIAL_WIRESIZE",wiresize,sTemp) ! ASE_In_UnquotedStr("*MATERIAL_SHADING",shading,sTemp) ! ASE_In_Var("*MATERIAL_XP_FALLOFF",xp_falloff,sTemp) ! ASE_In_Var("*MATERIAL_SELFILLUM",self_illum,sTemp) ! ASE_In_UnquotedStr("*MATERIAL_FALLOFF",falloff,sTemp) ! ASE_In_UnquotedStr("*MATERIAL_XP_TYPE",xp_type,sTemp) ! ASE_In_Var("*NUMSUBMTLS",itemp,sTemp) ! ASE_In_Bool("*MATERIAL_TWOSIDED",twosided,sTemp) ! ASE_In_If("*MAP_DIFFUSE",sTemp) ! ASE_In_Expect(in,sTemp,"{") diffuse_map.read(in); ! ASE_In_Endif ! ASE_In_If("*MAP_SPECULAR",sTemp) ! ASE_In_Expect(in,sTemp,"{") specular_map.read(in); ! ASE_In_Endif ! ASE_In_If("*MAP_SHINE",sTemp) ! ASE_In_Expect(in,sTemp,"{") shine_map.read(in); ! ASE_In_Endif ! ASE_In_If("*MAP_BUMP",sTemp) ! ASE_In_Expect(in,sTemp,"{") bump_map.read(in); ! ASE_In_Endif ! ASE_In_If("*MAP_SELFILLUM",sTemp) ! ASE_In_Expect(in,sTemp,"{") shine_map.read(in); ! ASE_In_Endif ! ASE_In_If("*SUBMATERIAL",sTemp) ! ASE_In_Read(itemp) ! ASE_In_Expect(in,sTemp,"{") material submat; submat.read(in); submats.push_back(submat); ! ASE_In_Endif ! ASE_In_End_VarProcessing("*MATERIAL",sTemp) } *************** *** 401,420 **** void transform_matrix::read(std::istream &in) { ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_Var("*INHERIT_POS",inherit_pos,sTemp) ! ASE_Var("*INHERIT_ROT",inherit_rot,sTemp) ! ASE_Var("*INHERIT_SCL",inherit_scl,sTemp) ! ASE_Var("*TM_ROW0",row1,sTemp) ! ASE_Var("*TM_ROW1",row1,sTemp) ! ASE_Var("*TM_ROW2",row2,sTemp) ! ASE_Var("*TM_ROW3",row3,sTemp) ! ASE_Var("*TM_POS",tm_pos,sTemp) ! ASE_Var("*TM_ROTAXIS",tm_rotaxis,sTemp) ! ASE_Var("*TM_ROTANGLE",tm_rotangle,sTemp) ! ASE_Var("*TM_SCALE",scale,sTemp) ! ASE_Var("*TM_SCALEAXIS",scale_axis,sTemp) ! ASE_Var("*TM_SCALEAXISANG",scale_axis_angle,sTemp) ! ASE_End_VarProcessing("*NODE_TM",sTemp) } --- 442,461 ---- void transform_matrix::read(std::istream &in) { ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_In_Var("*INHERIT_POS",inherit_pos,sTemp) ! ASE_In_Var("*INHERIT_ROT",inherit_rot,sTemp) ! ASE_In_Var("*INHERIT_SCL",inherit_scl,sTemp) ! ASE_In_Var("*TM_ROW0",row1,sTemp) ! ASE_In_Var("*TM_ROW1",row1,sTemp) ! ASE_In_Var("*TM_ROW2",row2,sTemp) ! ASE_In_Var("*TM_ROW3",row3,sTemp) ! ASE_In_Var("*TM_POS",tm_pos,sTemp) ! ASE_In_Var("*TM_ROTAXIS",tm_rotaxis,sTemp) ! ASE_In_Var("*TM_ROTANGLE",tm_rotangle,sTemp) ! ASE_In_Var("*TM_SCALE",scale,sTemp) ! ASE_In_Var("*TM_SCALEAXIS",scale_axis,sTemp) ! ASE_In_Var("*TM_SCALEAXISANG",scale_axis_angle,sTemp) ! ASE_In_End_VarProcessing("*NODE_TM",sTemp) } *************** *** 440,487 **** texture_face tftemp; ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_Var("*TIMEVALUE",timevalue,sTemp) ! ASE_Var("*MESH_NUMVERTEX",numvertex,sTemp) ! ASE_Var("*MESH_NUMFACES",numfaces,sTemp) // ------------------------- *MESH_VERTEX_LIST ------------------------- ! ASE_If("*MESH_VERTEX_LIST",sTemp) ! ASE_Expect(in,sTemp,"{") ! ASE_Start_VarProcessing(in,"}",sTemp2) // *MESH_VERTEX 7 62.5000 62.5000 80.0000 ! ASE_2VarArray("*MESH_VERTEX",itemp,vTemp,sTemp2,bitbox,vertex_list) ! ASE_End_VarProcessing("*MESH_VERTEX_LIST",sTemp2) ! ASE_Endif // ------------------------- *MESH_VERTEX_LIST ------------------------- // ------------------------- *MESH_FACE_LIST ------------------------- ! ASE_If("*MESH_FACE_LIST",sTemp) ! ASE_Expect(in,sTemp,"{") ! ASE_Start_VarProcessing(in,"}",sTemp3) //*MESH_FACE 11: A: 4 B: 6 C: 2 AB: 1 BC: 1 CA: 0 *MESH_SMOOTHING 7 *MESH_MTLID 2 ! ASE_If("*MESH_FACE",sTemp3) ! ASE_Read(itemp) ! ASE_Expect(in,sTemp3,":") ! ASE_Expect(in,sTemp3,"A:") ! ASE_Read(mftemp.vert0) ! ASE_Expect(in,sTemp3,"B:") ! ASE_Read(mftemp.vert1) ! ASE_Expect(in,sTemp3,"C:") ! ASE_Read(mftemp.vert2) ! ASE_Expect(in,sTemp3,"AB:") ! ASE_Read(mftemp.unknownAB) ! ASE_Expect(in,sTemp3,"BC:") ! ASE_Read(mftemp.unknownBC) ! ASE_Expect(in,sTemp3,"CA:") ! ASE_Read(mftemp.unknownCA) ! ASE_Expect(in,sTemp3,"*MESH_SMOOTHING") ! ASE_Read(strlist) // sometimes the list is empty --- 481,528 ---- texture_face tftemp; ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_Var("*TIMEVALUE",timevalue,sTemp) ! ASE_In_Var("*MESH_NUMVERTEX",numvertex,sTemp) ! ASE_In_Var("*MESH_NUMFACES",numfaces,sTemp) // ------------------------- *MESH_VERTEX_LIST ------------------------- ! ASE_In_If("*MESH_VERTEX_LIST",sTemp) ! ASE_In_Expect(in,sTemp,"{") ! ASE_In_Start_VarProcessing(in,"}",sTemp2) // *MESH_VERTEX 7 62.5000 62.5000 80.0000 ! ASE_In_2VarArray("*MESH_VERTEX",itemp,vTemp,sTemp2,bitbox,vertex_list) ! ASE_In_End_VarProcessing("*MESH_VERTEX_LIST",sTemp2) ! ASE_In_Endif // ------------------------- *MESH_VERTEX_LIST ------------------------- // ------------------------- *MESH_FACE_LIST ------------------------- ! ASE_In_If("*MESH_FACE_LIST",sTemp) ! ASE_In_Expect(in,sTemp,"{") ! ASE_In_Start_VarProcessing(in,"}",sTemp3) //*MESH_FACE 11: A: 4 B: 6 C: 2 AB: 1 BC: 1 CA: 0 *MESH_SMOOTHING 7 *MESH_MTLID 2 ! ASE_In_If("*MESH_FACE",sTemp3) ! ASE_In_Read(itemp) ! ASE_In_Expect(in,sTemp3,":") ! ASE_In_Expect(in,sTemp3,"A:") ! ASE_In_Read(mftemp.vert0) ! ASE_In_Expect(in,sTemp3,"B:") ! ASE_In_Read(mftemp.vert1) ! ASE_In_Expect(in,sTemp3,"C:") ! ASE_In_Read(mftemp.vert2) ! ASE_In_Expect(in,sTemp3,"AB:") ! ASE_In_Read(mftemp.unknownAB) ! ASE_In_Expect(in,sTemp3,"BC:") ! ASE_In_Read(mftemp.unknownBC) ! ASE_In_Expect(in,sTemp3,"CA:") ! ASE_In_Read(mftemp.unknownCA) ! ASE_In_Expect(in,sTemp3,"*MESH_SMOOTHING") ! ASE_In_Read(strlist) // sometimes the list is empty *************** *** 493,548 **** mftemp.smoothing_groups.push_back(itemp); ! ASE_Expect(in,sTemp3,"*MESH_MTLID") ! ASE_Read(mftemp.submaterial_id) } else { ! ASE_Read(mftemp.submaterial_id) } face_list.push_back(mftemp); ! ASE_Endif ! ASE_Var("*MESH_FACE",itemp,sTemp3) ! ASE_End_VarProcessing("*MESH_FACE_LIST",sTemp3) ! ASE_Endif // ------------------------- *MESH_FACE_LIST ------------------------- ! ASE_Var("*MESH_NUMTVERTEX",numtvert,sTemp) // ------------------------- *MESH_TVERTLIST ------------------------- ! ASE_If("*MESH_TVERTLIST",sTemp) ! ASE_Expect(in,sTemp,"{") ! ASE_Start_VarProcessing(in,"}",sTemp4) //*MESH_TVERT 11 1.0000 1.0000 0.0000 ! ASE_2VarArray("*MESH_TVERT",itemp,vTemp,sTemp4,bitbox,texture_vertex_list) ! ASE_End_VarProcessing("*MESH_TVERTLIST",sTemp4) ! ASE_Endif // ------------------------- *MESH_TVERTLIST ------------------------- ! ASE_Var("*MESH_NUMTVFACES",numtface,sTemp) // ------------------------- *MESH_TFACELIST ------------------------- ! ASE_If("*MESH_TFACELIST",sTemp) ! ASE_Expect(in,sTemp,"{") ! ASE_Start_VarProcessing(in,"}",sTemp5) // *MESH_TFACE 11 3 2 0 ! ASE_If("*MESH_TFACE",sTemp5) ! ASE_Read(itemp) ! ASE_Read(tftemp.a) ! ASE_Read(tftemp.b) ! ASE_Read(tftemp.c) texture_face_list.push_back(tftemp); ! ASE_Endif ! ASE_End_VarProcessing("*MESH_TFACELIS",sTemp5) ! ASE_Endif // ------------------------- *MESH_TFACELIST ------------------------- // ------------------------- *MESH_NORMALS ------------------------- ! ASE_If("*MESH_NORMALS",sTemp) ! ASE_Expect(in,sTemp,"{") ! ASE_Start_VarProcessing(in,"}",sTemp6) ! ASE_If("*MESH_FACENORMAL",sTemp6) //*MESH_FACENORMAL 0 0.0000 0.0000 -1.0000 ! ASE_Read(itemp) ! ASE_Read(vTemp) normals.push_back(vTemp); --- 534,589 ---- mftemp.smoothing_groups.push_back(itemp); ! ASE_In_Expect(in,sTemp3,"*MESH_MTLID") ! ASE_In_Read(mftemp.submaterial_id) } else { ! ASE_In_Read(mftemp.submaterial_id) } face_list.push_back(mftemp); ! ASE_In_Endif ! ASE_In_Var("*MESH_FACE",itemp,sTemp3) ! ASE_In_End_VarProcessing("*MESH_FACE_LIST",sTemp3) ! ASE_In_Endif // ------------------------- *MESH_FACE_LIST ------------------------- ! ASE_In_Var("*MESH_NUMTVERTEX",numtvert,sTemp) // ------------------------- *MESH_TVERTLIST ------------------------- ! ASE_In_If("*MESH_TVERTLIST",sTemp) ! ASE_In_Expect(in,sTemp,"{") ! ASE_In_Start_VarProcessing(in,"}",sTemp4) //*MESH_TVERT 11 1.0000 1.0000 0.0000 ! ASE_In_2VarArray("*MESH_TVERT",itemp,vTemp,sTemp4,bitbox,texture_vertex_list) ! ASE_In_End_VarProcessing("*MESH_TVERTLIST",sTemp4) ! ASE_In_Endif // ------------------------- *MESH_TVERTLIST ------------------------- ! ASE_In_Var("*MESH_NUMTVFACES",numtface,sTemp) // ------------------------- *MESH_TFACELIST ------------------------- ! ASE_In_If("*MESH_TFACELIST",sTemp) ! ASE_In_Expect(in,sTemp,"{") ! ASE_In_Start_VarProcessing(in,"}",sTemp5) // *MESH_TFACE 11 3 2 0 ! ASE_In_If("*MESH_TFACE",sTemp5) ! ASE_In_Read(itemp) ! ASE_In_Read(tftemp.a) ! ASE_In_Read(tftemp.b) ! ASE_In_Read(tftemp.c) texture_face_list.push_back(tftemp); ! ASE_In_Endif ! ASE_In_End_VarProcessing("*MESH_TFACELIS",sTemp5) ! ASE_In_Endif // ------------------------- *MESH_TFACELIST ------------------------- // ------------------------- *MESH_NORMALS ------------------------- ! ASE_In_If("*MESH_NORMALS",sTemp) ! ASE_In_Expect(in,sTemp,"{") ! ASE_In_Start_VarProcessing(in,"}",sTemp6) ! ASE_In_If("*MESH_FACENORMAL",sTemp6) //*MESH_FACENORMAL 0 0.0000 0.0000 -1.0000 ! ASE_In_Read(itemp) ! ASE_In_Read(vTemp) normals.push_back(vTemp); *************** *** 551,568 **** for (int mni = 0; mni < 3; mni++) { ! ASE_Read(sTemp6) ! ASE_Read(itemp); ! ASE_Read(vTemp); } ! ASE_Endif ! ASE_End_VarProcessing("*MESH_NORMALS",sTemp6) ! ASE_Endif // ------------------------- *MESH_NORMALS ------------------------- ! ASE_End_VarProcessing("*MESH",sTemp) } //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- --- 592,651 ---- for (int mni = 0; mni < 3; mni++) { ! ASE_In_Read(sTemp6) ! ASE_In_Read(itemp); ! ASE_In_Read(vTemp); } ! ASE_In_Endif ! ASE_In_End_VarProcessing("*MESH_NORMALS",sTemp6) ! ASE_In_Endif // ------------------------- *MESH_NORMALS ------------------------- ! ASE_In_End_VarProcessing("*MESH",sTemp) ! } ! ! ! //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- ! ! ase_compat_face mesh::fetchCompatface(int facenum) ! { ! if ((unsigned int)facenum > face_list.size()) ! throw ase_exception("Invalid face index"); ! ! ase_compat_face tface; ! tface.verts.resize(3); ! ! // points ! tface.verts[0].point = ASE_Translate_Vector(vertex_list[face_list[facenum].vert0]); ! tface.verts[1].point = ASE_Translate_Vector(vertex_list[face_list[facenum].vert1]); ! tface.verts[2].point = ASE_Translate_Vector(vertex_list[face_list[facenum].vert2]); ! ! // facenormal ! tface.normal = ASE_Translate_Vector(normals[facenum]); ! ! //uv ! tface.verts[0].u = texture_vertex_list[texture_face_list[facenum].a].x; ! tface.verts[0].v = 1-texture_vertex_list[texture_face_list[facenum].a].y; ! ! tface.verts[1].u = texture_vertex_list[texture_face_list[facenum].b].x; ! tface.verts[1].v = 1-texture_vertex_list[texture_face_list[facenum].b].y; ! ! tface.verts[2].u = texture_vertex_list[texture_face_list[facenum].c].x; ! tface.verts[2].v = 1-texture_vertex_list[texture_face_list[facenum].c].y; ! ! return tface; } + std::vector<ase_compat_face> mesh::getCompatFaces() + { + std::vector<ase_compat_face> faces; + faces.resize(face_list.size()); + + for (unsigned int i = 0; i < faces.size(); i++) + faces[i] = fetchCompatface(i); + return faces; + } + //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- *************** *** 578,600 **** void geomobject::read(std::istream &in) { ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_QuotedStr("*NODE_PARENT",parent,sTemp) ! ASE_If("*NODE_TM",sTemp) ! ASE_Expect(in,sTemp,"{") tm.read(in); ! ASE_Endif ! ASE_If("*MESH",sTemp) ! ASE_Expect(in,sTemp,"{") geometry.read(in); ! ASE_Endif ! ASE_Var("*PROP_MOTIONBLUR",motionblur,sTemp) ! ASE_Var("*PROP_CASTSHADOW",cast_shadow,sTemp) ! ASE_Var("*PROP_RECVSHADOW",recv_shadow,sTemp) ! ASE_Var("*MATERIAL_REF",material_ref,sTemp) ! ASE_End_VarProcessing("*NODE_TM",sTemp) } --- 661,683 ---- void geomobject::read(std::istream &in) { ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_In_QuotedStr("*NODE_PARENT",parent,sTemp) ! ASE_In_If("*NODE_TM",sTemp) ! ASE_In_Expect(in,sTemp,"{") tm.read(in); ! ASE_In_Endif ! ASE_In_If("*MESH",sTemp) ! ASE_In_Expect(in,sTemp,"{") geometry.read(in); ! ASE_In_Endif ! ASE_In_Var("*PROP_MOTIONBLUR",motionblur,sTemp) ! ASE_In_Var("*PROP_CASTSHADOW",cast_shadow,sTemp) ! ASE_In_Var("*PROP_RECVSHADOW",recv_shadow,sTemp) ! ASE_In_Var("*MATERIAL_REF",material_ref,sTemp) ! ASE_In_End_VarProcessing("*NODE_TM",sTemp) } *************** *** 615,631 **** void helperobject::read(std::istream &in) { ! ASE_Start_VarProcessing(in,"}",sTemp) ! ASE_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_QuotedStr("*NODE_PARENT",parent,sTemp) ! ASE_QuotedStr("*HELPER_CLASS",helpclass,sTemp) ! ASE_If("*NODE_TM",sTemp) ! ASE_Expect(in,sTemp,"{") tm.read(in); ! ASE_Endif ! ASE_Var("*BOUNDINGBOX_MIN",bbox_min,sTemp) ! ASE_Var("*BOUNDINGBOX_MAX",bbox_max,sTemp) ! ASE_End_VarProcessing("*NODE_TM",sTemp) } --- 698,714 ---- void helperobject::read(std::istream &in) { ! ASE_In_Start_VarProcessing(in,"}",sTemp) ! ASE_In_QuotedStr("*NODE_NAME",name,sTemp) ! ASE_In_QuotedStr("*NODE_PARENT",parent,sTemp) ! ASE_In_QuotedStr("*HELPER_CLASS",helpclass,sTemp) ! ASE_In_If("*NODE_TM",sTemp) ! ASE_In_Expect(in,sTemp,"{") tm.read(in); ! ASE_In_Endif ! ASE_In_Var("*BOUNDINGBOX_MIN",bbox_min,sTemp) ! ASE_In_Var("*BOUNDINGBOX_MAX",bbox_max,sTemp) ! ASE_In_End_VarProcessing("*NODE_TM",sTemp) } Index: ase_file.h =================================================================== RCS file: /cvsroot/alliance/pcs2/ase_file.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ase_file.h 11 Feb 2008 13:19:42 -0000 1.10 --- ase_file.h 12 Feb 2008 18:59:50 -0000 1.11 *************** *** 6,10 **** // Blender (>2.44) has support // ! // Documented at http://www.unrealwiki.com/wiki/ASE_File_Format // http://www.solosnake.com/main/ase.htm //**************************************************************************** --- 6,10 ---- // Blender (>2.44) has support // ! // Documented at http://www.unrealwiki.com/wiki/ASE_In_File_Format // http://www.solosnake.com/main/ase.htm //**************************************************************************** *************** *** 17,20 **** --- 17,23 ---- * * $Log$ + * Revision 1.11 2008/02/12 18:59:50 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.10 2008/02/11 13:19:42 kazan * Few tweaks to the loader from what i learned by loading the Sol City ASE *************** *** 93,125 **** public: ~ase_file() { reset(); } bool LoadFromFile(std::string &filename); bool SaveToFile(std::string &filename); ! void reset(); }; ! #define ASE_Expect(in,str,tag) in >> str; if (str != tag) throw ase_exception(string("Expected Value \"") + string(tag) + string("\" Not found, found \"") + str + string("\" instead.")); ! ! #define ASE_Read(var) in >> var; ! ! #define ASE_Var(tag,dst,vname) if (vname == tag) { in >> dst; continue; } ! #define ASE_Bool(tag,dst,vname) if (vname == tag) { dst = true; continue; } ! #define ASE_2Var(tag,dst1,dst2,vname) if (vname == tag) { in >> dst1 >> dst2; continue; } ! #define ASE_2VarArray(tag,dst1,dst2,vname,vec1,vec2) if (vname == tag) { in >> dst1 >> dst2; vec1.push_back(dst1); vec2.push_back(dst2); continue; } ! ! #define ASE_QuotedStr(tag,dst,vname) if (vname == tag) { in.ignore(10, '"'); getline(in,dst,'"'); continue; } ! #define ASE_UnquotedStr(tag,dst,vname) ASE_Var(tag,dst,vname) ! #define ASE_If(tag,vname) if (vname == tag) { ! #define ASE_Else continue; } else { ! #define ASE_Endif continue; } ! ! #define ASE_BreakIf(tag,vname) if (vname == tag) break; ! #define ASE_UnexpectedVar(section,vname) throw ase_exception(string("Unrecognized ") + string(section) + string(" Variable: ") + vname); - #define ASE_Start_VarProcessing(in,endtag,vname) string vname; while (in >> vname) { ASE_BreakIf(endtag,vname) - #define ASE_End_VarProcessing(section,vname) ASE_UnexpectedVar(section,vname) } - }; //ase namespace #endif //_ase_file_h_ \ No newline at end of file --- 96,121 ---- public: ~ase_file() { reset(); } + void reset(); bool LoadFromFile(std::string &filename); bool SaveToFile(std::string &filename); + + // material functions + bool validSubmat(int matid, int submatid); + material& resolveMaterialReference(int matid, int submatid); + std::string getTextureName(int matid, int submatid); ! size_t getMaterialCount() { return material_list.size(); } ! material& getMaterial(size_t idx) { if (idx > getMaterialCount()) { throw ase_exception("Invalid Material Index"); } return material_list[idx]; } ! ! // object functions ! size_t getObjectCount() { return objects.size(); } ! geomobject& getObject(size_t idx) { if (idx > getObjectCount()) { throw ase_exception("Invalid Object Index"); } return objects[idx]; } ! int getObjectParent(size_t idx); }; ! vector3d ASE_Translate_Vector(vector3d vec); }; //ase namespace #endif //_ase_file_h_ \ No newline at end of file Index: pcs2.cpp =================================================================== RCS file: /cvsroot/alliance/pcs2/pcs2.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** pcs2.cpp 11 Feb 2008 13:56:23 -0000 1.80 --- pcs2.cpp 12 Feb 2008 18:59:51 -0000 1.81 *************** *** 12,15 **** --- 12,18 ---- * * $Log$ + * Revision 1.81 2008/02/12 18:59:51 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.80 2008/02/11 13:56:23 kazan * tweaks *************** *** 332,336 **** wxString PCS2_COMP_VERSION = "PCS 2.0 Compiler Version 2 Final"; ! wxString PCS2_SUPPORTED_FORMATS = "All Supported Formats|*.cob;*.pmf;*.pof;*.scn;*.ase|Parallax Object Files (.pof)|*.pof|PCS2 Model File (.pmf)|*.pmf|Caligari Object Binary (.cob)|*.cob|Caligari Scene (.scn)|*.scn|3DS ASCII Scene Export (.ase)|*.ase"; //op_gl_funcs GLFunctions; --- 335,339 ---- wxString PCS2_COMP_VERSION = "PCS 2.0 Compiler Version 2 Final"; ! wxString PCS2_SUPPORTED_FORMATS = "All Supported Formats|*.cob;*.pmf;*.pof;*.scn|Parallax Object Files (.pof)|*.pof|PCS2 Model File (.pmf)|*.pmf|Caligari Object Binary (.cob)|*.cob|Caligari Scene (.scn)|*.scn"; //op_gl_funcs GLFunctions; Index: pcs2_filethread.cpp =================================================================== RCS file: /cvsroot/alliance/pcs2/pcs2_filethread.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pcs2_filethread.cpp 11 Feb 2008 13:56:23 -0000 1.17 --- pcs2_filethread.cpp 12 Feb 2008 18:59:53 -0000 1.18 *************** *** 12,15 **** --- 12,18 ---- * * $Log$ + * Revision 1.18 2008/02/12 18:59:53 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.17 2008/02/11 13:56:23 kazan * tweaks *************** *** 170,173 **** --- 173,177 ---- } } + /* format found to be unreliable else if (strstr(comp.c_str(), ".ase") != NULL) { *************** *** 194,198 **** } } ! } else { --- 198,202 ---- } } ! }*/ else { *************** *** 324,327 **** --- 328,333 ---- } } + + /* format found to be unreliable else if (strstr(comp.c_str(), ".ase") != NULL) { *************** *** 352,355 **** --- 358,362 ---- } } + */ else { Index: pcs_file.cpp =================================================================== RCS file: /cvsroot/alliance/pcs2/pcs_file.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** pcs_file.cpp 9 Feb 2008 23:01:45 -0000 1.65 --- pcs_file.cpp 12 Feb 2008 18:59:54 -0000 1.66 *************** *** 11,14 **** --- 11,17 ---- * * $Log$ + * Revision 1.66 2008/02/12 18:59:54 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.65 2008/02/09 23:01:45 kazan * post-kaz_templates removal cleanup *************** *** 1195,1201 **** void PCS_Model::AddModelInfo(std::string info) { ! unsigned int idx = model_info.size(); model_info.resize(idx+1); ! model_info[idx] = info; } --- 1198,1205 ---- void PCS_Model::AddModelInfo(std::string info) { ! /*unsigned int idx = model_info.size(); model_info.resize(idx+1); ! model_info[idx] = info;*/ ! model_info.push_back(info); } *************** *** 1213,1219 **** void PCS_Model::AddLOD(int sobj) { ! unsigned int idx = header.detail_levels.size(); header.detail_levels.resize(idx+1); ! header.detail_levels[idx] = sobj; } --- 1217,1224 ---- void PCS_Model::AddLOD(int sobj) { ! /* unsigned int idx = header.detail_levels.size(); header.detail_levels.resize(idx+1); ! header.detail_levels[idx] = sobj;*/ ! header.detail_levels.push_back(sobj); } *************** *** 1229,1235 **** void PCS_Model::AddDebris(int sobj) { ! unsigned int idx = header.debris_pieces.size(); header.debris_pieces.resize(idx+1); ! header.debris_pieces[idx] = sobj; } --- 1234,1241 ---- void PCS_Model::AddDebris(int sobj) { ! /* unsigned int idx = header.debris_pieces.size(); header.debris_pieces.resize(idx+1); ! header.debris_pieces[idx] = sobj;*/ ! header.debris_pieces.push_back(sobj); } *************** *** 1258,1267 **** //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- void PCS_Model::AddTextures(std::string txt) { ! unsigned int idx = textures.size(); ! textures.resize(idx+1); ! textures[idx] = txt; } --- 1264,1285 ---- //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + int PCS_Model::maybeAddTexture(std::string txt) + { + int index = FindInList<std::string>(textures, txt); + if (index != -1) + return index; + index = textures.size(); + textures.push_back(txt); + return index; + } + + //+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- void PCS_Model::AddTextures(std::string txt) { ! //unsigned int idx = textures.size(); ! //textures.resize(idx+1); ! //textures[idx] = txt; ! textures.push_back(txt); } Index: pcs_file.h =================================================================== RCS file: /cvsroot/alliance/pcs2/pcs_file.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** pcs_file.h 9 Feb 2008 23:01:46 -0000 1.45 --- pcs_file.h 12 Feb 2008 18:59:55 -0000 1.46 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.46 2008/02/12 18:59:55 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.45 2008/02/09 23:01:46 kazan * post-kaz_templates removal cleanup *************** *** 311,315 **** int LoadFromCOB(std::string filename, int &comp_target, int &comp_current, char *comp_msg_str, float scaler); - int LoadFromASE(std::string filename, int &comp_target, int &comp_current, char *comp_msg_str, float scaler); //geometery manipulation --- 314,317 ---- *************** *** 336,340 **** --- 338,346 ---- int SaveToCOB(std::string filename, int &comp_target, int &comp_current, char *comp_msg_str, float scaler); + + // These functions don't actually work, and they're not likely to - just kept here for historical purposes + // the ASE format was found to be unreliable int SaveToASE(std::string filename, int &comp_target, int &comp_current, char *comp_msg_str, float scaler); + int LoadFromASE(std::string filename, int &comp_target, int &comp_current, char *comp_msg_str, float scaler); *************** *** 418,421 **** --- 424,428 ---- void DelCrossSect(unsigned int idx); + int maybeAddTexture(std::string txt); void AddTextures(std::string txt=""); void DelTextures(unsigned int idx); Index: pcs_file_dstructs.h =================================================================== RCS file: /cvsroot/alliance/pcs2/pcs_file_dstructs.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pcs_file_dstructs.h 9 Feb 2008 23:01:46 -0000 1.17 --- pcs_file_dstructs.h 12 Feb 2008 18:59:56 -0000 1.18 *************** *** 11,14 **** --- 11,17 ---- * * $Log$ + * Revision 1.18 2008/02/12 18:59:56 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.17 2008/02/09 23:01:46 kazan * post-kaz_templates removal cleanup *************** *** 237,240 **** --- 240,255 ---- void Write(std::ostream& out); pcs_sobj() : parent_sobj(-1), radius(0.0), movement_type(MNONE), movement_axis(ANONE) {} + void GenerateBBoxes() { + for (unsigned int i = 0; i < polygons.size(); i++) + { + for (unsigned int j = 0; j < polygons[i].verts.size(); j++) + { + ExpandBoundingBoxes(bounding_box_max_point, bounding_box_min_point, polygons[i].verts[j].point); + } + } + } + void GenerateRadius() { + radius = FindObjectRadius(bounding_box_max_point, bounding_box_min_point, geometric_center); + } /* Index: vector3d.cpp =================================================================== RCS file: /cvsroot/alliance/pcs2/vector3d.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** vector3d.cpp 10 Feb 2008 01:24:21 -0000 1.12 --- vector3d.cpp 12 Feb 2008 18:59:57 -0000 1.13 *************** *** 12,15 **** --- 12,18 ---- * * $Log$ + * Revision 1.13 2008/02/12 18:59:57 kazan + * Disable ASE after more trying to get it working. Format found to be unreliable. + * * Revision 1.12 2008/02/10 01:24:21 kazan * More work on the ASE loader *************** *** 157,160 **** --- 160,167 ---- float Ang = Dp2/Dp1; + if (Ang > 1.00000f) + Ang = 1.00000f; + if (Ang < -1.00000f) + Ang = -1.00000f; Ang = (float) acos(Ang); //inverse cosine ang (cos-1 aka arccos) *************** *** 247,256 **** bool operator==(vector3d &one, vector3d &two) { ! return ((one.x == two.x) && (one.y == two.y) && (one.z == two.z)); } bool operator==(const vector3d &one, const vector3d &two) { ! return ((one.x == two.x) && (one.y == two.y) && (one.z == two.z)); } --- 254,263 ---- bool operator==(vector3d &one, vector3d &two) { ! return (fabs(one.x - two.x) < 0.0001 && fabs(one.y - two.y) < 0.0001 && fabs(one.z - two.z) < 0.0001 ); } bool operator==(const vector3d &one, const vector3d &two) { ! return (fabs(one.x - two.x) < 0.0001 && fabs(one.y - two.y) < 0.0001 && fabs(one.z - two.z) < 0.0001 ); } *************** *** 540,544 **** beta = u0 / u2; if ((beta >=0.0f) && (beta<=1.0f)) { ! alpha = (v0 - beta*v2)/v1; inter = ((alpha>=0.0f)&&(alpha+beta<=1.0f)); } --- 547,551 ---- beta = u0 / u2; if ((beta >=0.0f) && (beta<=1.0f)) { ! alpha = float((v0 - beta*v2)/v1); inter = ((alpha>=0.0f)&&(alpha+beta<=1.0f)); } *************** *** 547,551 **** beta = (v0*u1 - u0*v1) / (v2*u1 - u2*v1); if ((beta >=0.0f) && (beta<=1.0f)) { ! alpha = (u0 - beta*u2)/u1; inter = ((alpha>=0.0f)&&(alpha+beta<=1.0f)); } --- 554,558 ---- beta = (v0*u1 - u0*v1) / (v2*u1 - u2*v1); if ((beta >=0.0f) && (beta<=1.0f)) { ! alpha = float((u0 - beta*u2)/u1); inter = ((alpha>=0.0f)&&(alpha+beta<=1.0f)); } |