Hi
Thanks for the example for the video background.
Here you can see the only place where I use the cambeacon:
void ARTManager::initialize(void)//Grundaufbau des Scenengraph mit Kamera
und Viewport
{
// the rendering action
_action = RenderAction::create();
// the light beacon
NodePtr cartN = Node::create();
_cart = Transform::create();
beginEditCP(cartN);
cartN->setCore(_cart);
endEditCP(cartN);
//move the light beacon-relative to the camera, because the beacon
is later assigned to the camera
Matrix mCart;
mCart.setIdentity();
mCart.setTransform(Vec3f(4,0,0));
beginEditCP(_cart, Transform::MatrixFieldMask);
{
_cart->setMatrix(mCart);
}
endEditCP (_cart, Transform::MatrixFieldMask);
PointLightPtr pointLight= PointLight::create();
_internalRoot = Node::create();
addRefCP(_internalRoot);
beginEditCP(_internalRoot);
_internalRoot->setCore(pointLight);
_internalRoot->addChild(cartN);
endEditCP(_internalRoot);
beginEditCP(pointLight);
{
pointLight->setPosition (0, 0, 0);
pointLight->setConstantAttenuation
(1);//0.007);att1 = 00.1,att2=0,att3=0.003;
pointLight->setLinearAttenuation (0);
pointLight->setQuadraticAttenuation (0);
pointLight->setAmbient
(0.3,0.3,0.3,1);
pointLight->setDiffuse
(1,1,1,1);
pointLight->setSpecular
(1,1,1,1);
pointLight->setBeacon
(cartN);
//pointLight->setOn(false);
}
endEditCP (pointLight);
_MatrixCamera = MatrixCamera::create();
// need a viewport?
if(_win != NullFC && _win->getPort().size() == 0)
{
//Hintergrund erstellen
image = Image::create();
beginEditCP(image);
image->set( Image::OSG_RGBA_PF, 320, 240, 1, 1, 1,
0, dataPtr );
endEditCP(image);
addRefCP(image);
tex = TextureChunk::create();
beginEditCP(tex);
tex->setImage(image);
tex->setMinFilter(GL_NEAREST);
tex->setMagFilter(GL_LINEAR);
tex->setEnvMode(GL_REPLACE);
tex->setEnvMode(GL_REPLACE);
tex->setWrapS(GL_CLAMP);
tex->setWrapT(GL_CLAMP);
endEditCP(tex);
texBkg = TextureBackground::create();
beginEditCP(texBkg);
texBkg->setTexture(tex);
endEditCP(texBkg);
//init the cameraparameter
//assign the ARToolKitt camera parameter to the osg::matrix
camera
Matrix m;
double gl_cpara[16];
convertCamPara(&cparam,0.1,100000,gl_cpara);
//KameraMatrix für OpenSG nutzbar machen
m.setValueTransposed((Real32)gl_cpara[0],(Real32)gl_cpara[1],(Real32)gl_cpar
a[2],(Real32)gl_cpara[3],
(Real32)gl_cpara[4],(Real32)gl_cpara[5],(Real32)gl_cpara[6],(Real32)gl_cpara
[7],
(Real32)gl_cpara[8],(Real32)gl_cpara[9],(Real32)gl_cpara[10],(Real32)gl_cpar
a[11],
(Real32)gl_cpara[12],(Real32)gl_cpara[13],(Real32)gl_cpara[14],(Real32)gl_cp
ara[15]);
//Matrixkamera erstellen
beginEditCP(_MatrixCamera);
_MatrixCamera->setProjectionMatrix(m);
_MatrixCamera->setBeacon(cartN);
/*_MatrixCamera->setNear(0.1);
_MatrixCamera->setFar(100000);*/
endEditCP(_MatrixCamera);
//Viewport erstellen
ViewportPtr vp = Viewport::create();
beginEditCP(vp);
vp->setCamera (_MatrixCamera);
vp->setRoot (_internalRoot);
vp->setSize (0,0, 1,1);
vp->setBackground (texBkg);
endEditCP(vp);
//Viewport dem Fenster hinzufügen
beginEditCP(_win);
_win->addPort(vp);
endEditCP(_win);
}
}
Thanks again.
Manuel
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Dirk
Reiners
Gesendet: Donnerstag, 20. Januar 2005 00:45
An: users
Betreff: Re: AW: [Opensg-users] Distortion of Objects
Hi Manuel,
On Tue, 2005-01-18 at 12:34, Manuel Büchler wrote:
> Hello
>
> Thanks fort he answer.
> First to Andreas:
> Om the call of imagecontentchanged work. But it is the same speed like
> before...
> Do you know some other possibilities to speed up such a thing
see my other mail.
> To Dirk:
> Normal Geometrie doesn't seemed to be influenced. So I also send this
email
> to Manfred Weiler. Perhaps he has some good ideas for this.
Looking at the code the volumes use the Camera's beacon in a couple
places. Do you use the beacon's matrix at all or do you do everything in
the MatrixCamera?
Dirk
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users