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

Method buildPolyList

Engine/source/environment/waterBlock.cpp:650–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650bool WaterBlock::buildPolyList( PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& )
651{
652 if(context == PLC_Navigation && box.isOverlapped(mWorldBox))
653 {
654 polyList->setObject( this );
655 MatrixF mat(true);
656 Point3F pos = getPosition();
657 pos.x = pos.y = 0;
658 mat.setPosition(pos);
659 polyList->setTransform( &mat, Point3F(1, 1, 1) );
660
661 Box3F ov = box.getOverlap(mWorldBox);
662 Point3F
663 p0(ov.minExtents.x, ov.maxExtents.y, 0),
664 p1(ov.maxExtents.x, ov.maxExtents.y, 0),
665 p2(ov.maxExtents.x, ov.minExtents.y, 0),
666 p3(ov.minExtents.x, ov.minExtents.y, 0);
667
668 // Add vertices to poly list.
669 U32 v0 = polyList->addPoint(p0);
670 polyList->addPoint(p1);
671 polyList->addPoint(p2);
672 polyList->addPoint(p3);
673
674 // Add plane between first three vertices.
675 polyList->begin(0, 0);
676 polyList->vertex(v0);
677 polyList->vertex(v0+1);
678 polyList->vertex(v0+2);
679 polyList->plane(v0, v0+1, v0+2);
680 polyList->end();
681
682 // Add plane between last three vertices.
683 polyList->begin(0, 1);
684 polyList->vertex(v0+2);
685 polyList->vertex(v0+3);
686 polyList->vertex(v0);
687 polyList->plane(v0+2, v0+3, v0);
688 polyList->end();
689
690 return true;
691 }
692
693 return false;
694}
695
696F32 WaterBlock::getWaterCoverage( const Box3F &testBox ) const
697{

Callers

nothing calls this directly

Calls 12

getPositionFunction · 0.85
getOverlapMethod · 0.80
isOverlappedMethod · 0.60
Point3FClass · 0.50
setObjectMethod · 0.45
setPositionMethod · 0.45
setTransformMethod · 0.45
addPointMethod · 0.45
beginMethod · 0.45
vertexMethod · 0.45
planeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected