20 #include "MeshInstance.h"
22 #include "RenderNode.h"
98 const Vector2& srcPos,
float srcWidth,
float srcHeight,
float rotation,
float opacity);
199 std::vector<TexturePtr> mCurrentTextures;
203 bool mInitialized =
false;
205 1.0f, 0.0f, 0.0f, 0.0f,
206 0.0f, 1.0f, 0.0f, 0.0f,
207 0.0f, 0.0f, 1.0f, 0.0f,
208 0.0f, 0.0f, 0.0f, 1.0f };
211 std::unique_ptr<DebugRenderer> mDebugRenderer;
216 static const char* SHADER_COMPATIBILITY_PREFIX;
Header declaring and including types common to renderer classes such as Vector2. Also includes GL hea...
A class with helper methods for rendering primitives like lines, for debug visualization.
Definition: DebugRenderer.h:36
Class managing GL state switches and draw calls.
Definition: Renderer.h:50
const Matrix4 & getProjectionMatrix() const
Returns the projection matrix that will be used when rendering sprites.
Definition: Renderer.h:71
void selectShader(const ShaderPtr &shader)
Selects a Shader as current.
void selectTexture(const TexturePtr &texture, int stage)
Selects and binds a Texture to a texture stage.
float Matrix4[16]
4x4 float matrix, whose layout is compatible with GL.
Definition: RendererCommon.h:46
static std::string addCompatibilityPrefixToShaderCode(const char *code)
Prefixes the given shader code with code that normalizes shaders across some platforms.
DebugRenderer * getDebugRenderer() const
Returns the DebugRenderer managed by this Renderer.
Definition: Renderer.h:164
void flush()
Flush GL draw calls and state, and deselect objects.
void end()
Signals that rendering this frame should end.
void clearMesh()
Unbinds and clears the current MeshInstance.
b2Vec2 Vector2
2D float vector, whose layout is compatible with GL.
Definition: RendererCommon.h:50
void drawMesh(const MeshInstancePtr &meshInstance, const ShaderPtr &shader)
Draw a MeshInstance with a given Shader.
void attachAsCurrent()
Sets this Renderer as current, allowing it to be retrieved by getCurrent().
void selectMesh(const MeshInstancePtr &meshInstance)
Selects and binds a MeshInstance.
std::shared_ptr< Texture > TexturePtr
Shared pointer typedef for Texture.
Definition: PointerDeclarations.h:173
void begin()
Signal the Renderer that the frame has begun.
std::shared_ptr< Shader > ShaderPtr
Shared pointer typedef for Shader.
Definition: PointerDeclarations.h:143
void drawSprite(const TexturePtr &texture, const Vector2 &pos, float width, float height, const Vector2 &srcPos, float srcWidth, float srcHeight, float rotation, float opacity)
Draws a rectangular quadrilateral, textured with a Texture.
static Renderer * getCurrent()
Returns the Renderer that was set as current through a call to attachAsCurrent(). ...
void clearTextures()
Clears all texture stages.
std::shared_ptr< MeshInstance > MeshInstancePtr
Shared pointer typedef for MeshInstance.
Definition: PointerDeclarations.h:113
void clearTexture(int stage)
Unbinds and clears the Texture at the given stage.
void clearShader()
Unbinds and clears the current Shader.
void detachAsCurrent()
Unsets this Renderer as current.
void setProjectionMatrix(const Matrix4 &matrix)
Sets the projection matrix that will be used when rendering sprites.
static void detachCurrent()
Unsets the current Renderer, if any.