Exemple #1
0
        protected override void CreateScene()
        {            
            // Main Camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 400, 1200), new Vector3(0, 400, 0));
            camera.BackgroundColor = Color.Black;
            EntityManager.Add(camera.Entity);            

            // Initialize particle system

            Entity entitySystem = new Entity("Particles")
                .AddComponent(new Transform3D())
                .AddComponent(new ParticleBehavior())
                .AddComponent(new ParticleSystemRenderer3D());

            var behavior = entitySystem.FindComponent<ParticleBehavior>();
            behavior.ApplyChanges();
            behavior.ApplyMaterial();

            EntityManager.Add(entitySystem);

            textBlock1 = new TextBlock()
            {
                Margin = new Thickness(10),
                Text = "Fire",
                TextWrapping = true,
            };
            EntityManager.Add(textBlock1.Entity);
        }
Exemple #2
0
        protected override void CreateScene()
        {            
            ViewCamera mainCamera = new ViewCamera("MainCamera", new Vector3(500, 500, 500), Vector3.Zero);
            mainCamera.BackgroundColor = Color.Black;
            EntityManager.Add(mainCamera.Entity);            

            Entity drawable = new Entity("Drawable")
                .AddComponent(new DrawableLines(1));

            EntityManager.Add(drawable);
        }
Exemple #3
0
        protected override void CreateScene()
        {
            ViewCamera viewCamera = new ViewCamera("view", new Vector3(0f, 0f, 2.5f), Vector3.Zero);
            viewCamera.BackgroundColor = Color.CornflowerBlue;
            EntityManager.Add(viewCamera.Entity);

            var cube = new Entity("Cube")
            .AddComponent(new Transform3D())
            .AddComponent(Model.CreateCube())
            .AddComponent(new MaterialsMap())
            .AddComponent(new ModelRenderer());

            EntityManager.Add(cube);            
        }
Exemple #4
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;
            //WaveServices.ScreenLayers.SetDiagnosticsActive(true);

            ViewCamera mainCamera = new ViewCamera("MainCamera", new Vector3(0f,10f,15f), Vector3.Zero);
            EntityManager.Add(mainCamera.Entity);

            RenderManager.SetActiveCamera(mainCamera.Entity);

            Entity drawable = new Entity("Drawable")
                .AddComponent(new DebugShapes());

            EntityManager.Add(drawable);
        }
Exemple #5
0
        protected override void CreateScene()
        {
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 0, 3), Vector3.Zero);
            camera.BackgroundColor = Color.CornflowerBlue;
            EntityManager.Add(camera.Entity);         

            Entity primitive = new Entity("Primitive")
                .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1f, 2f, 1f) })
                .AddComponent(new Transform3D())
                .AddComponent(Model.CreateTeapot())
                .AddComponent(new BoxCollider())
                .AddComponent(new ChangeModel())
                .AddComponent(new MaterialsMap())//new BasicMaterial(Color.White)))
                .AddComponent(new ModelRenderer());

            EntityManager.Add(primitive);
        }     
Exemple #6
0
        protected override void CreateScene()
        {            
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(2, 1, 2), new Vector3(0, 1, 0));
            camera.BackgroundColor = Color.CornflowerBlue;
            EntityManager.Add(camera.Entity);            

            Entity animatedModel = new Entity("Isis")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new SkinnedModel("Content/isis.wpk"))
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/isis-difuse.wpk")))
                .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                .AddComponent(new SkinnedModelRenderer());

            anim = animatedModel.FindComponent<Animation3D>();
            EntityManager.Add(animatedModel);
        }
