Exemplo n.º 1
0
        public Curve(Device device)
        {
            this.device = device;
            name        = ValidateName("Curve", true);

            _children = new ArrayList();

            IObject3D onePoint;
            IObject3D twoPoint;
            IObject3D threePoint;
            IObject3D fourPoint;

            // automatically adds 4 control points to get the first line.
            //	( float x, float y, float z, float scale, int slices, int stacks)
            onePoint   = new MeshCtrlPt(device, 0.5f, 0.5f, 0.5f, 0.1f, 10, 10, this);
            twoPoint   = new MeshCtrlPt(device, 1, 1, 0.5f, 0.1f, 10, 10, this);
            threePoint = new MeshCtrlPt(device, 2, 1, 0.5f, 0.1f, 10, 10, this);
            fourPoint  = new MeshCtrlPt(device, 2.5f, 0.5f, 0.5f, 0.1f, 10, 10, this);

            _children.Add(onePoint);
            _children.Add(twoPoint);
            _children.Add(threePoint);
            _children.Add(fourPoint);

            CalcCatmullRom(device);
        }
Exemplo n.º 2
0
        public Curve(Device device)
        {
            this.device = device;
            name = ValidateName("Curve", true);

            _children = new ArrayList();

            IObject3D onePoint;
            IObject3D twoPoint;
            IObject3D threePoint;
            IObject3D fourPoint;

            // automatically adds 4 control points to get the first line.
            //	( float x, float y, float z, float scale, int slices, int stacks)
            onePoint = new MeshCtrlPt(device,    0.5f, 0.5f, 0.5f, 0.1f, 10, 10, this);
            twoPoint = new MeshCtrlPt(device,    1, 1, 0.5f, 0.1f, 10, 10, this);
            threePoint = new MeshCtrlPt(device,  2, 1, 0.5f, 0.1f, 10, 10, this);
            fourPoint = new MeshCtrlPt(device,   2.5f, 0.5f, 0.5f, 0.1f, 10, 10, this);

            _children.Add(onePoint);
            _children.Add(twoPoint);
            _children.Add(threePoint);
            _children.Add(fourPoint);

            CalcCatmullRom(device);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void AddCtrlPt()
        {
            IObject3D newPoint;

            newPoint = new MeshCtrlPt(device, 1, 0, 0, 0.1f, 10, 10, this);

            if (_children == null)
            {
                _children = new ArrayList();
            }

            _children.Add(newPoint);
            CalcCatmullRom(device);
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
        public void AddCtrlPt()
        {
            IObject3D newPoint;

            newPoint = new MeshCtrlPt(device, 1, 0, 0, 0.1f, 10, 10, this);

            if( _children == null)
                _children = new ArrayList();

            _children.Add(newPoint);
            CalcCatmullRom(device);
        }