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

Method onRender

Engine/source/gui/editor/guiParticleGraphCtrl.cpp:125–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

getBoundsFunction · 0.85
dSprintfFunction · 0.85
getDrawUtilMethod · 0.80
drawRectMethod · 0.80
drawRectFillMethod · 0.80
getStrWidthMethod · 0.80
setBitmapModulationMethod · 0.80
clearBitmapModulationMethod · 0.80
findObjectFunction · 0.50
Point2IClass · 0.50
Point2FClass · 0.50
ColorIClass · 0.50

Tested by

no test coverage detected