Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 177 additions & 22 deletions Lux/lux_files/CA_choices.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"a": 0,
"b": 9,
"min": 0,
"max": 9,
"max": 10,
"distribution": "uniform",
"enabled": { "functions": [ "autoplay_switch" ] }
},
Expand All @@ -260,8 +260,8 @@
"tool": "pull_down",
"label": "Target Image",
"description": "Choose a target image.",
"items": [ "Ada", "Apples", "Crab Nebula", "Earth", "Everest", "Flower", "Forest", "Hong Kong", "Lighthouse", "Sunrise" ],
"default_choice": 5,
"items": [ "Self", "Ada", "Apples", "Crab Nebula", "Earth", "Everest", "Flower", "Forest", "Hong Kong", "Lighthouse", "Sunrise" ],
"default_choice": 0,
"choice": { "functions": [ "targ_image_menu_generator" ] }
},
{
Expand All @@ -281,7 +281,7 @@
"tool": "pull_down",
"label": "Transition Rule",
"description": "Transition rules include cellular automata such as Conway's Game of Life, and other ways each frame can depend on the previous one.",
"items": [ "Diffuse", "Life", "Gravitate", "Snow", "Stargate", "Threadfall", "Borg", "Box blur", "Blurriffic" ],
"items": [ "Diffuse", "Life", "Gravitate", "Snow", "Stargate", "Threadfall", "Borg", "Box blur", "Blurriffic", "Random Copy" ],
"default_choice": 4,
"affects_widget_groups": true,
"choice": { "functions": [ "rule_menu_generator" ] }
Expand Down Expand Up @@ -404,6 +404,83 @@
"tool": "switch",
"default_value": false,
"value": { "functions": [ "bb_random_copy_toggle" ] }
},
{
"name": "flip_x_toggle",
"type": "random_toggle",
"p": { "functions": [ "autoplay_intensity", "autoplay_probability" ] },
"enabled": { "functions": [ "autoplay_switch" ] }
},
{
"name": "flip_x_switch",
"type": "switch_fn",
"label": "Flip X",
"description": "Flip the target image horizontally.",
"default_value": true,
"value": { "functions": [ "flip_x_toggle" ] }
},
{
"name": "flip_y_toggle",
"type": "random_toggle",
"p": { "functions": [ "autoplay_intensity", "autoplay_probability" ] },
"enabled": { "functions": [ "autoplay_switch" ] }
},
{
"name": "flip_y_switch",
"type": "switch_fn",
"label": "Flip Y",
"description": "Flip the target image vertically.",
"default_value": false,
"value": { "functions": [ "flip_y_toggle" ] }
},
{
"name": "angle_slider",
"type": "slider_float",
"label": "Rotation Angle",
"description": "Angle to rotate the target image (degrees).",
"min": -180.0,
"max": 180.0,
"default_value": 0.0,
"step": 1.0
},
{
"name": "warp_menu_generator",
"type": "generator_int",
"p": { "functions": [ "autoplay_intensity", "autoplay_probability" ] },
"a": 0,
"b": 2,
"min": 0,
"max": 2,
"distribution": "uniform",
"enabled": { "functions": [ "autoplay_switch" ] }
},
{
"name": "warp_menu",
"type": "menu_int",
"tool": "pull_down",
"label": "Warp Effect",
"description": "Choose a warp effect to apply to the target image.",
"items": [ "Flip", "Rotate" ],
"affects_widget_groups": true,
"default_choice": 0,
"choice": { "functions": [ "warp_menu_generator" ] }
},
{
"name": "warp_menu_0",
"type": "equal_int_condition",
"a": { "functions": [ "warp_menu" ] },
"b": 0
},
{
"name": "warp_menu_1",
"type": "equal_int_condition",
"a": { "functions": [ "warp_menu" ] },
"b": 1
},
{
"name": "targ_dim",
"type": "buffer_dim_fn",
"buf_name": { "functions": [ "targ_image_menu" ] }
}
],
"clusters":
Expand All @@ -428,7 +505,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "diffuse",
Expand All @@ -440,7 +518,8 @@
"type": "CA_ucolor",
"edge_block": { "functions": [ "edge_block_switch" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "life",
Expand All @@ -456,7 +535,8 @@
"bright_range": { "functions": [ "bright_block_slider" ] },
"edge_block": { "functions": [ "edge_block_switch" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "gravitate",
Expand All @@ -471,7 +551,8 @@
"bright_range": { "functions": [ "bright_block_slider" ] },
"edge_block": { "functions": [ "edge_block_switch" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "snow",
Expand All @@ -486,7 +567,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "pixel_sort",
Expand All @@ -502,7 +584,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "funky_sort",
Expand All @@ -520,7 +603,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "funky_sort",
Expand All @@ -537,7 +621,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "box blur rule",
Expand All @@ -556,7 +641,8 @@
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target": "target_buffer",
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "Blurriffic rule",
Expand All @@ -567,13 +653,62 @@
"random_copy": { "functions": [ "bb_random_copy_switch" ]},
"custom_picker": "blur_picker_custom"
}
},
},
{
"name": "Random Copy",
"type": "CA_ucolor",
"edge_block": { "functions": [ "edge_block_switch" ] },
"bright_block": { "functions": [ "bright_block_switch" ] },
"bright_range": { "functions": [ "bright_block_slider" ] },
"targeted": { "functions": [ "target_switch" ] },
"target_name": {"functions": [ "targ_image_menu" ] },
"warp_name": "Target Warp",
"rule":
{
"name": "Random Copy rule",
"type": "rule_random_copy_ucolor"
}
},
{
"name": "Rule Chooser",
"type": "eff_chooser",
"effects": [ "Diffuse", "Life", "Gravitate", "Snow", "Pixel sort", "Funky sort", "Diagonal funky sort", "Box blur", "Blurriffic" ],
"effects": [ "Diffuse", "Life", "Gravitate", "Snow", "Pixel sort", "Funky sort", "Diagonal funky sort", "Box blur", "Blurriffic", "Random Copy" ],
"choice": { "functions": [ "rule_menu" ] }
},
{
"name": "position fill",
"type": "eff_position_fill_vec2f"
},
{
"name": "radial",
"type": "eff_radial_vec2f"
},
{
"name": "cartesian",
"type": "eff_cartesian_vec2f"
},
{
"name": "fill warp field",
"type": "eff_fill_warp_int",
"vf_name": "warp_vf"
},
{
"name": "Flip",
"type": "eff_flip_vec2f",
"flip_x": { "functions": [ "flip_x_switch" ] },
"flip_y": { "functions": [ "flip_y_switch" ] }
},
{
"name": "Rotate",
"type": "eff_rotate_vectors_vec2f",
"angle": { "functions": [ "angle_slider" ] }
},
{
"name": "Warp chooser",
"type": "eff_chooser",
"effects": [ "Flip", "Rotate" ],
"choice": { "functions": [ "warp_menu" ] }
},
{
"name": "brush",
"type": "cluster",
Expand All @@ -589,14 +724,24 @@
"mode": "static",
"effects": [ "gray" ]
},
{ "name": "target_buffer",
"source": { "functions": [ "targ_image_menu" ] },
"type": "uimage",
"mode": "static",
"effects": []
{
"name": "warp_vf",
"self_generated": true,
"dim": { "functions": [ "targ_dim" ] },
"type": "vector_field",
"mode": "ephemeral",
"effects": [ "position fill", "Warp chooser" ]
},
{
"name": "Target Warp",
"self_generated": true,
"dim": { "functions": [ "targ_dim" ] },
"type": "warp_field",
"mode": "ephemeral",
"effects": [ "fill warp field" ]
},
{
"name": "Cellular Automata",
"name": "Self",
"source": { "functions": [ "source_image_menu" ] },
"type": "uimage",
"mode": "iterative",
Expand All @@ -611,7 +756,17 @@
},
{
"name": "targ_image_group",
"widgets": [ "targ_image_menu" ]
"widgets": [ "targ_image_menu", "warp_menu" ]
},
{
"name": "flip_group",
"conditions": [ "warp_menu_0" ],
"widgets": [ "flip_x_switch", "flip_y_switch" ]
},
{
"name": "rotate_group",
"conditions": [ "warp_menu_1" ],
"widgets": [ "angle_slider" ]
},
{
"name": "source_image_group",
Expand Down
1 change: 1 addition & 0 deletions Lux/lux_files/kaleido.json
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@
{
"name": "kaleido_vf",
"source": "base radial field",
"dim": { "functions": [ "source_image_dim" ] },
"type": "vector_field",
"mode": "ephemeral",
"effects": [ "funky chooser", "scope_chooser" ]
Expand Down
14 changes: 0 additions & 14 deletions Lux/lux_react/src/lux.js

This file was deleted.

2 changes: 1 addition & 1 deletion Lux/src/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ bool widget_group::operator() ( element_context& context ) {
return true;
}

widget_group::widget_group( const std::string& name_init, const std::string& label_init, const std::string& description_init ) : name( name_init ), label( label_init ), description( description_init ) {}
widget_group::widget_group( const std::string& name_init, const std::string& label_init, const std::string& description_init, const std::string& pane_init ) : name( name_init ), label( label_init ), description( description_init ), pane( pane_init ) {}

widget_group::~widget_group() {
clear();
Expand Down
4 changes: 2 additions & 2 deletions Lux/src/UI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ typedef widget_switch widget_switch_condition;
typedef widget_switch widget_switch_fn;

struct widget_group {
std::string name, label, description;
std::string name, label, description, pane;
std::vector< std::string > conditions;
std::vector< std::string > widgets;
// bool open; // is this widget group open? (Needed?)
Expand All @@ -246,7 +246,7 @@ struct widget_group {
// void reset(); // reset all widgets to default
void clear(); // clear all widgets

widget_group( const std::string& name_init = "", const std::string& label_init = "", const std::string& description_init = "" );
widget_group( const std::string& name_init = "", const std::string& label_init = "", const std::string& description_init = "", const std::string& pane_init = "home" );
~widget_group();
};

Expand Down
2 changes: 1 addition & 1 deletion Lux/src/buffer_pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ template< class T > void buffer_pair< T >::copy_first( const buffer_pair<T>& bp
else {
//std::cout << "buffer_pair::copy_first() - dest pointer not NULL" << std::endl;
image_pair.first->copy( *bp.image_pair.first );
//image_pair.second.reset( NULL );
image_pair.second.reset( NULL );
}
}
else {
Expand Down
4 changes: 3 additions & 1 deletion Lux/src/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ template class eff_turn< vec2i >;
template< class T > void eff_flip< T >::operator () ( any_buffer_pair_ptr& buf, element_context& context ) {
if (std::holds_alternative< std::shared_ptr< buffer_pair< T > > >(buf))
{
flip_x( context ); flip_y( context );
auto& buf_ptr = std::get< std::shared_ptr< buffer_pair< T > > >(buf);
if( !buf_ptr->has_image() ) throw std::runtime_error( "eff_flip: no image in buffer" );
buf_ptr->get_buffer().flip( buf_ptr->get_image(), flip_x, flip_y );
buf_ptr->get_buffer().flip( buf_ptr->get_image(), *flip_x, *flip_y );
buf_ptr->swap();
}
}
Expand Down Expand Up @@ -312,6 +313,7 @@ template class eff_cartesian< vec2f >;

template< class T > void eff_rotate_vectors< T >::operator () ( any_buffer_pair_ptr& buf, element_context& context )
{
angle( context );
vf_tools tools( get_image< T >( buf ) );
tools.rotate_vectors( *angle );
}
Expand Down
2 changes: 1 addition & 1 deletion Lux/src/effect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ typedef eff_turn< int > eff_turn_int;
typedef eff_turn< vec2i > eff_turn_vec2i;

template< class T > struct eff_flip {
bool flip_x, flip_y;
harness< bool > flip_x, flip_y;

void operator () ( any_buffer_pair_ptr& buf, element_context& context );

Expand Down
Loading