Skip to content

Commit 7dd3d4d

Browse files
author
monkstone
committed
Revised module includes
1 parent 1177fd9 commit 7dd3d4d

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

examples/gray_scott_tone_map.rb

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
require 'jruby_art'
22
require 'toxiclibs'
33

4-
class GrayScottToneMap < Processing::App
4+
#
5+
# <p>GrayScottToneMap shows how to use the ColorGradient & ToneMap classes of the
6+
# colorutils package to create a tone map for rendering the results of
7+
# the Gray-Scott reaction-diffusion.</p>
8+
#
9+
# <p><strong>Usage:</strong><ul>
10+
# <li>click + drag mouse to draw dots used as simulation seed</li>
11+
# <li>press any key to reset</li>
12+
# </ul></p>
13+
#
14+
# Copyright (c) 2010 Karsten Schmidt, JRubyArt Version (c) 2015 Martin Prout
15+
# Easily modified to run with ruby-processing.
16+
#
17+
# This demo & library is free software you can redistribute it and/or
18+
# modify it under the terms of the GNU Lesser General Public
19+
# License as published by the Free Software Foundation either
20+
# version 2.1 of the License, or (at your option) any later version.
21+
#
22+
# http://creativecommons.org/licenses/LGPL/2.1/
23+
#
24+
# This library is distributed in the hope that it will be useful,
25+
# but WITHOUT ANY WARRANTY without even the implied warranty of
26+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27+
# Lesser General Public License for more details.
28+
#
29+
# You should have received a copy of the GNU Lesser General Public
30+
# License along with this library if not, write to the Free Software
31+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32+
#
533

6-
#
7-
# <p>GrayScottToneMap shows how to use the ColorGradient & ToneMap classes of the
8-
# colorutils package to create a tone map for rendering the results of
9-
# the Gray-Scott reaction-diffusion.</p>
10-
#
11-
# <p><strong>Usage:</strong><ul>
12-
# <li>click + drag mouse to draw dots used as simulation seed</li>
13-
# <li>press any key to reset</li>
14-
# </ul></p>
15-
#
16-
17-
#
18-
# Copyright (c) 2010 Karsten Schmidt
19-
#
20-
# This demo & library is free software you can redistribute it and/or
21-
# modify it under the terms of the GNU Lesser General Public
22-
# License as published by the Free Software Foundation either
23-
# version 2.1 of the License, or (at your option) any later version.
24-
#
25-
# http://creativecommons.org/licenses/LGPL/2.1/
26-
#
27-
# This library is distributed in the hope that it will be useful,
28-
# but WITHOUT ANY WARRANTY without even the implied warranty of
29-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30-
# Lesser General Public License for more details.
31-
#
32-
# You should have received a copy of the GNU Lesser General Public
33-
# License along with this library if not, write to the Free Software
34-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35-
#
36-
37-
NUM_ITERATIONS = 10
38-
34+
class GrayScottToneMap < Processing::App
35+
NUM_ITERATIONS = 10
3936
attr_reader :gs, :tone_map
4037

4138
def setup

examples/inflate_mesh.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require 'jruby_art'
22
require 'toxiclibs'
3-
3+
# A JRubyArt sketch needs refactoring for ruby-processing
44
#
5-
# Copyright (c) 2010 Karsten Schmidt & ruby-processing version Martin Prout 2012
5+
# Copyright (c) 2010 Karsten Schmidt & JRubyArt version Martin Prout 2015
66
# This library is free software you can redistribute it and/or
77
# modify it under the terms of the GNU Lesser General Public
88
# License as published by the Free Software Foundation either
@@ -24,6 +24,7 @@ class InflateMesh < Processing::App
2424

2525
def setup
2626
size(680, 382, P3D)
27+
Processing::ArcBall.init(self)
2728
@gfx = Gfx::ToxiclibsSupport.new(self)
2829
init_physics
2930
end
@@ -37,9 +38,6 @@ def draw
3738
box.face_outwards
3839
box.compute_vertex_normals
3940
background(51)
40-
translate(width / 2.0, height / 2.0, 0)
41-
rotate_x((height / 2 - mouse_x) * 0.01)
42-
rotate_y((width / 2 - mouse_y) * 0.01)
4341
no_fill
4442
lights
4543
directional_light(255, 255, 255, -200, 1000, 500)
@@ -52,7 +50,7 @@ def draw
5250
end
5351

5452
def init_physics
55-
@box = Volume::WETriangleMesh.new
53+
@box = Toxi::WETriangleMesh.new
5654
# create a simple start mesh
5755
# box.addMesh(Toxi::Cone.new(Toxi::Vec3D.new(0, 0, 0), Toxi::Vec3D.new(0, 1, 0), 10, 50, 100).to_mesh(4))
5856
box.add_mesh(Toxi::AABB.new(Toxi::Vec3D.new, 50).to_mesh)

examples/isosurface.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# A ruby processing sketch (needs re-factoring for jruby_art)
2+
#
13
#
24
# This example implements a custom VolumetricSpace using an implicit function
35
# to calculate each voxel. This is slower than the default array or HashMap
@@ -37,8 +39,7 @@
3739
#
3840

3941
require 'toxiclibs'
40-
load_library 'vecmath'
41-
42+
load_library 'vecmath' # uncomment this line for ruby-processing
4243
RES = 64
4344
ISO = 0.2
4445
MAX_ISO = 0.66
@@ -50,7 +51,7 @@ def setup
5051
@gfx = Gfx::ToxiclibsSupport.new(self)
5152
vol = EvaluatingVolume.new(Toxi::Vec3D.new(400, 400, 400), RES, RES, RES, MAX_ISO)
5253
surface = Volume::HashIsoSurface.new(vol)
53-
@mesh = Volume::WETriangleMesh.new
54+
@mesh = Toxi::WETriangleMesh.new
5455
surface.compute_surface_mesh(mesh, ISO)
5556
@is_wire_frame = false
5657
end

lib/toxiclibs.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ module Physics
1818
end
1919

2020
module Volume
21-
include_package 'toxi.geom'
22-
include_package 'toxi.geom.mesh'
23-
include_package 'toxi.geom.mesh.subdiv'
2421
include_package 'toxi.volume'
2522
end
2623

2724
module Toxi
28-
include_package 'toxi.math'
2925
include_package 'toxi.color'
26+
include_package 'toxi.color.theory'
27+
include_package 'toxi.util.datatypes'
28+
include_package 'toxi.util.events'
29+
include_package 'toxi.geom'
30+
include_package 'toxi.geom.mesh'
31+
include_package 'toxi.geom.mesh.subdiv'
32+
include_package 'toxi.geom.nurbs'
33+
include_package 'toxi.math'
3034
end
3135

3236
module Gfx

0 commit comments

Comments
 (0)