2 #ifndef _YI_GEOMETRY_BATCH_H_ 3 #define _YI_GEOMETRY_BATCH_H_ 7 #include <glm/vec2.hpp> 124 void DrawRect(
const std::shared_ptr<CYIAssetTextureBase> &pTexture,
const glm::vec4 &rect,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f),
const glm::vec4 &UVs = glm::vec4(0, 0, 1, 1));
134 void DrawRectWithRenderTarget(
const std::shared_ptr<CYIOffscreenRenderTarget> &pRenderTarget,
const glm::vec4 &rect,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f),
const glm::vec4 &UVs = glm::vec4(0, 0, 1, 1));
144 void DrawQuad(
const std::shared_ptr<CYIAssetTextureBase> &pTexture,
const glm::vec2 &point1,
const glm::vec2 &point2,
const glm::vec2 &point3,
const glm::vec2 &point4,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f),
const glm::vec4 &UVs = glm::vec4(0, 0, 1, 1));
149 void DrawQuad(
const glm::vec2 &point1,
const glm::vec2 &point2,
const glm::vec2 &point3,
const glm::vec2 &point4,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f));
154 void DrawTriangle(
const std::shared_ptr<CYIAssetTextureBase> &pTexture,
const glm::vec2 &point1,
const glm::vec2 &point2,
const glm::vec2 &point3,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f),
const glm::vec4 &UVs = glm::vec4(0, 0, 1, 1));
164 void DrawLine(
const glm::vec2 &start,
const glm::vec2 &end,
const CYIColor &
color =
CYIColor(1.0f, 1.0f, 1.0f, 1.0f),
float fThickness = 1.f,
YI_LINE_STYLE eLineStyle =
YI_LINE_SOLID,
YI_LINE_HEAD_STYLE eStartHeadStyle =
YI_LINE_HEAD_PLAIN,
YI_LINE_HEAD_STYLE eEndHeadStyle =
YI_LINE_HEAD_PLAIN,
float fHeadSize = 10.0f);
213 void CreateBuffers();
215 void DrawRect(
const std::shared_ptr<CYIAssetTextureBase> &pTexture,
const glm::vec4 &rect,
const CYIColor &
color,
const glm::vec4 &UVs,
bool bTransposeTexture);
216 void DrawQuad(
const std::shared_ptr<CYIAssetTextureBase> &pTexture,
const glm::vec2 &point1,
const glm::vec2 &point2,
const glm::vec2 &point3,
const glm::vec2 &point4,
const CYIColor &
color,
const glm::vec4 &UVs,
bool bTransposeTexture);
219 std::shared_ptr<CYIAssetTexture> CreateAndAddLineStyleTexture(
const CYIString &pattern,
const CYIString &nameFragment)
const;
221 VertexP2T2C4 *m_pVertices;
224 std::shared_ptr<CYIAssetTextureBase> m_pCurrentTexture;
225 std::shared_ptr<CYIAssetShaderProgram> m_pShader;
226 std::shared_ptr<CYIAssetBufferObjectData> m_pIndexBuffer;
227 std::shared_ptr<CYIAssetBufferObjectData> *m_pVertexBuffer;
229 std::shared_ptr<CYIMesh> m_pMesh;
230 std::shared_ptr<CYIMaterial> m_pMaterial;
232 int32_t m_nCurrentBufferIndex;
233 uint32_t m_uClippingStackHeight;
238 bool m_bRenderingEnabled;
239 uint32_t m_uSpriteCount;
240 std::shared_ptr<CYIAssetTextureBase> m_pASCIITexture;
241 std::vector<std::shared_ptr<CYIAssetTextureBase>> m_lineStyleTextures;
250 #endif // _YI_GEOMETRY_BATCH_H_ Definition: YiGeometryBatch.h:71
Text wraps on the first character that exceeds the wrapping width.
Definition: YiGeometryBatch.h:87
Definition: YiGeometryBatch.h:38
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:114
void DrawQuad(const std::shared_ptr< CYIAssetTextureBase > &pTexture, const glm::vec2 &point1, const glm::vec2 &point2, const glm::vec2 &point3, const glm::vec2 &point4, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), const glm::vec4 &UVs=glm::vec4(0, 0, 1, 1))
No text wrapping (except for explicit newline characters)
Definition: YiGeometryBatch.h:86
static std::pair< glm::ivec2, float > GetTextSizeForCurrentSurface(YI_TEXT_SIZE eTextSize=YI_REGULAR)
A text size where each character is 9 pixels wide and 16 pixels tall.
Definition: YiGeometryBatch.h:48
Class representing an instance of geometry information.
Definition: YiMesh.h:33
YI_WRAP_MODE
Definition: YiGeometryBatch.h:84
33% of the size of YI_REGULAR
Definition: YiGeometryBatch.h:46
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
glm::vec2 boxSize
The tight fit of the size of the text, taking line breaks into consideration.
Definition: YiGeometryBatch.h:107
CYIColor color
The text color. Defaults to white.
Definition: YiGeometryBatch.h:96
Definition: YiGeometryBatch.h:64
static CYIGeometryBatch * GetInstance()
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:23
glm::vec2 lastCharacterBottomRight
The position of the bottom right corner of the last rendered character. Affected by the draw position...
Definition: YiGeometryBatch.h:108
Allows drawing of simple 2D geometry in batch.
Definition: YiGeometryBatch.h:30
charACTER_SET
Definition: YiGeometryBatch.h:53
A filled 'arrow head'-shaped arrow.
Definition: YiGeometryBatch.h:78
Definition: YiGeometryBatch.h:70
Definition: YiGeometryBatch.h:91
CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/...
Definition: YiMaterial.h:27
TextSize GetTextSize(const CYIString &text, const TextSettings &settings) const
Definition: YiGeometryBatch.h:39
A hollow flattended 'UML' diamond.
Definition: YiGeometryBatch.h:80
YI_TEXT_SIZE
Definition: YiGeometryBatch.h:44
A simple arrow made of line segments.
Definition: YiGeometryBatch.h:77
Definition: YiGeometryBatch.h:68
YI_LINE_HEAD_STYLE
Definition: YiGeometryBatch.h:74
Definition: YiGeometryBatch.h:41
Definition: YiGeometryBatch.h:104
200% of the size of YI_REGULAR
Definition: YiGeometryBatch.h:49
Definition: YiGeometryBatch.h:40
glm::vec2 characterSize
The size of single character.
Definition: YiGeometryBatch.h:106
Text wraps on the last space prior toto the wrapping width.
Definition: YiGeometryBatch.h:88
void DrawRectWithRenderTarget(const std::shared_ptr< CYIOffscreenRenderTarget > &pRenderTarget, const glm::vec4 &rect, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), const glm::vec4 &UVs=glm::vec4(0, 0, 1, 1))
50% of the size of YI_REGULAR
Definition: YiGeometryBatch.h:47
Definition: YiTextEngine.h:74
void PushClipping(const glm::vec4 &rect)
A filled flattened 'UML' diamond.
Definition: YiGeometryBatch.h:81
A filled triangular arrow.
Definition: YiGeometryBatch.h:79
Definition: YiGeometryBatch.h:69
YI_LINE_STYLE
Definition: YiGeometryBatch.h:62
Defines an offscreen target for the rendering results to be sent to.
Definition: YiOffscreenRenderTarget.h:26
300% of the size of YI_REGULAR
Definition: YiGeometryBatch.h:50
void DrawRect(const std::shared_ptr< CYIAssetTextureBase > &pTexture, const glm::vec4 &rect, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), const glm::vec4 &UVs=glm::vec4(0, 0, 1, 1))
YI_TEXT_STYLE eStyle
The text style. Defaults to YI_TEXT_STYLE_NORMAL.
Definition: YiGeometryBatch.h:98
Definition: YiGeometryBatch.h:66
Definition: YiGeometryBatch.h:67
Definition: YiGeometryBatch.h:56
void DrawTriangle(const std::shared_ptr< CYIAssetTextureBase > &pTexture, const glm::vec2 &point1, const glm::vec2 &point2, const glm::vec2 &point3, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), const glm::vec4 &UVs=glm::vec4(0, 0, 1, 1))
This asset represents the base class for POT (Power Of Two) and NPOT (Non-Power Of Two) textures...
Definition: YiAssetTextureBase.h:24
charACTER_SET eCharacterSet
The character set. If YI_UTF8, the text is intepreted as UTF-8 code points. If YI_CODE_PAGE_437, the text is interpreted as bytes repesenting Code Page 437 values. Defaults to YI_UTF8.
Definition: YiGeometryBatch.h:99
Shader program asset. Contains a vector of CYIAssetShaderObject types.
Definition: YiAssetShaderProgram.h:22
float fWrappingWidth
The text wrapping width. Used only when eWrapMode is not YI_WRAP_NONE. Defaults to 0...
Definition: YiGeometryBatch.h:101
As asset container which wraps shared index or vertex buffer object data.
Definition: YiAssetBufferObjectData.h:17
void DrawLine(const glm::vec2 &start, const glm::vec2 &end, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), float fThickness=1.f, YI_LINE_STYLE eLineStyle=YI_LINE_SOLID, YI_LINE_HEAD_STYLE eStartHeadStyle=YI_LINE_HEAD_PLAIN, YI_LINE_HEAD_STYLE eEndHeadStyle=YI_LINE_HEAD_PLAIN, float fHeadSize=10.0f)
A class used to represent a color value.
Definition: YiColor.h:31
float fScale
The text scale. Defaults to 1.0.
Definition: YiGeometryBatch.h:97
void DrawOutline(const glm::vec4 &rect, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), float fSize=1.f, YI_LINE_STYLE eStyle=YI_LINE_SOLID)
TextSize DrawText(const CYIString &text, const glm::vec2 &pos, const CYIColor &color=CYIColor(1.0f, 1.0f, 1.0f, 1.0f), float fScale=1.f, YI_TEXT_STYLE eStyle=YI_TEXT_STYLE_NORMAL, charACTER_SET eCharacterSet=YI_UTF8)
YI_WRAP_MODE eWrapMode
The text wrapping mode. Defaults to YI_WRAP_NONE.
Definition: YiGeometryBatch.h:100
Definition: YiGeometryBatch.h:55
glm::vec2 position
The top-left position at which text should be rendered. Defaults to (0.0, 0.0)
Definition: YiGeometryBatch.h:95
Definition: YiGeometryBatch.h:65
No line head.
Definition: YiGeometryBatch.h:76