C# Класс SSTUTools.MeshBuilder

Generic mesh-building class; input each vert and triangle as created, it will take care of creating the actual mesh and calculating tangents
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
subdivision int

Открытые методы

Метод Описание
addTriangle ( int a, int b, int c ) : void
addVertex ( Vector3 vert, Vector3 norm, Vector2 uv ) : Vertex
buildMesh ( ) : Mesh
clear ( ) : void
generateCuboid ( Vector3 size, Vector3 center, Vector2 uvStart, Vector2 uvEnd ) : void

Creates an axis-aligned cube mesh at the given center point, with the given size dimensions, from the input UV coordinates.

generateCylinderCap ( Vector3 offset, int faces, float outerRadius, float innerRadius, float height, float startAngle, float endAngle, UVArea area, bool bottomCap ) : void
generatePanelCollider ( Vector3 center, float startAngle, float endAngle, float startY, float height, float bottomRadius, float topRadius, float thickness ) : void
generateQuads ( List verts1, List verts2, bool invertFaces ) : void
generateRadialVerticesCylinderUVs ( Vector3 offset, int faces, float radius, float height, float startAngle, float endAngle, UVArea area, float uvRadius, float yCos, float ySin ) : List

Generates a ring of vertices using circular UV mapping, where the center of the ring is the center of the UV area. This would be used to generate a partial ring, such as the procedural decoupler Input radius is the radius of the actual ring, uvRadius is the radius to be used for maximal UV bounds (e.g. they will only be different on an inner-ring; where radius=ring radius, and uvRadius = outerRingRadius)

generateRadialVerticesFlatUVs ( Vector3 offset, int faces, float radius, float height, float startAngle, float endAngle, float v, UVArea area, float yCos, float ySin ) : List

Used to generate a ring of vertices with the uvMapping appropriate for a cylinder wall (increments in +x)

generateTriangle ( Vertex a, Vertex b, Vertex c, bool invertFace ) : void
generateTriangleFan ( List circ, List centers, bool invertFaces ) : void
generateTriangleFan ( List circ, Vertex cent, bool invertFaces ) : void

Приватные методы

Метод Описание
calculateTangents ( ) : Vector4[]
getNorms ( ) : Vector3[]
getTriangles ( ) : int[]
getUVs ( ) : Vector2[]
getVerts ( ) : Vector3[]

Описание методов

addTriangle() публичный Метод

public addTriangle ( int a, int b, int c ) : void
a int
b int
c int
Результат void

addVertex() публичный Метод

public addVertex ( Vector3 vert, Vector3 norm, Vector2 uv ) : Vertex
vert Vector3
norm Vector3
uv Vector2
Результат Vertex

buildMesh() публичный Метод

public buildMesh ( ) : Mesh
Результат UnityEngine.Mesh

clear() публичный Метод

public clear ( ) : void
Результат void

generateCuboid() публичный Метод

Creates an axis-aligned cube mesh at the given center point, with the given size dimensions, from the input UV coordinates.
public generateCuboid ( Vector3 size, Vector3 center, Vector2 uvStart, Vector2 uvEnd ) : void
size Vector3
center Vector3
uvStart Vector2
uvEnd Vector2
Результат void

generateCylinderCap() публичный Метод

public generateCylinderCap ( Vector3 offset, int faces, float outerRadius, float innerRadius, float height, float startAngle, float endAngle, UVArea area, bool bottomCap ) : void
offset Vector3
faces int
outerRadius float
innerRadius float
height float
startAngle float
endAngle float
area UVArea
bottomCap bool
Результат void

generatePanelCollider() публичный Метод

public generatePanelCollider ( Vector3 center, float startAngle, float endAngle, float startY, float height, float bottomRadius, float topRadius, float thickness ) : void
center Vector3
startAngle float
endAngle float
startY float
height float
bottomRadius float
topRadius float
thickness float
Результат void

generateQuads() публичный Метод

public generateQuads ( List verts1, List verts2, bool invertFaces ) : void
verts1 List
verts2 List
invertFaces bool
Результат void

generateRadialVerticesCylinderUVs() публичный Метод

Generates a ring of vertices using circular UV mapping, where the center of the ring is the center of the UV area. This would be used to generate a partial ring, such as the procedural decoupler Input radius is the radius of the actual ring, uvRadius is the radius to be used for maximal UV bounds (e.g. they will only be different on an inner-ring; where radius=ring radius, and uvRadius = outerRingRadius)
public generateRadialVerticesCylinderUVs ( Vector3 offset, int faces, float radius, float height, float startAngle, float endAngle, UVArea area, float uvRadius, float yCos, float ySin ) : List
offset Vector3
faces int
radius float
height float
startAngle float
endAngle float
area UVArea The UV area to map the UV vertex to.
uvRadius float The radius to be used for the UV area, in case it differs from the radius in use (basically scales the UV area)
yCos float Determines the x/z normal component
ySin float Used directly as the y normal component
Результат List

generateRadialVerticesFlatUVs() публичный Метод

Used to generate a ring of vertices with the uvMapping appropriate for a cylinder wall (increments in +x)
public generateRadialVerticesFlatUVs ( Vector3 offset, int faces, float radius, float height, float startAngle, float endAngle, float v, UVArea area, float yCos, float ySin ) : List
offset Vector3
faces int
radius float
height float
startAngle float
endAngle float
v float
area UVArea
yCos float
ySin float
Результат List

generateTriangle() публичный Метод

public generateTriangle ( Vertex a, Vertex b, Vertex c, bool invertFace ) : void
a Vertex
b Vertex
c Vertex
invertFace bool
Результат void

generateTriangleFan() публичный Метод

public generateTriangleFan ( List circ, List centers, bool invertFaces ) : void
circ List
centers List
invertFaces bool
Результат void

generateTriangleFan() публичный Метод

public generateTriangleFan ( List circ, Vertex cent, bool invertFaces ) : void
circ List
cent Vertex
invertFaces bool
Результат void

Описание свойств

subdivision публичное свойство

public int subdivision
Результат int