Here is my test ruby processing sketch (using my customised
toxiclibscore.jar), that exports the toxiclibs mesh as a PovRAY mesh2 object, written to a PovRAY inc file.
load_libraries 'toxiclibscore', 'toxiclibs_p5'
include_package 'toxi.geom'
include_package 'toxi.geom.mesh'
include_package 'toxi.processing'
attr_reader :mesh, :gfx
def setup()
size(200, 200, P3D)
@gfx = ToxiclibsSupport.new(self)
vert = AABB.fromMinMax(Vec3D.new(-1.0, -4.5, -1.0), Vec3D.new(1.0, 3.5, 1.0))
box = AABB.fromMinMax(Vec3D.new(1.0, 1.5, -1.0), Vec3D.new(3.0, 3.5, 1.0))
box2 = AABB.fromMinMax(Vec3D.new(1.0, -2.5, -1.0), Vec3D.new(3.0, -0.5, 1.0))
@mesh = box.toMesh()
mesh.addMesh(vert.toMesh())
mesh.addMesh(box2.toMesh())
end
def draw()
translate(width/2, height/2)
scale(15)
rotate_y(radians(-10))
gfx.mesh(mesh)
end
def keyPressed()
if (key == 'e')
file_id = "FTest"
pw = create_writer(file_id + ".inc")
mesh.save_as_pov(pw, false)
pw.flush()
pw.close()
exit()
end
if (key == 's')
save_frame("Frb.png")
end
end
Here is the pov file, that uses the geometry from the exported ruby-processing sketch, to create a PovRAY scene description file.
#version 3.7;
global_settings{
assumed_gamma 1.0
radiosity{
pretrace_start 0.04
pretrace_end 0.01
count 200
recursion_limit 3
nearest_count 10
error_bound 0.5
}
}
#include "colors.inc"
#include "skies.inc"
#include "FTest.inc"
#include "golds.inc"
#declare camera0 = camera {
location <-1.5, 30.0, -150.0>
direction <0.0, 0.0, 2.0>
up <0.0, 1.0, 0.0>
right <1.0, 0.0, 0.0>
look_at <0.0, 25.0, 35.0>
}
#declare light0 = light_source { <100.0, 100.0, -200.0> colour White }
#declare ground0 = plane { <0.0, 1.0, 0.0>, 0.0
pigment { NeonBlue }
finish {reflection 0.15}
}
camera { camera0 }
light_source{ light0 }
sky_sphere{ S_Cloud3 }
plane{ ground0 }
object{
mesh2{aabb}
texture {T_Gold_1A}
scale<5, 5, 5>
rotate<0, 25, 0>
translate<0, 20, 40>
}
|
Processing sketch |
|
PovRAY rendered |
No comments:
Post a Comment