Hello Dirk,
Am Sonntag, den 20.05.2007, 17:45 +0200 schrieb Dirk Reiners:
> Hi Thomas,
>
> Thomas Kulessa wrote:
> > Hello together,
> >
> > basically I got my app running, but not with the expected result.
> > Although the MultiDisplayWindow tells me that it has the expected number
> > of ports, applying an e.g. red background to one viewport result in a
> > red backgrounnd in all viewports. The same for changing a
> > postview/preview/postproject whatever matrix. The scene is not shown
> > from different direction, but still as if all viewports were in a row.
> >
> > I know the description is somewaht vague, but does anybody has an idea
> > about this (before I post the whole source code;-)
>
> hm, no direct lue. Can you reproduce it in something derived from a
> tutorial?
>
I got the MatrixCameraDecorator CAVE setup running. But as you
mentioned, the matrices have to be calculated to get the projection
right.
So I replaces the MatrixCameraDecorators by ProjectionCameraDecorators,
added a "user" node as child of the camera beacon, throwed out the
postview matrices stuff and instead defined one 4-point surface (which I
interpret as the projection screens(?)) for each decorator and as before
coupled each decorator to its own viewport.
The result is, that all "projection screens" (ClusterServer windows) are
aligned from left to right, no matter how I define the surfaces. So
there seems to happen some auto-magic or default behaviour behind the
scenes. Even with the highest debug level the log contains no hint, so I
am relativly clueless how to proceed. As mentioned I want to setup a 2x1 beamer
front projection with a 2x2 beamer
floor projection, all showing the same scene.
The (what I think) relevant code is this:
StageClusterClient::StageClusterClient(string fname, list<string>
snames)
{
NodePtr lightBeacon, lightNode, scene;
ProjectionCameraDecoratorPtr cameras[VP_NR];
ViewportPtr viewports[VP_NR];
Pnt3f vpproj[6][4] = {
{ Pnt3f(50, 50, 0), Pnt3f(50, -50, 0), Pnt3f(-50, 50, 0), Pnt3f(-50,
-50, 0)},
{ Pnt3f(25, 25, 10), Pnt3f(25, -75, 10), Pnt3f(-75, 25, 10), Pnt3f(-75,
-75, 10)},
{ Pnt3f(1, -1, 1), Pnt3f(1, 1, -3), Pnt3f(-1, 1, 1), Pnt3f(1, 1, 1)},
{ Pnt3f(1, 1, 1), Pnt3f(-1, -1, -1), Pnt3f(1, 1, -1), Pnt3f(1, 0, 1)},
{ Pnt3f(1, 1, 1), Pnt3f(-1, 1, 1), Pnt3f(-1, 1, 1), Pnt3f(1, -1, 0)},
{ Pnt3f(1, 0, 0), Pnt3f(-1, 1, 1), Pnt3f(1, 1, 1), Pnt3f(1, -2, 1)},
};
SolidBackgroundPtr back = SolidBackground::create();
//create geometry - just a simple torus
NodePtr torus = SceneFileHandler::the().read(fname.c_str(), 0);
//create transformations & beacons for cameras & light
lightBeacon = Node::create();
camera_beacon = Node::create();
//create Transformations
TransformPtr camtrans[VP_NR], lightTrans;
lightTrans = Transform::create();
beginEditCP(camera_beacon);
camera_beacon->setCore(Transform::create());
endEditCP(camera_beacon);
beginEditCP(lightTrans);
Matrix lightM;
lightM.setTransform(Vec3f(1,10,2));
lightTrans->setMatrix(lightM);
endEditCP(lightTrans);
beginEditCP(lightBeacon);
lightBeacon->setCore(lightTrans);
endEditCP(lightBeacon);
// -- end of camera beacon creation
//create the light source
DirectionalLightPtr dLight = DirectionalLight::create();
beginEditCP(dLight);
dLight->setDirection(Vec3f(0,1,2));
//color information
dLight->setDiffuse(Color4f(1,1,1,1));
dLight->setAmbient(Color4f(0.2,0.2,0.2,1));
dLight->setSpecular(Color4f(1,1,1,1));
//set the beacon
dLight->setBeacon(lightBeacon);
endEditCP (dLight);
// create the node that will contain the light source
lightNode = Node::create();
beginEditCP(lightNode);
lightNode->setCore(dLight);
lightNode->addChild(torus);
endEditCP(lightNode);
// now create the root and add all children
NodePtr root = Node::create();
beginEditCP(root);
root->setCore(Group::create());
root->addChild(lightNode);
root->addChild(camera_beacon);
root->addChild(lightBeacon);
endEditCP(root);
scene = root;
PerspectiveCameraPtr cam = PerspectiveCamera::create();
//Create Decorators, viewports and beacons
for (char c=0; c<VP_NR; c++) {
// cameras[c] = MatrixCameraDecorator::create();
cameras[c] = ProjectionCameraDecorator::create();
viewports[c] = Viewport::create();
beginEditCP(cameras[c]);
cameras[c]->setDecoratee(cam);
for (char z=0; z<4; z++) {
cameras[c]->getSurface().push_back(vpproj[c][z]);
}
endEditCP(cameras[c]);
}
user = Node::create();
beginEditCP(user);
user->setCore(Transform::create());
endEditCP(user);
beginEditCP(camera_beacon);
camera_beacon->addChild(user);
endEditCP(camera_beacon);
beginEditCP(cam);
cam->setFov(deg2rad(60));
cam->setNear(0.1);
cam->setFar(2000);
cam->setBeacon(camera_beacon);
endEditCP(cam);
for (char c=0; c<VP_NR; c++) {
beginEditCP(cameras[c]);
cameras[c]->setUser(user);
endEditCP(cameras[c]);
}
ViewportPtr leftViewport = viewports[0];
ViewportPtr rightViewport = viewports[1];
for (char c=0; c<VP_NR; c++) {
beginEditCP(viewports[c]);
viewports[c]->setCamera(cameras[c]);
viewports[c]->setBackground(back);
viewports[c]->setRoot(scene);
viewports[c]->setSize(0, 0, 1, 1);
endEditCP(viewports[c]);
}
mwin = MultiDisplayWindow::create();
beginEditCP(mwin);
for (list<string>::iterator it = snames.begin(); it != snames.end();
it++)
mwin->getServers().push_back(*it);
mwin->setSize(300, 300);
for (char c=0; c<VP_NR; c++) {
mwin->addPort(viewports[c]);
}
mwin->init();
endEditCP(mwin);
viewport = leftViewport;
}
thanks for any help,
thomas
--
Thomas Kulessa <[EMAIL PROTECTED]>
Academy of Media Arts, Cologne/Germany
http://www.khm.de/~tomk
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users