MCPcopy Create free account
hub / github.com/beefytech/Beef / Gfx_DrawTextureSegment

Function Gfx_DrawTextureSegment

BeefySysLib/BeefySysLib.cpp:630–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630BF_EXPORT void BF_CALLTYPE Gfx_DrawTextureSegment(TextureSegment* textureSegment, float a, float b, float c, float d, float tx, float ty, float z, uint32 color, int pixelSnapping)
631{
632 DrawLayer* drawLayer = gBFApp->mRenderDevice->mCurDrawLayer;
633 drawLayer->SetTexture(0, textureSegment->mTexture);
634 DefaultVertex3D* v = (DefaultVertex3D*)drawLayer->AllocStrip(4);
635
636 if ((pixelSnapping == 1) ||
637 ((pixelSnapping == 2) && (a == 1.0f) && (b == 0) && (c == 0) && (d == 1.0f)))
638 {
639 tx = (float) (int) (tx + 100000) - 100000;
640 ty = (float) (int) (ty + 100000) - 100000;
641 }
642
643 a *= textureSegment->mScaleX;
644 b *= textureSegment->mScaleX;
645 c *= textureSegment->mScaleY;
646 d *= textureSegment->mScaleY;
647
648 v[0].Set(tx, ty, z, textureSegment->mU1, textureSegment->mV1, color);
649 v[1].Set(tx + a, ty + b, z, textureSegment->mU2, textureSegment->mV1, color);
650 v[2].Set(tx + c, ty + d, z, textureSegment->mU1, textureSegment->mV2, color);
651 v[3].Set(tx + (a + c), ty + (b + d), z, textureSegment->mU2, textureSegment->mV2, color);
652
653 gPixelsDrawn += (int)((a + b) * (c + d));
654}
655
656static TextureSegment* gCurTextureSegment = NULL;
657static DefaultVertex3D* gCurAllocVertices = NULL;

Callers

nothing calls this directly

Calls 3

AllocStripMethod · 0.80
SetTextureMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected