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

Method renderDisplayPreview

Engine/source/gui/3d/guiTSControl.cpp:769–834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767//-----------------------------------------------------------------------------
768
769void GuiTSCtrl::renderDisplayPreview(const RectI &updateRect, GFXTexHandle &previewTexture)
770{
771 GFX->setWorldMatrix(MatrixF(1));
772 GFX->setViewMatrix(MatrixF::Identity);
773 GFX->setClipRect(updateRect);
774
775 GFX->getDrawUtil()->drawRectFill(RectI(Point2I(0, 0), Point2I(1024, 768)), ColorI::BLACK);
776 GFX->getDrawUtil()->drawRect(RectI(Point2I(0, 0), Point2I(1024, 768)), ColorI::RED);
777
778 if (!mStereoPreviewVB.getPointer())
779 {
780 mStereoPreviewVB.set(GFX, 4, GFXBufferTypeStatic);
781 GFXVertexPCT *verts = mStereoPreviewVB.lock(0, 4);
782
783 F32 texLeft = 0.0f;
784 F32 texRight = 1.0f;
785 F32 texTop = 0.0f;
786 F32 texBottom = 1.0f;
787
788 F32 rectWidth = updateRect.extent.x;
789 F32 rectHeight = updateRect.extent.y;
790
791 F32 screenLeft = 0;
792 F32 screenRight = rectWidth;
793 F32 screenTop = 0;
794 F32 screenBottom = rectHeight;
795
796 const F32 fillConv = 0.0f;
797 verts[0].point.set(screenLeft - fillConv, screenTop - fillConv, 0.f);
798 verts[1].point.set(screenRight - fillConv, screenTop - fillConv, 0.f);
799 verts[2].point.set(screenLeft - fillConv, screenBottom - fillConv, 0.f);
800 verts[3].point.set(screenRight - fillConv, screenBottom - fillConv, 0.f);
801
802 verts[0].color = verts[1].color = verts[2].color = verts[3].color = ColorI(255, 255, 255, 255);
803
804 verts[0].texCoord.set(texLeft, texTop);
805 verts[1].texCoord.set(texRight, texTop);
806 verts[2].texCoord.set(texLeft, texBottom);
807 verts[3].texCoord.set(texRight, texBottom);
808
809 mStereoPreviewVB.unlock();
810 }
811
812 if (!mStereoPreviewSB.getPointer())
813 {
814 // DrawBitmapStretchSR
815 GFXStateBlockDesc bitmapStretchSR;
816 bitmapStretchSR.setCullMode(GFXCullNone);
817 bitmapStretchSR.setZReadWrite(false, false);
818 bitmapStretchSR.setBlend(false, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
819 bitmapStretchSR.samplersDefined = true;
820
821 bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getClampLinear();
822 bitmapStretchSR.samplers[0].minFilter = GFXTextureFilterPoint;
823 bitmapStretchSR.samplers[0].mipFilter = GFXTextureFilterPoint;
824 bitmapStretchSR.samplers[0].magFilter = GFXTextureFilterPoint;
825
826 mStereoPreviewSB = GFX->createStateBlock(bitmapStretchSR);

Callers

nothing calls this directly

Calls 15

setViewMatrixMethod · 0.80
drawRectFillMethod · 0.80
getDrawUtilMethod · 0.80
drawRectMethod · 0.80
setCullModeMethod · 0.80
setZReadWriteMethod · 0.80
setBlendMethod · 0.80
createStateBlockMethod · 0.80
setVertexBufferMethod · 0.80
MatrixFClass · 0.50
RectIClass · 0.50
Point2IClass · 0.50

Tested by

no test coverage detected