Example #1
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;

            // Main Camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 400, 1200), new Vector3(0, 400, 0));

            EntityManager.Add(camera.Entity);
            RenderManager.SetActiveCamera(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);
        }
Example #2
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;

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

            RenderManager.SetActiveCamera(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);
        }
Example #3
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;

            //ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 2f, -2.5f), new Vector3(0, 1, 0));
            camera = new FreeCamera("freeCamera", new Vector3(0, 2f, -3.5f), Vector3.UnitY * 0.9f)
            {
                Speed = 5
            };
            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") { ReferenceAlpha = 0.5f }))
                .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                .AddComponent(new SkinnedModelRenderer())
                .AddComponent(new TimBehavior());

            anim = animatedModel.FindComponent<Animation3D>();
            EntityManager.Add(animatedModel);

            Entity floor = new Entity("Floor")
                       .AddComponent(new Transform3D())
                       .AddComponent(new BoxCollider())
                       .AddComponent(new Model("Content/Model/floor.wpk"))
                       .AddComponent(new MaterialsMap(new BasicMaterial("Content/Texture/floorNight.wpk")))
                       .AddComponent(new ModelRenderer());

            //Suddenly columns! Thousand of them!  (4x2 columns)

            EntityManager.Add(floor);

            //Suddenly columns! Thousand of them!  (4x2 columns)
            /*int nColumns = 0;
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    Entity column = new Entity("column_" + nColumns++)
                        .AddComponent(new Transform3D() { Position = new Vector3(4 - (8 * j), 0, 8 * i) })
                       .AddComponent(new Model("Content/Model/floor.wpk"))
                        .AddComponent(new ModelRenderer())
                       .AddComponent(new MaterialsMap(new BasicMaterial("Content/Texture/floorNight.wpk")));

                    EntityManager.Add(column);
                    Entity fern = new Entity("Fern" + nColumns++)
                             .AddComponent(new Transform3D() { Position = new Vector3(2f - (8 * j), 0f, 2.5f*i) })
                             .AddComponent(new BoxCollider())
                             .AddComponent(new Model("Content/Model/fern.wpk"))
                             .AddComponent(new MaterialsMap(new BasicMaterial("Content/Texture/FernTexture.wpk") { ReferenceAlpha = 0.5f }))
                             .AddComponent(new ModelRenderer());

                    EntityManager.Add(fern);
                }
            }*/

            camera.Entity.AddComponent(new CameraBehavior(EntityManager.Find("Isis")));

            //Add some light!
            PointLight light = new PointLight("light", Vector3.Zero)
            {
                Attenuation = 75,
                Color = new Color(1, 0.6f, 0.4f),
                IsVisible = true
            };
            light.Entity.AddComponent(new FollowCameraBehavior(camera.Entity));
            light.Entity.AddComponent(new TorchLightBehaviour());

            EntityManager.Add(light);
            EntityManager.Add(camera);
            RenderManager.SetActiveCamera(camera.Entity);
        }