58 return lhs.transform == rhs.transform && lhs.clipState == rhs.clipState;
95 template<
typename Allocator>
118 template<
typename Allocator>
153 template<
typename Allocator>
180 template<
typename Allocator>
206 template<
typename Allocator>
241 template<
typename Allocator>
245 template<
typename Allocator>
249 template<
typename Allocator>
253 template<
typename Allocator>
257 template<
typename Allocator>
261 template<
typename Allocator>
268 if constexpr(std::is_same_v<T, std::monostate>) {
271 return T(command, allocator.get_allocator());
278 template<
typename T> [[
nodiscard]]
const T&
as()
const {
return mData.as<
T>(); }
280 template<
typename Visitor>
decltype(
auto)
visit(Visitor&&
visitor)
const {
return std::visit(std::forward<Visitor>(
visitor), mData); }
289 template<
typename Allocator>
304 return command.
as<
T>();
318 if(commands.empty()) {
319 return pushCommand<T>(graphicsState);
324 return command.
as<
T>();
327 return pushCommand<T>(graphicsState);
#define CE_USES_ALLOCATOR(T)
Definition Macros.hpp:530
Definition GPUCommandBuffer.hpp:77
An object that encapsulates rendering context for a view.
Definition GraphicsCommandBuffer.hpp:284
GraphicsCommandBuffer() noexcept=default
Creates a new GraphicsCommandBuffer instance.
GraphicsCommandBuffer(std::allocator_arg_t, const Allocator &allocator)
Definition GraphicsCommandBuffer.hpp:290
Deque< GraphicsCommand, AnyAllocatorReference > commands
Definition GraphicsCommandBuffer.hpp:286
GraphicsCommandBuffer(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:291
T & tryReuseCommand(const GraphicsState &graphicsState)
Tries to get a command from the command list.
Definition GraphicsCommandBuffer.hpp:317
Definition Optional.hpp:17
A type that describes a conjunction of shapes that can be filled and stroked.
Definition Shape.hpp:198
Definition Application.hpp:19
std::deque< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Deque
Deque (double-ended queue) is an indexed sequence container that allows fast insertion and deletion a...
Definition Deque.hpp:20
SPtr< Font > FontPtr
Definition Forward.hpp:13
foonathan::memory::any_allocator_reference AnyAllocatorReference
Definition Allocator.hpp:98
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
SPtr< Texture > TexturePtr
Definition Forward.hpp:17
@ Color
Attachment is used for color output.
DefaultAllocator & gDefaultAllocator()
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition GraphicsCommandBuffer.hpp:160
ClearGraphicsCommand(const ClearGraphicsCommand &)=default
ClearGraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const ClearGraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:181
ClearGraphicsCommand()=default
ClearGraphicsCommand(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:178
ClearGraphicsCommand & operator=(const ClearGraphicsCommand &)=default
ClearGraphicsCommand(const ClearGraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:183
ClearGraphicsCommand(ClearGraphicsCommand &&) noexcept=default
Rect2 target
The area of the target texture to be cleared.
Definition GraphicsCommandBuffer.hpp:163
Color color
The color to render the text with.
Definition GraphicsCommandBuffer.hpp:166
A structure that describes the clipping state of the graphics context.
Definition GraphicsCommandBuffer.hpp:31
Rect2 area
The area to clip the render output.
Definition GraphicsCommandBuffer.hpp:33
friend bool operator==(const GraphicsClipState &lhs, const GraphicsClipState &rhs) noexcept
considered equal if they both yield the same result when rendering.
Definition GraphicsCommandBuffer.hpp:37
friend bool operator!=(const GraphicsClipState &lhs, const GraphicsClipState &rhs) noexcept
Compares the GraphicsClipState for inequality.
Definition GraphicsCommandBuffer.hpp:41
Definition GraphicsCommandBuffer.hpp:212
GraphicsCommand()=default
bool is() const noexcept
Definition GraphicsCommandBuffer.hpp:276
GraphicsCommand(const GraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:264
GraphicsCommand & operator=(const GraphicsCommand &)=default
decltype(auto) visit(Visitor &&visitor) const
Definition GraphicsCommandBuffer.hpp:280
GraphicsCommand(const GraphicsState &graphicsState, RawGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:229
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:262
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsState &graphicsState, TextGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:250
T & as()
Definition GraphicsCommandBuffer.hpp:277
GraphicsCommand(const GraphicsState &graphicsState, ClearGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:228
const T & as() const
Definition GraphicsCommandBuffer.hpp:278
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsState &graphicsState, ClearGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:254
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsState &graphicsState, ShapeGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:246
GraphicsCommand(const GraphicsCommand &)=default
GraphicsState graphicsState
Describes the rendering state the moment the command was recorded.
Definition GraphicsCommandBuffer.hpp:217
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsState &graphicsState, TextureGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:242
Variant mData
Definition GraphicsCommandBuffer.hpp:221
GraphicsCommand(const GraphicsState &graphicsState, TextGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:227
GraphicsCommand(const GraphicsState &graphicsState, TextureGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:225
GraphicsCommand(const GraphicsState &graphicsState, ShapeGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:226
GraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const GraphicsState &graphicsState, RawGraphicsCommand &&command)
Definition GraphicsCommandBuffer.hpp:258
GraphicsCommand(GraphicsCommand &&) noexcept=default
Variant< std::monostate, TextureGraphicsCommand, ShapeGraphicsCommand, TextGraphicsCommand, ClearGraphicsCommand, RawGraphicsCommand > Variant
Definition GraphicsCommandBuffer.hpp:220
A structure that represents a snapshot of the graphics context state.
Definition GraphicsCommandBuffer.hpp:45
friend bool operator!=(const GraphicsState &lhs, const GraphicsState &rhs) noexcept
Compares the GraphicsState for inequality.
Definition GraphicsCommandBuffer.hpp:63
friend bool operator==(const GraphicsState &lhs, const GraphicsState &rhs) noexcept
Compares the GraphicsState for equality.
Definition GraphicsCommandBuffer.hpp:57
Optional< GraphicsClipState > clipState
Describes how and where the renderer should clip draw commands from views.
Definition GraphicsCommandBuffer.hpp:53
AffineTransform transform
A 2D transformation matrix that transforms a point from the view coordinate space into the window coo...
Definition GraphicsCommandBuffer.hpp:49
Definition GraphicsCommandBuffer.hpp:186
RawGraphicsCommand(const RawGraphicsCommand &)=default
std::function< void(GPUCommandBuffer &, const GraphicsState &)> Command
A function type that represents the command to be called before rendering the .
Definition GraphicsCommandBuffer.hpp:188
RawGraphicsCommand & operator=(const RawGraphicsCommand &)=default
RawGraphicsCommand(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:204
RawGraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const RawGraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:207
RawGraphicsCommand()=default
RawGraphicsCommand(const RawGraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:209
Command command
A command that will be executed by the renderer every time when rendering a frame.
Definition GraphicsCommandBuffer.hpp:192
RawGraphicsCommand(RawGraphicsCommand &&) noexcept=default
Definition GraphicsCommandBuffer.hpp:101
Shape shape
The shape to be rendered.
Definition GraphicsCommandBuffer.hpp:103
ShapeGraphicsCommand & operator=(const ShapeGraphicsCommand &)=default
ShapeGraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const ShapeGraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:119
ShapeGraphicsCommand(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:116
ShapeGraphicsCommand(ShapeGraphicsCommand &&) noexcept=default
ShapeGraphicsCommand(const ShapeGraphicsCommand &)=default
ShapeGraphicsCommand(const ShapeGraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:121
ShapeGraphicsCommand()=default
Definition GraphicsCommandBuffer.hpp:124
TextGraphicsCommand()=default
TextGraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const TextGraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:154
FontPtr font
The font to draw the text with.
Definition GraphicsCommandBuffer.hpp:126
TexturePtr texture
A texture that contains the laidout text glyphs.
Definition GraphicsCommandBuffer.hpp:129
Vector2 offset
The offset to start rendering the text at.
Definition GraphicsCommandBuffer.hpp:136
Color tintColor
The color to render the text with.
Definition GraphicsCommandBuffer.hpp:139
TextGraphicsCommand(const TextGraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:156
TextGraphicsCommand(const TextGraphicsCommand &)=default
TextGraphicsCommand & operator=(const TextGraphicsCommand &)=default
TextGraphicsCommand(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:151
TextGraphicsCommand(TextGraphicsCommand &&) noexcept=default
Vector< TextLayout, AnyAllocator > layout
A copy of the current text layout.
Definition GraphicsCommandBuffer.hpp:132
Definition GraphicsCommandBuffer.hpp:66
TextureGraphicsCommand(const TextureGraphicsCommand &other, AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:98
TextureGraphicsCommand(AnyAllocatorReference allocator)
Definition GraphicsCommandBuffer.hpp:93
TextureGraphicsCommand & operator=(const TextureGraphicsCommand &)=default
Rect2 source
The area of the source texture to be blit.
Definition GraphicsCommandBuffer.hpp:72
Color tintColor
A tint color to be applied to the blit texture.
Definition GraphicsCommandBuffer.hpp:80
TextureGraphicsCommand()=default
TextureGraphicsCommand(std::allocator_arg_t, const Allocator &allocator, const TextureGraphicsCommand &other)
Definition GraphicsCommandBuffer.hpp:96
TextureGraphicsCommand(TextureGraphicsCommand &&) noexcept=default
TextureGraphicsCommand(const TextureGraphicsCommand &)=default
Rect2 target
The area of the target texture to be blit over.
Definition GraphicsCommandBuffer.hpp:76
TexturePtr texture
The texture to be copied into the view render area.
Definition GraphicsCommandBuffer.hpp:68