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

◆ DrawIndexedPrimitives()

unsafe void Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives ( PrimitiveType primitiveType,
int baseVertex,
int minVertexIndex,
int numVertices,
int startIndex,
int primitiveCount )
inline

Definition at line 1312 of file GraphicsDevice.cs.

1313 {
1314 IntPtr intPtr = (IntPtr)pComPtr;
1315 Helpers.CheckDisposed(this, intPtr);
1316 if (numVertices <= 0)
1317 {
1318 throw new ArgumentOutOfRangeException("numVertices", FrameworkResources.NumberVerticesMustBeGreaterZero);
1319 }
1320 if (primitiveCount <= 0)
1321 {
1322 throw new ArgumentOutOfRangeException("primitiveCount", FrameworkResources.MustDrawSomething);
1323 }
1324 int maxPrimitiveCount = _profileCapabilities.MaxPrimitiveCount;
1325 if (primitiveCount > maxPrimitiveCount)
1326 {
1327 _profileCapabilities.ThrowNotSupportedException(FrameworkResources.ProfileMaxPrimitiveCount, maxPrimitiveCount);
1328 }
1329 VerifyCanDraw(bUserPrimitives: false, bIndexedPrimitives: true);
1330 if (instanceStreamMask != 0)
1331 {
1332 throw new InvalidOperationException(FrameworkResources.NonZeroInstanceFrequency);
1333 }
1334 if (!_insideScene)
1335 {
1336 IDirect3DDevice9* intPtr2 = pComPtr;
1337 ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, int>)(int)(*(uint*)(*(int*)intPtr2 + 164)))((nint)intPtr2);
1338 _insideScene = true;
1339 }
1340 int num = *(int*)pComPtr + 328;
1341 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, _D3DPRIMITIVETYPE, int, uint, uint, uint, uint, int>)(int)(*(uint*)num))((nint)pComPtr, _003CModule_003E.ConvertXnaPrimitiveTypeToDx(primitiveType), baseVertex, (uint)minVertexIndex, (uint)numVertices, (uint)startIndex, (uint)primitiveCount);
1342 if (num2 < 0)
1343 {
1344 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1345 }
1346 }
unsafe void VerifyCanDraw([MarshalAs(UnmanagedType.U1)] bool bUserPrimitives, [MarshalAs(UnmanagedType.U1)] bool bIndexedPrimitives)

References Microsoft.Xna.Framework.Graphics.GraphicsDevice._insideScene, Microsoft.Xna.Framework.Graphics.GraphicsDevice._profileCapabilities, Microsoft.Xna.Framework.Helpers.CheckDisposed(), Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.GraphicsDevice.instanceStreamMask, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxPrimitiveCount, Microsoft.Xna.Framework.FrameworkResources.MustDrawSomething, Microsoft.Xna.Framework.FrameworkResources.NonZeroInstanceFrequency, Microsoft.Xna.Framework.FrameworkResources.NumberVerticesMustBeGreaterZero, Microsoft.Xna.Framework.Graphics.GraphicsDevice.pComPtr, Microsoft.Xna.Framework.FrameworkResources.ProfileMaxPrimitiveCount, System.startIndex, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException(), and Microsoft.Xna.Framework.Graphics.GraphicsDevice.VerifyCanDraw().

Referenced by Microsoft.Xna.Framework.Graphics.ModelMeshPart.Draw(), Terraria.DataStructures.SpriteDrawBuffer.DrawRange(), Microsoft.Xna.Framework.Graphics.SpriteBatch.PlatformRenderBatch(), and Terraria.Graphics.TileBatch.RenderBatch().