mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-15 09:49:23 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using NativeEngine;
|
|
|
|
namespace Sandbox;
|
|
|
|
public partial class Model
|
|
{
|
|
/// <summary>
|
|
/// Experimental!
|
|
/// </summary>
|
|
public unsafe Vertex[] GetVertices()
|
|
{
|
|
int numVertices = MeshGlue.GetModelNumVertices( native );
|
|
if ( numVertices == 0 )
|
|
return null;
|
|
|
|
var vertices = new Vertex[numVertices];
|
|
|
|
fixed ( Vertex* vmem = &vertices[0] )
|
|
{
|
|
MeshGlue.GetModelVertices( native, (IntPtr)vmem, (uint)numVertices );
|
|
}
|
|
|
|
return vertices;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Experimental!
|
|
/// </summary>
|
|
public unsafe uint[] GetIndices()
|
|
{
|
|
int numIndices = MeshGlue.GetModelNumIndices( native );
|
|
if ( numIndices == 0 )
|
|
return null;
|
|
|
|
var indices = new uint[numIndices];
|
|
|
|
fixed ( uint* vmem = &indices[0] )
|
|
{
|
|
MeshGlue.GetModelIndices( native, (IntPtr)vmem, (uint)numIndices );
|
|
}
|
|
|
|
return indices;
|
|
}
|
|
|
|
public int GetIndexCount( int drawcall ) => MeshGlue.GetModelIndexCount( native, drawcall );
|
|
public int GetIndexStart( int drawcall ) => MeshGlue.GetModelIndexStart( native, drawcall );
|
|
public int GetBaseVertex( int drawcall ) => MeshGlue.GetModelBaseVertex( native, drawcall );
|
|
}
|