public void Render() { Framebuffer.Execute(); Viewport.Execute(); BlendState.Execute(); FaceCullState.Execute(); MaskState.Execute(); DepthState.Execute(); StencilState.Execute(); Clear.Execute(); camera.UpdateFrame(); camera.UpdateViewport(Viewport.Viewport); foreach (var item in renderItems) { #if false if (item.Model.Frame != frame) { camera.UpdateModelFrame(frame); } #endif //item.Batch.Mesh.ApplyAttributes( } }
public void Render() { if (manipulator.Active == false) { return; } Model model = selectionManager.Models.First(); manipulator.Parent = model; // ManipulatorGroup is not updated by SceneManager.Update() sceneManager.UpdateOncePerFrame(ManipulatorGroup); renderer.CurrentGroup = ManipulatorGroup; renderer.Requested.MeshMode = MeshMode.PolygonFill; // Step 0: Lock depth, stencil and mask states Material.LockDepthState = true; Material.LockStencilState = true; Material.LockMaskState = true; Material.LockBlendState = true; // Hidden manipulator set stencil 1 maskNoRGBADepth.Execute(); depthGreater.Execute(); stencilSetOne.Execute(); BlendState.Default.Execute(); renderer.RenderGroup(); // Visible manipulator set stencil 2 maskNoRGBADepth.Execute(); depthLEqual.Execute(); stencilSetTwo.Execute(); renderer.RenderGroup(); // Clear depth for manipulator maskDepthOnly.Execute(); depthReplace.Execute(); StencilState.Default.Execute(); renderer.RenderGroup(); // Set depth for manipulator maskDepthOnly.Execute(); depthLEqual.Execute(); renderer.RenderGroup(); // Step 4: Render visible parts MaskState.Default.Execute(); depthLEqual.Execute(); stencilRequireTwo.Execute(); BlendState.Default.Execute(); renderer.RenderGroup(); // Step 5: Render with hidden depth and blend states maskNoDepth.Execute(); depthLEqual.Execute(); stencilRequireOne.Execute(); blendHidden.Execute(); renderer.RenderGroup(); // Unlock depth and blend states Material.LockDepthState = false; Material.LockStencilState = false; Material.LockMaskState = false; Material.LockBlendState = false; Vector3 o = model.Frame.LocalToWorld.Matrix.GetColumn3(3); Vector3 xStart = o; xStart.X -= 20.0f; Vector3 yStart = o; Vector3 zStart = o; zStart.Z -= 20.0f; Vector3 xEnd = o; xEnd.X += 20.0f; Vector3 yEnd = o; yEnd.Y = 0.0f; Vector3 zEnd = o; zEnd.Z += 20.0f; lineRenderer.Begin(); lineRenderer.Line(xStart, xEnd, new Vector4(1.0f, 0.0f, 0.0f, 1.0f)); lineRenderer.Line(yStart, yEnd, new Vector4(0.0f, 1.0f, 0.0f, 1.0f)); lineRenderer.Line(zStart, zEnd, new Vector4(0.0f, 0.0f, 1.0f, 1.0f)); lineRenderer.End(); }