mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
Fixed aabb blocks lights
This commit is contained in:
parent
b8d7e89f0b
commit
178107ffff
1 changed files with 12 additions and 7 deletions
|
|
@ -104,10 +104,15 @@ void BlocksRenderer::face(const vec3& coord,
|
||||||
void BlocksRenderer::vertex(const vec3& coord,
|
void BlocksRenderer::vertex(const vec3& coord,
|
||||||
float u, float v,
|
float u, float v,
|
||||||
const vec4& tint,
|
const vec4& tint,
|
||||||
const vec3& axisX,
|
const vec3& X,
|
||||||
const vec3& axisY,
|
const vec3& Y,
|
||||||
const vec3& axisZ) {
|
const vec3& Z) {
|
||||||
vec4 light = pickSoftLight(coord+axisZ*0.5f+(axisX+axisY)*0.5f, axisX, axisY);
|
// TODO: optimize
|
||||||
|
vec3 axisX = glm::normalize(X);
|
||||||
|
vec3 axisY = glm::normalize(Y);
|
||||||
|
vec3 axisZ = glm::normalize(Z);
|
||||||
|
vec3 pos = coord+axisZ*0.5f+(axisX+axisY)*0.5f;
|
||||||
|
vec4 light = pickSoftLight(ivec3(round(pos.x), round(pos.y), round(pos.z)), axisX, axisY);
|
||||||
vertex(coord, u, v, light * tint);
|
vertex(coord, u, v, light * tint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +248,7 @@ void BlocksRenderer::blockXSprite(int x, int y, int z,
|
||||||
|
|
||||||
// HINT: texture faces order: {east, west, bottom, top, south, north}
|
// HINT: texture faces order: {east, west, bottom, top, south, north}
|
||||||
|
|
||||||
/* AABB blocks render method (WIP) // TODO: fix lights */
|
/* AABB blocks render method */
|
||||||
void BlocksRenderer::blockAABB(const ivec3& icoord,
|
void BlocksRenderer::blockAABB(const ivec3& icoord,
|
||||||
const UVRegion(&texfaces)[6],
|
const UVRegion(&texfaces)[6],
|
||||||
const Block* block, ubyte rotation,
|
const Block* block, ubyte rotation,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue