Update UI code, Fix bugs
This commit is contained in:
parent
fd71242a42
commit
04df1078b4
@ -26,11 +26,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|||||||
set(KEKENGINE_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/src/kekengine/res")
|
set(KEKENGINE_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/src/kekengine/res")
|
||||||
set(KEKGAME_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/src/kekgame/res")
|
set(KEKGAME_RESOURCE_DIR "${CMAKE_SOURCE_DIR}/src/kekgame/res")
|
||||||
|
|
||||||
file(GLOB KEKENGINE_SOURCE_FILES "src/kekengine/cpp/*.cpp")
|
file(GLOB_RECURSE KEKENGINE_SOURCE_FILES "src/kekengine/cpp/*.cpp")
|
||||||
file(GLOB_RECURSE KEKENGINE_RESOURCE_FILES "${KEKENGINE_RESOURCE_DIR}/*")
|
file(GLOB_RECURSE KEKENGINE_RESOURCE_FILES "${KEKENGINE_RESOURCE_DIR}/*")
|
||||||
file(GLOB_RECURSE KEKENGINE_RELATIVE_RESOURCE_FILES RELATIVE ${KEKENGINE_RESOURCE_DIR} "${KEKENGINE_RESOURCE_DIR}/*")
|
file(GLOB_RECURSE KEKENGINE_RELATIVE_RESOURCE_FILES RELATIVE ${KEKENGINE_RESOURCE_DIR} "${KEKENGINE_RESOURCE_DIR}/*")
|
||||||
|
|
||||||
file(GLOB KEKGAME_SOURCE_FILES "src/kekgame/cpp/*.cpp")
|
file(GLOB_RECURSE KEKGAME_SOURCE_FILES "src/kekgame/cpp/*.cpp")
|
||||||
file(GLOB_RECURSE KEKGAME_RESOURCE_FILES "${KEKGAME_RESOURCE_DIR}/*")
|
file(GLOB_RECURSE KEKGAME_RESOURCE_FILES "${KEKGAME_RESOURCE_DIR}/*")
|
||||||
file(GLOB_RECURSE KEKGAME_RELATIVE_RESOURCE_FILES RELATIVE ${KEKGAME_RESOURCE_DIR} "${KEKGAME_RESOURCE_DIR}/*")
|
file(GLOB_RECURSE KEKGAME_RELATIVE_RESOURCE_FILES RELATIVE ${KEKGAME_RESOURCE_DIR} "${KEKGAME_RESOURCE_DIR}/*")
|
||||||
|
|
||||||
|
@ -35,17 +35,17 @@ Mesh::Mesh(std::vector<Vertex> vertices, std::vector<uint32_t> indices, Material
|
|||||||
|
|
||||||
glVertexArrayVertexBuffer(vao, KEK_MESH_VERTEX_BUFFER_BINDING, vbo, 0, sizeof(Vertex));
|
glVertexArrayVertexBuffer(vao, KEK_MESH_VERTEX_BUFFER_BINDING, vbo, 0, sizeof(Vertex));
|
||||||
|
|
||||||
glEnableVertexArrayAttrib(vao, KEK_VERTEX_SHADER_IN_POSITION);
|
glEnableVertexArrayAttrib(vao, KEK_MESH_VERTEX_SHADER_IN_POSITION);
|
||||||
glVertexArrayAttribFormat(vao, KEK_VERTEX_SHADER_IN_POSITION, sizeof(float), GL_FLOAT, GL_FALSE, 0);
|
glVertexArrayAttribFormat(vao, KEK_MESH_VERTEX_SHADER_IN_POSITION, 3, GL_FLOAT, GL_FALSE, 0);
|
||||||
glVertexArrayAttribBinding(vao, KEK_VERTEX_SHADER_IN_POSITION, KEK_MESH_VERTEX_BUFFER_BINDING);
|
glVertexArrayAttribBinding(vao, KEK_MESH_VERTEX_SHADER_IN_POSITION, KEK_MESH_VERTEX_BUFFER_BINDING);
|
||||||
|
|
||||||
glEnableVertexArrayAttrib(vao, KEK_VERTEX_SHADER_IN_NORMAL);
|
glEnableVertexArrayAttrib(vao, KEK_MESH_VERTEX_SHADER_IN_NORMAL);
|
||||||
glVertexArrayAttribFormat(vao, KEK_VERTEX_SHADER_IN_NORMAL, sizeof(float), GL_FLOAT, GL_FALSE, offsetof(Vertex, normal));
|
glVertexArrayAttribFormat(vao, KEK_MESH_VERTEX_SHADER_IN_NORMAL, 3, GL_FLOAT, GL_FALSE, offsetof(Vertex, normal));
|
||||||
glVertexArrayAttribBinding(vao, KEK_VERTEX_SHADER_IN_NORMAL, KEK_MESH_VERTEX_BUFFER_BINDING);
|
glVertexArrayAttribBinding(vao, KEK_MESH_VERTEX_SHADER_IN_NORMAL, KEK_MESH_VERTEX_BUFFER_BINDING);
|
||||||
|
|
||||||
glEnableVertexArrayAttrib(vao, KEK_VERTEX_SHADER_IN_TEXCOORD);
|
glEnableVertexArrayAttrib(vao, KEK_MESH_VERTEX_SHADER_IN_TEXCOORD);
|
||||||
glVertexArrayAttribFormat(vao, KEK_VERTEX_SHADER_IN_TEXCOORD, sizeof(float), GL_FLOAT, GL_FALSE, offsetof(Vertex, texCoords));
|
glVertexArrayAttribFormat(vao, KEK_MESH_VERTEX_SHADER_IN_TEXCOORD, 2, GL_FLOAT, GL_FALSE, offsetof(Vertex, texCoords));
|
||||||
glVertexArrayAttribBinding(vao, KEK_VERTEX_SHADER_IN_TEXCOORD, KEK_MESH_VERTEX_BUFFER_BINDING);
|
glVertexArrayAttribBinding(vao, KEK_MESH_VERTEX_SHADER_IN_TEXCOORD, KEK_MESH_VERTEX_BUFFER_BINDING);
|
||||||
|
|
||||||
glVertexArrayElementBuffer(vao, ebo);
|
glVertexArrayElementBuffer(vao, ebo);
|
||||||
|
|
||||||
|
@ -109,16 +109,16 @@ RectangleElement::RectangleElement(UIValue x, UIValue y, UIValue w, UIValue h):
|
|||||||
this->h = h;
|
this->h = h;
|
||||||
color = Colors::BLACK;
|
color = Colors::BLACK;
|
||||||
|
|
||||||
glGenVertexArrays(1, &vao);
|
glCreateVertexArrays(1, &vao);
|
||||||
glGenBuffers(1, &vbo);
|
glCreateBuffers(1, &vbo);
|
||||||
glBindVertexArray(vao);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(rectangleVerts), rectangleVerts, GL_STATIC_DRAW);
|
|
||||||
|
|
||||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), 0);
|
glNamedBufferData(vbo, sizeof(rectangleVerts), rectangleVerts, GL_STATIC_DRAW);
|
||||||
glEnableVertexAttribArray(0);
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
glVertexArrayVertexBuffer(vao, KEK_UI_VERTEX_BUFFER_BINDING, vbo, 0, 2 * sizeof(float));
|
||||||
|
|
||||||
|
glEnableVertexArrayAttrib(vao, KEK_UI_RECT_VERTEX_SHADER_IN_POSITION);
|
||||||
|
glVertexArrayAttribFormat(vao, KEK_UI_RECT_VERTEX_SHADER_IN_POSITION, 2, GL_FLOAT, GL_FALSE, 0);
|
||||||
|
glVertexArrayAttribBinding(vao, KEK_UI_RECT_VERTEX_SHADER_IN_POSITION, KEK_UI_VERTEX_BUFFER_BINDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
RectangleElement::~RectangleElement() {
|
RectangleElement::~RectangleElement() {
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
#define KEK_SUCCESS 0
|
#define KEK_SUCCESS 0
|
||||||
#define KEK_ERROR 1
|
#define KEK_ERROR 1
|
||||||
|
|
||||||
#define KEK_VERTEX_SHADER_IN_POSITION 0
|
#define KEK_MESH_VERTEX_SHADER_IN_POSITION 0
|
||||||
#define KEK_VERTEX_SHADER_IN_NORMAL 1
|
#define KEK_MESH_VERTEX_SHADER_IN_NORMAL 1
|
||||||
#define KEK_VERTEX_SHADER_IN_TEXCOORD 2
|
#define KEK_MESH_VERTEX_SHADER_IN_TEXCOORD 2
|
||||||
|
|
||||||
#define KEK_MESH_VERTEX_BUFFER_BINDING 0
|
#define KEK_MESH_VERTEX_BUFFER_BINDING 0
|
||||||
|
|
||||||
|
#define KEK_UI_RECT_VERTEX_SHADER_IN_POSITION 0
|
||||||
|
#define KEK_UI_VERTEX_BUFFER_BINDING 0
|
||||||
|
|
||||||
#define KEK_UNIFORM_LIGHTS_BINDING 0
|
#define KEK_UNIFORM_LIGHTS_BINDING 0
|
||||||
|
|
||||||
#define KEK_LIGHT_LIMIT 64 // Also in shader/include/constants.glsl
|
#define KEK_LIGHT_LIMIT 64 // Also in shader/include/constants.glsl
|
||||||
|
Loading…
Reference in New Issue
Block a user