Exemple #7
0
        protected override void CreateScene()
        {
            ViewCamera camera = new ViewCamera("Camera", new Vector3(0f, 0f, 5f), Vector3.Zero);

            RenderManager.SetActiveCamera(camera.Entity);

            EntityManager.Add(camera.Entity);

            CreateCube("Cube1", Vector3.Zero);
            CreateCube("Cube2", new Vector3(5f, 0f, 0f));
            CreateCube("Cube3", new Vector3(-5f, 0f, 0f));
            CreateCube("Cube4", new Vector3(5f, 0f, 5f));
            CreateCube("Cube5", new Vector3(-5f, 0f, 5f));
            CreateCube("Cube6", new Vector3(5f, 0f, -5f));
            CreateCube("Cube7", new Vector3(-5f, 0f, -5f));
            CreateCube("Cube8", new Vector3(0f, 0f, 5f));
            CreateCube("Cube9", new Vector3(0f, 0f, -5f));
        }
Exemple #8
0
        protected override void CreateScene()
        {
            this.CreateMaterials();

            this.camera = new ViewCamera("camera", new Vector3(0, 5, 13), new Vector3(0, 5, 0))
            {
                FieldOfView = 0.8f,
                NearPlane = 0.1f
            };
            this.camera.Entity.AddComponent(this.skyboxMaps[this.currentEnv]);
            EntityManager.Add(camera);           

            this.CreateVenus();

            this.CreateUI();

            this.UpdateMaterials();
        }
Exemple #9
0
        protected override void CreateScene()
        {            
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 2, 4), Vector3.Zero);
            camera.BackgroundColor = Color.Black;
            EntityManager.Add(camera.Entity);            

            DirectionalLight skylight = new DirectionalLight("SkyLight", new Vector3(1));
            EntityManager.Add(skylight);

            Entity primitive = new Entity("Primitive")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1f, 1f, 1f) })
                .AddComponent(Model.CreateCube())
                .AddComponent(new MaterialsMap(new BasicMaterial((WaveServices.ScreenContextManager.CurrentContext[0] as MyScene).SmallTarget) { LightingEnabled = true }))
                .AddComponent(new ModelRenderer());

            EntityManager.Add(primitive);
        }
Exemple #10
0
        protected override void CreateScene()
        {
            #region Scene creation
            // Create the camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(2, 1, 2), new Vector3(0, 1, 0));
            EntityManager.Add(camera.Entity);

            RenderManager.SetActiveCamera(camera.Entity);

            // Create the model. Note of we add the Animation3D component.
            Entity animatedModel = new Entity("Isis")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new SkinnedModel("Content/isis.wpk"))
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/isis-difuse.wpk")))
                .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                .AddComponent(new SkinnedModelRenderer())
                .AddComponent(new IsisBehavior());

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);

            RenderManager.BackgroundColor = Color.CornflowerBlue;
            #endregion

            #region Key Events
            // Add the key frames. The first parameter is the name of the animation, the second the number of frames and the third the name of the event. As you can see, we raise two events when
            // the animation is "Attack" ( see the Animation3D example for further information ). The first event is raised on frame 10 and the second on frame 25. See the SpankerBehavior class
            animation = animatedModel.FindComponent<Animation3D>()
                .AddKeyFrameEvent("Jog", 1, "DoFootstep")
                .AddKeyFrameEvent("Jog", 14, "DoFootstep")
                .AddKeyFrameEvent("Jog", 26, "DoFootstep")
                .AddKeyFrameEvent("Jog", 39, "DoFootstep");
            EntityManager.Add(animatedModel);
            #endregion
        }
Exemple #11
0
        protected override void CreateScene()
        {
            SmallTarget = WaveServices.GraphicsDevice.RenderTargets.CreateRenderTarget(256, 256);                       

            DirectionalLight skylight = new DirectionalLight("SkyLight", new Vector3(1));
            EntityManager.Add(skylight);

            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 2, 4), Vector3.Zero);
            camera.BackgroundColor = Color.Red;
            camera.RenderTarget = SmallTarget;
            EntityManager.Add(camera.Entity);            

            Entity primitive = new Entity("Primitive")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(-1f, -1f, -1f) })
                .AddComponent(Model.CreateCube())
                .AddComponent(new MaterialsMap(new BasicMaterial(Color.Yellow) { LightingEnabled = true }))
                .AddComponent(new ModelRenderer());

            EntityManager.Add(primitive);
        }
