public override Model Clone() { Joint j = new Joint(); j.copyFrom(this); j.jointIndex = this.jointIndex; j.BindMat = this.BindMat; j.invBMat = this.invBMat; j.color = this.color; j.meshVao = new GLMeshVao(); j.instanceId = GLMeshBufferManager.addInstance(ref j.meshVao, j); GLMeshBufferManager.setInstanceWorldMat(j.meshVao, j.instanceId, Matrix4.Identity); j.meshVao.type = TYPES.JOINT; j.meshVao.metaData = new MeshMetaData(); //TODO: Find a place to keep references from the Joint GLMeshVAOs j.meshVao.vao = new Primitives.LineSegment(this.children.Count, new Vector3(1.0f, 0.0f, 0.0f)).getVAO(); j.meshVao.material = Common.RenderState.activeResMgr.GLmaterials["jointMat"]; //Clone children foreach (Model child in children) { Model new_child = child.Clone(); new_child.parent = j; j.children.Add(new_child); } return(j); }
protected Joint(Joint input) : base(input) { this.jointIndex = input.jointIndex; this.BindMat = input.BindMat; this.invBMat = input.invBMat; this.color = input.color; meshVao = new GLMeshVao(); instanceId = GLMeshBufferManager.addInstance(ref meshVao, this); GLMeshBufferManager.setInstanceWorldMat(meshVao, instanceId, Matrix4.Identity); meshVao.type = TYPES.JOINT; meshVao.metaData = new MeshMetaData(); //TODO: Find a place to keep references from the joint GLMeshVAOs meshVao.vao = new Primitives.LineSegment(children.Count, new Vector3(1.0f, 0.0f, 0.0f)).getVAO(); meshVao.material = Common.RenderState.activeResMgr.GLmaterials["jointMat"]; }