示例#1
0
 public MeshNode(Mesh Mesh, Texture2D Texture, Texture2D NormalMap, Euler Orientation = null)
 {
     this.Mesh = Mesh;
     this.Texture = Texture;
     this.NormalMap = NormalMap;
     this.Orientation = Orientation;
     if (this.Orientation == null) this.Orientation = new Euler();
 }
示例#2
0
        public GuiSceneNode(Geo.Mesh Mesh, GraphicsDevice device, int width, int height, Euler Euler = null)
        {
            this.Device = device;
            this.Mesh = Mesh;

            this.Orientation = Euler;
            if (this.Orientation == null) this.Orientation = new Euler();

            uiCamera = new Render.OrthographicCamera(new Viewport(0, 0, width, height));
            uiRoot = new UIItem("ROOT", new QuadShape(0, 0, width, height), null);

            uiCamera.focus = new Vector2(width / 2, height / 2);

            renderTarget = new RenderTarget2D(device, uiCamera.Viewport.Width, uiCamera.Viewport.Height);
        }
示例#3
0
文件: EditorGrid.cs 项目: Blecki/CCDC
        public EditorGrid(GraphicsDevice Device, int DivisionsX, int DivisionsY, Euler Euler = null)
        {
            this.Orientation = Euler;
            if (this.Orientation == null) this.Orientation = new Euler();

            this.DivisionsX = DivisionsX;
            this.DivisionsY = DivisionsY;

            cellWidth = 1.0f / DivisionsX;
            cellHeight = 1.0f / DivisionsY;

            QuadMesh = Gem.Geo.Gen.FacetCopy(Gem.Geo.Gen.CreateQuad());
            Gem.Geo.Gen.Transform(QuadMesh, Matrix.CreateTranslation(0.5f, 0.5f, 0.0f));
            GridMesh = Gem.Geo.WireframeMesh.GenerateGrid(1.0f, 1.0f, DivisionsX, DivisionsY);
        }
