SpriteBatch全部绘制 [英] SpriteBatch draw all
问题描述
我对Libgdx SpriteBatch
有疑问:
当我调用 SpriteBatch#draw()
时,Libgdx是否会照顾 Camera
的视锥,即使它位于视锥之外,还是会绘制?/p>
我已经准备好查看 SpriteBatch
的代码,但是我什么也没找到,所以我想知道Libgdx是否在内部执行某些操作.还是我必须自己实施frstum淘汰像这样:
if(camera.frustum.boundsInFrustum(250,32,0,100,100,0)){tempEnemy.draw(批处理);}
其中 tempEnemy
是 Sprite
,其中(250,32)是其中心,而(100,100)是其一半大小.
如果我正确理解您的意思,您是在问Libgdxs SpriteBatch
是否关心 ViewFrustum
和只是绘制可见的部分,或者只是绘制您告诉他绘制的所有内容.
如果那是问题,答案是, SpriteBatch
绘制所有内容,而忽略 ViewFrustum
.您必须自己解决这个问题,或者使用Scene2D,它似乎在做一些 解决方案
If i understand you correctly, you are asking, whether Libgdxs SpriteBatch
takes care about the ViewFrustum
and just draws visible parts or if it just draws everything you tell him to draw.
If thats the question, the answer is, the SpriteBatch
draws everything, ignoring the ViewFrustum
. You have to take care about that yourself, or use Scene2D, which seems to do some culling.
这篇关于SpriteBatch全部绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!