Table of Contents

Class CGVMesh

Mesh Data (Bounds + Vertex,UV,UV2,Normal,Tangents,SubMehes)

[CGDataInfo(0.98, 0.5, 0, 1)]
public class CGVMesh : CGBounds
Inheritance
CGVMesh
Inherited Members

Constructors

CGVMesh()

public CGVMesh()

CGVMesh(CGMeshProperties)

public CGVMesh(CGMeshProperties meshProperties)

Parameters

meshProperties CGMeshProperties

CGVMesh(CGVMesh)

public CGVMesh(CGVMesh source)

Parameters

source CGVMesh

CGVMesh(CGVolume)

public CGVMesh(CGVolume volume)

Parameters

volume CGVolume

CGVMesh(CGVolume, IntRegion)

public CGVMesh(CGVolume volume, IntRegion subset)

Parameters

volume CGVolume
subset IntRegion

CGVMesh(int, bool, bool, bool, bool)

public CGVMesh(int vertexCount, bool addUV = false, bool addUV2 = false, bool addNormals = false, bool addTangents = false)

Parameters

vertexCount int
addUV bool
addUV2 bool
addNormals bool
addTangents bool

CGVMesh(Mesh, Material[], Matrix4x4)

public CGVMesh(Mesh source, Material[] materials, Matrix4x4 trsMatrix)

Parameters

source Mesh
materials Material[]
trsMatrix Matrix4x4

Fields

SubMeshes

public CGVSubMesh[] SubMeshes

Field Value

CGVSubMesh[]

Properties

Count

Gets the number of vertices

public override int Count { get; }

Property Value

int

HasNormals

True if at least one vertex has a normal

public bool HasNormals { get; }

Property Value

bool

HasPartialNormals

True if HasNormals but not all vertices have normals

public bool HasPartialNormals { get; }

Property Value

bool

HasPartialTangents

True if HasTangents but not all vertices have tangents

public bool HasPartialTangents { get; }

Property Value

bool

HasTangents

True if at least one vertex has a tangent

public bool HasTangents { get; }

Property Value

bool

HasUV

public bool HasUV { get; }

Property Value

bool

HasUV2

public bool HasUV2 { get; }

Property Value

bool

NormalsList

Normals of the points, in the local space

public SubArray<Vector3> NormalsList { get; set; }

Property Value

SubArray<Vector3>

Remarks

Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance

TangentsList

Tangents of the points, in the local space

public SubArray<Vector4> TangentsList { get; set; }

Property Value

SubArray<Vector4>

Remarks

Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance

TriangleCount

public int TriangleCount { get; }

Property Value

int

UV2s

UV2s of the points

public SubArray<Vector2> UV2s { get; set; }

Property Value

SubArray<Vector2>

Remarks

Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance

UVs

UVs of the points

public SubArray<Vector2> UVs { get; set; }

Property Value

SubArray<Vector2>

Remarks

Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance

Vertices

Positions of the points, in the local space

public SubArray<Vector3> Vertices { get; set; }

Property Value

SubArray<Vector3>

Remarks

Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance

Methods

AddSubMesh(CGVSubMesh)

public void AddSubMesh(CGVSubMesh submesh = null)

Parameters

submesh CGVSubMesh

Clone<T>()

public override T Clone<T>() where T : CGData

Returns

T

Type Parameters

T

Dispose(bool)

protected override bool Dispose(bool disposing)

Parameters

disposing bool

Returns

bool

Get(CGVMesh, CGVolume, IntRegion, bool, bool, bool)

[NotNull]
public static CGVMesh Get(CGVMesh data, CGVolume source, IntRegion subset, bool addUV, bool addUV2, bool reverseNormals)

Parameters

data CGVMesh
source CGVolume
subset IntRegion
addUV bool
addUV2 bool
reverseNormals bool

Returns

CGVMesh

GetCachedSortedVertexIndices()

Gets an array of the index of vertices when sorted by Z coordinate, from smaller to bigger. This array is cached. Curvy Splines makes sure the cache is valid when it modifies Vertices. Whoever, if you modify yourself Vertices through its getter, the cache will become outdated.

public SubArray<int> GetCachedSortedVertexIndices()

Returns

SubArray<int>

Remarks

Is thread safe

GetMaterialSubMesh(Material, bool)

Gets the submesh using a certain material

public CGVSubMesh GetMaterialSubMesh(Material mat, bool createIfMissing = true)

Parameters

mat Material

the material the submesh should use

createIfMissing bool

whether to create the submesh if no existing one matches

Returns

CGVSubMesh

a submesh using the given material

GetMaterials()

Gets a list of all Materials used

public Material[] GetMaterials()

Returns

Material[]

MergeVMesh(CGVMesh)

Combine/Merge another VMesh into this

public void MergeVMesh(CGVMesh source)

Parameters

source CGVMesh

MergeVMesh(CGVMesh, Matrix4x4)

Combine/Merge another VMesh into this, applying a matrix

public void MergeVMesh(CGVMesh source, Matrix4x4 matrix)

Parameters

source CGVMesh
matrix Matrix4x4

MergeVMeshes(List<CGVMesh>, int, int)

Combine/Merge multiple CGVMeshes into this

public void MergeVMeshes(List<CGVMesh> vMeshes, int startIndex, int endIndex)

Parameters

vMeshes List<CGVMesh>

list of CGVMeshes

startIndex int

Index of the first element of the list to merge

endIndex int

Index of the last element of the list to merge

RecalculateBounds()

public override void RecalculateBounds()

SetSubMeshCount(int)

public void SetSubMeshCount(int count)

Parameters

count int

TRS(Matrix4x4)

Applies the translation, rotation and scale defined by the given matrix

public void TRS(Matrix4x4 matrix)

Parameters

matrix Matrix4x4

ToMesh(ref Mesh, bool, bool)

Copies the data into an existing Mesh

public void ToMesh(ref Mesh mesh, bool includeNormals = true, bool includeTangents = true)

Parameters

mesh Mesh

The mesh to copy the data from this CGVMesh into

includeNormals bool

should normals be copied or set to empty?

includeTangents bool

should tangents be copied or set to empty?