24#ifndef GF_RENDER_TARGET_H
25#define GF_RENDER_TARGET_H
29#include "GraphicsApi.h"
30#include "GraphicsHandle.h"
33#include "PrimitiveType.h"
36#include "RenderStates.h"
42#ifndef DOXYGEN_SHOULD_SKIP_THIS
80 static void gen(
int n,
unsigned* resources);
81 static void del(
int n,
const unsigned* resources);
462 static constexpr std::size_t CountMax = 5;
464 std::size_t count = 0;
468 void drawFinish(
const Locations& locations);
473 Shader m_defaultAlphaShader;
477#ifndef DOXYGEN_SHOULD_SKIP_THIS
Abstract base class for objects that can be drawn to a render window.
Definition: Drawable.h:57
Class for loading, manipulating and saving images.
Definition: Image.h:81
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:102
void customDraw(const void *vertices, std::size_t size, std::size_t count, PrimitiveType type, Span< const RenderAttributeInfo > attributes, const RenderStates &states=RenderStates())
Draw primitives defined by an array of custom vertices.
RectI getScissorBox()
Get the current scissor box.
void clear(const Color4f &color)
Clear the entire target with a single color.
void draw(const Vertex *vertices, std::size_t count, PrimitiveType type, const RenderStates &states=RenderStates())
Draw primitives defined by an array of vertices.
void draw(Drawable &drawable, const RenderStates &states=RenderStates())
Draw a drawable object to the render target.
RenderTarget & operator=(const RenderTarget &)=delete
Deleted copy assignment.
Image captureFramebuffer(unsigned name) const
Capture the given framebuffer.
void customDraw(const void *vertices, std::size_t size, const uint16_t *indices, std::size_t count, PrimitiveType type, Span< const RenderAttributeInfo > attributes, const RenderStates &states=RenderStates())
Draw primitives defined by an array of custom vertices and their indices.
RectI getViewport(const View &view) const
Get the viewport of a view, applied to this render target.
void draw(const Vertex *vertices, const uint16_t *indices, std::size_t count, PrimitiveType type, const RenderStates &states=RenderStates())
Draw primitives defined by an array of vertices and their indices.
RenderTarget(Vector2i size)
Constructor.
Region getCanonicalScissorBox()
Get the current canonical scissor box.
Vector2f mapPixelToCoords(Vector2i point) const
Convert a point from target coordinates to world coordinates, using the current view.
void draw(const VertexBuffer &buffer, const RenderStates &states=RenderStates())
Draw a vertex buffer to the render target.
virtual ~RenderTarget()
Destructor.
void customDraw(const VertexBuffer &buffer, Span< const RenderAttributeInfo > attributes, const RenderStates &states=RenderStates())
Draw a custom vertex buffer to the render target.
void clear()
Clear the entire target.
virtual void setActive()
Activate the render target for rendering.
RangeF getAliasedLineWidthRange() const
Get the range for aliased line width.
void setCanonicalScissorBox(const Region &box)
Define the canonical scissor box.
void setScissorBox(const RectI &box)
Define the scissor box.
void setView(const View &view)
Change the current active view.
const View & getView() const
Get the view currently in use in the render target.
Definition: RenderTarget.h:318
Vector2f mapPixelToCoords(Vector2i point, const View &view) const
Convert a point from target coordinates to world coordinates.
Vector2i mapCoordsToPixel(Vector2f point) const
Convert a point from world coordinates to target coordinates, using the current view.
Vector2i mapCoordsToPixel(Vector2f point, const View &view) const
Convert a point from world coordinates to target coordinates.
RenderTarget(const RenderTarget &)=delete
Deleted copy constructor.
float getLineWidth() const
Get the line width.
Region getCanonicalViewport(const View &view) const
Get the canonical viewport of a view, applied to this render target.
virtual Vector2i getSize() const =0
Return the size of the rendering region of the target.
An OpenGL vertex and/or fragment shader.
Definition: Shader.h:119
A span.
Definition: Span.h:414
A texture for colored images.
Definition: Texture.h:313
Data in the graphics memory.
Definition: VertexBuffer.h:81
2D camera that defines what region is shown on framebuffer
Definition: View.h:94
GraphicsTag
A tag to represent various GPU resources.
Definition: GraphicsHandle.h:37
@ Framebuffer
A GPU framebuffer.
PrimitiveType
Kind of primitives to render.
Definition: PrimitiveType.h:43
RenderAttributeType
The type of an attribute.
Definition: RenderTarget.h:54
The namespace for gf classes.
static void del(int n, const unsigned *resources)
static void gen(int n, unsigned *resources)
A trait to handle creation and deletion of GPU resources.
Definition: GraphicsHandle.h:48
A half-open range of values.
Definition: Range.h:44
A region of a window.
Definition: Region.h:40
Attribute info.
Definition: RenderTarget.h:66
std::size_t offset
Offset of the attribute in the vertex.
Definition: RenderTarget.h:71
int size
Size of the attribute.
Definition: RenderTarget.h:68
RenderAttributeType type
Type of the attribute.
Definition: RenderTarget.h:69
const char * name
Name of the attribute.
Definition: RenderTarget.h:67
bool normalized
Is the attribute normalized?
Definition: RenderTarget.h:70
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82
A 4D vector.
Definition: Vector.h:852
A point associated with a color and a texture coordinate.
Definition: Vertex.h:75