![]() |
Lysa
0.0
Lysa 3D Engine
|
3D vector renderer
Inheritance diagram for Vector3DRenderer:Classes | |
| struct | Vertex |
Public Member Functions | |
| Vector3DRenderer (const RendererConfiguration &config, vireo::ImageFormat outputFormat, bool useCamera=true, bool depthTestEnable=true, bool filledTriangles=false, bool enableAlphaBlending=true, const std::string &name="VectorRenderer", const std::string &shadersName="vector", const std::string &glyphShadersName="glyph") | |
| bool | isUseCamera () const |
| unique_id | beginDraw (unique_id sessionId=INVALID_ID) |
| void | endDraw () |
| void | setVisible (unique_id sessionId, bool visible) |
| void | clearSession (unique_id sessionId) |
| void | restart () |
| void | drawLine (const float3 &from, const float3 &to, const float4 &color) |
| void | drawTriangle (const float3 &v1, const float3 &v2, const float3 &v3, const float4 &color) |
| void | drawImage (unique_id imageId, const float3 &position, const quaternion &rotation, const float2 &size, const float4 &color) |
| void | drawText (const std::string &text, Font &font, float fontScale, const float3 &position, const quaternion &rotation, const float4 &innerColor, TextAlignment alignment=TextAlignment::LEFT, bool rotationGlobal=false) |
| void | drawSpline (const std::vector< float3 > &points, const float4 &color, uint32 segsPerSpan=16, float tension=0.0f) |
| void | update (const std::shared_ptr< vireo::CommandList > &commandList, uint32 frameIndex) |
| void | resize (const vireo::Extent &extent) |
| void | render (const std::shared_ptr< vireo::CommandList > &commandList, const Camera &camera, const std::shared_ptr< vireo::RenderTarget > &colorAttachment, const std::shared_ptr< vireo::RenderTarget > &depthAttachment, uint32 frameIndex) |
| void | setGammaCorrectionParameters (const float gamma, const float _) |
| virtual | ~Vector3DRenderer () |
| Vector3DRenderer (Vector3DRenderer &) = delete | |
| Vector3DRenderer & | operator= (Vector3DRenderer &) = delete |
Protected Member Functions | |
| void | commitPrimitive (DrawPrimType type, uint32 vertexCount) |
| int32 | addImage (const Image &texture) |
| int32 | addFontAtlas (const Image &texture) |
| int32 | addFont (Font &font) |
Protected Attributes | |
| const std::string | name |
| const size_t | maxVertices |
| const size_t | maxParams |
| const size_t | maxImages |
| const size_t | maxFonts |
| ImageManager & | imageManager |
| const RendererConfiguration & | config |
| float | aspectRatio {} |
| std::vector< Vertex > | vertices |
| uint32 | nextVertexOffset {0} |
| std::vector< DrawParam > | params |
| uint32 | nextParamOffset {0} |
| uint32 | lineListCount {0} |
| uint32 | lineStripCount {0} |
| uint32 | triPlainCount {0} |
| uint32 | triImageCount {0} |
| uint32 | triGlyphCount {0} |
| std::optional< DrawSession > | currentSession |
| Vector3DRenderer | ( | const RendererConfiguration & | config, |
| vireo::ImageFormat | outputFormat, | ||
| bool | useCamera = true, |
||
| bool | depthTestEnable = true, |
||
| bool | filledTriangles = false, |
||
| bool | enableAlphaBlending = true, |
||
| const std::string & | name = "VectorRenderer", |
||
| const std::string & | shadersName = "vector", |
||
| const std::string & | glyphShadersName = "glyph" |
||
| ) |
Constructs a vector renderer.
| config | Rendering config. |
| outputFormat | Output attachment color format |
| useCamera | True to apply Scene view/projection. |
| depthTestEnable | Enable depth test for 3D primitives. |
| enableAlphaBlending | Enable alpha blending (for UI/text). |
| filledTriangles | True to fill the triangles; false for wireframe only. |
| name | Debug name for pipelines. |
| shadersName | Base shader name for vector primitives. |
| glyphShadersName | Base shader name for glyph rendering. |
|
virtual |
|
delete |
Starts a drawing session. Is the session already exists it will be cleared first
| sessionId | Session ID |
| void clearSession | ( | unique_id | sessionId | ) |
Clear a drawing session and all of the corresponding elements (vertices, params)
| sessionId | Session ID |
|
protected |
| void drawImage | ( | unique_id | imageId, |
| const float3 & | position, | ||
| const quaternion & | rotation, | ||
| const float2 & | size, | ||
| const float4 & | color | ||
| ) |
Draws a textured quad
| imageId | Resource ID of the image to display, or INVALID_ID for a solid-color quad. |
| position | Bottom-left corner of the quad in world space. |
| rotation | Orientation applied to the quad around its bottom-left corner. |
| size | Width (x) and height (y) of the quad in world units. |
| color | Tint color multiplied with the texture sample. |
| void drawLine | ( | const float3 & | from, |
| const float3 & | to, | ||
| const float4 & | color | ||
| ) |
Draws a colored line segment
| void drawSpline | ( | const std::vector< float3 > & | points, |
| const float4 & | color, | ||
| uint32 | segsPerSpan = 16, |
||
| float | tension = 0.0f |
||
| ) |
Draws a cardinal spline through the given control points.
| points | Ordered list of control points the curve passes through (at least 2). |
| color | Color applied to the entire spline. |
| segsPerSpan | Number of line segments used to approximate each span between two consecutive points. |
| tension | Curve tension in [0, 1]: 0 = Catmull-Rom, 1 = straight segments. |
| void drawText | ( | const std::string & | text, |
| Font & | font, | ||
| float | fontScale, | ||
| const float3 & | position, | ||
| const quaternion & | rotation, | ||
| const float4 & | innerColor, | ||
| TextAlignment | alignment = TextAlignment::LEFT, |
||
| bool | rotationGlobal = false |
||
| ) |
Draws text using the provided font.
| text | UTF-8 string to render. |
| font | Font object providing glyph atlas/metrics. |
| fontScale | Scaling factor applied to glyph metrics. |
| position | Anchor point in world space (meaning depends on alignment). |
| rotation | Orientation for the text in world space. |
| innerColor | Color applied to glyphs (vertex alpha can modulate it). |
| alignment | LEFT: position = left edge; CENTER: position = center; RIGHT: position = right edge. |
| rotationGlobal | false (default): rotation is local around position. true: rotation is global around world origin. |
| void drawTriangle | ( | const float3 & | v1, |
| const float3 & | v2, | ||
| const float3 & | v3, | ||
| const float4 & | color | ||
| ) |
Draws a filled triangle .
| void endDraw | ( | ) |
Close a drawing session
|
inline |
Returns true if the renderer applies the scene camera's view/projection transform.
|
delete |
| void render | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| const Camera & | camera, | ||
| const std::shared_ptr< vireo::RenderTarget > & | colorAttachment, | ||
| const std::shared_ptr< vireo::RenderTarget > & | depthAttachment, | ||
| uint32 | frameIndex | ||
| ) |
Renders accumulated primitives using the given Scene (with camera).
| commandList | Command buffer to record into. |
| camera | Current camera (ignored if useCamera is false) |
| colorAttachment | Target color surface. |
| depthAttachment | Target depth surface (may be null if no depth). |
| frameIndex | Index of the current frame in flight. |
| void resize | ( | const vireo::Extent & | extent | ) |
Resizes the renderer's viewport
| extent | The new extent |
| void restart | ( | ) |
Removes all sessions, vertices and params, resetting the renderer to its initial empty state.
|
inline |
| void setVisible | ( | unique_id | sessionId, |
| bool | visible | ||
| ) |
Shows or hides a draw session without clearing its primitives. Hidden sessions are skipped by the GPU indirect command generator but remain in the vertex and params buffers so they can be made visible again cheaply.
| sessionId | Session ID returned by beginDraw(). |
| visible | True to show, false to hide. |
| void update | ( | const std::shared_ptr< vireo::CommandList > & | commandList, |
| uint32 | frameIndex | ||
| ) |
Uploads dirty vertex & params buffers.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |