Fix
This commit is contained in:
parent
c2c255c70a
commit
6d777ea01b
@ -94,15 +94,18 @@ void GUI::act(float delta) {
|
|||||||
for (auto key : Events::pressedKeys) {
|
for (auto key : Events::pressedKeys) {
|
||||||
focus->keyPressed(key);
|
focus->keyPressed(key);
|
||||||
}
|
}
|
||||||
if (!Events::_cursor_locked && Events::clicked(mousecode::BUTTON_1)) {
|
|
||||||
int mx = Events::x;
|
if (!Events::_cursor_locked) {
|
||||||
int my = Events::y;
|
if (Events::clicked(mousecode::BUTTON_1)) {
|
||||||
focus->mouseMove(this, mx, my);
|
int mx = Events::x;
|
||||||
}
|
int my = Events::y;
|
||||||
if (prevfocus == focus){
|
focus->mouseMove(this, mx, my);
|
||||||
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
|
}
|
||||||
if (Events::jclicked(i)) {
|
if (prevfocus == focus){
|
||||||
focus->clicked(this, i);
|
for (int i = mousecode::BUTTON_1; i < mousecode::BUTTON_1+12; i++) {
|
||||||
|
if (Events::jclicked(i)) {
|
||||||
|
focus->clicked(this, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) {
|
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) };
|
vec4 lights[]{ vec4(1.0f), vec4(1.0f), vec4(1.0f), vec4(1.0f) };
|
||||||
if (isOpen(x, y, z + 1, group)) {
|
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)) {
|
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));
|
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;
|
int z = (i / CHUNK_D) % CHUNK_W;
|
||||||
switch (def.model) {
|
switch (def.model) {
|
||||||
case BlockModel::block:
|
case BlockModel::block:
|
||||||
if (*((light_t*)&def.emission)) {
|
if (*((uint32_t*)&def.emission)) {
|
||||||
blockCube(x, y, z, vec3(1, 1, 1), texfaces, def.drawGroup);
|
blockCube(x, y, z, vec3(1, 1, 1), texfaces, def.drawGroup);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public:
|
|||||||
unsigned int id;
|
unsigned int id;
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
std::string textureFaces[6]; // -x,x, -y,y, -z,z
|
std::string textureFaces[6]; // -x,x, -y,y, -z,z
|
||||||
unsigned char emission[3];
|
unsigned char emission[4];
|
||||||
unsigned char drawGroup = 0;
|
unsigned char drawGroup = 0;
|
||||||
BlockModel model = BlockModel::block;
|
BlockModel model = BlockModel::block;
|
||||||
bool lightPassing = false;
|
bool lightPassing = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user