示例#4
0
        public void Begin()
        {
            guiModule = new Gui.GuiModule(Main.GraphicsDevice, Main.Input);
            //inputModule = new InputModule(Main.Input);

            simulation = new Simulation(Main.Content, new PropertySet(
                "episode-name", "Content", "server", null));
            simulation.debugOutput += (s) => { Main.Write(s); };
            simulation.Content.FrontLoadTextures();
            Main.Write("Started menu simulation\n");

            renderModule = new Render.RenderModule(Main.GraphicsDevice, simulation.Content);
            simulation.modules.Add(renderModule);
            //simulation.modules.Add(inputModule);
            simulation.modules.Add(guiModule);

            simulation.beginSimulation();

            Main.Input.ClearBindings();
            Main.Input.AddAxis("primary", new MouseAxisBinding());

            var icosohedron = Geo.Ico.Icosahedron.Generate();
            //icosohedron = icosohedron.Subdivide();
            var icoMesh = icosohedron.GenerateMesh(2.0f);
            var icoBrush = Geo.Csg.PlanesFromMesh(icoMesh);

            spinner = //new RealtimeCSG.CSGNode(RealtimeCSG.CSGNodeType.Addition,
                new RealtimeCSG.CSGNode(new RealtimeCSG.StaticBrushGenerator(Geo.Csg.CreatePrism(6, Vector3.UnitY, Vector3.UnitZ, 10.0f)));
            spinner.TextureProjection = new Geo.PlanarProjection(
                new RealtimeCSG.Plane(0.0f, 1.0f, 0.0f, 1.0f), Vector3.UnitZ, 10.0f);
            spinner.Texture = Main.Content.Load<Texture2D>("Content/swirl");

            //spinner = new Geo.Csg.CsgTransformationNode(
            //        new Geo.Csg.OperationNode(RealtimeCSG.CSGNodeType.Addition,
            //            new Geo.Csg.BrushNode(Geo.Csg.CreatePrism(6, Vector3.UnitY, Vector3.UnitZ, 10.0f)),
            //            new Geo.Csg.OperationNode(RealtimeCSG.CSGNodeType.Addition,
            //                new Geo.Csg.BrushNode(Geo.Csg.CreatePrism(6, Vector3.UnitX, Vector3.UnitY, 10.0f)),
            //                new Geo.Csg.BrushNode(Geo.Csg.CreatePrism(6, Vector3.UnitZ, Vector3.UnitX, 10.0f)))),
            //        spinEuler);

            var icoNode = new RealtimeCSG.CSGNode(icoBrush);
            csgNode = new RealtimeCSG.CSGNode(RealtimeCSG.CSGNodeType.Subtraction,
                icoNode,
                spinner);
            icoNode.Texture = Main.Content.Load<Texture2D>("Content/swirl");
            icoNode.TextureProjection = new Geo.PlanarProjection(
                new RealtimeCSG.Plane(0, 0, 1, 0), new Vector3(0, 1, 0), 10.0f);
            //this.csgNode = new Geo.Csg.OperationNode(RealtimeCSG.CSGNodeType.Subtraction,
            //    new Geo.Csg.BrushTransformationNode(
            //        new Geo.Csg.BrushNode(icoBrush),
            //        rootEuler),
            //        spinner);

            //this.csgNode = new Geo.Csg.BrushNode(icoBrush);
            var list = new List<RealtimeCSG.CSGNode>();
            list.Add(csgNode);
            var result = RealtimeCSG.CSGCategorization.ProcessCSGNodes(csgNode, list);
            var gemCube = Geo.Csg.ConvertToMesh(csgNode.cachedMesh);
            gemCube = Geo.Gen.FacetCopy(gemCube);

            var cubeEuler = new Euler();
            var renderNode = new Render.CsgMeshLeafNode(csgNode, cubeEuler);
            simulation.AddEntity(250, new Render.SceneGraphRoot(renderNode));
            //var guiEuler = new Euler();
            //var gui = new Gui.SceneNode(128, 128, guiEuler);
            //simulation.AddEntity(61440, new Render.SceneGraphRoot(gui));

            /*guiEuler.Scale = new Vector3(4, 4, 4);
            var button = new Gui.UIItem(new Rectangle(16,16,64,32));
            button.settings.Upsert("bg-color", new Vector3(0.3f, 0.3f, 0.3f));
            button.hoverSettings = new PropertySet("bg-color", new Vector3(0.9f, 0.9f, 0.9f));
            gui.uiRoot.AddChild(button);*/

            Input.AddBinding("left", new KeyboardBinding(Keys.A, KeyBindingType.Held));
            Input.AddBinding("up", new KeyboardBinding(Keys.W, KeyBindingType.Held));
            Input.AddBinding("right", new KeyboardBinding(Keys.D, KeyBindingType.Held));
            Input.AddBinding("down", new KeyboardBinding(Keys.S, KeyBindingType.Held));

            actionHandler.MapAction("left", () => { renderModule.Camera.Yaw(2 * elapsedTime); });
            actionHandler.MapAction("right", () => { renderModule.Camera.Yaw(-2 * elapsedTime); });
            actionHandler.MapAction("up", () => { renderModule.Camera.Pitch(2 * elapsedTime); });
            actionHandler.MapAction("down", () => { renderModule.Camera.Pitch(-2 * elapsedTime); });

            Input.AddBinding("click", new MouseButtonBinding("LeftButton", KeyBindingType.Pressed));
            actionHandler.MapAction("click", () => { clickHandler.FireMapping(hoverObject, simulation); });

            //clickHandler.AddHandler(250, l => { renderNode.Color = Vector3.UnitX; });
        }
示例#5
0
 public CombatGridVisual(CombatGrid Grid, Euler Euler = null)
 {
     this.Grid = Grid;
     this.Orientation = Euler;
     if (this.Orientation == null) this.Orientation = new Euler();
 }
示例#6
0
 public NormalMapMeshNode(Euler Orientation = null)
 {
     this.Orientation = Orientation;
     if (this.Orientation == null) this.Orientation = new Euler();
 }