Exemple #1
0
        private void InitializeTorusDecorator()
        {
            Transform3D transform   = null;
            ModelObject modelObject = null;

            #region Torus
            transform = new Transform3D(
                new Vector3(0, 10, 0),
                Vector3.Zero, new Vector3(0.1f, 0.4f, 0.05f),
                Vector3.UnitX, Vector3.UnitY);

            modelObject = new ModelObject("torus 1",
                                          ActorType.Decorator, transform,
                                          this.modelDictionary["fart"],
                                          new ColorParameters(Color.Yellow,
                                                              this.textureDictionary["crate1"], 1f),
                                          this.modelEffect);

            //attach a rotation controller to see torus spin
            modelObject.AttachController(new RotationController("torus rotation controller 1",
                                                                ControllerType.Rotation,
                                                                new Vector3(0, 20 / 60.0f, 0))); //rotate around +ve Y-axis 0.016 degrees each update or 1 degree/second
            this.object3DManager.Add(modelObject);
            #endregion
        }
Exemple #2
0
        private void InitializeSemiTransparentDecorators()
        {
            Transform3D transform   = null;
            ModelObject modelObject = null;

            #region Box 1
            transform = new Transform3D(
                new Vector3(10, 5, 0),
                new Vector3(0, 0, 0),
                new Vector3(4, 16, 2),
                Vector3.UnitX, Vector3.UnitY);


            modelObject = new ModelObject("box 1",
                                          ActorType.Decorator, transform,
                                          this.modelDictionary["box"],
                                          new ColorParameters(Color.PaleVioletRed,
                                                              this.textureDictionary["crate1"], 0.7f),
                                          this.modelEffect);

            modelObject.AttachController(new TranslationSineLerpController(
                                             "tsl1", ControllerType.SineTranslation,
                                             new Vector3(0, 1, 0), new TrigonometricParameters(10, 0.1f, 0)));
            this.object3DManager.Add(modelObject);
            #endregion

            #region Box 2
            transform = new Transform3D(
                new Vector3(30, 5, 0),
                new Vector3(0, 0, 0),
                new Vector3(4, 16, 8),
                Vector3.UnitX, Vector3.UnitY);

            modelObject = new ModelObject("box 2",
                                          ActorType.Decorator, transform,
                                          this.modelDictionary["box"],
                                          new ColorParameters(Color.LightBlue,
                                                              this.textureDictionary["crate1"], 0.3f),
                                          this.modelEffect);

            this.object3DManager.Add(modelObject);
            #endregion
        }