openscenegraph

Controling OpenSceneGraph camera with Cartesian coordinates and Euler angles

巧了我就是萌 提交于 2019-12-06 12:26:13
问题 I am attempting to control an osg::Camera with Cartesian coordinates (X, Y, Z) and Euler angles (Yaw, Pitch, Roll) that I read in from file. Part 1 For some reason setting my roll will cause the camera to rotate around the z-axis and not the y-axis as expected. The following is the previously written camera manipulator that I am feeding my positional data to. class EulerManipulator : public osgGA::CameraManipulator { public: EulerManipulator(osg::ref_ptr<osg::View> x) : view(x), camView(new

Create Sun light source in OSG

独自空忆成欢 提交于 2019-12-06 08:29:08
问题 I need to set a point Source above my landscape in OpenSceneGraph that will act like a sun. I already know how to set up the light and it can be done in this fashion: //LIGHT CODE ------------------------ osg::ref_ptr<osg::Group> lightGroup (new osg::Group); osg::ref_ptr<osg::StateSet> lightSS (root->getOrCreateStateSet()); osg::ref_ptr<osg::LightSource> lightSource1 = new osg::LightSource; osg::ref_ptr<osg::LightSource> lightSource2 = new osg::LightSource; // create a local light. float

Generic picking solution for 3D scenes with vertex-shader-based geometry deformation applied

老子叫甜甜 提交于 2019-12-05 16:34:34
I'm trying to implement a navigation technique for 3D scenes (in OpenSceneGraph with OpenGL). Among other things the user should be able to click on an scene object on the screen to move towards it. The navigation technique should be integrated into another project which uses a vertex shader to apply a global deformation to the scene geometry. And here is the problem: Since the geometry is deformed using a vertex shader, it is not straight forward to un-project the mouse cursor position to the world coordinates of the spot the user actually selected. But I need those coordinates to perform the

OpenSceneGraph set the camera at an initial position

杀马特。学长 韩版系。学妹 提交于 2019-12-05 03:07:58
问题 I am working on OpenSceneGraph for the first time and I'm a bit lost cause the documentation is really not that clear... So, I have this code that load a obj file with a house on it, and I have drown a little box where I want the "person" to be. So now, instead of having that box there, I would like to have the camera there, looking at the front and later on I'll to something to move the terrain around the fixed camera so that it looks like the camera is moving but the terrain is moving. So,

Controling OpenSceneGraph camera with Cartesian coordinates and Euler angles

谁都会走 提交于 2019-12-04 19:36:04
I am attempting to control an osg::Camera with Cartesian coordinates (X, Y, Z) and Euler angles (Yaw, Pitch, Roll) that I read in from file. Part 1 For some reason setting my roll will cause the camera to rotate around the z-axis and not the y-axis as expected. The following is the previously written camera manipulator that I am feeding my positional data to. class EulerManipulator : public osgGA::CameraManipulator { public: EulerManipulator(osg::ref_ptr<osg::View> x) : view(x), camView(new osg::CameraView) { } virtual ~EulerManipulator(){} virtual osg::Matrixd getMatrix() const { // Note: (x,

Create Sun light source in OSG

僤鯓⒐⒋嵵緔 提交于 2019-12-04 15:37:27
I need to set a point Source above my landscape in OpenSceneGraph that will act like a sun. I already know how to set up the light and it can be done in this fashion: //LIGHT CODE ------------------------ osg::ref_ptr<osg::Group> lightGroup (new osg::Group); osg::ref_ptr<osg::StateSet> lightSS (root->getOrCreateStateSet()); osg::ref_ptr<osg::LightSource> lightSource1 = new osg::LightSource; osg::ref_ptr<osg::LightSource> lightSource2 = new osg::LightSource; // create a local light. float xCenter = tree->getRoot()->getXCenter(); float yCenter = tree->getRoot()->getYCenter(); osg::Vec4f

OpenSceneGraph set the camera at an initial position

寵の児 提交于 2019-12-03 16:23:13
I am working on OpenSceneGraph for the first time and I'm a bit lost cause the documentation is really not that clear... So, I have this code that load a obj file with a house on it, and I have drown a little box where I want the "person" to be. So now, instead of having that box there, I would like to have the camera there, looking at the front and later on I'll to something to move the terrain around the fixed camera so that it looks like the camera is moving but the terrain is moving. So, here is my code: int main() { osgViewer::Viewer viewer; viewer.setUpViewInWindow(0,0,800,800); osg::ref

The type in a dynamic_cast must be a pointer or reference to a complete class type, or void *

早过忘川 提交于 2019-12-01 17:14:24
I am hoping there is someone out there who understands why the code below fails. I am trying to get an instance of PositionAttitudeTransform (Openscenegraph class) from an osg::Node* node object. But there is the compiler error below in bold. void CameraPosCallbackUpdate::operator()(osg::Node* node, osg::NodeVisitor* nv) { // other code goes here osg::PositionAttitudeTransform* pat = dynamic_cast<osg::PositionAttitudeTransform*> (node); } IntelliSense: the type in a dynamic_cast must be a pointer or reference to a complete class type, or void * Please help me with correct way to access my

Qt5.6: high DPI support and OpenGL (OpenSceneGraph)

蓝咒 提交于 2019-12-01 07:35:41
I have a minimal application which uses QOpenGLWidget that integrates an OpenGL wrapper library (OpenSceneGraph). I am trying to figure out how to correctly use the Qt5.6 support for high DPI screens when dealing with OpenGL content like I use. My main() function has the following code: int main(int argc, char** argv) { // DPI support is on QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QMainWindow window; // QOpenGLWidget with OpenSceneGraph content QtOSGWidget* widget = new QtOSGWidget(); window.setCentralWidget(widget); window.show(); return app.exec(

Qt5.6: high DPI support and OpenGL (OpenSceneGraph)

跟風遠走 提交于 2019-12-01 05:16:52
问题 I have a minimal application which uses QOpenGLWidget that integrates an OpenGL wrapper library (OpenSceneGraph). I am trying to figure out how to correctly use the Qt5.6 support for high DPI screens when dealing with OpenGL content like I use. My main() function has the following code: int main(int argc, char** argv) { // DPI support is on QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QMainWindow window; // QOpenGLWidget with OpenSceneGraph content