Exemple #12
0
        protected override void CreateScene()
        {
            RenderManager.RegisterLayerBefore(new SkyLayer(this.RenderManager), DefaultLayers.Alpha);

            ViewCamera camera = new ViewCamera("camera", new Vector3(0, 5, 13), new Vector3(0, 5, 0))
            {
                FieldOfView = 0.8f,
                NearPlane = 0.1f
            };
            EntityManager.Add(camera);

            RenderManager.SetActiveCamera(camera.Entity);

            this.CreateMaterials();

            this.CreateVenus();

            this.CreateSky();

            this.CreateUI();

            this.UpdateMaterials();
        }
Exemple #13
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            string name = string.Empty;

            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 0, 3), Vector3.Zero);
            EntityManager.Add(camera.Entity);            

            Entity primitive = new Entity("Primitive")
                .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1f, 2f, 1f) })
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new MaterialsMap())
                .AddComponent(new ModelRenderer());

            switch (this.index)
            {
                case (0):
                    name = "Push";
                    primitive.AddComponent(Model.CreateTeapot());
                    camera.BackgroundColor = Color.Black;                    
                    break;
                case (1):
                    name = "Color Fade";
                    primitive.AddComponent(Model.CreateCapsule());
                    camera.BackgroundColor = Color.DarkBlue;
                    break;
                case (2):
                    name = "Doorway";
                    primitive.AddComponent(Model.CreateSphere());
                    camera.BackgroundColor = Color.DarkCyan;
                    break;
                case (3):
                    name = "Comb";
                    primitive.AddComponent(Model.CreateTorus());
                    camera.BackgroundColor = Color.DarkGoldenrod;
                    break;
                case (4):
                    name = "Cover";
                    primitive.AddComponent(Model.CreateCapsule());
                    camera.BackgroundColor = Color.DarkGray;
                    break;
                case (5):
                    name = "Curtains";
                    primitive.AddComponent(Model.CreatePyramid());
                    camera.BackgroundColor = Color.DarkGreen;
                    break;
                case (6):
                    name = "Falling Lines";
                    primitive.AddComponent(Model.CreatePlane());
                    camera.BackgroundColor = Color.DarkKhaki;
                    break;
                case (7):
                    name = "Fan";
                    primitive.AddComponent(Model.CreateCone());
                    camera.BackgroundColor = Color.DarkMagenta;
                    break;
                case (8):
                    name = "Rotate";
                    primitive.AddComponent(Model.CreateCube());
                    camera.BackgroundColor = Color.DarkOliveGreen;
                    break;
                case (9):
                    name = "Scale";
                    primitive.AddComponent(Model.CreateTeapot());
                    camera.BackgroundColor = Color.DarkOrange;
                    break;
                case (10):
                    name = "Shrink and Spin";
                    primitive.AddComponent(Model.CreateCapsule());
                    camera.BackgroundColor = Color.DarkOrchid;
                    break;
                case (11):
                    name = "Spinning Squares";
                    primitive.AddComponent(Model.CreateSphere());
                    camera.BackgroundColor = Color.DarkRed;
                    break;
                case (12):
                    name = "Uncover";
                    primitive.AddComponent(Model.CreateTorus());
                    camera.BackgroundColor = Color.DarkSalmon;
                    break;
                case (13):
                    name = "Zoom";
                    primitive.AddComponent(Model.CreatePyramid());
                    camera.BackgroundColor = Color.DarkSeaGreen;
                    break;
                case (14):
                    name = "Chequered";
                    primitive.AddComponent(Model.CreatePlane());
                    camera.BackgroundColor = Color.DarkSlateBlue;
                    break;
                case (15):
                    name = "Cross Fade";
                    primitive.AddComponent(Model.CreateCube());
                    camera.BackgroundColor = Color.DarkSlateGray;
                    break;
                default:
                    break;
            }

            Button button = new Button()
            {
                Text = string.Format("Next scene with {0} transition", name),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Bottom,
                Width = 400,
                Margin = new Thickness(10),
            };

            button.Click += this.OnClick;

            this.EntityManager.Add(button);
            this.EntityManager.Add(primitive);
        }