Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Thursday, 30 September 2010
SunflowAPIAPI in ruby processing
# sunflow_test.rb
class SunflowTest < Processing::App
load_libraries :sunflow_api, :sunflow
include_package 'com.briansteen'
include_package "org.sunflow.math"
API = Java::Com::briansteen::SunflowAPIAPI
SMath = Java::Org::sunflow::math
WIDTH = 500
HEIGHT = 500
def setup
@sunflow = API.new
@sunflow.set_width(WIDTH)
@sunflow.set_height(HEIGHT)
@sunflow.set_camera_position(0, 2.5, -5)
@sunflow.set_camera_target(0, 0, 0)
@sunflow.set_thinlens_camera("thinLensCamera", 50, WIDTH/HEIGHT)
@sunflow.draw_plane("ground", SMath::Point3.new(0,-3.5,0), SMath::Vector3.new(0, 1, 0))
@sunflow.draw_sphere_flake("mySphereFlake", 20, SMath::Vector3.new(0, 1, 0), 1)
@sunflow.setPathTracingGIEngine 6
@sunflow.render "SunflowTestRender.png"
end
def draw
exit
end
end
SunflowTest.new :title => "Sunflow Test"
This example was copied from amnon, following his recent posting on the processing discussion boards.
Checkout the sunflowapapi source (created by Christopher Warnow?) as follows:-
svn checkout http://sunflowapiapi.googlecode.com/svn/trunk/ sunflowapiapi-read-only
Get the sunflow libraries here, NB must be version 0.07.3:-
http://sunflow.sourceforge.net
Or possible here for Windows users:-
http://www.polyquark.com/opensource
The usual library setup required compile and jar the sunflowapiapi code into sunflow_api.jar nest that as follows in a folder library, in a folder sunflow_api in the library folder (in the directory where the sketch you want to run is stored). Do similar for the sunflow.jar put the janino.jar in the same folder. The janino.jar provides a fast java compiler, version is 2.~ is supplied with the sunflow download, however with a few minor modifications sunflow can be updated to use the latest version 2.6.1 (basically include the commons-compiler.jar, and remove a couple of deprecated exception types from the code and update the CompileException to the commons compiler version org.codehaus.commons.compiler.CompileException, do this in an ide unless you are crazy).
Labels:
ruby processing,
sunflow,
sunflowAPIAPI
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2010
(73)
-
▼
September
(15)
- Basic Hair Example SunflowAPIAPI just using jruby
- Basic Hair Example SunflowAPIAPI in ruby processing
- SunflowAPIAPI in ruby processing
- A Staffordshire Knot Using Ruby Processing and A C...
- An Infinity Loop? With My 3D Context Free Library
- Revised 3D Context Free DSL Sketch, with Mouse Whe...
- A Mouse Wheel Listener in Ruby Processing
- 3D Context Free DSL Screen Saver?
- Translating the default.es to ruby processing DSL
- Testing the cube primitive in my context free DSL
- Experimental 3D Context Free DSL in ruby-processin...
- Using the control panel and Toxi Processing Libra...
- Tone map example of Gray-Scott diffusion using tox...
- Another Example of Using Toxi Processing Libraries
- Using the Toxi Processing Libraries in ruby proces...
-
▼
September
(15)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment