示例#1
0
        public override void Load()
        {
            // Engine components.
            RessourceManager ressourceManager = Engine.GetComponent <RessourceManager>();


            // Setup the scene
            Entities              = new List <Entity>();
            camera                = new OrbitalCamera(Engine.GraphicDevice.GetBufferSize().X / Engine.GraphicDevice.GetBufferSize().Y, 90);
            render                = new RenderBatch();
            testSun               = new Sun(new Point3D(-150f, 150f, -150f), new Color3(255, 255, 255));
            testScene             = new Scene(camera, testSun);
            testScene.Fog.Density = 0f;

            // Dragon
            Model    dragonModel    = ressourceManager.ImportRessource <Model>("model:dragon.obj");
            Material dragonMaterial = new Material(ressourceManager.ImportRessource <Texture2D>("texture2D:blue.png"));

            dragonMaterial.Reflectivity = 1f;
            dragonMaterial.ShineDamper  = 10f;
            ressourceManager.ImportRessource <ShaderProgram>("shader:material.json");
            Entities.Add(new Entity(new Transform(new Vector3(0, 0, 0), new Vector3(), 0.1f), dragonModel, dragonMaterial));

            // Terrain
            Material GrassMaterial = new Material(ressourceManager.ImportRessource <Texture2D>("texture2D:grass.png"))
            {
                Reflectivity = 0f,
                ShineDamper  = 10f
            };

            terrain = new Entity(new Transform(0, -10f, 0), ModelFactorie.GeneratePlane(640f, 256, 64, new PerlinHeightMap()), GrassMaterial);
            water   = new Entity(new Transform(0, 0, 0), ModelFactorie.GeneratePlane(640f, 16, 64, new FlatHeightMap()), dragonMaterial);


            // Show the inspector.
            new Inspector.InspectorUI(Engine, testScene).ShowInspector();
        }