Skip to content
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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

DragonMoffon
Copy link
Contributor

A simple subclass for advanced users who are using the new cameras outside the standard 2D plane.

Depends on PR #2047

Copy link
Member

@pushfoo pushfoo left a 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:

  1. Under doc/example_code/how_to_examples:
    1. A billboardlist_isometric.png screenshot file
    2. A billboardlist_isometric.rst file modelled off the others which includes:
      1. an :orphan: directive at the top
      2. a .. _billboardlist_isometric: link target
      3. A title using = to underline it / mark it as a heading
      4. An .. image:: billboardlist_isometric.png directive to include the screenshot as in other examples
      5. A brief explanation if needed
      6. A .. literalinclude:: ../../../arcade/examples/billboard_isometric.py directive like the other files to include the py source
  2. A cross-links to the example as included in the suggestion comments on this PR further down

Comment on lines +5 to +10
"""
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.
Copy link
Member

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.

Suggested change
"""
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.

Comment on lines +15 to +16
For the advanced options check the advanced section in the
arcade documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`

Copy link
Member

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
Copy link
Member

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.

Suggested change
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants