@ -32,6 +32,7 @@ public class QModel
public int numSubModels ;
public int numSubModels ;
public IntPtr subModels ; // Array of dmodel_t
public IntPtr subModels ; // Array of dmodel_t
public QSubModel [ ] SubModels = > subModels . ToStructArray < QSubModel > ( numSubModels ) ;
public int numPlanes ;
public int numPlanes ;
public IntPtr planes ; // Array of mplane_t
public IntPtr planes ; // Array of mplane_t
@ -53,6 +54,7 @@ public class QModel
public int numSurfaces ;
public int numSurfaces ;
public IntPtr surfaces ; // Array of msurface_t
public IntPtr surfaces ; // Array of msurface_t
public QSurface [ ] Surfaces = > surfaces . ToStructArray < QSurface > ( numSurfaces ) ;
public int numSurfEdges ;
public int numSurfEdges ;
public IntPtr surfEdges ; // Array of int
public IntPtr surfEdges ; // Array of int
@ -222,6 +224,47 @@ public struct QSTVert
public int s , t ;
public int s , t ;
}
}
/// <summary>
/// Managed equivalent of dmodel_t
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct QSubModel
{
public QVec3 mins , maxs ;
public QVec3 origin ;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = QConstants.MaxMapHulls)] public int [ ] headNode ;
public int visLeafs ;
public int firstFace , numFaces ;
public QNode GetHeadNode ( QModel model )
{
IntPtr nodePtr = IntPtr . Add ( model . nodes , headNode [ 0 ] ) ;
return Marshal . PtrToStructure < QNode > ( nodePtr ) ;
}
}
/// <summary>
/// Managed equivalent of mnode_t
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct QNode
{
public int contents ; // 0 for nodes, negative for leafs
public int visFrame ;
public QVec3 mins , maxs ;
public IntPtr parent ; // Pointer to mnode_t
public IntPtr plane ; // Pointer to mplane_t
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr [ ] children ; // Array of pointers to mnode_t
public uint firstSurface ;
public uint numSurfaces ;
public QNode [ ] Children = > new [ ]
{
Marshal . PtrToStructure < QNode > ( children [ 0 ] ) ,
Marshal . PtrToStructure < QNode > ( children [ 1 ] ) ,
} ;
}
/// <summary>
/// <summary>
/// Managed equivalent of msurface_t
/// Managed equivalent of msurface_t
/// </summary>
/// </summary>