UnityEngine.Graphics.DrawMesh(UnityEngine.Mesh, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Material, int, UnityEngine.Camera, int)

Here are the examples of the csharp api UnityEngine.Graphics.DrawMesh(UnityEngine.Mesh, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Material, int, UnityEngine.Camera, int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : SF_PreviewWindow.cs
License : MIT License
Project Creator : XINCGer

public void DrawMesh( RenderTexture overrideRT = null, Material overrideMaterial = null, bool sphere = false ) {
			if( backgroundTexture == null )
				UpdatePreviewBackgroundColor();

			// Make sure all objects are set up properly
			if( previewIsSetUp == false ) {
				SetupPreview();
			}
			

			// TODO: Override RT is used for screenshots, probably
			if( overrideRT != null )
				cam.targetTexture = overrideRT;
			else if( cam.targetTexture == null )
				cam.targetTexture = render;

			UpdateRenderPath();

			SetCustomLight(on:true);

			Mesh drawMesh = sphere ? sphereMesh : mesh;

			float A = sphere ? rotMeshSphere.y : rotMeshSmooth.y;
			float B = sphere ? rotMeshSphere.x : rotMeshSmooth.x;
			Quaternion rotA = Quaternion.Euler( 0f, A, 0f );
			Quaternion rotB = Quaternion.Euler( B, 0f, 0f );
			Quaternion finalRot = rotA * rotB;
			camPivot.rotation = finalRot;
			float meshExtents = drawMesh.bounds.extents.magnitude;


			Vector3 pos = new Vector3( -drawMesh.bounds.center.x, -drawMesh.bounds.center.y, -drawMesh.bounds.center.z );
			cam.transform.localPosition = new Vector3( 0f, 0f, -3f * meshExtents );

			int smCount = drawMesh.subMeshCount;

			Material mat = (overrideMaterial == null) ? InternalMaterial : overrideMaterial;
			for( int i=0; i < smCount; i++ ) {
				Graphics.DrawMesh( drawMesh, Quaternion.idenreplacedy * pos, Quaternion.idenreplacedy, mat, 31, cam, i );
			}

			cam.farClipPlane = 3f * meshExtents * 2f;
			cam.nearClipPlane = 0.1f;
			cam.fieldOfView = sphere ? fovSphere : smoothFOV;
			cam.Render();

			// Reset things
			SetCustomLight( on: false );

			if( overrideRT != null )
				cam.targetTexture = render;

			if( sphere ) // Reset if needed. // TODO: What?
				cam.fieldOfView = smoothFOV;
		}