Thursday, 30 September 2010
SunflowAPIAPI in ruby processing
class SunflowTest < Processing::App
load_libraries :sunflow_api, :sunflow
API = Java::Com::briansteen::SunflowAPIAPI
SMath = Java::Org::sunflow::math
WIDTH = 500
HEIGHT = 500
@sunflow = API.new
@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)
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:-
Or possible here for Windows users:-
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).
- ► 2015 (51)
- ► 2014 (79)
- ► 2013 (94)
- Basic Hair Example SunflowAPIAPI just using jruby
- Basic Hair Example SunflowAPIAPI in ruby processin...
- 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)