Added GUI shaders to the repository.

master
aurailus 2018-12-26 00:10:59 -08:00
parent ffdcf3d828
commit 68edae3fcb
9 changed files with 41 additions and 58 deletions

View File

@ -66,6 +66,10 @@ add_executable(zeus
zeus/lua_api/LuaParser.h
zeus/lua_api/LRegisterBlock.cpp
zeus/lua_api/LRegisterBlock.h
zeus/engine/iVec3.h zeus/mesh/TextBuilder.cpp zeus/mesh/TextBuilder.h zeus/mesh/TextBuilder.cpp zeus/engine/graphics/HudText.cpp zeus/engine/graphics/HudText.h)
zeus/mesh/TextBuilder.cpp
zeus/mesh/TextBuilder.h
zeus/mesh/TextBuilder.cpp
zeus/engine/graphics/HudText.cpp
zeus/engine/graphics/HudText.h)
target_link_libraries(zeus ${OPENGL_gl_LIBRARY} glfw libGLEW.so pthread lua dl)

View File

@ -21,5 +21,5 @@ zeus.register_block('default:dirt', {
-- Stone
zeus.register_block('default:stone', {
name = "Stone",
textures = {"default_stone"}
textures = {"default_cobblestone"}
})

BIN
tex/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
textureAtlas.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -37,7 +37,7 @@ void Renderer::update() {
void Renderer::begin() {
//Clear Window
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClearColor(0.1f, 0.15f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

View File

@ -1,53 +0,0 @@
//
// Created by aurailus on 19/12/18.
//
#ifndef ZEUS_IVEC3_H
#define ZEUS_IVEC3_H
struct iVec3 {
int x, y, z;
iVec3() {
x = 0;
y = 0;
z = 0;
}
iVec3(int x, int y, int z) {
this->x = x;
this->y = y;
this->z = z;
}
// iVec3(int n) {
// this->x = n;
// this->y = n;
// this->z = n;
// }
};
#endif //ZEUS_IVEC3_H
namespace std {
template<> struct hash<iVec3> {
std::size_t operator()(const iVec3 &k) const {
return (k.x * 97 + k.y) * 89 + k.z;
}
};
template<> struct less<iVec3> {
bool operator()(const iVec3 &a, const iVec3 &b) const {
if (a.x < b.x) return true;
if (a.y < b.y) return true;
if (a.z < b.z) return true;
return false;
}
};
template<> struct equal_to<iVec3> {
bool operator()(const iVec3 &a, const iVec3 &b) const {
return (a.x == b.x && a.y == b.y && a.z == b.z);
}
};
}

14
zeus/shader/gui.fs Normal file
View File

@ -0,0 +1,14 @@
#version 330
in vec4 color;
in vec2 fragTex;
out vec4 fragColor;
uniform sampler2D tex;
void main() {
vec2 texCoord = fragTex;
fragColor = texture(tex, texCoord) * color;
// fragColor = color;
}

18
zeus/shader/gui.vs Normal file
View File

@ -0,0 +1,18 @@
#version 330
layout (location = 0) in vec3 pos;
layout (location = 1) in vec2 tex;
layout (location = 2) in vec3 nor;
uniform mat4 model;
uniform mat4 ortho;
out vec4 color;
out vec2 fragTex;
void main() {
gl_Position = ortho * model * vec4(pos, 1.0);
color = vec4(1, 1, 1, 1);
fragTex = tex;
}

View File

@ -26,9 +26,9 @@ void GameInstance::initialize(Renderer* renderer) {
//The world requires the blockAtlas for meshing and handling inputs.
world = new World(blockAtlas);
int SIZE = 32;
int SIZE = 24;
for (int i = -SIZE; i < SIZE; i++) {
for (int j = 0; j < 4; j++) {
for (int j = 0; j < 3; j++) {
for (int k = -SIZE; k < SIZE; k++) {
world->genNewChunk(glm::vec3(i, j, k));
}