diff --git a/resources/block.svg b/resources/block.svg
index 47ef9f8..be9e339 100644
--- a/resources/block.svg
+++ b/resources/block.svg
@@ -7,7 +7,7 @@
viewBox="0 0 512 512"
version="1.1"
id="svg1"
- inkscape:export-filename="round-delete.png"
+ inkscape:export-filename="blocker_open.png"
inkscape:export-xdpi="24"
inkscape:export-ydpi="24"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
@@ -35,7 +35,7 @@
inkscape:window-x="2560"
inkscape:window-y="1106"
inkscape:window-maximized="1"
- inkscape:current-layer="layer1">
+ inkscape:current-layer="g5">
-
+ id="layer1"
+ style="display:none">
+
+
+
+
+
+
+
+
+
diff --git a/resources/blocker_closed.png b/resources/blocker_closed.png
new file mode 100644
index 0000000..27d304e
Binary files /dev/null and b/resources/blocker_closed.png differ
diff --git a/resources/blocker_open.png b/resources/blocker_open.png
new file mode 100644
index 0000000..488e189
Binary files /dev/null and b/resources/blocker_open.png differ
diff --git a/src/graph-manager.cpp b/src/graph-manager.cpp
index 36e262c..4b26acf 100644
--- a/src/graph-manager.cpp
+++ b/src/graph-manager.cpp
@@ -33,6 +33,8 @@ namespace VISEQ::GRAPH{
void GraphManager::loadTextures(){
tex_delete = LoadTexture("resources/textures/delete.png");
tex_split = LoadTexture("resources/textures/split.png");
+ tex_blocker_open = LoadTexture("resources/textures/blocker_open.png");
+ tex_blocker_closed= LoadTexture("resources/textures/blocker_closed.png");
}
int GraphManager::getNodesSize(){
@@ -369,11 +371,13 @@ namespace VISEQ::GRAPH{
Vec2Df flip_handle_2 = middle_handle_2 + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*-0.2, -20.f, 0.f) : 1.0f);
// Dynamic opacity by distance to mouse
- unsigned char opacity = 200.0f; //150.0f - Clamp(middle_handle.dist(mouse_pos), 0.0f, 150.0f);
- unsigned char opacity_from = 200.0f; //250.0f - Clamp(from_to_handle.dist(mouse_pos), 0.0f, 220.0f);
- unsigned char opacity_to = 200.0f; //250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
+ unsigned char opacity = 150.0f - Clamp(center_handle.dist(mouse_pos), 0.0f, 130.0f);
+ unsigned char opacity_from = 250.0f - Clamp(from_to_handle.dist(mouse_pos), 0.0f, 220.0f);
+ unsigned char opacity_to = 250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
- float opacity_normalized = 0.80f; //Clamp((float)opacity / 255.0f, .0f, 1.0f);
+ float opacity_normalized = Clamp((float)opacity / 255.0f, .0f, 1.0f);
+ float opacity_from_normalized = Clamp((float)opacity_from / 255.0f, .0f, 1.0f);
+ float opacity_to_normalized = Clamp((float)opacity_to / 255.0f, .0f, 1.0f);
// float midi_gate_v1 = 0.0f;
// float midi_gate_v2 = 0.0f;
@@ -414,21 +418,20 @@ namespace VISEQ::GRAPH{
if(!c->start.lock()->picked_up && !c->end.lock()->picked_up){
// On/Off switches on both sides
- if(ViButton(mouse_pos, from_to_handle.x, from_to_handle.y, 8.0f, c->pass_forward ? (Color){120, 210, 115, opacity_from} : (Color){232, 50, 32, opacity_from} )) c->pass_forward = !c->pass_forward;
- if(ViButton(mouse_pos, to_from_handle.x, to_from_handle.y, 8.0f, c->pass_backward ? (Color){120, 210, 115, opacity_to} : (Color){232, 50, 32, opacity_to} )) c->pass_backward = !c->pass_backward;
+ Texture2D tex_forward;
+ Texture2D tex_backward;
- if(!c->pass_forward){
- Vec2Df block_point1 = (v1_position - v2_position).norm().orth()*4.0f + from_to_handle;
- Vec2Df block_point2 = (v1_position - v2_position).norm().orth()*-4.0f + from_to_handle;
- DrawLineEx(block_point1, block_point2, 2.0f, (Color){232,232,232,opacity_from});
- }
+ if(c->pass_forward) tex_forward = tex_blocker_open;
+ if(!c->pass_forward) tex_forward = tex_blocker_closed;
- if(!c->pass_backward){
- Vec2Df block_point1 = (v1_position - v2_position).norm().orth()*4.0f + to_from_handle;
- Vec2Df block_point2 = (v1_position - v2_position).norm().orth()*-4.0f + to_from_handle;
- DrawLineEx(block_point1, block_point2, 2.0f, (Color){232,232,232,opacity_to});
- }
+ if(c->pass_backward) tex_backward = tex_blocker_open;
+ if(!c->pass_backward) tex_backward = tex_blocker_closed;
if(IsWindowReady()){
+
+ if(ViTexButton(mouse_pos, from_to_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_forward, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_from_normalized))) c->pass_forward = !c->pass_forward;
+
+ if(ViTexButton(mouse_pos, to_from_handle, HELPER::GetRotation(to_from_handle, from_to_handle), 8.0f, tex_backward, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_to_normalized))) c->pass_backward = !c->pass_backward;
+
if(ViTexButton(mouse_pos, center_handle, HELPER::GetRotation(from_to_handle, to_from_handle) + 90.0f, 8.0f, tex_split, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) splitEdge(c);
}
}
@@ -437,8 +440,8 @@ namespace VISEQ::GRAPH{
DrawLine(v1_position.x, v1_position.y, v2_position.x, v2_position.y, VS_COLOR_BLUE);
}
if(IsWindowReady()){
- if(ViTexButton(mouse_pos, middle_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
- if(ViTexButton(mouse_pos, middle_handle_2, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
+ if(ViTexButton(mouse_pos, middle_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_from_normalized) )) removeEdge(c);
+ if(ViTexButton(mouse_pos, middle_handle_2, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_to_normalized) )) removeEdge(c);
}
}
}
diff --git a/src/graph-manager.h b/src/graph-manager.h
index ef25773..1eeb9a6 100644
--- a/src/graph-manager.h
+++ b/src/graph-manager.h
@@ -88,6 +88,8 @@ namespace VISEQ::GRAPH {
Texture2D tex_delete;
Texture2D tex_split;
+ Texture2D tex_blocker_open;
+ Texture2D tex_blocker_closed;
};
}