feat: display a handheld item in first-person view (WIP)

This commit is contained in:
MihailRis
2024-10-27 17:07:32 +03:00
parent fb17228eff
commit b93668ba94
9 changed files with 110 additions and 38 deletions
+5
View File
@@ -77,6 +77,7 @@ void ModelBatch::draw(const model::Mesh& mesh, const glm::mat4& matrix,
const texture_names_map* varTextures,
bool backlight) {
glm::vec3 gpos = matrix * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
gpos += lightsOffset;
light_t light = chunks->getLight(
std::floor(gpos.x),
std::floor(std::min(CHUNK_H-1.0f, gpos.y)),
@@ -137,6 +138,10 @@ void ModelBatch::render() {
entries.clear();
}
void ModelBatch::setLightsOffset(const glm::vec3& offset) {
lightsOffset = offset;
}
void ModelBatch::setTexture(const std::string& name,
const texture_names_map* varTextures) {
if (name.at(0) == '$') {