MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / render

Method render

Source/Node/Node.cpp:970–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

968}
969
970void Node::render() {
971 if (_updateItem && _updateItem->renderFuncs) {
972 if (!_updateItem->renderFuncs->empty()) {
973 double deltaTime = _scheduler->getDeltaTime() * _scheduler->getTimeScale();
974 auto funcs = std::move(*_updateItem->renderFuncs);
975 for (auto it = funcs.begin(); it != funcs.end();) {
976 if ((*it)(deltaTime)) {
977 it = funcs.erase(it);
978 } else {
979 it++;
980 }
981 }
982 for (auto& f : *_updateItem->renderFuncs) {
983 funcs.emplace_back(std::move(f));
984 }
985 *_updateItem->renderFuncs = std::move(funcs);
986 }
987 }
988 if (isShowDebug()) {
989 Matrix transform;
990 Matrix::mulMtx(transform, SharedDirector.getViewProjection(), getWorld());
991 float w = getWidth();
992 float h = getHeight();
993 const float anchorSize = 20.0f;
994 float anchorPointX = GetTAttr(anchorPointX);
995 float anchorPointY = GetTAttr(anchorPointY);
996 Vec4 positions[] = {
997 {0, h, 0, 1.0f},
998 {w, h, 0, 1.0f},
999 {w, 0, 0, 1.0f},
1000 {0, 0, 0, 1.0f},
1001 {anchorPointX - anchorSize, anchorPointY, 0, 1.0f},
1002 {anchorPointX + anchorSize, anchorPointY, 0, 1.0f},
1003 {anchorPointX, anchorPointY - anchorSize, 0, 1.0f},
1004 {anchorPointX, anchorPointY + anchorSize, 0, 1.0f}};
1005 auto color = getColor().toABGR();
1006 auto themeColor = SharedApplication.getThemeColor();
1007 themeColor.setOpacity(getRealOpacity());
1008 auto anchorColor = themeColor.toABGR();
1009 PosColorVertex verts[8] = {
1010 {0, 0, 0, 0, color},
1011 {0, 0, 0, 0, color},
1012 {0, 0, 0, 0, color},
1013 {0, 0, 0, 0, color},
1014 {0, 0, 0, 0, anchorColor},
1015 {0, 0, 0, 0, anchorColor},
1016 {0, 0, 0, 0, anchorColor},
1017 {0, 0, 0, 0, anchorColor}};
1018 for (size_t i = 0; i < 8; i++) {
1019 Matrix::mulVec4(&verts[i].x, transform, positions[i]);
1020 }
1021 SharedRendererManager.setCurrent(SharedLineRenderer.getTarget());
1022 if (getSize() != Size::zero) {
1023 SharedLineRenderer.pushRect(verts);
1024 }
1025 SharedLineRenderer.pushSegment(verts + 4);
1026 SharedLineRenderer.pushSegment(verts + 6);
1027 }

Callers 5

grabMethod · 0.45
doRenderMethod · 0.45
rendertarget_renderFunction · 0.45
svgdef_renderFunction · 0.45
vgnode_renderFunction · 0.45

Calls 15

moveFunction · 0.85
getColorFunction · 0.85
getSizeFunction · 0.85
toABGRMethod · 0.80
getThemeColorMethod · 0.80
setCurrentMethod · 0.80
getTargetMethod · 0.80
pushRectMethod · 0.80
pushSegmentMethod · 0.80
emptyMethod · 0.45
getDeltaTimeMethod · 0.45
getTimeScaleMethod · 0.45

Tested by

no test coverage detected