GrassTrample

from acron.vegetation import GrassTrample
class GrassTrample

Bases:

Bases: TypedReferenceCount

Where the grass has been trodden or driven over: a square map of `size` texels over `extent` metres that follows a centre (a camera, a player, a vehicle) in whole texels, so what was stamped stays put in the world while the map moves. A texel holds the push direction (x, y) and how flat the grass is (0..1); flat grass recovers over `recovery` seconds. The grass shader reads it as an RGBA16F texture. At most MAX_SIZE texels a side; non-finite arguments are rejected with an error.

Inheritance diagram

digraph inheritance1d87392b18 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "GrassTrample" [URL="acron.vegetation.GrassTrample.html#acron.vegetation.GrassTrample",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedReferenceCount" -> "GrassTrample" [arrowsize=0.75,style=""]; "ReferenceCount" [URL="acron.core.ReferenceCount.html#acron.core.ReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ReferenceCount" [arrowsize=0.75,style=""]; "TypedObject" [URL="acron.core.TypedObject.html#acron.core.TypedObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "TypedObject" [arrowsize=0.75,style=""]; "TypedReferenceCount" [URL="acron.core.TypedReferenceCount.html#acron.core.TypedReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedObject" -> "TypedReferenceCount" [arrowsize=0.75,style=""]; "ReferenceCount" -> "TypedReferenceCount" [arrowsize=0.75,style=""]; }
__init__()

A map of size x size texels over extent x extent metres, centred on the origin until set_center() moves it.

clear()
static get_class_type()
get_extent()
get_flatness()

How flat the grass is at (x, y) (0 outside the map).

get_origin()

The world position of the map’s south-west corner.

get_size()
property origin → LPoint2f

The world position of the map’s south-west corner.

recover()

Lets the grass stand up again: flatness falls to nothing over `recovery` seconds.

set_center()

Centres the map on (x, y), scrolling what it holds by whole texels.

stamp()

Flattens the grass in a disc (a soft edge over its outer third), pushing it along (dir_x, dir_y) – or away from the centre when that is zero. Stamps keep the flattest value.

write_texture()

The map as an RGBA16F texture (rows south to north): rg the push direction, b the flatness.