This commit is contained in:
@clasher113 2023-11-25 00:42:18 +02:00
parent c2c255c70a
commit 6d777ea01b
3 changed files with 15 additions and 12 deletions

View File

@ -94,15 +94,18 @@ void GUI::act(float delta) {
for (auto key : Events::pressedKeys) {
focus->keyPressed(key);
}
if (!Events::_cursor_locked && Events::clicked(mousecode::BUTTON_1)) {
int mx = Events::x;
int my = Events::y;
focus->mouseMove(this, mx, my);
}
if (prevfocus == focus){
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
if (Events::jclicked(i)) {
focus->clicked(this, i);
if (!Events::_cursor_locked) {
if (Events::clicked(mousecode::BUTTON_1)) {
int mx = Events::x;
int my = Events::y;
focus->mouseMove(this, mx, my);
}
if (prevfocus == focus){
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
if (Events::jclicked(i)) {
focus->clicked(this, i);
}
}
}
}

View File

@ -139,7 +139,7 @@ inline vec4 do_tint(float value) {
void BlocksRenderer::blockCube(int x, int y, int z, const vec3& size, const UVRegion(&texfaces)[6], ubyte group) {
vec4 lights[]{ vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f) };
if (isOpen(x, y, z + 1, group)) {
face(vec3(x, y, z), size.x, size.y, vec3(1, 0, 0), vec3(0, 1, 0), texfaces[5], lights, do_tint(0.9f));
face(vec3(x, y, z), size.x, size.y, vec3(1, 0, 0), vec3(0, 1, 0), texfaces[5], lights, do_tint(1.0));
}
if (isOpen(x, y, z - 1, group)) {
face(vec3(x + size.x, y, z - size.z), size.x, size.y, vec3(-1, 0, 0), vec3(0, 1, 0), texfaces[4], lights, vec4(1.0f));
@ -332,7 +332,7 @@ void BlocksRenderer::render(const voxel* voxels, int atlas_size) {
int z = (i / CHUNK_D) % CHUNK_W;
switch (def.model) {
case BlockModel::block:
if (*((light_t*)&def.emission)) {
if (*((uint32_t*)&def.emission)) {
blockCube(x, y, z, vec3(1, 1, 1), texfaces, def.drawGroup);
}
else {

View File

@ -20,7 +20,7 @@ public:
unsigned int id;
// 0 1 2 3 4 5
std::string textureFaces[6]; // -x,x, -y,y, -z,z
unsigned char emission[3];
unsigned char emission[4];
unsigned char drawGroup = 0;
BlockModel model = BlockModel::block;
bool lightPassing = false;