Ejemplo n.º 1
0
        public static ProceduralShape CockpitPanel()
        {
            ProceduralShapeBuilder builder = new ProceduralShapeBuilder();

            builder.AddBevelledSquareFace(Vector3.Left + Vector3.Up, Vector3.Right + Vector3.Up, Vector3.Left + Vector3.Down, Vector3.Right + Vector3.Down, 0.1f, 0.1f);
            return(builder.BakeShape());
        }
Ejemplo n.º 2
0
        public void Initalise()
        {
            currentVertices = new List <Vector3>();

            SystemCore.ActiveScene.SetUpAmbientAndFullLightingRig();

            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 15, 0), Color.White, 20, 20, 1, PointLightNumber.One);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, -15, 0), Color.White, 20, 20, 1, PointLightNumber.Two);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 0, 15), Color.White, 20, 20, 1, PointLightNumber.Three);
            SystemCore.ActiveScene.AddPointLight(new Vector3(0, 0, -15), Color.White, 20, 20, 1, PointLightNumber.Four);

            SystemCore.AddNewUpdateRenderSubsystem(new SkyDome(Color.LightGray, Color.Gray, Color.DarkBlue));

            shapeBuilder = new ProceduralShapeBuilder();
            CurrentMode  = EditMode.Voxel;
            shapesToBake = new Dictionary <GameObject.GameObject, ProceduralShape>();


            cameraGameObject = new GameObject.GameObject("camera");
            cameraGameObject.AddComponent(new ComponentCamera());
            cameraGameObject.Transform.SetPosition(new Vector3(0, 0, 20));
            cameraGameObject.Transform.SetLookAndUp(new Vector3(0, 0, -1), new Vector3(0, 1, 0));
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraGameObject);
            SystemCore.SetActiveCamera(cameraGameObject.GetComponent <ComponentCamera>());


            mouseCursor = GameObjectFactory.CreateRenderableGameObjectFromShape(new ProceduralCube(),
                                                                                EffectLoader.LoadSM5Effect("flatshaded"));
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(mouseCursor);



            AddGUI();
        }
Ejemplo n.º 3
0
        public static ProceduralShape CockpitBar()
        {
            ProceduralShapeBuilder builder = new ProceduralShapeBuilder();

            //bottom bar
            builder.AddFace(Vector3.Left, Vector3.Left + new Vector3(0, 0.1f, 0), Vector3.Right + new Vector3(0, 0.1f, 0), Vector3.Right);
            builder.AddFace(Vector3.Left * 2 + Vector3.Backward,
                            Vector3.Left * 2 + Vector3.Backward + new Vector3(0, 0.1f, 0),
                            Vector3.Left + new Vector3(0, 0.1f, 0),
                            Vector3.Left);
            builder.AddFace(Vector3.Right,
                            Vector3.Right + new Vector3(0, 0.1f, 0),
                            Vector3.Right * 2 + Vector3.Backward + new Vector3(0, 0.1f, 0),
                            Vector3.Right * 2 + Vector3.Backward);
            var b = Vector3.Forward;

            return(builder.BakeShape());
        }
Ejemplo n.º 4
0
        private static GameObject CreateTestArena(float arenaSize)
        {
            ProceduralShapeBuilder floor = new ProceduralShapeBuilder();

            floor.AddSquareFace(new Vector3(arenaSize, 0, arenaSize), new Vector3(-arenaSize, 0, arenaSize),
                                new Vector3(arenaSize, 0, -arenaSize), new Vector3(-arenaSize, 0, -arenaSize));

            ProceduralShape arenaFloor = floor.BakeShape();

            arenaFloor.SetColor(Color.DarkOrange);

            ProceduralCuboid a = new ProceduralCuboid(arenaSize, 1, arenaSize / 5);

            a.Translate(new Vector3(0, arenaSize / 5, arenaSize));
            a.SetColor(Color.LightGray);

            ProceduralShape b = a.Clone();

            b.Translate(new Vector3(0, 0, -arenaSize * 2));

            ProceduralShape c = ProceduralShape.Combine(a, b);
            ProceduralShape d = b.Clone();

            d.Transform(MonoMathHelper.RotateNinetyDegreesAroundUp(true));

            ProceduralShape e = ProceduralShape.Combine(arenaFloor, c, d);



            var side2 = e.Clone();
            var side3 = e.Clone();
            var side4 = e.Clone();

            e.Translate(new Vector3(-arenaSize * 2, 0, 0));

            side2.Transform(MonoMathHelper.RotateHundredEightyDegreesAroundUp(true));
            side2.Translate(new Vector3(arenaSize * 2, 0, 0));
            side3.Transform(MonoMathHelper.RotateNinetyDegreesAroundUp(true));
            side3.Translate(new Vector3(0, 0, arenaSize * 2));
            side4.Transform(MonoMathHelper.RotateNinetyDegreesAroundUp(false));
            side4.Translate(new Vector3(0, 0, -arenaSize * 2));



            var final = ProceduralShape.Combine(e, side2, side3, side4, arenaFloor);

            var arenaObject = GameObjectFactory.CreateRenderableGameObjectFromShape(final,
                                                                                    EffectLoader.LoadSM5Effect("flatshaded"));


            arenaObject.AddComponent(new StaticMeshColliderComponent(arenaObject, final.GetVertices(),
                                                                     final.GetIndicesAsInt().ToArray()));


            // arenaObject.AddComponent(new RotatorComponent(Vector3.Up, 0.0001f));

            SystemCore.GameObjectManager.AddAndInitialiseGameObject(arenaObject);


            LineBatch  l          = new LineBatch(new Vector3(-arenaSize, 0.1f, -arenaSize), new Vector3(-arenaSize, 0.1f, arenaSize), new Vector3(arenaSize, 0.1f, arenaSize), new Vector3(arenaSize, 0.1f, -arenaSize), new Vector3(-arenaSize, 0.1f, -arenaSize));
            GameObject lineObject = SystemCore.GameObjectManager.AddLineBatchToScene(l);

            arenaObject.AddChild(lineObject);



            return(arenaObject);
        }
Ejemplo n.º 5
0
 public void Clear()
 {
     shapeBuilder = new ProceduralShapeBuilder();
 }