|
|
I have something similar in Java that I plan on releasing, I just haven't
had the time to clean it up. I wanted objects to work with rather than a
scripting language. It allows you to create things like tables that you can
query later, to ask how to place things on top of them. There are tons of
uses. Here's a snippet from some of my code.
public static void main(String[] args) {
SceneQuick scene = new SceneQuick();
scene.setGroundPlane(false);
scene.build();
{
Camera camera = new Camera("45");
camera.setLocation(0, 2, -6);
camera.setLookAt(0, 0, 0);
camera.rotate(0,45,0);
scene.addCamera(camera);
}
SurfaceFactory surfaces = D3PartFactory.getSurfaceFactory();
D3Object obj = scene.add(new Xylophone());
obj.rotate(0,30,0);
//obj.translate(0,0.0,0);
Camera camera = scene.getCamera(0);
camera.setLocation(0, 4.5, -6.0);
camera.setLookAt(0, 0, 0);
camera.rotate(0,45,0);
scene.add(new LightSource(LightSource.POINTLIGHT, new D3Vector(
30,1,-30), surfaces.colour(1,1,1)));
scene.add(new LightSource(LightSource.POINTLIGHT, new
D3Vector(-30,1,-30), surfaces.colour(1,1,1)));
try {
scene.render(args);
}
catch(Throwable t) {
t.printStackTrace();
}
}
--
#macro Q(A,E,W)box{-A/2,A/2pigment{rgb 9*W}translate E*A+W/1000}#end#macro
M(D,E)#local A=1/pow(3,D);#if(D<3)#local C=D+1;union{M(C,1)M(C,x+y)M(C,x+z)
M(C,y+z)M(C,x+y-z)M(C,x+z-y)M(C,y+z-x)M(C,x-y)M(C,z-x)M(C,y-z)M(C,y-x)M(C,
x-z)M(C,z-y)M(C,x-y-z)M(C,y-x-z)M(C,z-x-y)translate A*E}#else Q(A,E,x)Q(A,E
,y)Q(A,E,z)#end#end union{M(0,0)rotate<45,145,0>translate z*2}//Andrew
Post a reply to this message
|
|