mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
add 'lighting-mode' entity property
This commit is contained in:
parent
507f32f1e5
commit
8911cded07
9 changed files with 61 additions and 18 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue