//Entry Vertices Position of object Vector3[] EntryVertices(MQO.MQOFormat format,int obj_id) { int vcount = (int)format.object_list.obj[obj_id].face_list.face_vartex_count; int face_add = 0; Vector3[] vpos = new Vector3[vcount]; for (int i = 0; i < vcount;) { if(format.object_list.obj[obj_id].face_list.face[face_add].vartex_count == 3) { vpos[i] = format.GetVPos(obj_id ,face_add,2); vpos[i+1] = format.GetVPos(obj_id ,face_add,0); vpos[i+2] = format.GetVPos(obj_id ,face_add,1); } else if(format.object_list.obj[obj_id].face_list.face[face_add].vartex_count == 4) { vpos[i] = format.GetVPos(obj_id ,face_add,3); vpos[i+1] = format.GetVPos(obj_id ,face_add,0); vpos[i+2] = format.GetVPos(obj_id ,face_add,1); vpos[i+3] = format.GetVPos(obj_id ,face_add,2); } i += format.object_list.obj[obj_id].face_list.face[face_add].vartex_count; face_add++; } for(int i = 0; i < vcount; i++) vpos[i] = Vector3.Reflect(vpos[i],Vector3.right); return vpos; }
//Entry Vertives NormalsVector of Face (You must make Normals from face positions) Vector3[] EntryNormals(MQO.MQOFormat format,int obj_id) { int vcount = (int)format.object_list.obj[obj_id].face_list.face_vartex_count; //Entry Normal vector making Vector3 Nvector_1; Vector3 Nvector_2; Vector3 Nvector; int face_add = 0; Vector3[] normal = new Vector3[vcount]; for (int i = 0; i < vcount;) { if(format.object_list.obj[obj_id].face_list.face[face_add].vartex_count == 3) { //Entry Normal vector making Nvector_1 = format.GetVPos(obj_id ,face_add,1) - format.GetVPos(obj_id ,face_add,0); Nvector_2 = format.GetVPos(obj_id ,face_add,2) - format.GetVPos(obj_id ,face_add,0); Nvector = Vector3.Cross(Nvector_2,Nvector_1); Nvector.Normalize(); normal[i+2] = Nvector; normal[i+1] = Nvector; normal[i] = Nvector; } else if(format.object_list.obj[obj_id].face_list.face[face_add].vartex_count == 4) { // Nvector_1 = format.GetVPos(obj_id ,face_add,2) - format.GetVPos(obj_id ,face_add,0); Nvector_2 = format.GetVPos(obj_id ,face_add,3) - format.GetVPos(obj_id ,face_add,1); Nvector = Vector3.Cross(Nvector_2,Nvector_1); Nvector.Normalize(); normal[i+3] = Nvector; normal[i+2] = Nvector; normal[i+1] = Nvector; normal[i] = Nvector; } i += format.object_list.obj[obj_id].face_list.face[face_add].vartex_count; face_add++; } for(int i = 0; i < vcount; i++) normal[i] = Vector3.Reflect(normal[i],Vector3.right); return normal; }