fix custom models render
This commit is contained in:
@@ -304,7 +304,6 @@ void BlocksRenderer::blockAABB(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
void BlocksRenderer::blockCustomModel(
|
void BlocksRenderer::blockCustomModel(
|
||||||
const glm::ivec3& icoord, const Block* block, ubyte rotation, bool lights, bool ao
|
const glm::ivec3& icoord, const Block* block, ubyte rotation, bool lights, bool ao
|
||||||
) {
|
) {
|
||||||
@@ -329,18 +328,17 @@ void BlocksRenderer::blockCustomModel(
|
|||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (const auto& vertex : mesh.vertices) {
|
for (const auto& vertex : mesh.vertices) {
|
||||||
if ((i++) % 6 < 3) {
|
auto n =
|
||||||
// continue;
|
vertex.normal.x * X + vertex.normal.y * Y + vertex.normal.z * Z;
|
||||||
}
|
float d = glm::dot(glm::normalize(n), SUN_VECTOR);
|
||||||
float d = glm::dot(glm::normalize(vertex.normal), SUN_VECTOR);
|
|
||||||
d = 0.8f + d * 0.2f;
|
d = 0.8f + d * 0.2f;
|
||||||
const auto& n = vertex.normal;
|
const auto& vcoord = vertex.coord - 0.5f;
|
||||||
vertexAO(
|
vertexAO(
|
||||||
coord + vertex.coord - 0.5f,
|
coord + vcoord.x * X + vcoord.y * Y + vcoord.z * Z,
|
||||||
vertex.uv.x,
|
vertex.uv.x,
|
||||||
vertex.uv.y,
|
vertex.uv.y,
|
||||||
glm::vec4(1, 1, 1, 0),
|
glm::vec4(1, 1, 1, 1),
|
||||||
glm::vec3(n.x, -n.z, n.y),
|
glm::vec3(1, 0, 0),
|
||||||
glm::vec3(0, 1, 0),
|
glm::vec3(0, 1, 0),
|
||||||
n
|
n
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user