Ejemplo n.º 1
0
        public RenderTestScreen()
            : base()
        {
            SystemCore.CursorVisible = false;
            fpsLabel.Visible         = true;
            SystemCore.ActiveScene.SetUpBasicAmbientAndKey();

            var effect = EffectLoader.LoadSM5Effect("FlatShaded");


            mouseCamera = new MouseFreeCamera(new Vector3(0, 0, 0));
            SystemCore.SetActiveCamera(mouseCamera);

            var shape = new ProceduralSphere(20, 20);

            shape.SetColor(SystemCore.ActiveColorScheme.Color5);



            //create 100 cubes, add collision and collision visualiser components, give them random position and velocity
            for (int i = 0; i < 100; i++)
            {
                var gameObject = new GameObject();
                gameObject.AddComponent(new RenderGeometryComponent(BufferBuilder.VertexBufferBuild(shape), BufferBuilder.IndexBufferBuild(shape), shape.PrimitiveCount));

                gameObject.AddComponent(new EffectRenderComponent(effect));
                //gameObject.AddComponent(new BasicEffectRenderComponent(effect));
                gameObject.Transform.SetPosition(RandomHelper.GetRandomVector3(Vector3.One * -100, Vector3.One * 100));
                gameObject.AddComponent(new RotatorComponent(Vector3.Up));
                SystemCore.GetSubsystem <GameObjectManager>().AddAndInitialiseGameObject(gameObject);

                gameObject.Transform.Scale    = 5f;
                gameObject.Transform.Velocity = RandomHelper.GetRandomVector3(-Vector3.One, Vector3.One) * 0.01f;
            }


            AddInputBindings();

            Model           geoDesicModel = SystemCore.ContentManager.Load <Model>("Models/geodesic");
            ProceduralShape geodesicShape = ModelMeshParser.GetShapeFromModelNoUVs(geoDesicModel);

            geodesicShape.Scale(20f);
            geodesicShape.InsideOut();
            GameObject geoDesic = GameObjectFactory.CreateRenderableGameObjectFromShape(geodesicShape, EffectLoader.LoadSM5Effect("cockpitscreen"));

            SystemCore.GameObjectManager.AddAndInitialiseGameObject(geoDesic);
        }
Ejemplo n.º 2
0
        public MainGameScreen()
            : base()
        {
            SystemCore.ActiveScene.SetUpBasicAmbientAndKey();

            SystemCore.AddNewUpdateRenderSubsystem(new SkyDome(Color.Black, Color.Black, Color.Black));


            ship = new Ship("ship");
            SystemCore.SetActiveCamera(ship.shipCameraObject.GetComponent <ComponentCamera>());



            Model           geoDesicModel = SystemCore.ContentManager.Load <Model>("Models/geodesic2");
            ProceduralShape geodesicShape = ModelMeshParser.GetShapeFromModelWithUVs(geoDesicModel);

            geodesicShape.Scale(1f);
            geodesicShape.InsideOut();

            ship.AddComponent(new RenderGeometryComponent(geodesicShape));
            //var cockpitEffectComponent = new EffectRenderComponent(EffectLoader.LoadEffect("cockpitscreen"));
            //cockpitEffectComponent.DrawOrder = 100;
            //ship.AddComponent(cockpitEffectComponent);

            oldPos = ship.GetComponent <HighPrecisionPosition>().Position;
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(ship);


            testPlanetSurfacePosition           = new PlanetSurfacePosition();
            testPlanetSurfacePosition.Latitude  = 40;
            testPlanetSurfacePosition.Longitude = -90;

            solarSystem            = new SolarSystem();
            solarSystem.PlayerShip = ship;
            ship.SolarSystem       = solarSystem;
            SystemCore.AddNewGameComponent(solarSystem);
            ship.Transform.Rotate(Vector3.Up, MathHelper.PiOver2);
        }