GX2-backed ImageRenderer for GuiImage/GuiImageData, using Texture2DShader. More...
#include <WutVideoDriver.h>
Public Member Functions | |
| WutImageRenderer (WutVideoDriver *driver) | |
| void * | createTexture (int width, int height) override |
| Allocates an empty hardware-aligned texture buffer. | |
| void | loadTextureData (void *texture, const uint8_t *rgba, int width, int height) override |
| Loads raw RGBA8 pixels into the pre-allocated texture. | |
| bool | canReuseTexture (int allocWidth, int allocHeight, int width, int height) const override |
| Whether a texture allocated for allocWidth x allocHeight can be reloaded in place. | |
| void | destroyTexture (void *texture) override |
| Destroys a texture created by createTexture. | |
| void | drawTexture (void *texture, float xpos, float ypos, uint16_t width, uint16_t height, float degrees, float scaleX, float scaleY, uint8_t alpha) override |
| Draws a texture created by createTexture. | |
| void | drawRectangle (float x, float y, float width, float height, PixelColor color) override |
| Draws a solid-color rectangle (alpha-blended using color.a). | |
| void | drawMesh (const MeshVertex *vertices, size_t count) override |
| Draws a triangle list: three vertices per triangle, each with its own color. | |
| void * | createMesh (const MeshVertex *vertices, size_t count) override |
| Hands a triangle list to the backend to keep in its own ready-to-draw form (a GX display list, a GX2 vertex buffer), so drawing it again with drawMeshInstance() costs the CPU almost nothing, where drawMesh() sends every vertex every time. | |
| void | destroyMesh (void *mesh) override |
| Releases a mesh from createMesh(). | |
| void | drawMeshInstance (void *mesh, float x, float y, float scaleX, float scaleY) override |
| Draws a mesh from createMesh() fully opaque, as its vertex colors say. | |
GX2-backed ImageRenderer for GuiImage/GuiImageData, using Texture2DShader.
Definition at line 217 of file WutVideoDriver.h.
| WutImageRenderer::WutImageRenderer | ( | WutVideoDriver * | driver | ) |
| driver | The video driver draws are queued on |
Definition at line 604 of file WutVideoDriver.cpp.
|
overridevirtual |
Whether a texture allocated for allocWidth x allocHeight can be reloaded in place.
Reimplemented from ImageRenderer.
Definition at line 649 of file WutVideoDriver.cpp.
|
overridevirtual |
Hands a triangle list to the backend to keep in its own ready-to-draw form (a GX display list, a GX2 vertex buffer), so drawing it again with drawMeshInstance() costs the CPU almost nothing, where drawMesh() sends every vertex every time.
Same vertex rules as drawMesh(); the vertices are copied. Call while drawing, since a backend may record from its current render state.
Reimplemented from ImageRenderer.
Definition at line 715 of file WutVideoDriver.cpp.
|
overridevirtual |
Allocates an empty hardware-aligned texture buffer.
Implements ImageRenderer.
Definition at line 610 of file WutVideoDriver.cpp.
|
overridevirtual |
Releases a mesh from createMesh().
Safe to call while draws that use it are still waiting to be submitted; the backend keeps it until they are done.
Reimplemented from ImageRenderer.
Definition at line 758 of file WutVideoDriver.cpp.
|
overridevirtual |
Destroys a texture created by createTexture.
Implements ImageRenderer.
Definition at line 654 of file WutVideoDriver.cpp.
|
overridevirtual |
Draws a triangle list: three vertices per triangle, each with its own color.
Positions are in design-canvas pixels (the same space as drawRectangle()), colors are straight (non-premultiplied) RGBA blended source-over, so per-vertex alpha gives gradients and soft edges (see GuiMesh). Winding does not matter. A count that is not a multiple of 3 is rounded down. The vertices are copied (or consumed) before this returns, so the caller can free or reuse the array immediately.
| vertices | Triangle list |
| count | Number of vertices |
Implements ImageRenderer.
Definition at line 707 of file WutVideoDriver.cpp.
|
overridevirtual |
Draws a mesh from createMesh() fully opaque, as its vertex colors say.
Mesh vertex (vx, vy) lands at (x + vx * scaleX, y + vy * scaleY) in design-canvas pixels.
| mesh | Handle from createMesh() |
| x | Where mesh (0,0) lands |
| y | Where mesh (0,0) lands |
| scaleX | Horizontal stretch about (x,y) |
| scaleY | Vertical stretch about (x,y) |
Reimplemented from ImageRenderer.
Definition at line 764 of file WutVideoDriver.cpp.
|
overridevirtual |
Draws a solid-color rectangle (alpha-blended using color.a).
Implements ImageRenderer.
Definition at line 772 of file WutVideoDriver.cpp.
|
overridevirtual |
Draws a texture created by createTexture.
Implements ImageRenderer.
Definition at line 667 of file WutVideoDriver.cpp.
|
overridevirtual |
Loads raw RGBA8 pixels into the pre-allocated texture.
Implements ImageRenderer.
Definition at line 631 of file WutVideoDriver.cpp.