public SceneObject Clone() { SceneObject obj=new SceneObject(); rebuild(); for(int i=0;i<vertices;i++) obj.addVertex(vertex[i].Clone()); for(int i=0;i<triangles;i++) obj.addTriangle(triangle[i].Clone()); obj.name=name+" [cloned]"; obj.material=material; obj.matrix=matrix.Clone(); obj.normalmatrix=normalmatrix.Clone(); obj.rebuild(); return obj; }
// O B J E C T M A N A G E M E N T public void addObject(string key, SceneObject obj) { obj.name = key; objectData.Add(key, obj); obj.parent = this; objectsNeedRebuild = true; }
private void readNextJunk(BinaryReader input) { readJunkHeader(input); if (currentJunkId == 0x3D3D) return; // Mesh block if (currentJunkId == 0x4000) // Object block { currentObjectName = readString(input); System.Console.WriteLine(">> Importing object: " + currentObjectName); return; } if (currentJunkId == 0x4100) // Triangular polygon object { currentObject = new SceneObject(); scene.addObject(currentObjectName, currentObject); return; } if (currentJunkId == 0x4110) // Vertex list { readVertexList(input); return; } if (currentJunkId == 0x4120) // Point list { readPointList(input); return; } if (currentJunkId == 0x4140) // Mapping coordinates { readMappingCoordinates(input); return; } skipJunk(input); }