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

Method extrude

Engine/source/collision/extrudedPolyList.cpp:67–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65//----------------------------------------------------------------------------
66
67void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector)
68{
69 // Clear state
70 mIndexList.clear();
71 mVertexList.clear();
72 mPlaneList.clear();
73 mPolyPlaneList.clear();
74
75 // Determine which faces will be extruded.
76 mExtrudedList.setSize(pt.mPlaneList.size());
77
78 for (U32 f = 0; f < pt.mPlaneList.size(); f++)
79 {
80 const PlaneF& face = pt.mPlaneList[f];
81 ExtrudedFace& eface = mExtrudedList[f];
82 F32 dot = mDot(face,vector);
83 eface.active = dot > EqualEpsilon;
84
85 if (eface.active)
86 {
87 eface.maxDistance = dot;
88 eface.plane = face;
89 eface.planeMask = BIT(mPlaneList.size());
90
91 // Add the face as a plane to clip against.
92 mPlaneList.increment(2);
93 PlaneF* plane = mPlaneList.end() - 2;
94 plane[0] = plane[1] = face;
95 plane[0].invert();
96 }
97 }
98
99 // Produce extruded planes for bounding and internal edges
100 for (U32 e = 0; e < pt.mEdgeList.size(); e++)
101 {
102 Polyhedron::Edge const& edge = pt.mEdgeList[e];
103 ExtrudedFace& ef1 = mExtrudedList[edge.face[0]];
104 ExtrudedFace& ef2 = mExtrudedList[edge.face[1]];
105 if (ef1.active || ef2.active)
106 {
107
108 // Assumes that the edge points are clockwise
109 // for face[0].
110 const Point3F& p1 = pt.mPointList[edge.vertex[1]];
111 const Point3F &p2 = pt.mPointList[edge.vertex[0]];
112 Point3F p3 = p2 + vector;
113
114 mPlaneList.increment(2);
115 PlaneF* plane = mPlaneList.end() - 2;
116 plane[0].set(p3,p2,p1);
117 plane[1] = plane[0];
118 plane[1].invert();
119
120 U32 pmask = BIT(mPlaneList.size()-2);
121 ef1.planeMask |= pmask;
122 ef2.planeMask |= pmask << 1;
123 }
124 }

Callers 6

findGroundContactMethod · 0.45
findCollisionMethod · 0.45
findGroundContactMethod · 0.45
findCollisionMethod · 0.45
updatePosMethod · 0.45
_moveMethod · 0.45

Calls 8

incrementMethod · 0.80
mDotFunction · 0.50
clearMethod · 0.45
setSizeMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
invertMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected