This helps 'render' elements from the DOM into a set of 3D meshes. It also performs things such as alignment and line packing.
Public Member Functions | |
Renderman (WorldUI worldUI) | |
Creates a new renderer for rendering in the world. More... | |
Renderman () | |
Creates a new renderer and a new document. More... | |
Renderman (bool aot) | |
Creates a renderman for use in the Editor with AOT compiling Nitro. More... | |
void | SetInputMode (InputMode mode) |
Called when the physics input mode changes. Ensures all batches in this renderer are on the correct new input mode. More... | |
void | RelocateCollider () |
Figures out where the box collider should be if we're in physics mode. More... | |
void | IncreaseDepth () |
Increases the current depth value. More... | |
void | Clear () |
Clears all batches from this renderer. More... | |
void | Destroy () |
Destroys this renderman when it's no longer needed. More... | |
void | SetupBatch (DisplayableProperty property, TextureAtlas graphics, TextureAtlas font) |
Sets up the current batch based on the isolation settings requested by a property. More... | |
void | AddBatch (UIBatch batch) |
Adds the given batch to the main linked list for processing. More... | |
void | BeginLinePack (Element element) |
Sets up this renderer so that it's ready to start packing child elements of a given element into lines. More... | |
void | HorizontalAlign (Element element) |
Aligns all elements that have been packed so far based on the alignment settings in a given parent element. More... | |
void | EndLinePack (Element element) |
Lets the renderer know that the given parent element has finished packing all of its kids. This allows alignment to occur next. More... | |
void | CompleteLine (ComputedStyle parentStyle) |
Lets the renderer know the current line doesn't fit anymore elements and has been finished. More... | |
void | PackOnLine (Element element) |
Puts the given element onto the current line. More... | |
bool | IsInvisible (int left, int top, int width, int height) |
Checks if the given box coordinates are outside the current clipping boundary. If they are, the box is considered invisible. More... | |
void | SetBoundary (ComputedStyle style) |
Sets the clipping boundary from the given computed style. More... | |
void | ResetBoundary () |
Resets the clipping boundary back to the whole screen. More... | |
void | Reset () |
Resets all values in the renderer. Called before each layout. More... | |
void | RenderWithCamera (int id) |
Puts all batches of this renderer into the given unity layer. More... | |
void | RequestLayout () |
Asks the renderer to perform a layout next update. More... | |
void | RequestPaint (Css.ElementStyle style) |
Asks the renderer to perform a paint on the given style object next update. More... | |
void | Update () |
Update causes all changes to be applied and layouts to occur. More... | |
void | Layout () |
Relocates all DOM elements by calculating their onscreen position. Each element may allocate sections of the 3D mesh (blocks) which are then flushed out into the unity mesh and onto the screen. More... | |
Vector3 | PixelToWorldUnit (float px, float py, float depth) |
Converts the given screen coordinate to world coordinates. More... | |
Public Attributes | |
int | PenX |
The current x location of the renderer in screen pixels from the left. More... | |
int | PenY |
The current y location of the renderer in screen pixels from the top. More... | |
int | LineHeight |
The height of the current line being processed. More... | |
float | Depth =0f |
The current depth the rendering is occuring at. More... | |
float | MaxDepth =0f |
The deepest element rendered so far. More... | |
bool | DepthUsed |
Set to true when an element has been placed in the depth buffer. More... | |
TransformationStack | Transformations =new TransformationStack() |
A stack of transformations to apply to elements. Updated during a layout event. More... | |
ComputedStyle | LastOnLine |
A linked list of elements on a line are kept. This is the last element on the current line. More... | |
ComputedStyle | FirstOnLine |
A linked list of elements on a line are kept. This is the first element on the current line. More... | |
bool | GoingLeftwards |
True if the rendering direction is left. This originates from the direction: css property. More... | |
UIBatch | CurrentBatch |
The batch that we are currently rendering to. More... | |
ComputedStyle | LastPacked |
The last child element of an element to be packed onto any line. Tracked for valign. More... | |
ComputedStyle | FirstPacked |
The first child element of an element to be packed onto any line. Tracked for valign. More... | |
BoxRegion | ClippingBoundary |
The active clipping boundary. Usually the bounds of the parent element. More... | |
int | BatchDepth |
Essentially counts how many batches were issued. Used to define the render order. More... | |
int | LineStart =0 |
The point at which lines begin at. More... | |
int | MaxX |
The x value that must not be exceeded by elements on a line. Used if the parent has fixed width. More... | |
int | Baseline |
The position of the text baseline. More... | |
int | LargestLineWidth |
The length of the longest line so far. More... | |
int | RenderLayer |
The unity layer that all meshes should go into. More... | |
bool | LayoutOccuring |
A flag which notes if the vital parts of a layout are occuring. During this, the DOM delays updates. More... | |
UIBatch | LastBatch |
The tail of the batch linked list. More... | |
UIBatch | FirstBatch |
The head of the batch linked list. More... | |
Document | RootDocument |
The base document being rendered. More... | |
float | DepthResolution =0.05f |
How far apart along z elements are placed on the UI. More... | |
bool | DoLayout |
True if a layout event was requested. More... | |
Shader | CustomShader |
The current shader override, if there is one. More... | |
ElementStyle | StylesToPaint |
The start of a linked list of styles that need to be painted. This linked list helps prevent layouts occuring as many updates only affect the appearance. More... | |
ElementStyle | StylesToRecompute |
The start of a linked list of styles that need to be recomputed. More... | |
GameObject | Node |
An optional gameobject to parent all content to. More... | |
bool | ScreenClip =true |
True if the screen should clip this renderer. More... | |
WorldUI | InWorldUI |
Used if this renderer is generating a UI in the game world (e.g. on a billboard). More... | |
Transform | PhysicsModeCollider |
The transform of a gameobject containing a cube collider. More... | |
Properties | |
bool | RenderingInWorld [get] |
Is this a renderer for a WorldUI? More... | |
GameObject | Parent [get] |
Gets the parent gameobject for this renderman, if there is one. More... | |
RenderMode | RenderMode [get, set] |
How this renderman renders images; either on an atlas or with them 'as is'. More... | |
FilterMode | FilterMode [get, set] |
The image filter mode. If you're using lots of WorldUI's or animations its best to have this on bilinear. More... | |
FilterMode | TextFilterMode [get, set] |
The text filter mode. If you're using lots of WorldUI's its best to have this on Bilinear. More... | |
int | Layer [get, set] |
The layer to put this Renderer in. Simply an alias for RenderWithCamera. More... | |
Private Member Functions | |
void | AlignLine (ComputedStyle first, ComputedStyle last, int lineSpace, int elementCount, int lineLength, ComputedStyle parent) |
Horizontally aligns a line based on alignment settings in the given computed style. More... | |
void | AddToLine (ComputedStyle style, Element parentNode) |
Adds the given style to the current line. More... | |
Private Attributes | |
List< ComputedStyle > | ActiveFloats |
The set of active floated elements for the current line being rendered. More... | |
FilterMode | ImageFilterMode =FilterMode.Point |
The default filtering mode used by all images of this renderer. More... | |
Static Private Attributes | |
static RenderMode | UIRenderMode =RenderMode.Atlas |
How this renderman renders images; either on an atlas or with them 'as is'. More... | |
|
inline |
Creates a new renderer for rendering in the world.
|
inline |
Creates a new renderer and a new document.
|
inline |
Creates a renderman for use in the Editor with AOT compiling Nitro.
|
inline |
Adds the given batch to the main linked list for processing.
|
inlineprivate |
Adds the given style to the current line.
style | The style to add. |
|
inlineprivate |
Horizontally aligns a line based on alignment settings in the given computed style.
first | The style of the first element on the line. |
last | The style of the last element on the line. |
lineSpace | The amount of space available to the line. |
elementCount | The number of elements on this line. |
lineLength | The width of the line in pixels. |
parent | The style which defines the alignment. |
|
inline |
Sets up this renderer so that it's ready to start packing child elements of a given element into lines.
element | The parent element whose children will be packed. |
|
inline |
Clears all batches from this renderer.
|
inline |
Lets the renderer know the current line doesn't fit anymore elements and has been finished.
parentStyle | The computed style of the element holding this line. |
|
inline |
Destroys this renderman when it's no longer needed.
|
inline |
Lets the renderer know that the given parent element has finished packing all of its kids. This allows alignment to occur next.
element | The element that is done packing. |
|
inline |
Aligns all elements that have been packed so far based on the alignment settings in a given parent element.
element | The element that defines the alignment. |
|
inline |
Increases the current depth value.
|
inline |
Checks if the given box coordinates are outside the current clipping boundary. If they are, the box is considered invisible.
left | The x coordinate of the left edge of the box in pixels from the left of the screen. |
top | The y coordinate of the top edge of the box in pixels from the top edge of the screen. |
width | The width of the box. |
height | The height of the box (extends down the screen). |
|
inline |
Relocates all DOM elements by calculating their onscreen position. Each element may allocate sections of the 3D mesh (blocks) which are then flushed out into the unity mesh and onto the screen.
|
inline |
Puts the given element onto the current line.
element | The element to pack. |
|
inline |
Converts the given screen coordinate to world coordinates.
px | The screen x coordinate in pixels from the left. |
py | The screen y coordinate in pixels from the top. |
depth | The z depth. |
|
inline |
Figures out where the box collider should be if we're in physics mode.
|
inline |
Puts all batches of this renderer into the given unity layer.
id | The ID of the unity layer. |
|
inline |
Asks the renderer to perform a layout next update.
|
inline |
Asks the renderer to perform a paint on the given style object next update.
style | The style to paint. |
|
inline |
Resets all values in the renderer. Called before each layout.
|
inline |
Resets the clipping boundary back to the whole screen.
|
inline |
Sets the clipping boundary from the given computed style.
style | The computed style to find the clipping boundary from. |
|
inline |
Called when the physics input mode changes. Ensures all batches in this renderer are on the correct new input mode.
mode | The new input mode to use. |
|
inline |
Sets up the current batch based on the isolation settings requested by a property.
property | The displayable property which wants the batch. |
fontTexture | The font texture to use with this batch. |
|
inline |
Update causes all changes to be applied and layouts to occur.
|
private |
The set of active floated elements for the current line being rendered.
int PowerUI.Renderman.Baseline |
The position of the text baseline.
int PowerUI.Renderman.BatchDepth |
Essentially counts how many batches were issued. Used to define the render order.
BoxRegion PowerUI.Renderman.ClippingBoundary |
The active clipping boundary. Usually the bounds of the parent element.
UIBatch PowerUI.Renderman.CurrentBatch |
The batch that we are currently rendering to.
Shader PowerUI.Renderman.CustomShader |
The current shader override, if there is one.
float PowerUI.Renderman.Depth =0f |
The current depth the rendering is occuring at.
float PowerUI.Renderman.DepthResolution =0.05f |
How far apart along z elements are placed on the UI.
bool PowerUI.Renderman.DepthUsed |
Set to true when an element has been placed in the depth buffer.
bool PowerUI.Renderman.DoLayout |
True if a layout event was requested.
UIBatch PowerUI.Renderman.FirstBatch |
The head of the batch linked list.
ComputedStyle PowerUI.Renderman.FirstOnLine |
A linked list of elements on a line are kept. This is the first element on the current line.
ComputedStyle PowerUI.Renderman.FirstPacked |
The first child element of an element to be packed onto any line. Tracked for valign.
bool PowerUI.Renderman.GoingLeftwards |
True if the rendering direction is left. This originates from the direction: css property.
|
private |
The default filtering mode used by all images of this renderer.
WorldUI PowerUI.Renderman.InWorldUI |
Used if this renderer is generating a UI in the game world (e.g. on a billboard).
int PowerUI.Renderman.LargestLineWidth |
The length of the longest line so far.
UIBatch PowerUI.Renderman.LastBatch |
The tail of the batch linked list.
ComputedStyle PowerUI.Renderman.LastOnLine |
A linked list of elements on a line are kept. This is the last element on the current line.
ComputedStyle PowerUI.Renderman.LastPacked |
The last child element of an element to be packed onto any line. Tracked for valign.
bool PowerUI.Renderman.LayoutOccuring |
A flag which notes if the vital parts of a layout are occuring. During this, the DOM delays updates.
int PowerUI.Renderman.LineHeight |
The height of the current line being processed.
int PowerUI.Renderman.LineStart =0 |
The point at which lines begin at.
float PowerUI.Renderman.MaxDepth =0f |
The deepest element rendered so far.
int PowerUI.Renderman.MaxX |
The x value that must not be exceeded by elements on a line. Used if the parent has fixed width.
GameObject PowerUI.Renderman.Node |
An optional gameobject to parent all content to.
int PowerUI.Renderman.PenX |
The current x location of the renderer in screen pixels from the left.
int PowerUI.Renderman.PenY |
The current y location of the renderer in screen pixels from the top.
Transform PowerUI.Renderman.PhysicsModeCollider |
The transform of a gameobject containing a cube collider.
int PowerUI.Renderman.RenderLayer |
The unity layer that all meshes should go into.
Document PowerUI.Renderman.RootDocument |
The base document being rendered.
bool PowerUI.Renderman.ScreenClip =true |
True if the screen should clip this renderer.
ElementStyle PowerUI.Renderman.StylesToPaint |
The start of a linked list of styles that need to be painted. This linked list helps prevent layouts occuring as many updates only affect the appearance.
ElementStyle PowerUI.Renderman.StylesToRecompute |
The start of a linked list of styles that need to be recomputed.
TransformationStack PowerUI.Renderman.Transformations =new TransformationStack() |
A stack of transformations to apply to elements. Updated during a layout event.
|
staticprivate |
How this renderman renders images; either on an atlas or with them 'as is'.
|
getset |
The image filter mode. If you're using lots of WorldUI's or animations its best to have this on bilinear.
|
getset |
The layer to put this Renderer in. Simply an alias for RenderWithCamera.
|
get |
Gets the parent gameobject for this renderman, if there is one.
|
get |
Is this a renderer for a WorldUI?
|
getset |
How this renderman renders images; either on an atlas or with them 'as is'.
|
getset |
The text filter mode. If you're using lots of WorldUI's its best to have this on Bilinear.