The UFZ services GitLab and Mattermost will be unavailable on Monday, July 4 from 06:00 AM to 08:00 AM due to maintenance work.

Commit 2374c2b4 authored by Adam Reichold's avatar Adam Reichold
Browse files

Include the insects in highlighting infected/contaminated entities.

parent 21dc4b24
Pipeline #34790 passed with stage
in 3 minutes and 31 seconds
......@@ -62,9 +62,10 @@ shader_param/point_size = 2.0
shader_param/color = Vector3( 0, 0, 0 )
[sub_resource type="SpatialMaterial" id=14]
albedo_color = Color( 1, 1, 0, 1 )
vertex_color_use_as_albedo = true
[sub_resource type="MultiMesh" id=15]
color_format = 1
transform_format = 1
mesh = ExtResource( 4 )
......@@ -74,9 +75,10 @@ shader_param/point_size = 1.0
shader_param/color = Vector3( 1, 1, 0 )
[sub_resource type="SpatialMaterial" id=17]
albedo_color = Color( 1, 0, 0, 1 )
vertex_color_use_as_albedo = true
[sub_resource type="MultiMesh" id=18]
color_format = 1
transform_format = 1
mesh = ExtResource( 5 )
......@@ -86,9 +88,10 @@ shader_param/point_size = 1.0
shader_param/color = Vector3( 1, 0, 0 )
[sub_resource type="SpatialMaterial" id=20]
albedo_color = Color( 0, 0, 0, 1 )
vertex_color_use_as_albedo = true
[sub_resource type="MultiMesh" id=21]
color_format = 1
transform_format = 1
mesh = ExtResource( 6 )
......@@ -99,6 +102,11 @@ shader_param/color = Vector3( 0, 0, 0 )
[node name="Visualisation" type="Spatial"]
script = ExtResource( 1 )
flower_patch_color = Color( 0, 1, 0, 1 )
solitary_bee_color = Color( 1, 0, 0, 1 )
bumblebee_color = Color( 0, 0, 0, 1 )
hoverfly_color = Color( 1, 1, 0, 1 )
pathogen_color = Color( 1, 1, 1, 1 )
[node name="Sun" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0 )
......
......@@ -69,4 +69,6 @@ common/physics_fps=25
quality/intended_usage/framebuffer_allocation=3
threads/thread_model=2
quality/shading/force_vertex_shading=true
quality/shading/force_lambert_over_burley=true
environment/default_environment="res://Sky.tres"
......@@ -13,12 +13,31 @@ use process::SingleThread;
#[inherit(Node)]
struct Visualisation {
model: Option<Model>,
#[property]
flower_patch_color: Color,
#[property]
hoverfly_color: Color,
#[property]
solitary_bee_color: Color,
#[property]
bumblebee_color: Color,
#[property]
pathogen_color: Color,
}
#[methods]
impl Visualisation {
fn new(_owner: &Node) -> Self {
Self { model: None }
let black = Color::rgb(0., 0., 0.);
Self {
model: None,
flower_patch_color: black,
hoverfly_color: black,
solitary_bee_color: black,
bumblebee_color: black,
pathogen_color: black,
}
}
#[export]
......@@ -87,6 +106,14 @@ impl Visualisation {
fn _physics_process(&mut self, owner: &Node, _delta: f64) {
let model = self.model.as_mut().unwrap();
let flower_patch_color = self.flower_patch_color;
let hoverfly_color = self.hoverfly_color;
let solitary_bee_color = self.solitary_bee_color;
let bumblebee_color = self.bumblebee_color;
let pathogen_color = self.pathogen_color;
model.run(&mut SingleThread);
unsafe {
......@@ -117,9 +144,9 @@ impl Visualisation {
!= 0;
let color = if contaminated {
Color::rgb(1., 0.65, 0.)
pathogen_color
} else {
Color::rgb(0., 1., 0.)
flower_patch_color
};
(&location.position, None, Some(color))
......@@ -172,10 +199,16 @@ impl Visualisation {
fetch_transforms(
&frustum,
model.world.hoverflies.iter().map(|hoverfly| {
let color = if hoverfly.insect.pathogen_status.is_infected() {
pathogen_color
} else {
hoverfly_color
};
(
&hoverfly.insect.position,
Some(&hoverfly.insect.movement),
None,
Some(color),
)
}),
),
......@@ -199,10 +232,16 @@ impl Visualisation {
fetch_transforms(
&frustum,
model.world.solitary_bees.iter().map(|solitary_bee| {
let color = if solitary_bee.insect.pathogen_status.is_infected() {
pathogen_color
} else {
solitary_bee_color
};
(
&solitary_bee.insect.position,
Some(&solitary_bee.insect.movement),
None,
Some(color),
)
}),
),
......@@ -226,10 +265,16 @@ impl Visualisation {
fetch_transforms(
&frustum,
model.world.bumblebees.iter().map(|bumblebee| {
let color = if bumblebee.insect.pathogen_status.is_infected() {
pathogen_color
} else {
bumblebee_color
};
(
&bumblebee.insect.position,
Some(&bumblebee.insect.movement),
None,
Some(color),
)
}),
),
......
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