FreeCAD-VR: Proper light handling
This commit is contained in:
parent
9a19baa8f5
commit
b5c2554378
|
@ -96,34 +96,28 @@ CoinRiftWidget::CoinRiftWidget() : QGLWidget()
|
||||||
m_sceneManager->setBackgroundColor(SbColor(.0f, .0f, .8f));
|
m_sceneManager->setBackgroundColor(SbColor(.0f, .0f, .8f));
|
||||||
#endif
|
#endif
|
||||||
basePosition = SbVec3f(0.0f, 0.0f, -2.0f);
|
basePosition = SbVec3f(0.0f, 0.0f, -2.0f);
|
||||||
// light handling
|
|
||||||
SoGroup *lightGroup = new SoGroup;
|
|
||||||
|
|
||||||
SoTranslation *lightTranslation1 = new SoTranslation;
|
// light handling
|
||||||
lightTranslation1->translation.setValue(0,1,1);
|
SoDirectionalLight *light = new SoDirectionalLight();
|
||||||
lightGroup->addChild (lightTranslation1);
|
light->direction.setValue(1,-1,-1);
|
||||||
|
|
||||||
SoDirectionalLight *light = new SoDirectionalLight();
|
SoDirectionalLight *light2 = new SoDirectionalLight();
|
||||||
lightGroup->addChild (light);
|
light2->direction.setValue(-1,-1,-1);
|
||||||
|
light2->intensity.setValue(0.6);
|
||||||
|
light2->color.setValue(0.8,0.8,1);
|
||||||
|
|
||||||
SoTranslation *lightTranslation2 = new SoTranslation;
|
|
||||||
lightTranslation2->translation.setValue(0,-1,-1);
|
|
||||||
lightGroup->addChild (lightTranslation2);
|
|
||||||
|
|
||||||
|
|
||||||
//translation->translation.setValue(0,-1,0);
|
|
||||||
//workplace->addChild(translation);
|
|
||||||
|
|
||||||
scene = new SoSeparator(0); // Placeholder.
|
scene = new SoSeparator(0); // Placeholder.
|
||||||
for (int eye = 0; eye < 2; eye++) {
|
for (int eye = 0; eye < 2; eye++) {
|
||||||
rootScene[eye] = new SoSeparator(3);
|
rootScene[eye] = new SoSeparator();
|
||||||
rootScene[eye]->ref();
|
rootScene[eye]->ref();
|
||||||
camera[eye] = new SoFrustumCamera();
|
camera[eye] = new SoFrustumCamera();
|
||||||
camera[eye]->position.setValue(basePosition);
|
camera[eye]->position.setValue(basePosition);
|
||||||
camera[eye]->focalDistance.setValue(5.0f);
|
camera[eye]->focalDistance.setValue(5.0f);
|
||||||
camera[eye]->viewportMapping.setValue(SoCamera::LEAVE_ALONE);
|
camera[eye]->viewportMapping.setValue(SoCamera::LEAVE_ALONE);
|
||||||
rootScene[eye]->addChild(camera[eye]);
|
rootScene[eye]->addChild(camera[eye]);
|
||||||
rootScene[eye]->addChild(lightGroup); // TODO Connect direction to camera.
|
rootScene[eye]->addChild(light);
|
||||||
|
rootScene[eye]->addChild(light2);
|
||||||
rootScene[eye]->addChild(scene);
|
rootScene[eye]->addChild(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +352,6 @@ void CoinRiftWidget::paintGL()
|
||||||
riftOrientation.multVec(viewAdjust,viewAdjust);
|
riftOrientation.multVec(viewAdjust,viewAdjust);
|
||||||
|
|
||||||
camera[eye]->position.setValue(basePosition - viewAdjust + riftPosition);
|
camera[eye]->position.setValue(basePosition - viewAdjust + riftPosition);
|
||||||
//camera[eye]->position.setValue(basePosition - riftPosition);
|
|
||||||
|
|
||||||
//Base::Console().Log("Eye(%d) Pos: %f, %f, %f ViewAdjust: %f, %f, %f \n",eye, eyePose[eye].Position.x,
|
//Base::Console().Log("Eye(%d) Pos: %f, %f, %f ViewAdjust: %f, %f, %f \n",eye, eyePose[eye].Position.x,
|
||||||
// eyePose[eye].Position.y,
|
// eyePose[eye].Position.y,
|
||||||
|
|
|
@ -67,7 +67,7 @@ View3DInventorRiftViewer::View3DInventorRiftViewer() : CoinRiftWidget()
|
||||||
|
|
||||||
|
|
||||||
setBackgroundColor(SbColor(51,51,101));
|
setBackgroundColor(SbColor(51,51,101));
|
||||||
basePosition = SbVec3f(0.0f, 0.5f, 0.5f);
|
basePosition = SbVec3f(0.0f, 0.5f, 0.8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void saveWinPostion(void)
|
//void saveWinPostion(void)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user