MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _setupStateBlocks

Method _setupStateBlocks

Engine/source/gfx/gfxDrawUtil.cpp:56–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void GFXDrawUtil::_setupStateBlocks()
57{
58 // DrawBitmapStretchSR
59 GFXStateBlockDesc bitmapStretchSR;
60 bitmapStretchSR.setCullMode(GFXCullNone);
61 bitmapStretchSR.setZReadWrite(false);
62 bitmapStretchSR.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
63 bitmapStretchSR.samplersDefined = true;
64 bitmapStretchSR.setColorWrites(true, true, true, false); // NOTE: comment this out if alpha write is needed
65
66 // Linear: Create wrap SB
67 bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getWrapLinear();
68 mBitmapStretchWrapLinearSB = mDevice->createStateBlock(bitmapStretchSR);
69
70 // Linear: Create clamp SB
71 bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getClampLinear();
72 mBitmapStretchLinearSB = mDevice->createStateBlock(bitmapStretchSR);
73
74 // Point:
75 bitmapStretchSR.samplers[0].minFilter = GFXTextureFilterPoint;
76 bitmapStretchSR.samplers[0].mipFilter = GFXTextureFilterPoint;
77 bitmapStretchSR.samplers[0].magFilter = GFXTextureFilterPoint;
78
79 // Point: Create clamp SB, last created clamped so no work required here
80 mBitmapStretchSB = mDevice->createStateBlock(bitmapStretchSR);
81
82 // Point: Create wrap SB, have to do this manually because getWrapLinear doesn't
83 bitmapStretchSR.samplers[0].addressModeU = GFXAddressWrap;
84 bitmapStretchSR.samplers[0].addressModeV = GFXAddressWrap;
85 bitmapStretchSR.samplers[0].addressModeW = GFXAddressWrap;
86 mBitmapStretchWrapSB = mDevice->createStateBlock(bitmapStretchSR);
87
88 GFXStateBlockDesc rectFill;
89 rectFill.setCullMode(GFXCullNone);
90 rectFill.setZReadWrite(false);
91 rectFill.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
92 mRectFillSB = mDevice->createStateBlock(rectFill);
93}
94
95//-----------------------------------------------------------------------------
96// Color Modulation

Callers

nothing calls this directly

Calls 5

setCullModeMethod · 0.80
setZReadWriteMethod · 0.80
setBlendMethod · 0.80
setColorWritesMethod · 0.80
createStateBlockMethod · 0.80

Tested by

no test coverage detected