public Intersection(RayObject obj, double t, double u = 0.0, double v = 0.0)
 {
     rayObject = obj;
     this.t = t;
     this.u = u;
     this.v = v;
 }
Esempio n. 2
0
        //Method used outside of class to control setting the parent of an object.
        //We do not directly remove objects, instead we would set an object's parent to null.
        public void SetParent(RayObject newParent)
        {
            //Remove us from any objects that currently have us as a child
            if (parent != null)
            {
                parent.RemoveChild(this);
            }

            //Set ourselves as a child of the parent
            if (newParent != null)
            {
                newParent.AddChild(this);
            }

            //Can't let objects just sit around, make ourselves
            //part of the root
            else if (Scene.current.root != null)
            {
                Scene.current.root.AddChild(this);
            }
            //ONly thing that should get here is the global root of the scene...
            else
            {
                Console.WriteLine("Root group of scene successfully created.");
            }
        }
Esempio n. 3
0
 protected void RemoveChild(RayObject child)
 {
     if (child.parent == this)
     {
         children.Remove(child);
     }
     child.parent = null;
 }
Esempio n. 4
0
 public Computations(RayObject rayObject, double t,
                     Point point, Vector eye, Vector normal)
 {
     this.t         = t;
     this.rayObject = rayObject;
     this.point     = point;
     this.eye       = eye;
     this.normal    = normal;
 }
Esempio n. 5
0
 public CSG(Operation operation, RayObject s1,
            RayObject s2) : base()
 {
     this.operation = operation;
     left           = s1;
     right          = s2;
     left.SetParent(this);
     right.SetParent(this);
 }
Esempio n. 6
0
 protected void AddChild(RayObject newChild)
 {
     //Is this already a child of this object?
     if (newChild.parent != this)
     {
         children.Add(newChild);
     }
     newChild.parent = this;
 }
Esempio n. 7
0
        public bool Includes(RayObject o)
        {
            //Are we the object?

            if (this == o)
            {
                return(true);
            }

            //What about our children?
            foreach (RayObject i in GetChildren())
            {
                if (i.Includes(o))
                {
                    return(true);
                }
            }

            //Object never found
            return(false);
        }
Esempio n. 8
0
 public void AddRayObject(RayObject rayObject)
 {
     rayObjects.Add(rayObject);
 }