guillaume 1.0.0
Guillaume is a component-based UI framework library built around a primitive rendering system. It's designed for building user interfaces across XR platforms and traditional platforms with custom rendering backends and input handling. The framework is lightweight, flexible, and easy to integrate into existing projects.
Loading...
Searching...
No Matches
renderer.hpp
1/*
2 Copyright (c) 2025 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <memory>
26
27// Forward declarations
28class Component;
29class Primitive;
30class Text;
31class Rectangle;
32class Triangle;
33class Polygon;
34
43class Renderer {
44private:
45protected:
46public:
50 Renderer(void) {}
51
55 virtual ~Renderer(void) = default;
56
63 virtual void clear(void) {}
64
71 virtual void present(void) {}
72
82 virtual void draw(std::shared_ptr<Primitive> primitive);
83
93 virtual void drawText(std::shared_ptr<Text> text) {
94 // Default implementation does nothing
95 // Derived classes should override this method
96 (void)text;
97 }
98
108 virtual void drawRectangle(std::shared_ptr<Rectangle> rectangle) {
109 // Default implementation does nothing
110 // Derived classes should override this method
111 (void)rectangle;
112 }
113
123 virtual void drawTriangle(std::shared_ptr<Triangle> triangle) {
124 // Default implementation does nothing
125 // Derived classes should override this method
126 (void)triangle;
127 }
128
138 virtual void drawPolygon(std::shared_ptr<Polygon> polygon) {
139 // Default implementation does nothing
140 // Derived classes should override this method
141 (void)polygon;
142 }
143};
Base class for all UI components.
Definition component.hpp:38
Represents a polygon primitive for 3D rendering.
Definition polygon.hpp:40
Base class for all drawing primitives.
Definition primitive.hpp:34
Represents a rectangle primitive. The Rectangle class is a derived class of Polygon that represents a...
Definition rectangle.hpp:37
Represents the renderer of an Application.
Definition renderer.hpp:43
Renderer(void)
Constructs a Renderer object.
Definition renderer.hpp:50
virtual void present(void)
Presents the rendered content to the display.
Definition renderer.hpp:71
virtual void drawTriangle(std::shared_ptr< Triangle > triangle)
Draws a triangle primitive in 3D space.
Definition renderer.hpp:123
virtual void clear(void)
Clears the rendering target.
Definition renderer.hpp:63
virtual ~Renderer(void)=default
Destroys the Renderer object.
virtual void drawRectangle(std::shared_ptr< Rectangle > rectangle)
Draws a rectangle primitive in 3D space.
Definition renderer.hpp:108
virtual void drawText(std::shared_ptr< Text > text)
Draws a text primitive in 3D space.
Definition renderer.hpp:93
virtual void drawPolygon(std::shared_ptr< Polygon > polygon)
Draws a polygon primitive in 3D space.
Definition renderer.hpp:138
virtual void draw(std::shared_ptr< Primitive > primitive)
Draws a primitive to the screen.
Represents a text primitive for rendering in 3D space.
Definition text.hpp:39
Represents a triangle primitive for 3D rendering.
Definition triangle.hpp:37