2D immediate-mode drawing surface (screen or offscreen Canvas). 更多...
#include <IGraphics2D.h>
Public 成员函数 | |
| virtual | ~IGraphics2D ()=default |
| Releases IGraphics2D resources. | |
| virtual void | clearScreen ()=0 |
| Clears the current draw target to the background color. | |
| virtual void | setBackgroundColorRGBA (float r, float g, float b, float a=1.f)=0 |
| Sets the background color rgba. | |
| virtual void | drawSolidRectRGBA (float x, float y, float w, float h, float r, float g, float b, float a=1.f)=0 |
| Draws solid rect rgba. | |
| virtual void | drawTexturedRectRGBA (Texture *texture, float x, float y, float w, float h, float r, float g, float b, float a=1.f)=0 |
| Draws textured rect rgba. | |
| virtual void | drawSolidRect (float x, float y, float w, float h, const Color &color, BlendMode blend=BlendMode::Alpha)=0 |
| Draws solid rect. | |
| virtual void | drawSolidRectRotated (float cx, float cy, float w, float h, float degrees, const Color &color, BlendMode blend=BlendMode::Alpha)=0 |
| Draws solid rect rotated. | |
| virtual void | drawPrimitiveCanvas (const PrimitiveCanvas2D &canvas)=0 |
| Resolves and queues one frame-local primitive Canvas. | |
| virtual void | drawTexturedRect (Texture *texture, float x, float y, float w, float h, const Color &color)=0 |
| Draws textured rect. | |
| virtual void | drawTexturedRectShader (Texture *texture, Shader *shader, float x, float y, float w, float h, const Color &color)=0 |
| Draws textured rect shader. | |
| virtual void | drawTexturedRectUV (Texture *texture, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color)=0 |
| Draws textured rect uv. | |
| virtual void | drawTexturedRectShaderUV (Texture *texture, Shader *shader, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha)=0 |
| Draws textured rect shader uv. | |
| virtual void | drawTexturedRectShaderUVRotated (Texture *texture, Shader *shader, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha)=0 |
| Draws textured rect shader uv rotated. | |
| virtual void | drawTexturedRectShaderDepth (Texture *color, Texture *depth, Shader *shader, float x, float y, float w, float h, const Color &tint)=0 |
| Draws textured rect shader depth. | |
| virtual void | drawTexturedRectLitUV (Texture *albedo, Texture *normal, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color, BlendMode blend=BlendMode::Alpha)=0 |
| Lit 2D draw (albedo + normal map); normal may be null → flat. | |
| virtual void | drawTexturedRectLitUVRotated (Texture *albedo, Texture *normal, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, const Color &color, BlendMode blend=BlendMode::Alpha)=0 |
Lit 2D draw rotated degrees clockwise (screen Y-down) around (cx, cy). | |
| virtual void | setLighting2D (const Lighting2DUBO &ubo)=0 |
| Upload per-frame / per-canvas 2D lighting constants. | |
| virtual void | setCanvas (Canvas *canvas)=0 |
| Draw target; nullptr → screen. | |
| virtual bool | isCanvasActive () const =0 |
| True when canvas active. | |
| virtual Canvas * | getCanvas () const =0 |
| Returns the canvas. | |
| virtual void | setShader (Shader *shader)=0 |
| Custom fragment pipeline for subsequent textured 2D draws. | |
| virtual void | setShader ()=0 |
| Sets the shader. | |
| virtual Shader * | getShader () const =0 |
| Returns the shader. | |
| virtual void | setFont (Font *font)=0 |
| Optional shared font used by legacy consumers; nullptr = none set. | |
| virtual Font * | getFont () const =0 |
| Returns the font. | |
| virtual void | print (const std::string &text, float x, float y, const Color &color=Color(1.f, 1.f, 1.f, 1.f), float scale=1.f)=0 |
| Draws UTF-8 text with the font selected by setFont(). | |
| virtual void | drawText (Font *font, const std::string &text, float x, float y, const Color &color=Color(1.f, 1.f, 1.f, 1.f), float scale=1.f)=0 |
| Draws UTF-8 text with an explicitly supplied GPU font. | |
| virtual void | draw (Drawable *drawable, const glm::mat4 &m)=0 |
| Draws . | |
| virtual void | drawOcclusion (Drawable *drawable, const glm::mat4 &m)=0 |
| Draws occlusion. | |
| virtual void | drawOcclusionSolid (float x, float y, float w, float h)=0 |
| Draws occlusion solid. | |
| virtual void | drawOcclusionTexture (Texture *texture, float x, float y, float w, float h)=0 |
| Draws occlusion texture. | |
| virtual void | pushValidationScope ()=0 |
| Backend GPU validation scopes (WebGPU). | |
| virtual void | popValidationScope ()=0 |
| Pops validation scope. | |
详细描述
2D immediate-mode drawing surface (screen or offscreen Canvas).
在文件 IGraphics2D.h 第 33 行定义.
构造及析构函数说明
◆ ~IGraphics2D()
|
virtualdefault |
Releases IGraphics2D resources.
成员函数说明
◆ clearScreen()
|
pure virtual |
Clears the current draw target to the background color.
在 eve::graphics::Graphics 内被实现.
◆ draw()
|
pure virtual |
Draws .
在 eve::graphics::Graphics 内被实现.
◆ drawOcclusion()
|
pure virtual |
Draws occlusion.
在 eve::graphics::Graphics 内被实现.
◆ drawOcclusionSolid()
|
pure virtual |
Draws occlusion solid.
在 eve::graphics::Graphics 内被实现.
◆ drawOcclusionTexture()
|
pure virtual |
Draws occlusion texture.
在 eve::graphics::Graphics 内被实现.
◆ drawPrimitiveCanvas()
|
pure virtual |
Resolves and queues one frame-local primitive Canvas.
- 参数
-
canvas Borrowed recorder consumed synchronously and never retained.
- 注解
- Render-thread affine; invokes no callbacks.
在 eve::graphics::vulkan::Graphics , 以及 eve::graphics::webgpu::Graphics 内被实现.
被这些函数引用 eve::physics::World::drawDebug().
◆ drawSolidRect()
|
pure virtual |
Draws solid rect.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawSolidRectRGBA()
|
pure virtual |
Draws solid rect rgba.
在 eve::graphics::Graphics 内被实现.
◆ drawSolidRectRotated()
|
pure virtual |
Draws solid rect rotated.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawText()
|
pure virtual |
Draws UTF-8 text with an explicitly supplied GPU font.
- 参数
-
font Borrowed non-null font belonging to this graphics backend; it is not retained beyond the call. text Borrowed UTF-8 text retained only for this call. x Left edge in the current canvas coordinate space. y Top edge in the current canvas coordinate space. color Glyph tint and opacity. scale Uniform text scale.
- 异常
-
eve::Exception if fontis nullptr.
- 注解
- Render-thread only. The call is synchronous and invokes no callbacks.
在 eve::graphics::Graphics 内被实现.
◆ drawTexturedRect()
|
pure virtual |
Draws textured rect.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectLitUV()
|
pure virtual |
Lit 2D draw (albedo + normal map); normal may be null → flat.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectLitUVRotated()
|
pure virtual |
Lit 2D draw rotated degrees clockwise (screen Y-down) around (cx, cy).
- 参数
-
albedo Borrowed albedo texture; nullptr draws a solid tinted rect. normal Borrowed tangent-space normal map; nullptr uses a flat +Z map. blend Compositing mode; matches the non-lit textured 2D path.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectRGBA()
|
pure virtual |
Draws textured rect rgba.
在 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectShader()
|
pure virtual |
Draws textured rect shader.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectShaderDepth()
|
pure virtual |
Draws textured rect shader depth.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectShaderUV()
|
pure virtual |
Draws textured rect shader uv.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectShaderUVRotated()
|
pure virtual |
Draws textured rect shader uv rotated.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ drawTexturedRectUV()
|
pure virtual |
Draws textured rect uv.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ getCanvas()
|
pure virtual |
Returns the canvas.
在 eve::graphics::Graphics, eve::graphics::vulkan::Graphics , 以及 eve::graphics::webgpu::Graphics 内被实现.
◆ getFont()
|
pure virtual |
Returns the font.
在 eve::graphics::Graphics 内被实现.
◆ getShader()
|
pure virtual |
Returns the shader.
在 eve::graphics::Graphics 内被实现.
◆ isCanvasActive()
|
pure virtual |
True when canvas active.
在 eve::graphics::Graphics, eve::graphics::vulkan::Graphics , 以及 eve::graphics::webgpu::Graphics 内被实现.
◆ popValidationScope()
|
pure virtual |
Pops validation scope.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ print()
|
pure virtual |
Draws UTF-8 text with the font selected by setFont().
- 参数
-
text Borrowed UTF-8 text retained only for this call. x Left edge in the current canvas coordinate space. y Top edge in the current canvas coordinate space. color Glyph tint and opacity. scale Uniform text scale.
- 异常
-
eve::Exception if no current font has been selected.
- 注解
- Render-thread only. The call is synchronous and invokes no callbacks.
在 eve::graphics::Graphics 内被实现.
◆ pushValidationScope()
|
pure virtual |
Backend GPU validation scopes (WebGPU).
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ setBackgroundColorRGBA()
|
pure virtual |
Sets the background color rgba.
在 eve::graphics::Graphics 内被实现.
◆ setCanvas()
|
pure virtual |
Draw target; nullptr → screen.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ setFont()
|
pure virtual |
Optional shared font used by legacy consumers; nullptr = none set.
在 eve::graphics::Graphics 内被实现.
◆ setLighting2D()
|
pure virtual |
Upload per-frame / per-canvas 2D lighting constants.
在 eve::graphics::vulkan::Graphics, eve::graphics::webgpu::Graphics , 以及 eve::graphics::Graphics 内被实现.
◆ setShader() [1/2]
|
pure virtual |
Sets the shader.
在 eve::graphics::Graphics 内被实现.
◆ setShader() [2/2]
|
pure virtual |
Custom fragment pipeline for subsequent textured 2D draws.
在 eve::graphics::Graphics 内被实现.
该类的文档由以下文件生成:
- src/modules/graphics/IGraphics2D.h