public void SetPolyCount(PolyCount _newPolyCount, bool _collider) { // If this is not the collider... if (!_collider) { // This is the actual asteroid mesh.. so specify which poly count we want polyCount = _newPolyCount; switch (_newPolyCount) { case PolyCount.LOW: // access the MeshFilter component and change the sharedMesh to the low poly version transform.GetComponent <MeshFilter>().sharedMesh = meshLowPoly.sharedMesh; break; case PolyCount.MEDIUM: // access the MeshFilter component and change the sharedMesh to the medium poly version transform.GetComponent <MeshFilter>().sharedMesh = meshMediumPoly.sharedMesh; break; case PolyCount.HIGH: // access the MeshFilter component and change the sharedMesh to the high poly version transform.GetComponent <MeshFilter>().sharedMesh = meshHighPoly.sharedMesh; break; } } else { // This is the collider mesh we set this time polyCountCollider = _newPolyCount; switch (_newPolyCount) { case PolyCount.LOW: // access the MeshFilter component and change the sharedMesh to the low poly version transform.GetComponent <MeshCollider>().sharedMesh = meshLowPoly.sharedMesh; break; case PolyCount.MEDIUM: // access the MeshFilter component and change the sharedMesh to the medium poly version transform.GetComponent <MeshCollider>().sharedMesh = meshMediumPoly.sharedMesh; break; case PolyCount.HIGH: // access the MeshFilter component and change the sharedMesh to the high poly version transform.GetComponent <MeshCollider>().sharedMesh = meshHighPoly.sharedMesh; break; } } }
/// <summary> /// /// </summary> protected void Render(object sender, EventArgs args) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); // push and pop attributes so no cleanup is needed GL.PushAttrib(AttribMask.AllAttribBits); if (ApplicationSettings.RenderBackgroundGradient) { GL.Disable(EnableCap.DepthTest); RenderBackground(); } GL.Enable(EnableCap.DepthTest); GL.MatrixMode(MatrixMode.Modelview); Matrix4 modelViewMatrix = camera.MvpMatrix; GL.LoadMatrix(ref modelViewMatrix); if (ApplicationSettings.EnableGridDisplay) { Rendering.Shapes.GridFloor3D.Draw(ApplicationSettings.GridSize, 25, ApplicationSettings.GridLineColor); } if (Scene != null) { Scene.Render(camera); } if (ApplicationSettings.RenderSceneInformation) { TextRenderer.DrawOrtho(camera, "Polygon Count: " + PolyCount.ToString(), new Vector2(0, 30)); TextRenderer.DrawOrtho(camera, "Vertex Count: " + VertexCount.ToString(), new Vector2(0, 46)); } GL.PopAttrib(); if (ScreenTexture != null) { StudioSB.Rendering.Shapes.ScreenTriangle.RenderTexture(ScreenTexture, false); } // Cleanup unused gl objects GLObjectManager.DeleteUnusedGLObjects(); }
public void SetPolyCount(PolyCount _newPolyCount, bool _collider) { // If this is not the collider... if (!_collider) { // This is the actual asteroid mesh.. so specify which poly count we want polyCount = _newPolyCount; switch (_newPolyCount) { case PolyCount.LOW: // access the MeshFilter component and change the sharedMesh to the low poly version transform.GetComponent<MeshFilter>().sharedMesh = meshLowPoly.GetComponent<MeshFilter>().sharedMesh; break; case PolyCount.MEDIUM: // access the MeshFilter component and change the sharedMesh to the medium poly version transform.GetComponent<MeshFilter>().sharedMesh = meshMediumPoly.GetComponent<MeshFilter>().sharedMesh; break; case PolyCount.HIGH: // access the MeshFilter component and change the sharedMesh to the high poly version transform.GetComponent<MeshFilter>().sharedMesh = meshHighPoly.GetComponent<MeshFilter>().sharedMesh; break; } } else { // This is the collider mesh we set this time polyCountCollider = _newPolyCount; switch (_newPolyCount) { case PolyCount.LOW: // access the MeshFilter component and change the sharedMesh to the low poly version transform.GetComponent<MeshCollider>().sharedMesh = meshLowPoly.GetComponent<MeshFilter>().sharedMesh; break; case PolyCount.MEDIUM: // access the MeshFilter component and change the sharedMesh to the medium poly version transform.GetComponent<MeshCollider>().sharedMesh = meshMediumPoly.GetComponent<MeshFilter>().sharedMesh; break; case PolyCount.HIGH: // access the MeshFilter component and change the sharedMesh to the high poly version transform.GetComponent<MeshCollider>().sharedMesh = meshHighPoly.GetComponent<MeshFilter>().sharedMesh; break; } } }
// Set the mesh based on the poly count (quality) public void SetPolyCount(PolyCount _newPolyCount) { SetPolyCount(_newPolyCount, false); }