Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
data
README.md
Rakefile
anti_aliasing.rb
bloom_demo.rb
flow_field_particles.rb
fluid_basic.rb
fluid_minimal.rb
image_processing_filter.rb
optical_flow_capture.rb
reaction_diffusion.rb
sampling_fibonacci.rb
sampling_halton.rb
sampling_poisson2d.rb
sampling_poisson3d.rb
shadertoy_alien_corridor.rb
shadertoy_expansive_reaction_diffusion.rb
shadertoy_menger.rb
shadertoy_raymarching_primitives.rb
shadertoy_seascape.rb
shadertoy_voronoi_distances.rb
shadertoy_wet_stone.rb
skylight_basic.rb

README.md

PixelFlow examples

Requires peasycam library

Note how we can implement callbacks in jruby with a ruby lambda

processing

// callback for rendering the scene
DwSceneDisplay scene_display = new DwSceneDisplay(){
  @Override
  public void display(PGraphics3D canvas) {
    displayScene(canvas);  
  }
};

public void displayScene(PGraphics canvas){
  if(canvas == skylight.renderer.pg_render){
    canvas.background(32);
  }
  canvas.shape(shape);
}

propane

# callback for rendering scene, implements DwSceneDisplay interface
scene_display = lambda do |canvas|
  canvas.background(32) if canvas == skylight.renderer.pg_render
  canvas.shape(shape)
end

# init skylight renderer
@skylight = DwSkyLight.new(context, scene_display, mat_scene_bounds)

In antialiasing.rb if we just use the overloaded color method, jruby complains of overloaded method but guesses right and chooses the correct java signature (float, float, float). Mainly to show how we can do it, we provide an alias method color_float that avoids the look up cost in detecting the correct signature, this is not generally important if you can put up with the warning.

The ControlP5 library is overly complicated and does not seem to work well with JRubyArt, the built in control_panel is much simpler to use. If you must use ControlP5 see examples and the revised basic_fluid.rb

NB: where processing sketches use fill(hexadecimal) etc in propane we must wrap hexadecimal with color fill(color(hexadecimal)) (otherwise fill etc will complain of int too big)

You can’t perform that action at this time.