Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawUserPrimitives< T >() [2/2]

unsafe void Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserPrimitives< T > ( PrimitiveType primitiveType,
T[] vertexData,
int vertexOffset,
int primitiveCount,
VertexDeclaration vertexDeclaration )
inline
Type Constraints
T :struct 

Definition at line 1664 of file GraphicsDevice.cs.

1664 : struct
1665 {
1666 IntPtr intPtr = (IntPtr)pComPtr;
1667 Helpers.CheckDisposed(this, intPtr);
1668 if (vertexData == null)
1669 {
1670 throw new ArgumentNullException("vertexData", FrameworkResources.NullNotAllowed);
1671 }
1672 if (vertexDeclaration == null)
1673 {
1674 throw new ArgumentNullException("vertexDeclaration", FrameworkResources.NullNotAllowed);
1675 }
1676 if (primitiveCount <= 0)
1677 {
1678 throw new ArgumentOutOfRangeException("primitiveCount", FrameworkResources.MustDrawSomething);
1679 }
1680 int maxPrimitiveCount = _profileCapabilities.MaxPrimitiveCount;
1681 if (primitiveCount > maxPrimitiveCount)
1682 {
1683 _profileCapabilities.ThrowNotSupportedException(FrameworkResources.ProfileMaxPrimitiveCount, maxPrimitiveCount);
1684 }
1685 if (vertexOffset >= 0)
1686 {
1687 int num = vertexData.Length;
1688 if (vertexOffset < num)
1689 {
1690 if ((uint)((int)GetElementCountFromPrimitiveType(primitiveType, primitiveCount) + vertexOffset) > (uint)num)
1691 {
1692 throw new ArgumentOutOfRangeException("primitiveCount", FrameworkResources.MustBeValidIndex);
1693 }
1694 BeginUserPrimitives(vertexDeclaration);
1695 VerifyCanDraw(bUserPrimitives: true, bIndexedPrimitives: false);
1696 fixed (T* ptr = &vertexData[vertexOffset])
1697 {
1698 int num2 = *(int*)pComPtr + 332;
1699 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, _D3DPRIMITIVETYPE, uint, void*, uint, int>)(int)(*(uint*)num2))((nint)pComPtr, _003CModule_003E.ConvertXnaPrimitiveTypeToDx(primitiveType), (uint)primitiveCount, ptr, (uint)System.Runtime.CompilerServices.Unsafe.SizeOf<T>());
1700 if (num3 < 0)
1701 {
1702 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1703 }
1704 return;
1705 }
1706 }
1707 }
1708 throw new ArgumentOutOfRangeException("vertexOffset", FrameworkResources.OffsetNotValid);
1709 }
unsafe void BeginUserPrimitives(VertexDeclaration vertexDeclaration)
uint GetElementCountFromPrimitiveType(PrimitiveType primitiveType, int primitiveCount)
unsafe void VerifyCanDraw([MarshalAs(UnmanagedType.U1)] bool bUserPrimitives, [MarshalAs(UnmanagedType.U1)] bool bIndexedPrimitives)

References Microsoft.Xna.Framework.Graphics.GraphicsDevice._profileCapabilities, Microsoft.Xna.Framework.Graphics.GraphicsDevice.BeginUserPrimitives(), Microsoft.Xna.Framework.Helpers.CheckDisposed(), Microsoft.Xna.Framework.Graphics.GraphicsDevice.GetElementCountFromPrimitiveType(), Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxPrimitiveCount, Microsoft.Xna.Framework.FrameworkResources.MustBeValidIndex, Microsoft.Xna.Framework.FrameworkResources.MustDrawSomething, Microsoft.Xna.Framework.FrameworkResources.NullNotAllowed, Microsoft.Xna.Framework.FrameworkResources.OffsetNotValid, Microsoft.Xna.Framework.Graphics.GraphicsDevice.pComPtr, Microsoft.Xna.Framework.FrameworkResources.ProfileMaxPrimitiveCount, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException(), and Microsoft.Xna.Framework.Graphics.GraphicsDevice.VerifyCanDraw().