public Object3D() { __webglInit = false; position = new Vector3(); children = new List <Object3D>(); position = new Vector3(); rotation = new Vector3(); scale = new Vector3(1, 1, 1); parent = null; matrixAutoUpdate = true; quaternion = new Quaternion(); useQuaternion = false; matrixWorldNeedsUpdate = true; matrix = new Matrix4(); matrixWorld = new Matrix4(); }
public void add(Object3D objectt) { if (objectt.parent != null) { objectt.parent.remove(objectt); } objectt.parent = this; this.children.Add(objectt); var scene = this; while (scene.parent != null) { scene = scene.parent; } if (scene != null && scene is Scene) { (scene as Scene).__addObject(objectt); } }
public void remove(Object3D objectt) { int index = this.children.IndexOf(objectt); if (index != -1) { objectt.parent = null; this.children.RemoveAt(index); } var scene = this; while (scene.parent != null) { scene = scene.parent; } if (scene != null && scene is Scene) { (scene as Scene).__removeObject(objectt); } }
public void __addObject(Object3D object3d) { if (object3d is Light) { if (this.__lights.IndexOf(object3d as Light) == -1) { this.__lights.Add(object3d as Light); } //if ( object.target && object.target.parent === undefined ) { // this.add( object.target ); //} } else if (!(object3d is Camera || object3d is Bone)) { if (this.__objects.IndexOf(object3d) == -1) { this.__objects.Add(object3d); this.__objectsAdded.Add(object3d); // check if previously removed int i = this.__objectsRemoved.IndexOf(object3d); if (i != -1) { this.__objectsRemoved.RemoveAt(i); } } } for (int i = 0; i < object3d.children.Count; i++) { this.__addObject(object3d.children[i]); } }