You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.5 KiB
114 lines
2.5 KiB
4 months ago
|
/*
|
||
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
|
||
|
* Description: Common header
|
||
|
* Author:
|
||
|
* Create: 2019-08-23
|
||
|
*/
|
||
|
|
||
|
#ifndef COMMON_H
|
||
|
#define COMMON_H
|
||
|
|
||
|
#include <GLES2/gl2.h>
|
||
|
#include <ft2build.h>
|
||
|
#include FT_FREETYPE_H
|
||
|
#include "DFXDefine.h"
|
||
|
|
||
|
namespace dolgles {
|
||
|
#define FONTSIZE_STANDARD 40
|
||
|
constexpr EGL_U32 FBO_INVALID_HANDLE = 0xffffffff;
|
||
|
|
||
|
struct TagFrameBuffObject {
|
||
|
EGL_U32 fboHandleIndex = FBO_INVALID_HANDLE;
|
||
|
GLuint colorTex = 0;
|
||
|
GLuint frameBuffId = 0;
|
||
|
GLint width = 0;
|
||
|
GLint height = 0;
|
||
|
};
|
||
|
|
||
|
using FrameBuffObject = TagFrameBuffObject;
|
||
|
|
||
|
struct TagColorRGBA {
|
||
|
GLfloat red = 0.0;
|
||
|
GLfloat green = 0.0;
|
||
|
GLfloat blue = 0.0;
|
||
|
GLfloat alpha = 0.0;
|
||
|
};
|
||
|
|
||
|
using ColorRGBA = TagColorRGBA;
|
||
|
|
||
|
struct TagGLRectInfo {
|
||
|
GLfloat x = 0.0;
|
||
|
GLfloat y = 0.0;
|
||
|
GLfloat width = 0.0;
|
||
|
GLfloat height = 0.0;
|
||
|
};
|
||
|
|
||
|
using GLRectInfo = TagGLRectInfo;
|
||
|
|
||
|
struct TagGLRoundInfo {
|
||
|
GLfloat x = 0.0;
|
||
|
GLfloat y = 0.0;
|
||
|
GLfloat rw = 0.0;
|
||
|
GLfloat rh = 0.0;
|
||
|
};
|
||
|
|
||
|
using GLRoundInfo = TagGLRoundInfo;
|
||
|
|
||
|
struct TagGLBlitInfo {
|
||
|
FrameBuffObject srcFBO;
|
||
|
FrameBuffObject dstFBO;
|
||
|
GLRectInfo srcRect;
|
||
|
GLRectInfo dstRect;
|
||
|
};
|
||
|
|
||
|
using GLBlitInfo = TagGLBlitInfo;
|
||
|
|
||
|
struct TagPoint {
|
||
|
GLfloat x = 0.0; // vertex x
|
||
|
GLfloat y = 0.0; // vertex y
|
||
|
GLfloat z = 0.0; // z is texture coord x in vertex shader
|
||
|
GLfloat w = 0.0; // w is texture coord y in vertex shader
|
||
|
};
|
||
|
|
||
|
using Point = TagPoint;
|
||
|
|
||
|
struct TagGLTextInfo {
|
||
|
const EGL_CHAR16 *text = nullptr;
|
||
|
EGL_U32 textLen = 0;
|
||
|
ColorRGBA fgColor;
|
||
|
ColorRGBA bgColor;
|
||
|
EGL_U8 justify = 0;
|
||
|
FT_UInt fontSize = 0;
|
||
|
FT_Bool isBold = false;
|
||
|
FT_Bool isUnderLine = false;
|
||
|
FT_Bool isItalic = false;
|
||
|
};
|
||
|
|
||
|
using GLTextInfo = TagGLTextInfo;
|
||
|
|
||
|
struct TagGLBitmapInfo {
|
||
|
void *bitmap = nullptr;
|
||
|
GLRectInfo dstRect;
|
||
|
GLsizei texWidth = 0;
|
||
|
GLsizei texHeight = 0;
|
||
|
GLint colorFormat = 0;
|
||
|
bool isBlend = false;
|
||
|
};
|
||
|
|
||
|
using GLBitmapInfo = TagGLBitmapInfo;
|
||
|
|
||
|
struct TagGlyphInfo {
|
||
|
GLfloat advX = 0.0; // advance.x
|
||
|
GLfloat advY = 0.0; // advance.y
|
||
|
GLfloat bWidth = 0.0; // bitmap.width
|
||
|
GLfloat bHeight = 0.0; // bitmap.height
|
||
|
GLfloat bLeft = 0.0; // bitmap_left
|
||
|
GLfloat bTop = 0.0; // bitmap_top
|
||
|
GLfloat texX = 0.0; // x offset of glyph in texture coordinates
|
||
|
GLfloat texY = 0.0; // y offset of glyph in texture coordinates
|
||
|
}; // character information
|
||
|
|
||
|
using GlyphInfo = TagGlyphInfo;
|
||
|
}; // namespace dolgles
|
||
|
|
||
|
#endif // end COMMON_H
|