UnityEngine.Graphics.DrawMesh C# (CSharp) Method

DrawMesh() public static method

Draw a mesh.

public static DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [ receiveShadows, [ probeAnchor, [ useLightProbes ) : void
mesh Mesh The Mesh to draw.
position Vector3 Position of the mesh.
rotation Quaternion Rotation of the mesh.
material Material Material to use.
layer int to use.
camera Camera If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given camera only.
submeshIndex int Which subset of the mesh to draw. This applies only to meshes that are composed of several materials.
properties MaterialPropertyBlock Additional material properties to apply onto material just before this mesh will be drawn. See MaterialPropertyBlock.
castShadows ShadowCastingMode Should the mesh cast shadows?
receiveShadows [ Should the mesh receive shadows?
probeAnchor [ If used, the mesh will use this Transform's position to sample light probes and find the matching reflection probe.
useLightProbes [ Should the mesh use light probes?
return void
        public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [UnityEngine.Internal.DefaultValue("true")] bool receiveShadows, [UnityEngine.Internal.DefaultValue("null")] Transform probeAnchor, [UnityEngine.Internal.DefaultValue("true")] bool useLightProbes)
        {
            DrawMesh(mesh, Matrix4x4.TRS(position, rotation, Vector3.one), material, layer, camera, submeshIndex, properties, castShadows, receiveShadows, probeAnchor, useLightProbes);
        }

Same methods

Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, [ receiveShadows, [ probeAnchor, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material material, int layer, [ camera, [ submeshIndex, [ properties, [ castShadows, [ receiveShadows, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Matrix4x4 matrix, int materialIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, ShadowCastingMode castShadows, bool receiveShadows, Transform probeAnchor ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, bool castShadows, bool receiveShadows ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, [ camera, [ submeshIndex, [ properties, [ castShadows, [ receiveShadows, [ useLightProbes ) : void
Graphics::DrawMesh ( Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex ) : void

Usage Example

コード例 #1
0
        public void DrawUserIndexedPrimitives(PrimitiveType primitiveType, VertexPositionColorTexture[] vertexData, int vertexOffset, int numVertices, short[] indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration)
        {
            Debug.Assert(vertexData != null && vertexData.Length > 0, "The vertexData must not be null or zero length!");
            Debug.Assert(indexData != null && indexData.Length > 0, "The indexData must not be null or zero length!");

            var material = _materialPool.Get(Textures[0]);

            var mesh = _meshPool.Get(primitiveCount / 2);

            mesh.Populate(vertexData, numVertices);

            UnityGraphics.DrawMesh(mesh.Mesh, _matrix, material, 0);
        }
All Usage Examples Of UnityEngine.Graphics::DrawMesh