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

Method clear

Engine/source/gfx/gl/gfxGLDevice.cpp:549–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549void GFXGLDevice::clear(U32 flags, const LinearColorF& color, F32 z, U32 stencil)
550{
551 // Make sure we have flushed our render target state.
552 _updateRenderTargets();
553
554 bool writeAllColors = true;
555 bool zwrite = true;
556 bool writeAllStencil = true;
557 const GFXStateBlockDesc *desc = NULL;
558 if (mCurrentGLStateBlock)
559 {
560 desc = &mCurrentGLStateBlock->getDesc();
561 zwrite = desc->zWriteEnable;
562 writeAllColors = desc->colorWriteRed && desc->colorWriteGreen && desc->colorWriteBlue && desc->colorWriteAlpha;
563 writeAllStencil = desc->stencilWriteMask == 0xFFFFFFFF;
564 }
565
566 glColorMask(true, true, true, true);
567 glDepthMask(true);
568 glStencilMask(0xFFFFFFFF);
569 glClearColor(color.red, color.green, color.blue, color.alpha);
570 glClearDepth(z);
571 glClearStencil(stencil);
572
573 GLbitfield clearflags = 0;
574 clearflags |= (flags & GFXClearTarget) ? GL_COLOR_BUFFER_BIT : 0;
575 clearflags |= (flags & GFXClearZBuffer) ? GL_DEPTH_BUFFER_BIT : 0;
576 clearflags |= (flags & GFXClearStencil) ? GL_STENCIL_BUFFER_BIT : 0;
577
578 glClear(clearflags);
579
580 if(!writeAllColors)
581 glColorMask(desc->colorWriteRed, desc->colorWriteGreen, desc->colorWriteBlue, desc->colorWriteAlpha);
582
583 if(!zwrite)
584 glDepthMask(false);
585
586 if(!writeAllStencil)
587 glStencilMask(desc->stencilWriteMask);
588}
589
590void GFXGLDevice::clearColorAttachment(const U32 attachment, const LinearColorF& color)
591{

Callers 15

getAdaptersMethod · 0.45
~GFXDeviceMethod · 0.45
beginSceneMethod · 0.45
~GFXTextureManagerMethod · 0.45
killMethod · 0.45
~GFXCardProfilerMethod · 0.45
~GFXAdapterMethod · 0.45
wrapStringMethod · 0.45
importStripMethod · 0.45
initMethod · 0.45
initConstantDescsMethod · 0.45
initHandlesMethod · 0.45

Calls 1

getDescMethod · 0.80

Tested by

no test coverage detected