Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
sf::View culling
Print
Pages: [
1
]
Author
Topic: sf::View culling (Read 3666 times)
0 Members and 1 Guest are viewing this topic.
Elusive
Newbie
Posts: 10
sf::View culling
«
on:
September 25, 2011, 04:28:08 am »
Hi,
Is there a simple way of culling invisible items in the scene using sf::View? Is there some method of checking wether a boundary box is intersecting with the visible region?
-Elusive
Logged
Laurent
Administrator
Hero Member
Posts: 32498
sf::View culling
«
Reply #1 on:
September 25, 2011, 08:58:52 am »
Build the view's rectangle (from its size and position), the entities' bounding rects, and use rect1.Intersect(rect2) to find out if they intersect.
Logged
Laurent Gomila - SFML developer
Elusive
Newbie
Posts: 10
sf::View culling
«
Reply #2 on:
September 25, 2011, 01:09:27 pm »
That was my first guess, but what about the view rotation?
Logged
Laurent
Administrator
Hero Member
Posts: 32498
sf::View culling
«
Reply #3 on:
September 25, 2011, 01:52:43 pm »
If you have a rotation it becomes more complicated. You must use the separate axis theorem to compute the intersection between two non-aligned rectangles.
Logged
Laurent Gomila - SFML developer
Elusive
Newbie
Posts: 10
sf::View culling
«
Reply #4 on:
September 25, 2011, 01:59:36 pm »
That is not part of SFML, right? I'll look into that. Thanks!
Logged
Nexus
SFML Team
Hero Member
Posts: 6287
Thor Developer
sf::View culling
«
Reply #5 on:
September 25, 2011, 02:06:30 pm »
Here
you find a tutorial that explains the Separate Axis Theorem.
Logged
Zloxx II
: action platformer
Thor Library
: particle systems, animations, dot products, ...
SFML Game Development
:
Elusive
Newbie
Posts: 10
sf::View culling
«
Reply #6 on:
September 25, 2011, 02:08:04 pm »
Awesome! Thanks a lot!
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
sf::View culling
anything