class PaperTransformStack
Defined at line 22 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
PaperTransformStack is a helper class to be used along with PaperRenderer
when rendering hierarchical scenes. It maintains a stack where each item has
two fields:
- a 4x4 model-to-world transform matrix
- a list of model-space clip planes
Public Methods
void PaperTransformStack ()
Defined at line 11 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
const Item & PushTransform (const mat4 & transform)
All of the Push*() methods generate a new Item and push it onto the stack.
The new Item is generated by applying the specified transform to the Item
that is currently on top of the stack. The returned Item
&
is valid until
it is popped from the stack via Pop().
NOTE: Variants such as PushTranslation() and PushIdentity() are more
performant than PushTransform(), because they do something cheaper than
applying a 4x4 matrix to the matrix/clip-planes on top of the stack.
NOTE: as long as the returned item is on top of the stack, its clip-planes
will be affected by calls to AddClipPlanes(). Use PushIdentity() if you
want to add additional clip-planes in the current coordinate system without
affecting existing Item
&
references. For example, this is handy for the
use-case where a parent has several children, and different sets of
clip-planes for each child in the parent's coordinate system.
Defined at line 13 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
const Item & PushTranslation (const vec3 & translation)
Defined at line 30 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
const Item & PushTranslation (const vec2 & translation)
Defined at line 46 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
const Item & PushScale (float scale)
Defined at line 47 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
const Item & PushElevation (float elevation)
Defined at line 49 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
const Item & AddClipPlanes (const std::vector<plane3> & clip_planes)
Defined at line 59 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
const Item & PushIdentity ()
Defined at line 64 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
const Item & Top ()
There is always a valid Item at the top of the stack. Popping the last
item clears the clip planes, leaving an identity matrix.
Defined at line 65 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
const Item & AddClipPlanes (const plane3 * clip_planes, size_t num_clip_planes)
Add the clip planes to the stack. These planes are in the space defined by
the current transform. In other words, they are not transformed by the
current transform, but will be transformed by each subsequent transform
that is pushed onto the stack. NOTE: stack's size must be > 0 when this is
called.
Defined at line 69 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
size_t size ()
Defined at line 80 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
size_t empty ()
Defined at line 81 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
size_t num_clip_planes ()
Defined at line 82 of file ../../src/ui/lib/escher/paper/paper_transform_stack.h
PaperTransformStack & Pop ()
Pop the top entry from the stack, unless only the default identity matrix
remains.
Defined at line 85 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc
PaperTransformStack & Clear (std::pair<size_t, size_t> stack_size_and_num_clip_planes)
Pop entries off the stack until only the specified number remain (zero by
default). Then, trim trailing clip-planes until only the specified number
remain (zero by default). In both cases, the specified number must not
exceed the number of stack-entries/clip-planes that currently exist.
Defined at line 92 of file ../../src/ui/lib/escher/paper/paper_transform_stack.cc