Commit e85248b7 authored by Florian Oetke's avatar Florian Oetke

added process method to entity_manager to directly access components by an...

added process method to entity_manager to directly access components by an entity_handle; fixed decal blending
parent c44b9ab5
Pipeline #3148 passed with stage
in 14 minutes and 29 seconds
......@@ -121,6 +121,8 @@ namespace mirrage::ecs {
auto get(Entity_handle entity) -> util::maybe<Entity_facet>;
auto get_handle(Entity_id id) const -> Entity_handle { return _handles.get(id); }
auto validate(Entity_handle entity) -> bool { return _handles.valid(entity); }
template <typename... Ts, typename F>
void process(Entity_handle entity, F&& callback);
// deferred to next call to process_queued_actions
void erase(Entity_handle entity);
......
......@@ -30,6 +30,13 @@ namespace mirrage::ecs {
return it != _components_by_name.end() ? util::just(it->second) : util::nothing;
}
template <typename... Ts, typename F>
void Entity_manager::process(Entity_handle entity, F&& callback)
{
if(auto f = get(entity); f.is_some())
f.get_or_throw().process<Ts...>(std::forward<F>(callback));
}
template <typename C>
auto Entity_manager::list() -> Component_container<C>&
{
......@@ -103,7 +110,8 @@ namespace mirrage::ecs {
template <typename T, typename... Args>
void Entity_facet::emplace(Args&&... args)
{
emplace_init<T>(+[](const T&) {}, std::forward<Args>(args)...);
emplace_init<T>(
+[](const T&) {}, std::forward<Args>(args)...);
}
template <typename T, typename F, typename... Args>
......
......@@ -87,7 +87,7 @@ void main() {
albedo_mat_id_out = albedo;
mat_data_out = vec4(encode_normal(N), roughness, metallic);
color_out = vec4(albedo.rgb * emissive_color.rgb
* emissive_power * emissive_color.a, albedo.a);
* emissive_power * emissive_color.a * albedo.a, albedo.a);
color_diffuse_out = color_out;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment