---------------------------------------------------------------------------- Core rendering method for this control. This method scans through all the current client ShapeBase objects. If one is named, it displays the name and damage information for it. Information is offset from the center of the object's bounding box, unless the object is a PlayerObjectType, in which case the eye point is used
| 160 | /// |
| 161 | /// @param updateRect Extents of control. |
| 162 | void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect) |
| 163 | { |
| 164 | // Background fill first |
| 165 | if (mShowFill) |
| 166 | GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor.toColorI()); |
| 167 | |
| 168 | // Must be in a TS Control |
| 169 | GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent()); |
| 170 | if (!parent) return; |
| 171 | |
| 172 | // Must have a connection and control object |
| 173 | GameConnection* conn = GameConnection::getConnectionToServer(); |
| 174 | if (!conn) return; |
| 175 | GameBase * control = dynamic_cast<GameBase*>(conn->getControlObject()); |
| 176 | if (!control) return; |
| 177 | |
| 178 | // Get control camera info |
| 179 | MatrixF cam; |
| 180 | Point3F camPos; |
| 181 | VectorF camDir; |
| 182 | conn->getControlCameraTransform(0,&cam); |
| 183 | cam.getColumn(3, &camPos); |
| 184 | cam.getColumn(1, &camDir); |
| 185 | |
| 186 | F32 camFovCos; |
| 187 | conn->getControlCameraFov(&camFovCos); |
| 188 | camFovCos = mCos(mDegToRad(camFovCos) / 2); |
| 189 | |
| 190 | // Visible distance info & name fading |
| 191 | F32 visDistance = gClientSceneGraph->getVisibleDistance(); |
| 192 | F32 visDistanceSqr = visDistance * visDistance; |
| 193 | F32 fadeDistance = visDistance * mDistanceFade; |
| 194 | |
| 195 | // Collision info. We're going to be running LOS tests and we |
| 196 | // don't want to collide with the control object. |
| 197 | static U32 losMask = TerrainObjectType | ShapeBaseObjectType | StaticObjectType; |
| 198 | control->disableCollision(); |
| 199 | |
| 200 | // All ghosted objects are added to the server connection group, |
| 201 | // so we can find all the shape base objects by iterating through |
| 202 | // our current connection. |
| 203 | for (SimSetIterator itr(conn); *itr; ++itr) { |
| 204 | ShapeBase* shape = dynamic_cast< ShapeBase* >(*itr); |
| 205 | if ( shape ) { |
| 206 | if (shape != control && shape->getShapeName()) |
| 207 | { |
| 208 | |
| 209 | // Target pos to test, if it's a player run the LOS to his eye |
| 210 | // point, otherwise we'll grab the generic box center. |
| 211 | Point3F shapePos; |
| 212 | if (shape->getTypeMask() & PlayerObjectType) |
| 213 | { |
| 214 | MatrixF eye; |
| 215 | |
| 216 | // Use the render eye transform, otherwise we'll see jittering |
| 217 | shape->getRenderEyeTransform(&eye); |
| 218 | eye.getColumn(3, &shapePos); |
| 219 | } |
nothing calls this directly
no test coverage detected