MCPcopy Create free account
hub / github.com/axmolengine/axmol / drawDebugRects

Method drawDebugRects

tests/live2d-tests/Source/LAppView.cpp:219–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void LAppView::drawDebugRects(LAppLive2DManager* manager) const
220{
221 const Color4F hitAreaColor = Color4F(1.0f, 0, 0, 0.2f);
222 const Color4F userDataAreaColor = Color4F(0, 0, 1.0f, 0.2f);
223
224 CubismMatrix44 projection;
225 const Size window = Director::getInstance()->getWinSize();
226 const CubismVector2 windowSize = CubismVector2(window.width, window.height);
227 projection.Scale(1, window.width / window.height);
228
229 if (viewMatrix != NULL)
230 {
231 projection.MultiplyByMatrix(viewMatrix);
232 }
233
234 for (csmUint32 i = 0; i < manager->GetModelCount(); ++i)
235 {
236 _debugRects->clear();
237 LAppModel* model = manager->GetModel(i);
238 const Csm::csmVector<Csm::csmRectF>& userDataAreas = model->GetUserDataAreas(projection, windowSize);
239 for (csmUint32 j = 0; j < userDataAreas.GetSize(); ++j)
240 {
241 _debugRects->drawSolidRect(Vec2(userDataAreas[j].X, userDataAreas[j].Y)
242 , Vec2(userDataAreas[j].GetRight(), userDataAreas[j].GetBottom())
243 , userDataAreaColor);
244 }
245
246 const Csm::csmVector<Csm::csmRectF>& hitAreas = model->GetHitAreas(projection, windowSize);
247 for (csmUint32 j = 0; j < hitAreas.GetSize(); ++j)
248 {
249 _debugRects->drawSolidRect(Vec2(hitAreas[j].X, hitAreas[j].Y)
250 , Vec2(hitAreas[j].GetRight(), hitAreas[j].GetBottom())
251 , hitAreaColor);
252 }
253 }
254}
255
256LAppView* LAppView::createDrawNode()
257{

Callers

nothing calls this directly

Calls 13

getInstanceFunction · 0.85
CubismVector2Class · 0.85
MultiplyByMatrixMethod · 0.80
drawSolidRectMethod · 0.80
GetRightMethod · 0.80
GetBottomMethod · 0.80
Color4FFunction · 0.50
Vec2Function · 0.50
ScaleMethod · 0.45
GetModelCountMethod · 0.45
clearMethod · 0.45
GetModelMethod · 0.45

Tested by

no test coverage detected