Class: Vizcore::Server::GalleryApp

Inherits:
Object
  • Object
show all
Defined in:
lib/vizcore/server/gallery_app.rb

Overview

Rack app that lists bundled example scenes and their launch commands.

Constant Summary collapse

POSTER_PATH =
"/assets/vizcore-poster.png"
DESCRIPTIONS =
{
  "basic.rb" => "Single wireframe cube starter.",
  "intro_drop.rb" => "Beat-triggered intro to drop transition.",
  "file_audio_demo.rb" => "File-audio walkthrough with layered visuals.",
  "complex_audio_showcase.rb" => "Dense multi-scene showcase for audio-reactive layers.",
  "rhythm_geometry.rb" => "Morphing geometric pattern driven by rhythm and bands.",
  "ruby_crystal_show.rb" => "Ruby-themed crystal, particles, and text showcase.",
  "parser_visualizer.rb" => "Parser-themed token, AST, and reduce visual sketch.",
  "live_coding_minimal.rb" => "Tiny live-coding scene with a pulsing blob.",
  "club_intro_drop.rb" => "Intro, build, and drop flow for rhythmic file input.",
  "shader_playground.rb" => "Focused liquid shader scene with mapped params.",
  "audio_inspector.rb" => "Audio feature visualization scene with bars and blob.",
  "readme_demo.rb" => "Minimal beat pulse to ring radius demo.",
  "midi_scene_switch.rb" => "MIDI note and CC driven scene switching.",
  "midi_controller_show.rb" => "MIDI pads switch scenes and knobs drive global shader uniforms.",
  "kansai_rubykaigi_visual.rb" => "Event showcase with ruby crystal, water ripple, and Kyoto-inspired pattern.",
  "custom_shader.rb" => "Custom GLSL fragment shader example.",
  "unyo_liquid.rb" => "Organic liquid wobble scene with FFT blobs and particles."
}.freeze
FILE_AUDIO_EXAMPLES =
%w[
  file_audio_demo.rb
  complex_audio_showcase.rb
  rhythm_geometry.rb
  ruby_crystal_show.rb
  parser_visualizer.rb
  club_intro_drop.rb
  audio_inspector.rb
  readme_demo.rb
  kansai_rubykaigi_visual.rb
].freeze
ORDER =
DESCRIPTIONS.keys.freeze

Instance Method Summary collapse

Constructor Details

#initialize(examples_root: Vizcore.root.join("examples"), docs_assets_root: Vizcore.root.join("docs", "assets")) ⇒ GalleryApp

Returns a new instance of GalleryApp.

Parameters:

  • examples_root (Pathname, String) (defaults to: Vizcore.root.join("examples"))
  • docs_assets_root (Pathname, String) (defaults to: Vizcore.root.join("docs", "assets"))


48
49
50
51
52
53
54
# File 'lib/vizcore/server/gallery_app.rb', line 48

def initialize(
  examples_root: Vizcore.root.join("examples"),
  docs_assets_root: Vizcore.root.join("docs", "assets")
)
  @examples_root = Pathname.new(examples_root.to_s).expand_path
  @docs_assets_root = Pathname.new(docs_assets_root.to_s).expand_path
end

Instance Method Details

#call(env) ⇒ Array(Integer, Hash, Array<String>)

Parameters:

  • env (Hash)

Returns:

  • (Array(Integer, Hash, Array<String>))


58
59
60
61
62
63
64
65
66
67
# File 'lib/vizcore/server/gallery_app.rb', line 58

def call(env)
  request = Rack::Request.new(env)

  return html_response if request.path_info == "/"
  return json_response if request.path_info == "/examples.json"
  return poster_response if request.path_info == POSTER_PATH
  return health_response if request.path_info == "/health"

  not_found_response
end