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

Method render

Source/Node/Sprite.cpp:261–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void Sprite::render() {
262 if (!_texture || !_effect || _textureRect.size == Size::zero) {
263 Node::render();
264 return;
265 }
266
267 if (getSize() == Size::zero) {
268 return;
269 } else {
270 updateVertPosition();
271 }
272
273 if (SharedDirector.isFrustumCulling()) {
274 AABB aabb;
275 Matrix::mulAABB(aabb, getWorld(), getWidth(), getHeight());
276 if (!SharedDirector.isInFrustum(aabb)) {
277 return;
278 }
279 }
280
281 if (_flags.isOn(Sprite::VertexColorDirty)) {
282 _flags.setOff(Sprite::VertexColorDirty);
283 updateVertColor();
284 }
285
286 if (_flags.isOn(Sprite::VertexPosDirty)) {
287 _flags.setOff(Sprite::VertexPosDirty);
288 Matrix transform;
289 Matrix::mulMtx(transform, SharedDirector.getViewProjection(), getWorld());
290 Matrix::mulVec4(&_quad.rb.x, transform, _quadPos.rb);
291 Matrix::mulVec4(&_quad.lb.x, transform, _quadPos.lb);
292 Matrix::mulVec4(&_quad.lt.x, transform, _quadPos.lt);
293 Matrix::mulVec4(&_quad.rt.x, transform, _quadPos.rt);
294 }
295
296 _renderState = (BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_ALPHA_REF(_alphaRef) | BGFX_STATE_MSAA | _blendFunc.toValue());
297 if (_flags.isOn(Sprite::DepthWrite)) {
298 _renderState |= (BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS);
299 }
300
301 SharedRendererManager.setCurrent(SharedSpriteRenderer.getTarget());
302 SharedSpriteRenderer.push(this);
303
304 Node::render();
305}
306
307void Sprite::cleanup() {
308 if (_flags.isOff(Node::Cleanup)) {

Callers

nothing calls this directly

Calls 15

getSizeFunction · 0.85
allocTransientBuffersFunction · 0.85
isFrustumCullingMethod · 0.80
isInFrustumMethod · 0.80
isOnMethod · 0.80
setOffMethod · 0.80
setCurrentMethod · 0.80
getTargetMethod · 0.80
pushMethod · 0.65
getIdMethod · 0.65
getMethod · 0.65
applyMethod · 0.65

Tested by

no test coverage detected