UnityEngine.Graphics.DrawMeshNow(UnityEngine.Mesh, UnityEngine.Matrix4x4)

Here are the examples of the csharp api UnityEngine.Graphics.DrawMeshNow(UnityEngine.Mesh, UnityEngine.Matrix4x4) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

19 View Source File : DepthOfFieldDeprecated.cs
License : Apache License 2.0
Project Creator : activey

void AddBokeh ( RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget) {
            if (bokehMaterial) {
                var meshes = Quads.GetMeshes (tempTex.width, tempTex.height);	// quads: exchanging more triangles with less overdraw

                RenderTexture.active = tempTex;
                GL.Clear (false, true, new Color (0.0f, 0.0f, 0.0f, 0.0f));

                GL.PushMatrix ();
                GL.LoadIdenreplacedy ();

                // point filter mode is important, otherwise we get bokeh shape & size artefacts
                bokehInfo.filterMode = FilterMode.Point;

                float arW = (bokehInfo.width * 1.0f) / (bokehInfo.height * 1.0f);
                float sc = 2.0f / (1.0f * bokehInfo.width);
                sc += bokehScale * maxBlurSpread * BOKEH_EXTRA_BLUR * oneOverBaseSize;

                bokehMaterial.SetTexture ("_Source", bokehInfo);
                bokehMaterial.SetTexture ("_MainTex", bokehTexture);
                bokehMaterial.SetVector ("_ArScale",new Vector4 (sc, sc * arW, 0.5f, 0.5f * arW));
                bokehMaterial.SetFloat ("_Intensity", bokehIntensity);
                bokehMaterial.SetPreplaced (0);

                foreach(Mesh m in meshes)
                    if (m) Graphics.DrawMeshNow (m, Matrix4x4.idenreplacedy);

                GL.PopMatrix ();

                Graphics.Blit (tempTex, finalTarget, dofMaterial, 8);

                // important to set back as we sample from this later on
                bokehInfo.filterMode = FilterMode.Bilinear;
            }
        }

19 View Source File : SleekRenderPostProcess.cs
License : GNU General Public License v3.0
Project Creator : Cytoid

private void DrawFullscreenQuad(Texture source, Material material, int materialPreplaced = 0)
        {
            material.SetTexture(Uniforms._MainTex, source);
            material.SetPreplaced(materialPreplaced);
            Graphics.DrawMeshNow(_fullscreenQuadMesh, Matrix4x4.idenreplacedy);
        }

19 View Source File : NoiseAndGrain.cs
License : MIT License
Project Creator : GlaireDaggers

static void DrawNoiseQuadGrid(RenderTexture source, RenderTexture dest, Material fxMaterial, Texture2D noise, Mesh mesh, int preplacedNr)
        {
            RenderTexture.active = dest;

            fxMaterial.SetTexture("_MainTex", source);

            GL.PushMatrix();
            GL.LoadOrtho();

            fxMaterial.SetPreplaced(preplacedNr);

            BuildMesh(mesh, source, noise);

            // Reset camera to origin
            Transform cam = Camera.main.transform;
            Vector3 camPos = cam.position;
            Quaternion camRot = cam.rotation;
            cam.position = Vector3.zero;
            cam.rotation = Quaternion.idenreplacedy;

            // Render mesh
            Graphics.DrawMeshNow(mesh, Matrix4x4.idenreplacedy);

            // Restore camera
            cam.position = camPos;
            cam.rotation = camRot;

            GL.PopMatrix();
        }

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

public void FinalizeDraw () {
			RemoveUnusedMeshes(meshes);

			var cam = Camera.current;
			var planes = GeometryUtility.CalculateFrustumPlanes(cam);

			// Silently do nothing if the materials are not set
			if (surfaceMaterial == null || lineMaterial == null) return;

			Profiler.BeginSample("Draw Retained Gizmos");
			// First surfaces, then lines
			for (int matIndex = 0; matIndex <= 1; matIndex++) {
				var mat = matIndex == 0 ? surfaceMaterial : lineMaterial;
				for (int preplaced = 0; preplaced < mat.preplacedCount; preplaced++) {
					mat.SetPreplaced(preplaced);
					for (int i = 0; i < meshes.Count; i++) {
						if (meshes[i].lines == (mat == lineMaterial) && GeometryUtility.TestPlanesAABB(planes, meshes[i].mesh.bounds)) {
							Graphics.DrawMeshNow(meshes[i].mesh, Matrix4x4.idenreplacedy);
						}
					}
				}
			}

			usedHashes.Clear();
			Profiler.EndSample();
		}