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

Method render

Source/Node/DragonBone.cpp:33–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 , _transform(AffineTransform::Indentity) { }
32
33void DBSlotNode::render() {
34 if (!_texture || !_effect || _vertices.empty()) {
35 Node::render();
36 return;
37 }
38
39 if (SharedDirector.isFrustumCulling()) {
40 auto [minX, maxX] = std::minmax_element(_points.begin(), _points.end(), [](const auto& a, const auto& b) {
41 return a.x < b.x;
42 });
43 auto [minY, maxY] = std::minmax_element(_points.begin(), _points.end(), [](const auto& a, const auto& b) {
44 return a.y < b.y;
45 });
46 AABB aabb;
47 Matrix::mulAABB(aabb, _matrix, {
48 {minX->x, minY->y, 0},
49 {maxX->x, maxY->y, 0},
50 });
51 if (!SharedDirector.isInFrustum(aabb)) {
52 return;
53 }
54 }
55
56 Matrix transform;
57 Matrix::mulMtx(transform, SharedDirector.getViewProjection(), _matrix);
58 for (size_t i = 0; i < _points.size(); i++) {
59 Matrix::mulVec4(&_vertices[i].x, transform, _points[i]);
60 }
61
62 auto parent = s_cast<DragonBone*>(getParent());
63 uint64_t renderState = (BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_MSAA | _blendFunc.toValue());
64 if (parent->isDepthWrite()) {
65 renderState |= (BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS);
66 }
67
68 SharedRendererManager.setCurrent(SharedSpriteRenderer.getTarget());
69 SharedSpriteRenderer.push(
70 _vertices.data(), _vertices.size(),
71 _indices.data(), _indices.size(),
72 _effect, _texture, renderState);
73
74 Node::render();
75}
76
77const AffineTransform& DBSlotNode::getDBTransform() const noexcept {
78 return _transform;

Callers

nothing calls this directly

Calls 15

isFrustumCullingMethod · 0.80
isInFrustumMethod · 0.80
setCurrentMethod · 0.80
getTargetMethod · 0.80
getTextureScaleMethod · 0.80
pushMethod · 0.65
clearMethod · 0.65
addMethod · 0.65
getParentFunction · 0.50
ColorClass · 0.50
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected