Skip to content

Commit

Permalink
Merge branch 'master' into detached5
Browse files Browse the repository at this point in the history
  • Loading branch information
hotstreams authored Jun 12, 2024
2 parents 8ce1e7a + 72056e6 commit 6914749
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions include/limitless/instances/decal_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace Limitless {
void updateBoundingBox() noexcept override;
std::unique_ptr<Instance> clone() noexcept override;

void setMaterial(std::shared_ptr<ms::Material> new_material);

void draw(Context& ctx, const Assets& assets, ShaderType shader_type, ms::Blending blending, const UniformSetter& uniform_set) override;
};
}
16 changes: 8 additions & 8 deletions shaders/terrain/terrain.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ void calculateTerrain(inout MaterialContext mctx) {
vec2 uv = getVertexUV();

float vectors[8] = {
smoothstep(0.0, 1.0, length(uv)),
smoothstep(0.0, 1.0, uv.y),
smoothstep(0.0, 1.0, length(vec2(1.0 - uv.x, uv.y))),
smoothstep(0.0, 1.0, uv.x),
smoothstep(0.0, 1.0, 1.0 - uv.x),
smoothstep(0.0, 1.0, length(vec2(uv.x, 1.0 - uv.y))),
smoothstep(0.0, 1.0, 1.0 - uv.y),
smoothstep(0.0, 1.0, length(vec2(1.0 - uv.x, 1.0 - uv.y)))
smoothstep(0.0, 1.0, length(uv)),
smoothstep(0.0, 1.0, uv.y),
smoothstep(0.0, 1.0, length(vec2(1.0 - uv.x, uv.y))),
smoothstep(0.0, 1.0, uv.x),
smoothstep(0.0, 1.0, 1.0 - uv.x),
smoothstep(0.0, 1.0, length(vec2(uv.x, 1.0 - uv.y))),
smoothstep(0.0, 1.0, 1.0 - uv.y),
smoothstep(0.0, 1.0, length(vec2(1.0 - uv.x, 1.0 - uv.y)))
};

uint mask[8];
Expand Down
4 changes: 4 additions & 0 deletions src/limitless/instances/decal_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ void DecalInstance::draw(Context &ctx, const Assets &assets, ShaderType shader_t
model->getMeshes()[0]->draw();
}

void DecalInstance::setMaterial(std::shared_ptr<ms::Material> new_material) {
material = std::make_shared<ms::Material>(*new_material);
}

void DecalInstance::updateBoundingBox() noexcept {

}
Expand Down

0 comments on commit 6914749

Please sign in to comment.