MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OnRenderStaticItems

Method OnRenderStaticItems

ogsr_engine/xrGame/debug_renderer.cpp:146–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144extern ENGINE_API CCustomHUD* g_hud;
145
146void CDebugRenderer::OnRenderStaticItems()
147{
148 CHUDManager& HUD = *((CHUDManager*)g_hud);
149 //-- draw text
150 auto draw_text = [&HUD](const Fvector& position, const shared_str& text, const float& clamp_dist, u32& color) {
151 if (text.size() && Device.vCameraPosition.distance_to(position) < clamp_dist)
152 {
153 Fvector4 v_res;
154 Device.mFullTransform.transform(v_res, position);
155 if (v_res.z < 0 || v_res.w < 0)
156 return;
157 if (v_res.x < -1.f || v_res.x > 1.f || v_res.y < -1.f || v_res.y > 1.f)
158 return;
159 float x = (1.f + v_res.x) / 2.f * (Device.dwWidth);
160 float y = (1.f - v_res.y) / 2.f * (Device.dwHeight);
161 HUD.Font().pFontMedium->SetColor(color);
162 HUD.Font().pFontMedium->OutSet(x, y);
163 HUD.Font().pFontMedium->OutNext("%s", text.c_str());
164 }
165 };
166
167 //-- draw static lines
168 for (auto& line : m_StaticLines)
169 {
170 if (!psActorFlags.test(line.mDrawMask) && line.mDrawMask != 0xFFFFFFFF)
171 continue;
172 draw_line(Fidentity, line.mStartPos, line.mEndPos, line.mColor);
173 draw_text(line.mStartPos, line.mText, line.mNameDist, line.mTextColor);
174 draw_text(line.mEndPos, line.mTextEnd, line.mNameDist, line.mTextColor);
175 }
176
177 //-- draw static boxes
178 for (auto& box : m_StaticBoxes)
179 {
180 if (!psActorFlags.test(box.mDrawMask) && box.mDrawMask != 0xFFFFFFFF)
181 continue;
182 draw_aabb(box.mXFORM.c, VPUSH(box.mHalfSize), box.mColor);
183 draw_text(box.mXFORM.c, box.mText, box.mNameDist, box.mTextColor);
184 }
185
186 //-- draw static spheres
187 for (auto& sphere : m_StaticSpheres)
188 {
189 if (!psActorFlags.test(sphere.mDrawMask) && sphere.mDrawMask != 0xFFFFFFFF)
190 continue;
191 draw_ellipse(sphere.mXFORM, sphere.mColor);
192 draw_text(sphere.mXFORM.c, sphere.mText, sphere.mNameDist, sphere.mTextColor);
193 }
194}

Callers 1

OnRenderMethod · 0.80

Calls 9

FontMethod · 0.80
OutSetMethod · 0.80
OutNextMethod · 0.80
sizeMethod · 0.45
distance_toMethod · 0.45
transformMethod · 0.45
SetColorMethod · 0.45
c_strMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected