1

I found culling only under spatial hashing for collisions. I'm referring to the kind of backface culling performed by 3D graphics libraries, where anything that need not be visible isn't rendered.

Does Chipmunk2D/Pymunk have any provision for not drawing objects that are not within screen bounds or does that user have to implement it themselves?
For example:
enter image description here

The red rectangle is the screen boundary. All blue objects should get drawn because they are within the screen. Green objects shouldn't be drawn.

I was hoping debug_draw() would have a culling functionality.

ps: btw, if I don't use debug_draw() for drawing, what is the other way of drawing? I don't see a draw() or release_draw() function. So would the user have to write code to individually iterate all objects and draw them? I guess that'd work fine because then the user can do a rectangle intersection test and decide which objects to cull. Perhaps debug_draw could be renamed to drawAll().

4

1 回答 1

1

调试绘制方法主要用于调试和快速原型制作,因此剔除等更高级的功能不在其实现范围内。

如果您觉得自己受到调试绘图的限制,那么可能是时候转换到您自己的绘图代码了,您可以在其中完全控制。自己模拟调试绘图应该很容易,一些示例代码进行自定义绘图。

于 2019-04-01T20:10:35.960 回答