예제 #1
0
        /// <summary>
        /// Creates a new 3d object and its to the scene
        /// </summary>
        /// <param name="iObjectType">The type of object that is too be created</param>
        /// <returns>Whether or not a new 3D object could be successfully added to the scene</returns>
        public static IObject3D CreateObject(int iObjectType)
        {
            // the new object we're creating - this variable is required to fire the CreateObject event
            IObject3D newObject;

            switch (iObjectType)
            {
                case (int)ObjectTypes.MeshTeapot:
                    newObject = new MeshTeapot(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshSphere:
                    newObject = new MeshSphere(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshTorus:
                    newObject = new MeshTorus(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshBox:
                    newObject = new MeshBox(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshCylinder:
                    newObject = new MeshCylinder(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshPolygon:
                    newObject = new MeshPolygon(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshText:
                    newObject = new MeshText(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.Curve:
                    newObject = new Curve(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.MeshControlPoint:
                    newObject = new MeshCtrlPt(DeviceManager.Instance.Device);
                    break;

                case (int)ObjectTypes.ParticleSystem:
                    newObject = new ParticleSystem(DeviceManager.Instance.Device);
                    break;

                default:
                    return null;
            }

            return newObject;
        }
예제 #2
0
        /// <summary>
        /// Creates a new 3d object and its to the scene
        /// </summary>
        /// <param name="iObjectType">The type of object that is too be created</param>
        /// <returns>Whether or not a new 3D object could be successfully added to the scene</returns>
        public static IObject3D CreateObject(int iObjectType)
        {
            // the new object we're creating - this variable is required to fire the CreateObject event
            IObject3D newObject;

            switch (iObjectType)
            {
            case (int)ObjectTypes.MeshTeapot:
                newObject = new MeshTeapot(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshSphere:
                newObject = new MeshSphere(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshTorus:
                newObject = new MeshTorus(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshBox:
                newObject = new MeshBox(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshCylinder:
                newObject = new MeshCylinder(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshPolygon:
                newObject = new MeshPolygon(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshText:
                newObject = new MeshText(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.Curve:
                newObject = new Curve(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.MeshControlPoint:
                newObject = new MeshCtrlPt(DeviceManager.Instance.Device);
                break;

            case (int)ObjectTypes.ParticleSystem:
                newObject = new ParticleSystem(DeviceManager.Instance.Device);
                break;

            default:
                return(null);
            }

            return(newObject);
        }