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

Method addStatic

Engine/source/lighting/common/sceneLighting.cpp:671–719  ·  view source on GitHub ↗

adds TSStatic objects as shadow casters.

Source from the content-addressed store, hash-verified

669
670/// adds TSStatic objects as shadow casters.
671void SceneLighting::addStatic(ShadowVolumeBSP *shadowVolume,
672 SceneObject *sceneobject, LightInfo *light, S32 level)
673{
674 if (!sceneobject)
675 return;
676
677 if(light->getType() != LightInfo::Vector)
678 return;
679
680 ConcretePolyList polylist;
681 const Box3F box;
682 const SphereF sphere;
683 sceneobject->buildPolyList(PLC_Collision, &polylist, box, sphere);
684
685 // retrieve the poly list (uses the collision mesh)...
686 //sobj->sgAdvancedStaticOptionsData.sgBuildPolyList(sobj, &polylist);
687
688 S32 i, count, vertind[3];
689 ConcretePolyList::Poly *poly;
690
691 count = polylist.mPolyList.size();
692
693 // add the polys to the shadow volume...
694 for(i=0; i<count; i++)
695 {
696 poly = (ConcretePolyList::Poly *)&polylist.mPolyList[i];
697 AssertFatal((poly->vertexCount == 3), "Hmmm... vert count is greater than 3.");
698
699 vertind[0] = polylist.mIndexList[poly->vertexStart];
700 vertind[1] = polylist.mIndexList[poly->vertexStart + 1];
701 vertind[2] = polylist.mIndexList[poly->vertexStart + 2];
702
703 if(mDot(PlaneF(polylist.mVertexList[vertind[0]], polylist.mVertexList[vertind[1]],
704 polylist.mVertexList[vertind[2]]), light->getDirection()) < gParellelVectorThresh)
705 {
706 ShadowVolumeBSP::SVPoly *svpoly = shadowVolume->createPoly();
707 svpoly->mWindingCount = 3;
708
709 svpoly->mWinding[0].set(polylist.mVertexList[vertind[0]]);
710 svpoly->mWinding[1].set(polylist.mVertexList[vertind[1]]);
711 svpoly->mWinding[2].set(polylist.mVertexList[vertind[2]]);
712 svpoly->mPlane = PlaneF(svpoly->mWinding[0], svpoly->mWinding[1], svpoly->mWinding[2]);
713 svpoly->mPlane.neg();
714
715 shadowVolume->buildPolyVolume(svpoly, light);
716 shadowVolume->insertPoly(svpoly);
717 }
718 }
719}
720
721//------------------------------------------------------------------------------
722bool SceneLighting::verifyMissionInfo(PersistInfo::PersistChunk * chunk)

Callers

nothing calls this directly

Calls 11

createPolyMethod · 0.80
buildPolyVolumeMethod · 0.80
mDotFunction · 0.50
PlaneFClass · 0.50
getTypeMethod · 0.45
buildPolyListMethod · 0.45
sizeMethod · 0.45
getDirectionMethod · 0.45
setMethod · 0.45
negMethod · 0.45
insertPolyMethod · 0.45

Tested by

no test coverage detected