コード例 #1
0
ファイル: FNGame.cs プロジェクト: Sprunth/From-Nothing
        public void Initialize()
        {
            //var light = Scene.AddLightSceneNode(Scene.RootNode,new Vector3Df(2, 6, 3), new Colorf(200, 200, 180), 20);
            var light = Scene.AddLightSceneNode(null, new Vector3Df(-30, 35, -25));

            light.Radius      = 25;
            light.CastShadows = true;
            light.LightType   = LightType.Point;

            var sun = Scene.AddLightSceneNode(null, new Vector3Df(40, 100, 40));

            sun.Radius      = 50;
            sun.CastShadows = true;
            sun.LightType   = LightType.Point;


            sphere       = Scene.AddAnimatedMeshSceneNode(Scene.AddSphereMesh("sphere", 10f));
            sphere.Scale = new Vector3Df(1);
            sphere.SetMaterialFlag(MaterialFlag.Lighting, true);
            sphere.Position = new Vector3Df(1, 11, 1);
            //sphere.SetMaterialTexture(0, Driver.GetTexture("Mars.jpg"));
            sphere.SetMaterialTexture(0, GeneratePlanetTexture(new Vector2Dd(300, 300)));
            Scene.MeshManipulator.SetVertexColors(sphere.Mesh, new Color(200, 200, 200));

            var terrain =
                Scene.AddAnimatedMeshSceneNode(Scene.AddHillPlaneMesh("terrain", new Dimension2Df(1, 1),
                                                                      new Dimension2Di(128, 128),
                                                                      new Material(), 0));

            terrain.Position = new Vector3Df(0, 0, 0);
            terrain.SetMaterialFlag(MaterialFlag.Lighting, true);
            Scene.MeshManipulator.SetVertexColors(terrain.Mesh, new Color(220, 220, 220));
            selector = Scene.CreateOctreeTriangleSelector(terrain.Mesh, terrain, 128);
            terrain.TriangleSelector = selector;
            Scene.CreateCollisionResponseAnimator(selector, terrain);

            _cam = new Camera(this);

            selectionCube = Scene.AddCubeSceneNode(10, null, -1);
            selectionCube.SetMaterialFlag(MaterialFlag.Wireframe, true);
        }