-
Notifications
You must be signed in to change notification settings - Fork 343
Create a BillboardList subclass of SpriteList. #2048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a BillboardList subclass of SpriteList. #2048
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this new billboard class isn't going in experimental, it's a good idea to add:
- Under
doc/example_code/how_to_examples
:- A
billboardlist_isometric.png
screenshot file - A
billboardlist_isometric.rst
file modelled off the others which includes:- an
:orphan:
directive at the top - a
.. _billboardlist_isometric:
link target - A title using
=
to underline it / mark it as a heading - An
.. image:: billboardlist_isometric.png
directive to include the screenshot as in other examples - A brief explanation if needed
- A
.. literalinclude:: ../../../arcade/examples/billboard_isometric.py
directive like the other files to include the py source
- an
- A
- A cross-links to the example as included in the suggestion comments on this PR further down
""" | ||
The purpose of the BillboardList is to batch draw a list of sprites. | ||
The difference between the BillboardList and a basic SpriteList is how it | ||
orientates Sprites. The normal SpriteList always aligns them to the X-Y plane. | ||
The BillboardList purposely forces the sprite to always look directly towards | ||
the screen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd clean up the intro section as follows.
""" | |
The purpose of the BillboardList is to batch draw a list of sprites. | |
The difference between the BillboardList and a basic SpriteList is how it | |
orientates Sprites. The normal SpriteList always aligns them to the X-Y plane. | |
The BillboardList purposely forces the sprite to always look directly towards | |
the screen. | |
"""Draw sprites to always face the screen regardless of camera orientation. | |
Since the basic :py:class:`~arcade.SpriteList` draws every :py:class:`~arcade.Sprite` | |
as aligned with the X and Y axes, it allows perspective and camera position to affect | |
how sprite polygons are drawn. This class differs by using a special default shader | |
program to always make sure the sprite polygons face the camera. This is also known | |
as billboarding or billboard-style sprites. |
For the advanced options check the advanced section in the | ||
arcade documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the advanced options check the advanced section in the | |
arcade documentation. | |
To learn more, please see: | |
* The :ref:`spritelist_billboardlist` example | |
* The :py:class:`~arcade.sprite_list.SpatialHash` class | |
* The notes on :ref:`collision_detection_performance` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this something like billboardlist_isometric.py
so it's shorter to type when users type python -m arcade.examples.billboardlist_isometric
The up vector is similarly calculated. | ||
|
||
If Python and Arcade are installed, this example can be run from the command line with: | ||
python -m arcade.examples.isometric_with_billboards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to update this line to match any top-level file rename.
python -m arcade.examples.isometric_with_billboards | |
python -m arcade.examples.billboardlist_isometric |
BillboardLists make sprites always face the screen. This is useful for something like isometric. Where the ground tiles are flat, but walls and other decorations should still face the camera. Sprites assume they are on the x-y plane a lot so all of the left, right, bottom, top methods aren't accurate for a sprite that is drawn with a billboardlist.
A new Isometric example which uses and OthrographicProjector and a BillboardList to show how you could implement an isometric view in a game.
A simple subclass for advanced users who are using the new cameras outside the standard 2D plane.
Depends on PR #2047