示例#1
0
        public SceneManager(bool bUseVertexBuffer = true)
        {
            Current = this;

            content = new ContentManager();

            bVertexBuffer = bUseVertexBuffer;

            node = new Entity
            {
                Name = "node",
                EntityType = EntityType.Bone,
                AssetType = AssetType.Model,
                Asset = new Model()
            };

            var sphere = new Sphere(0.125f, 7, 7);
            ModelManipulator.SetVertexColour(sphere, 0, 255, 0, 255);
            ((Model)node.Asset).AddMesh(sphere);
            ((Model)node.Asset).SetRenderStyle(RenderStyle.Wireframe);
            entities.Add(node);

            InputManager.Current.RegisterBinding('d', KeyBinding.KeysClearSelection, ClearBoundingBox);
            InputManager.Current.RegisterBinding('w', KeyBinding.KeysRenderMode, CycleRenderMode);
            InputManager.Current.RegisterBinding('p', KeyBinding.KeysCoordinateSystem, ToggleCoordinateSystem);
        }
示例#2
0
        public void Draw(SceneManager scene)
        {
            GL.ClearColor(Color.FromArgb(0x9D9D9D));

            if (mode == ProjectionType.Orthographic) { perspective = Matrix4.CreateOrthographic(4 * camera.Zoom, (4 / aspect_ratio) * camera.Zoom, 0.001f, 100); }

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref perspective);
            GL.Enable(EnableCap.Texture2D);

            var offsetX = (bActive ? x + 1 : x);
            var offsetY = (bActive ? y + 1 : y);
            var scissorWidth = (bActive ? vw - 2 : vw);
            var scissorHeight = (bActive ? vh - 2 : vh);

            GL.Viewport(x, y, vw, vh);
            GL.Scissor(offsetX, offsetY, scissorWidth, scissorHeight);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            scene.Draw(camera);
        }