|
|
Looks a little similar to OpenGL. Something like "begin(kCamera)" would
be more compact and get rid of the repetitive "xxx(); begin();" pattern.
You would of course put it in its own namespace to avoid name conflicts.
I don't really see the point of this approach though, it doesn't take
advantage of any C++ features. The only advantage I see is that it could
probably be mostly automatically generated. How about something more
like:
begin("camera");
key("look_at"); vecval(2, 3, 2);
key("angle"); vecval(135);
end();
or:
//the constructor pushes the camera onto a stack of things being
//constructed
Camera cam1();
key("look_at"); vecval(2, 3, 2);
key("angle"); vecval(135);
Close();//Pops the camera off the construction stack
SetCamera(cam1);
I wouldn't like using either of these though, I personally would do
something like:
Scene scene;
scene.SetCamera(PerspectiveCamera);
scene.GetCamera().SetLookAt(vec(2, 3, 2));
scene.GetCamera().SetAngle(135);
Material boxMat;
boxMat.SetPigment(SolidPigment(0.8));
boxMat.GetFinish().SetReflection(0.3);
scene.AddShape(Box(-1, 9, boxMat));
scene.OGLPreview();
outfile << scene;
This is similar to what I'm doing for the CSDL/Sapphire POV library,
though things are a little different with a prototype-based OOL.
Sapphire is slower than C++ because it is interpreted, but faster and
more flexible than POV-Script. It will look more like:
delegate load POV: "povray.csdl";
function run() {
.camera.SetLookAt(< 2, 3, 2>);
.camera.SetAngle(135);
//make() is a method of the POV-Ray library object that
//clones a shape object and adds the clone to the scene,
//and returns the clone.
.make(.Box) {
pta = -1;
ptb = 9;
material {
clone pigment: SolidPigment {color = 0.8};
finish.SetReflection(0.3);
};
};
clone fout: stream;
fout.open("outputfile.pov");
fout.write(POV);
};
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|