override protected void StartMain() { curEditData.editType = EditType.Image; editMethods = this.gameObject.AddComponent <TriangleModifyMethods> (); baseTriangleObj = (TriangleObj)baseObj; editTransform = this.gameObject.GetComponent <RectTransform> (); baseTransform = baseObj.gameObject.GetComponent <RectTransform> (); editImage = editMethods.GetImageObj(this.gameObject); SetAddListener(); ChangeColorAllowPos(); }
/** * ReadPoly * * @param infile * @param ObjID * @return int */ private int ReadPoly(int ObjID) { String temp; double[] input = new double[3]; int i, j, k; int numpolys = 0; int numverts; bool trimesh, vertnormal; Point max = new Point(MaxX, MaxY, MaxZ); Point min = new Point(MinX, MinY, MinZ); temp = readString(); temp = readString(); Material theMaterial = ReadMaterial(); temp = readString(); if (temp.Substring(7).Equals("POLYSET_TRI_MESH")) { trimesh = true; } else { trimesh = false; } temp = readString(); if (temp.Substring(11).Equals("PER_VERTEX_NORMAL")) { vertnormal = true; } else { vertnormal = false; } for (i = 0; i < 4; i++) { temp = readString(); } temp = temp.Substring(11); numpolys = Int32.Parse(temp); ObjID++; for (i = 0; i < numpolys; i++) { temp = readString(); temp = readString(); temp = temp.Substring(16); numverts = Int32.Parse(temp); Point[] vertices = new Point[numverts]; for (j = 0; j < numverts; j++) { temp = readString(); temp = temp.Substring(8); for (k = 0; k < 2; k++) { input[k] = (double)Double.Parse(temp.Substring(0, temp.IndexOf(' '))); temp = temp.Substring(temp.IndexOf(' ') + 1); } input[2] = (double)Double.Parse(temp); vertices[j] = new Point(input[0], input[1], input[2]); if (vertnormal) { temp = readString(); } } temp = readString(); TriangleObj newtriangle; PolygonObj newpoly; ObjNode newnode; if (trimesh) { newtriangle = new TriangleObj(theMaterial, ObjID, numverts, vertices, max, min); newnode = new ObjNode(newtriangle, objects); } else { newpoly = new PolygonObj(theMaterial, ObjID, numverts, vertices, max, min); newnode = new ObjNode(newpoly, objects); } objects = newnode; } temp = readString(); MaxX = max.GetX(); MaxY = max.GetY(); MaxZ = max.GetZ(); MinX = min.GetX(); MinY = min.GetY(); MinZ = min.GetZ(); return(numpolys); }
/** * ReadPoly * * @param infile * @param ObjID * @return int */ private int ReadPoly(int ObjID) { String temp; double[] input = new double[3]; int i, j, k; int numpolys = 0; int numverts; bool trimesh, vertnormal; Point max = new Point(MaxX, MaxY, MaxZ); Point min = new Point(MinX, MinY, MinZ); temp = readString(); temp = readString(); Material theMaterial = ReadMaterial(); temp = readString(); if(temp.Substring(7).Equals("POLYSET_TRI_MESH")) { trimesh = true; } else { trimesh = false; } temp = readString(); if(temp.Substring(11).Equals("PER_VERTEX_NORMAL")) { vertnormal = true; } else { vertnormal = false; } for(i = 0; i < 4; i++) { temp = readString(); } temp = temp.Substring(11); numpolys = Int32.Parse(temp); ObjID++; for(i = 0; i < numpolys; i++) { temp = readString(); temp = readString(); temp = temp.Substring(16); numverts = Int32.Parse(temp); Point[] vertices = new Point[numverts]; for(j = 0; j < numverts; j++) { temp = readString(); temp = temp.Substring(8); for(k = 0; k < 2; k++) { input[k] = (double)Double.Parse(temp.Substring(0, temp.IndexOf(' '))); temp = temp.Substring(temp.IndexOf(' ') + 1); } input[2] = (double)Double.Parse(temp); vertices[j] = new Point(input[0], input[1], input[2]); if(vertnormal) { temp = readString(); } } temp = readString(); TriangleObj newtriangle; PolygonObj newpoly; ObjNode newnode; if(trimesh) { newtriangle = new TriangleObj(theMaterial, ObjID, numverts, vertices, max, min); newnode = new ObjNode(newtriangle, objects); } else { newpoly = new PolygonObj(theMaterial, ObjID, numverts, vertices, max, min); newnode = new ObjNode(newpoly, objects); } objects = newnode; } temp = readString(); MaxX = max.GetX(); MaxY = max.GetY(); MaxZ = max.GetZ(); MinX = min.GetX(); MinY = min.GetY(); MinZ = min.GetZ(); return (numpolys); }