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

Method onRender

Engine/source/gui/editor/guiParticleGraphCtrl.cpp:127–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
128{
129 // Fetch Draw Utility.
130 GFXDrawUtil* pDrawUtil = GFX->getDrawUtil();
131
132 if (mProfile->mBorder)
133 {
134 const RectI bounds = getBounds();
135 RectI rect(offset.x, offset.y, bounds.extent.x, bounds.extent.y);
136 pDrawUtil->drawRect(rect, mProfile->mBorderColor);
137 }
138
139 GuiControlProfile* profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
140 Resource<GFont> font = profile->mFont;
141 GFXVideoMode videoMode = GFXInit::getDesktopResolution();
142
143 ColorI color(255, 255, 255, 128);
144 pDrawUtil->drawRectFill(updateRect, color);
145
146 for (S32 k = 0; k < MaxPlots; k++)
147 {
148 // Nothing to graph
149 if ((mPlots[k].mGraphData.size() == 0) || (mPlots[k].mHidden == true))
150 continue;
151
152 Point2F graphExtent = getGraphExtent(k);
153
154 // Adjust scale to max value + 5% so we can see high value
155 F32 ScaleX = (F32(getExtent().x) / (graphExtent.x*(1.00 + (mPlots[k].mGraphScale))));
156 F32 ScaleY = (F32(getExtent().y) / (graphExtent.y*(1.00 + (mPlots[k].mGraphScale))));
157
158 if((mPlots[k].mGraphType == Point) || (mPlots[k].mGraphType == Polyline))
159 {
160 S32 posX;
161 S32 posY;
162 S32 lastPosX = 0;
163 S32 lastPosY = 0;
164 Point2F plotPoint;
165
166 S32 size = 32;
167
168 for (S32 sample = 0; sample < mPlots[k].mGraphData.size(); sample++)
169 {
170 S32 temp;
171
172 temp = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample);
173
174 // calculate the point positions
175 plotPoint = getPlotPoint(k, sample);
176
177 posX = (S32)((plotPoint.x - mPlots[k].mGraphMin.x) * (ScaleX /(1.00 + mPlots[k].mGraphScale)));
178 posY = (getExtent().y) - (S32)((plotPoint.y - mPlots[k].mGraphMin.y) * ScaleY);
179
180 posX += getExtent().x * (mPlots[k].mGraphScale);
181 posY /= (1.00 + (mPlots[k].mGraphScale));
182
183 posX = localToGlobalCoord(Point2I(posX, posY)).x;
184 posY = localToGlobalCoord(Point2I(posX, posY)).y;

Callers

nothing calls this directly

Calls 15

getBoundsFunction · 0.85
getPositionFunction · 0.85
dSprintfFunction · 0.85
getDrawUtilMethod · 0.80
drawRectMethod · 0.80
drawRectFillMethod · 0.80
toColorIMethod · 0.80
getStrWidthMethod · 0.80
setBitmapModulationMethod · 0.80
clearBitmapModulationMethod · 0.80
findObjectFunction · 0.50
Point2IClass · 0.50

Tested by

no test coverage detected