Meshclass
A mesh is a basic version of a `Sandbox.Model`, containing a set of vertices and indices which make up faces that make up a shape. A set of meshes can be used to create a `Sandbox.Model` via the `Sandbox.ModelBuilder` class.
Constructors3
Showing 3 constructors
No results match this filter.
Methods27
Showing 27 methods
public Sandbox.Mesh AddMorph(string name, System.ReadOnlySpan`1<Sandbox.MorphDelta> deltas)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| deltas | ReadOnlySpan<MorphDelta> | — |
public Sandbox.Mesh AddSubMesh(Sandbox.Material material, int startIndex, int indexCount, int startVertex = 0, int vertexCount = 0)
Add a sub mesh, drawing a range of the index buffer with its own `material`. Create the vertex and index buffers before adding sub meshes.
| Parameter | Type | Description |
|---|---|---|
| material | Material | Material to draw this range with. |
| startIndex | int | First index of the range to draw. |
| indexCount | int | Number of indices to draw. |
| startVertex = 0 | int | Base vertex offset. Defaults to the whole vertex buffer when zero. |
| vertexCount = 0 | int | Number of vertices referenced. Defaults to the whole vertex buffer when zero. |
public void CreateBuffers(Sandbox.VertexBuffer vb, bool calculateBounds = True)
Create vertex and index buffers.
| Parameter | Type | Description |
|---|---|---|
| vb | VertexBuffer | Input vertex buffer. If it is indexed (`Sandbox.VertexBuffer.Indexed`), then index buffer will also be created. |
| calculateBounds = True | bool | Whether to recalculate bounds from the vertex buffer. |
void—protected virtual override void Finalize()
void—public void SetIndexBufferSize(int elementCount)
Resize the index buffer.
| Parameter | Type | Description |
|---|---|---|
| elementCount | int | — |
void—public void SetIndexRange(int start, int count)
Set how many indices this mesh draws
| Parameter | Type | Description |
|---|---|---|
| start | int | — |
| count | int | — |
void—public void SetVertexBufferSize(int elementCount)
Resize the vertex buffer
| Parameter | Type | Description |
|---|---|---|
| elementCount | int | — |
void—public void SetVertexRange(int start, int count)
Set how many vertices this mesh draws (if there's no index buffer)
| Parameter | Type | Description |
|---|---|---|
| start | int | — |
| count | int | — |
void—No results match this filter.
Properties9
Showing 9 properties
public bool Sandbox.Mesh.HasIndexBuffer { get; set; }
Whether this mesh has an index buffer.
bool—public bool Sandbox.Mesh.HasVertexBuffer { get; set; }
Whether this mesh has a vertex buffer.
bool—public int Sandbox.Mesh.IndexCount { get; set; }
Number of indices this mesh has.
int—public virtual sealed bool Sandbox.Mesh.IsValid { get; set; }
bool—public Sandbox.MeshPrimitiveType Sandbox.Mesh.PrimitiveType { get; set; }
Sets the primitive type for this mesh.
public float Sandbox.Mesh.UvDensity { get; set; }
Used to calculate texture size for texture streaming.
float—public int Sandbox.Mesh.VertexCount { get; set; }
Number of vertices this mesh has.
int—No results match this filter.