示例#1
0
    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;
            }
        }
    }
示例#2
0
        /// <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();
        }
示例#3
0
	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;
			}			
		}
	}
示例#4
0
 // Set the mesh based on the poly count (quality)
 public void SetPolyCount(PolyCount _newPolyCount)
 {
     SetPolyCount(_newPolyCount, false);
 }
示例#5
0
	// Set the mesh based on the poly count (quality)
	public void SetPolyCount(PolyCount _newPolyCount) { SetPolyCount(_newPolyCount, false); }