private UWB_Primitive CreateRectangle(RTRectangle r)
        {
            UWB_XNAPrimitiveMesh m = new UWB_XNAPrimitiveMesh("HiResFloor");

            m.EnableTexturing(false);
            m.EnableLighting(true);
            return(m);
        }
        private UWB_Primitive CreateSphereMesh()
        {
            UWB_XNAPrimitiveMesh m = new UWB_XNAPrimitiveMesh("sphere");

            m.EnableTexturing(false);
            m.EnableLighting(true);
            return(m);
        }
        private void AddCamera(RayTracer_552.RTCamera c)
        {
            // Look at position
            UWB_SceneNode        atN = new UWB_SceneNode();
            UWB_XNAPrimitiveMesh at  = new UWB_XNAPrimitiveMesh("sphere");

            at.Material.Diffuse = new Vector4(0.8f, 0.1f, 0.1f, 1.0f);
            atN.setPrimitive(at);
            UWB_XFormInfo atxf = atN.getXFormInfo();

            atxf.SetTranslation(c.AtPosition);
            atxf.SetScale(new Vector3(0.3f, 0.3f, 0.3f));
            atN.setXFormInfo(atxf);

            // Eye position
            UWB_SceneNode        eyeN = new UWB_SceneNode();
            UWB_XNAPrimitiveMesh eye  = new UWB_XNAPrimitiveMesh("cone");

            eyeN.setPrimitive(eye);
            UWB_XFormInfo eyexf = eyeN.getXFormInfo();

            eyexf.SetTranslation(c.EyePosition);
            mCameraPosition = c.EyePosition;
            Vector3 init  = new Vector3(0, 0, 1); // initial cone orientation
            Vector3 final = c.AtPosition - c.EyePosition;

            final = Vector3.Normalize(final);
            float dot = Vector3.Dot(init, final);

            if (Math.Abs(dot) < 0.9999)
            {
                float   angle = (float)Math.Acos(dot);
                Vector3 axis  = Vector3.Cross(init, final);
                axis = Vector3.Normalize(axis);
                Quaternion q = Quaternion.CreateFromAxisAngle(axis, angle);
                eyexf.SetRotationQuat(q);
            }
            eyeN.setXFormInfo(eyexf);

            // Lines ...
            UWB_SceneNode lineN = new UWB_SceneNode();

            mCameraPrimitives = new UWB_PrimitiveList();
            lineN.setPrimitive(mCameraPrimitives);
            UWB_PrimitiveLine l = new UWB_PrimitiveLine();

            l.setStartPoint(c.EyePosition.X, c.EyePosition.Y, c.EyePosition.Z);
            l.setEndPoint(c.AtPosition.X, c.AtPosition.Y, c.AtPosition.Z);
            mCameraPrimitives.append(l);

            mCamera.insertChildNode(lineN);
            mCamera.insertChildNode(atN);
            mCamera.insertChildNode(eyeN);
        }