예제 #1
0
        void DrawGL(int renderWidth, int renderHeight)
        {
            //Set state
            renderTarget.BindFramebuffer();
            rstate.Cull = true;
            var cc = rstate.ClearColor;

            rstate.DepthEnabled = true;
            rstate.ClearColor   = Color4.CornflowerBlue * new Color4(0.3f, 0.3f, 0.3f, 1f);
            rstate.ClearAll();
            vps.Push(0, 0, renderWidth, renderHeight);
            var cam = new LookAtCamera();

            cam.Update(renderWidth, renderHeight, new Vector3(zoom, 0, 0), Vector3.Zero);
            buffer.StartFrame(rstate);
            polyline.SetCamera(cam);
            billboards.Begin(cam, buffer);
            debug.StartFrame(cam, rstate);
            instance.Draw(polyline, billboards, debug, transform, sparam);
            polyline.FrameEnd();
            billboards.End();
            buffer.DrawOpaque(rstate);
            rstate.DepthWrite = false;
            buffer.DrawTransparent(rstate);
            rstate.DepthWrite = true;
            debug.Render();
            //Restore state
            rstate.Cull         = false;
            rstate.BlendMode    = BlendMode.Normal;
            rstate.DepthEnabled = false;
            rstate.ClearColor   = cc;
            RenderTarget2D.ClearBinding();
            vps.Pop();
        }
예제 #2
0
        void DrawGL(int renderWidth, int renderHeight)
        {
            var       cam = new LookAtCamera();
            Matrix4x4 rot = Matrix4x4.CreateRotationX(aleViewport.CameraRotation.Y) *
                            Matrix4x4.CreateRotationY(aleViewport.CameraRotation.X);
            var dir = Vector3.Transform(-Vector3.UnitZ, rot);
            var to  = aleViewport.CameraOffset + (dir * 10);

            if (aleViewport.Mode == CameraModes.Arcball)
            {
                to = Vector3.Zero;
            }
            cam.Update(renderWidth, renderHeight, aleViewport.CameraOffset, to, rot);
            buffer.StartFrame(rstate);
            polyline.SetCamera(cam);
            debug.StartFrame(cam, rstate);
            instance.Draw(transform, sparam);
            pool.Draw(cam, polyline, res, debug);
            polyline.FrameEnd();
            buffer.DrawOpaque(rstate);
            rstate.DepthWrite = false;
            buffer.DrawTransparent(rstate);
            rstate.DepthWrite = true;
            debug.Render();
        }
예제 #3
0
        void DrawGL(int renderWidth, int renderHeight)
        {
            var cam = new LookAtCamera();

            cam.Update(renderWidth, renderHeight, new Vector3(aleViewport.Zoom, 0, 0), Vector3.Zero);
            buffer.StartFrame(rstate);
            polyline.SetCamera(cam);
            billboards.Begin(cam, buffer);
            debug.StartFrame(cam, rstate);
            instance.Draw(polyline, billboards, debug, transform, sparam);
            polyline.FrameEnd();
            billboards.End();
            buffer.DrawOpaque(rstate);
            rstate.DepthWrite = false;
            buffer.DrawTransparent(rstate);
            rstate.DepthWrite = true;
            debug.Render();
        }
예제 #4
0
        void DrawGL(int renderWidth, int renderHeight)
        {
            //Set state
            renderTarget.BindFramebuffer();
            rstate.Cull = true;
            var cc = rstate.ClearColor;

            rstate.DepthEnabled = true;
            rstate.ClearColor   = Color4.CornflowerBlue * new Color4(0.3f, 0.3f, 0.3f, 1f);
            rstate.ClearAll();
            vps.Push(0, 0, renderWidth, renderHeight);
            //Draw Model
            var cam = new ChaseCamera(new Viewport(0, 0, renderWidth, renderHeight));

            cam.ChasePosition         = Vector3.Zero;
            cam.ChaseOrientation      = Matrix4.CreateRotationX(MathHelper.Pi);
            cam.DesiredPositionOffset = new Vector3(zoom, 0, 0);
            //cam.OffsetDirection = Vector3.UnitX;
            cam.Reset();
            cam.Update(TimeSpan.FromSeconds(500));
            buffer.StartFrame(rstate);
            polyline.SetCamera(cam);
            billboards.Begin(cam, buffer);
            debug.StartFrame(cam, rstate);
            instance.Draw(polyline, billboards, debug, transform, sparam);
            polyline.FrameEnd();
            billboards.End();
            buffer.DrawOpaque(rstate);
            rstate.DepthWrite = false;
            buffer.DrawTransparent(rstate);
            rstate.DepthWrite = true;
            debug.Render();
            //Restore state
            rstate.Cull         = false;
            rstate.BlendMode    = BlendMode.Normal;
            rstate.DepthEnabled = false;
            rstate.ClearColor   = cc;
            RenderTarget2D.ClearBinding();
            vps.Pop();
        }
예제 #5
0
        void DrawGL(int renderWidth, int renderHeight)
        {
            var     cam = new LookAtCamera();
            Matrix4 rot = Matrix4.CreateRotationX(aleViewport.CameraRotation.Y) *
                          Matrix4.CreateRotationY(aleViewport.CameraRotation.X);
            var dir = rot.Transform(Vector3.Forward);
            var to  = aleViewport.CameraOffset + (dir * 10);

            cam.Update(renderWidth, renderHeight, aleViewport.CameraOffset, to, rot);
            buffer.StartFrame(rstate);
            polyline.SetCamera(cam);
            billboards.Begin(cam, buffer);
            debug.StartFrame(cam, rstate);
            instance.Draw(polyline, billboards, debug, transform, sparam);
            polyline.FrameEnd();
            billboards.End();
            buffer.DrawOpaque(rstate);
            rstate.DepthWrite = false;
            buffer.DrawTransparent(rstate);
            rstate.DepthWrite = true;
            debug.Render();
        }