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

Method addElement

Engine/source/renderInstance/renderParticleMgr.cpp:102–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void RenderParticleMgr::addElement( RenderInst *inst )
103{
104 ParticleRenderInst *pri = reinterpret_cast<ParticleRenderInst *>(inst);
105
106 // If this system isn't waiting for an offscreen draw, skip it
107 if( pri->systemState != PSS_AwaitingOffscreenDraw )
108 return;
109
110 // If offscreen rendering isn't enabled, set to high-res, and skip
111 if(!mOffscreenRenderEnabled)
112 {
113 pri->systemState = PSS_AwaitingHighResDraw;
114 return;
115 }
116
117 // Assign a target index
118 RectF screenRect;
119 S32 chainIndex = -1;
120 if(RenderToSingleTarget)
121 {
122 pri->targetIndex = 0;
123 screenRect.point.set(-1.0f, -1.0f);
124 screenRect.extent.set(2.0f, 2.0f);
125
126 mElementList.setSize(1);
127 }
128 else
129 {
130
131 // If we can't fit this into the offscreen systems, skip it, it will render
132 // high resolution
133 //
134 // TODO: Improve this once we are grouping systems
135 if( mTargetChainIdx == OffscreenPoolSize )
136 return;
137
138 // Transform bounding box into screen space
139 const static PlaneF planes[] = {
140 PlaneF(Point3F( 1.0f, 0.0f, 0.0f), Point3F(-1.0f, 0.0f, 0.0f)),
141 PlaneF(Point3F(-1.0f, 0.0f, 0.0f), Point3F( 1.0f, 0.0f, 0.0f)),
142
143 PlaneF(Point3F( 0.0f, 1.0f, 0.0f), Point3F( 0.0f, -1.0f, 0.0f)),
144 PlaneF(Point3F( 0.0f, -1.0f, 0.0f), Point3F( 0.0f, 1.0f, 0.0f)),
145
146 PlaneF(Point3F( 0.0f, 0.0f, 0.0f), Point3F( 0.0f, 0.0f, 1.0f)),
147 PlaneF(Point3F( 0.0f, 0.0f, 1.0f), Point3F( 0.0f, 0.0f, -1.0f)),
148 };
149 const static dsize_t numPlanes = sizeof(planes) / sizeof(PlaneF);
150
151 // Set up a clipper
152 ClippedPolyList screenClipper;
153 screenClipper.setBaseTransform(MatrixF::Identity);
154 screenClipper.setTransform(&MatrixF::Identity, Point3F::One);
155 TORQUE_UNUSED(numPlanes);
156
157 Point4F tempPt(0.0f, 0.0f, 0.0f, 1.0f);
158 pri->bbModelViewProj->mul(tempPt);
159 tempPt = tempPt / tempPt.w;

Callers

nothing calls this directly

Calls 15

getMaxFunction · 0.85
setBaseTransformMethod · 0.80
asPoint3FMethod · 0.80
cullUnusedVertsMethod · 0.80
incrementMethod · 0.80
PlaneFClass · 0.50
Point3FClass · 0.50
setMethod · 0.45
setSizeMethod · 0.45
setTransformMethod · 0.45
mulMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected