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

Method _renderMassAndContacts

Engine/source/T3D/rigidShape.cpp:1765–1808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1763}
1764
1765void RigidShape::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
1766{
1767 // Box for the center of Mass
1768 GFXStateBlockDesc desc;
1769 desc.setBlend(false, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
1770 desc.setZReadWrite(false);
1771 desc.fillMode = GFXFillWireframe;
1772
1773 GFX->getDrawUtil()->drawCube( desc, Point3F(0.1f,0.1f,0.1f), mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld );
1774
1775 // Collision points...
1776 for (S32 i = 0; i < mCollisionList.getCount(); i++)
1777 {
1778 const Collision& collision = mCollisionList[i];
1779 GFX->getDrawUtil()->drawCube( desc, Point3F(0.05f,0.05f,0.05f), collision.point, ColorI(0, 0, 255) );
1780 }
1781
1782 // Render the normals as one big batch...
1783 PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2);
1784 for (S32 i = 0; i < mCollisionList.getCount(); i++)
1785 {
1786
1787 const Collision& collision = mCollisionList[i];
1788 PrimBuild::color3f(1, 1, 1);
1789 PrimBuild::vertex3fv(collision.point);
1790 PrimBuild::vertex3fv(collision.point + collision.normal * 0.05f);
1791 }
1792 PrimBuild::end();
1793
1794 // Build and render the collision polylist which is returned
1795 // in the server's world space.
1796 ClippedPolyList polyList;
1797 polyList.mPlaneList.setSize(6);
1798 polyList.mPlaneList[0].set(getWorldBox().minExtents,VectorF(-1,0,0));
1799 polyList.mPlaneList[1].set(getWorldBox().minExtents,VectorF(0,-1,0));
1800 polyList.mPlaneList[2].set(getWorldBox().minExtents,VectorF(0,0,-1));
1801 polyList.mPlaneList[3].set(getWorldBox().maxExtents,VectorF(1,0,0));
1802 polyList.mPlaneList[4].set(getWorldBox().maxExtents,VectorF(0,1,0));
1803 polyList.mPlaneList[5].set(getWorldBox().maxExtents,VectorF(0,0,1));
1804 Box3F dummyBox;
1805 SphereF dummySphere;
1806 buildPolyList(PLC_Collision, &polyList, dummyBox, dummySphere);
1807 //polyList.render();
1808}
1809
1810void RigidShape::reset()
1811{

Callers

nothing calls this directly

Calls 13

beginFunction · 0.85
color3fFunction · 0.85
endFunction · 0.85
setBlendMethod · 0.80
setZReadWriteMethod · 0.80
drawCubeMethod · 0.80
getDrawUtilMethod · 0.80
Point3FClass · 0.50
ColorIClass · 0.50
vertex3fvFunction · 0.50
getCountMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected