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

@ -177,6 +177,7 @@ void SkeletonConfig::render(
const Assets& assets,
ModelBatch& batch,
Skeleton& skeleton,
ModelLightingMode lightingMode,
const glm::mat3& rotation,
const glm::vec3& position,
const glm::vec3& scale
@ -203,16 +204,24 @@ void SkeletonConfig::render(
if (auto foundOverride = modelOverride.model.lock()) {
model = foundOverride.get();
}
if (model) {
batch.draw(
skeleton.calculated.matrices[i],
skeleton.tint * skeleton.boneTints[i],
model,
&skeleton.textures
);
} else if (!node->model.name.empty()) {
node->model.updateFlag = true;
}
if (model == nullptr) {
if (!node->model.name.empty()) {
node->model.updateFlag = true;
}
continue;
}
batch.draw(
skeleton.calculated.matrices[i],
skeleton.tint * skeleton.boneTints[i],
lightingMode == ModelLightingMode::SOLID
? position - glm::vec3(
skeleton.calculated.matrices[i] *
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)
)
: glm::vec3(),
model,
&skeleton.textures
);
}
}

View file

@ -11,6 +11,7 @@
#include "typedefs.hpp"
#include "data/dv_fwd.hpp"
#include "util/Interpolation.hpp"
#include "util/EnumMetadata.hpp"
class Assets;
class ModelBatch;
@ -19,6 +20,16 @@ namespace model {
struct Model;
}
enum class ModelLightingMode {
BONE_BASED,
SOLID,
};
VC_ENUM_METADATA(ModelLightingMode)
{"bone-based", ModelLightingMode::BONE_BASED},
{"solid", ModelLightingMode::SOLID},
VC_ENUM_END
namespace rigging {
struct Skeleton;
class SkeletonConfig;
@ -132,6 +143,7 @@ namespace rigging {
const Assets& assets,
ModelBatch& batch,
Skeleton& skeleton,
ModelLightingMode lightingMode,
const glm::mat3& rotation,
const glm::vec3& position,
const glm::vec3& scale