add 'lighting-mode' entity property

This commit is contained in:
MihailRis 2026-09-19 18:13:15 +03:00
parent 507f32f1e5
commit 8911cded07
9 changed files with 61 additions and 18 deletions

View file

@ -30,6 +30,7 @@ void HandsRenderer::render(const Camera& camera) {
assets,
modelBatch,
skeleton,
ModelLightingMode::SOLID,
glm::mat3(1.0f),
glm::vec3(),
glm::vec3(1.0f)

View file

@ -100,13 +100,18 @@ void ModelBatch::draw(
void ModelBatch::draw(
const glm::mat4& matrix,
const glm::vec4& tint,
const glm::vec3& lightSampleOffset,
const model::Model* model,
const TextureNamesMap* varTextures
) {
for (const auto& mesh : model->meshes) {
entries.push_back({
matrix, extract_rotation(matrix), tint, &mesh, varTextures
});
entries.push_back(DrawEntry {
matrix,
extract_rotation(matrix),
tint,
lightSampleOffset,
&mesh,
varTextures});
}
}
@ -118,6 +123,7 @@ void ModelBatch::render() {
);
bool backlight = settings.graphics.backlight.get();
for (auto& entry : entries) {
setLightsOffset(entry.lightSampleOffset);
draw(
*entry.mesh,
entry.matrix,
@ -126,6 +132,7 @@ void ModelBatch::render() {
entry.varTextures,
backlight
);
setLightsOffset(glm::vec3());
}
batch->flush();
entries.clear();

View file

@ -33,6 +33,7 @@ public:
void draw(
const glm::mat4& matrix,
const glm::vec4& tint,
const glm::vec3& lightSampleOffset,
const model::Model* model,
const TextureNamesMap* varTextures
);
@ -66,6 +67,7 @@ private:
glm::mat4 matrix;
glm::mat3 rotation;
glm::vec4 tint;
glm::vec3 lightSampleOffset;
const model::Mesh* mesh;
const TextureNamesMap* varTextures;
};